diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-16 12:32:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-16 12:32:49 +0000 |
commit | ea92beba2db60d8947dc9b53fbe1f8387b85c13e (patch) | |
tree | e7d4f605abc20ae8abc05900bb98342103bfa21c /sys/dev/isa/opti.c | |
parent | 75dc0c127a811a7d6e0d07f193c7efe91fa42132 (diff) |
proto
Diffstat (limited to 'sys/dev/isa/opti.c')
-rw-r--r-- | sys/dev/isa/opti.c | 158 |
1 files changed, 105 insertions, 53 deletions
diff --git a/sys/dev/isa/opti.c b/sys/dev/isa/opti.c index b71cf1a1fd3..fac35d21424 100644 --- a/sys/dev/isa/opti.c +++ b/sys/dev/isa/opti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opti.c,v 1.4 1996/05/27 07:57:09 deraadt Exp $ */ +/* $OpenBSD: opti.c,v 1.5 1996/10/16 12:32:48 deraadt Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -62,43 +62,73 @@ int opti_type = OPTI_C929; /* XXX only one card can be installed */ #define OPTI_cd_valid_ift(i) ((i)==OPTI_SONY||(i)==OPTI_PANASONIC||\ (i)==OPTI_MITSUMI||(i)==OPTI_IDE) + +static __inline int OPTI_cd_addr __P((int)); +static __inline int OPTI_cd_irq __P((int)); +static __inline int OPTI_cd_drq __P((int)); +static __inline int OPTI_snd_addr __P((int)); +static __inline int OPTI_snd_irq __P((int)); +static __inline int OPTI_snd_drq __P((int)); +static __inline void opti_outb __P((u_short, u_char)); +static __inline u_char opti_inb __P((u_short)); +static int opti_present __P((void)); + static __inline int OPTI_cd_addr(a) int a; { switch(a) { - case 0x320: return 0xc0; - case 0x330: return 0x40; - case 0x340: return 0x00; - case 0x360: return 0x80; - default: return -1; + case 0x320: + return 0xc0; + case 0x330: + return 0x40; + case 0x340: + return 0x00; + case 0x360: + return 0x80; + default: + return -1; } } + static __inline int OPTI_cd_irq(i) int i; { switch(i) { - case 5: return 0x04; - case 7: return 0x08; - case 3: return 0x0c; - case 9: return 0x10; - case 10:return 0x14; - case 11:return 0x18; - case -1:return 0x00; - default:return -1; + case 5: + return 0x04; + case 7: + return 0x08; + case 3: + return 0x0c; + case 9: + return 0x10; + case 10: + return 0x14; + case 11: + return 0x18; + case -1: + return 0x00; + default: + return -1; } } + static __inline int OPTI_cd_drq(d) int d; { switch(d) { - case 3: - case 5: return 0; - case 6: return 1; - case 7: return 2; - default:return 3; + case 3: + case 5: + return 0; + case 6: + return 1; + case 7: + return 2; + default: + return 3; } } @@ -109,59 +139,83 @@ OPTI_snd_addr(a) int a; { switch(a) { - case 0x220: return 0x0; - case 0x240: return 0x3; - case 0x530: return 0x8; - case 0xE80: return 0x9; - case 0xF40: return 0xa; - case 0x604: return 0xb; - default: return -1; + case 0x220: + return 0x0; + case 0x240: + return 0x3; + case 0x530: + return 0x8; + case 0xE80: + return 0x9; + case 0xF40: + return 0xa; + case 0x604: + return 0xb; + default: + return -1; } } + static __inline int OPTI_snd_irq(i) int i; { switch(i) { - case 5: return 0x04; - case 7: return 0x08; - case 3: return 0x0c; - case 9: return 0x10; - case 10:return 0x14; - case 11:return 0x18; - case -1:return 0x00; - default:return -1; + case 5: + return 0x04; + case 7: + return 0x08; + case 3: + return 0x0c; + case 9: + return 0x10; + case 10: + return 0x14; + case 11: + return 0x18; + case -1: + return 0x00; + default: + return -1; } } + static __inline int OPTI_snd_drq(d) int d; { switch(d) { - case 3: - case 5: return 0; - case 6: return 1; - case 7: return 2; - default:return 3; + case 3: + case 5: + return 0; + case 6: + return 1; + case 7: + return 2; + default: + return 3; } } static __inline void -opti_outb( u_short port, u_char byte ) +opti_outb(port, byte) + u_short port; + u_char byte; { outb( OPTI_PASSWD, opti_type ); outb( port, byte ); } static __inline u_char -opti_inb( u_short port ) +opti_inb(port) + u_short port; { outb( OPTI_PASSWD, opti_type ); return inb( port ); } static int -opti_present( void ) +opti_present() { register u_char a, b; int s = splhigh(); @@ -186,7 +240,7 @@ opti_present( void ) } int -opti_cd_setup( ift, addr, irq, drq ) +opti_cd_setup(ift, addr, irq, drq) int ift, addr, irq, drq; { int ret = 0; @@ -204,8 +258,7 @@ opti_cd_setup( ift, addr, irq, drq ) XDEBUG( 2, ("opti: wrong CD-ROM irq number.\n")); else if( OPTI_cd_drq(drq) == -1) XDEBUG( 2, ("opti: bad CD_ROM drq number.\n")); - else - { + else { /* so the setup */ int s = splhigh(); register u_char a, b; @@ -252,7 +305,7 @@ opti_cd_setup( ift, addr, irq, drq ) } int -opti_snd_setup( ift, addr, irq, drq ) +opti_snd_setup(ift, addr, irq, drq) int ift, addr, irq, drq; { XDEBUG( 2, ("opti: do SND setup type=%u,addr=%x,irq=%d,drq=%d\n", @@ -268,17 +321,16 @@ opti_snd_setup( ift, addr, irq, drq ) XDEBUG( 2, ("opti: wrong SND irq number.\n")); else if( OPTI_snd_drq(drq) == -1) XDEBUG( 2, ("opti: bad SND drq number.\n")); - else - { + else { /* so the setup */ int s = splhigh(); - register u_char a, b; + register u_char a; if (ift == OPTI_WSS) { - a = opti_inb( OPTI_IFTP ); - opti_outb( OPTI_IFTP, (a & ~OPTI_SND_MASK) - | OPTI_snd_addr(addr)*16 + 1 ); - opti_outb( OPTI_ENBL, 0x1a ); + a = opti_inb(OPTI_IFTP); + opti_outb(OPTI_IFTP, ((a & ~OPTI_SND_MASK) + | (OPTI_snd_addr(addr)*16)) + 1); + opti_outb(OPTI_ENBL, 0x1a); } splx(s); |