Add common reset function so if_ep and if_ie don't reset each-other.

(this is a 3commonality)
This commit is contained in:
hpeyerl 1994-02-16 07:26:50 +00:00
parent f6b942b4cf
commit 19219795da
5 changed files with 61 additions and 23 deletions

View File

@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_ep.c,v 1.16 1994/02/15 22:57:09 mycroft Exp $
* $Id: if_ep.c,v 1.17 1994/02/16 07:26:50 hpeyerl Exp $
*/
/*
* TODO:
@ -121,7 +121,7 @@ static int epbusyeeprom __P((struct isa_device * is));
* Rudimentary support for multiple cards is here but is not
* currently handled. In the future we will have to add code
* for tagging the cards for later activation. We wanna do something
* about the id_port. We're limited due to current config procedure.
* about the ELINK_ID_PORT. We're limited due to current config procedure.
* Magnum config holds promise of a fix but we'll have to wait a bit.
*/
int
@ -130,37 +130,36 @@ epprobe(is)
{
struct ep_softc *sc = &ep_softc[is->id_unit];
u_short k;
int id_port = 0x100;/* XXX */
outw(BASE + EP_COMMAND, GLOBAL_RESET);
DELAY(1000);
outb(id_port, 0xc0); /* Global reset to id_port. */
elink_reset(); /* global reset to ELINK_ID_PORT */
DELAY(1000);
epsendidseq(id_port);
epsendidseq(ELINK_ID_PORT);
DELAY(1000);
/*
* MFG_ID should have 0x6d50.
* PROD_ID should be 0x9[0-f]50
*/
k = epreadeeprom(id_port, EEPROM_MFG_ID);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_MFG_ID);
if (k != MFG_ID)
return (0);
k = epreadeeprom(id_port, EEPROM_PROD_ID);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_PROD_ID);
if ((k & 0xf0ff) != (PROD_ID & 0xf0ff))
return (0);
k = epreadeeprom(id_port, EEPROM_ADDR_CFG); /* get addr cfg */
k = epreadeeprom(ELINK_ID_PORT, EEPROM_ADDR_CFG); /* get addr cfg */
k = (k & 0x1f) * 0x10 + 0x200; /* decode base addr. */
if (k != is->id_iobase)
return (0);
k = epreadeeprom(id_port, EEPROM_RESOURCE_CFG);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
k >>= 12;
if (is->id_irq != (1 << ((k == 2) ? 9 : k)))
return (0);
outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG);
outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
return (0x10); /* 16 bytes of I/O space used. */
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.32 1993/12/20 09:11:52 mycroft Exp $
* $Id: isa.c,v 1.33 1994/02/16 07:26:52 hpeyerl Exp $
*/
/*
@ -94,6 +94,23 @@ int config_isadev(struct isa_device *, u_int *);
void config_attach(struct isa_driver *, struct isa_device *);
static void sysbeepstop(int);
/*
* elink_reset: This is the reset code for the dumb 3c50[79] cards
* which is required during probe. The problem is that the two cards
* use the same reset to the ID_PORT and hence the two drivers will
* reset each others cards. This is notably non-optimal.
*/
void
elink_reset()
{
static x;
if(x == 0)
outb(ELINK_ID_PORT, ELINK_RESET);
x = 1;
}
/*
* Configure all ISA devices
*/

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.h 5.7 (Berkeley) 5/9/91
* $Id: isa.h,v 1.13 1994/01/03 23:54:35 mycroft Exp $
* $Id: isa.h,v 1.14 1994/02/16 07:26:55 hpeyerl Exp $
*/
/*
@ -208,3 +208,9 @@ int isa_irq_pending __P((struct isa_device *dvp));
#ifndef LOCORE
extern vm_offset_t isaphysmem;
#endif
/*
* defines for elink_reset() (See isa.c)
*/
#define ELINK_ID_PORT 0x100
#define ELINK_RESET 0xc0

View File

@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_ep.c,v 1.16 1994/02/15 22:57:09 mycroft Exp $
* $Id: if_ep.c,v 1.17 1994/02/16 07:26:50 hpeyerl Exp $
*/
/*
* TODO:
@ -121,7 +121,7 @@ static int epbusyeeprom __P((struct isa_device * is));
* Rudimentary support for multiple cards is here but is not
* currently handled. In the future we will have to add code
* for tagging the cards for later activation. We wanna do something
* about the id_port. We're limited due to current config procedure.
* about the ELINK_ID_PORT. We're limited due to current config procedure.
* Magnum config holds promise of a fix but we'll have to wait a bit.
*/
int
@ -130,37 +130,36 @@ epprobe(is)
{
struct ep_softc *sc = &ep_softc[is->id_unit];
u_short k;
int id_port = 0x100;/* XXX */
outw(BASE + EP_COMMAND, GLOBAL_RESET);
DELAY(1000);
outb(id_port, 0xc0); /* Global reset to id_port. */
elink_reset(); /* global reset to ELINK_ID_PORT */
DELAY(1000);
epsendidseq(id_port);
epsendidseq(ELINK_ID_PORT);
DELAY(1000);
/*
* MFG_ID should have 0x6d50.
* PROD_ID should be 0x9[0-f]50
*/
k = epreadeeprom(id_port, EEPROM_MFG_ID);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_MFG_ID);
if (k != MFG_ID)
return (0);
k = epreadeeprom(id_port, EEPROM_PROD_ID);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_PROD_ID);
if ((k & 0xf0ff) != (PROD_ID & 0xf0ff))
return (0);
k = epreadeeprom(id_port, EEPROM_ADDR_CFG); /* get addr cfg */
k = epreadeeprom(ELINK_ID_PORT, EEPROM_ADDR_CFG); /* get addr cfg */
k = (k & 0x1f) * 0x10 + 0x200; /* decode base addr. */
if (k != is->id_iobase)
return (0);
k = epreadeeprom(id_port, EEPROM_RESOURCE_CFG);
k = epreadeeprom(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
k >>= 12;
if (is->id_irq != (1 << ((k == 2) ? 9 : k)))
return (0);
outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG);
outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
return (0x10); /* 16 bytes of I/O space used. */
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: isa.c,v 1.32 1993/12/20 09:11:52 mycroft Exp $
* $Id: isa.c,v 1.33 1994/02/16 07:26:52 hpeyerl Exp $
*/
/*
@ -94,6 +94,23 @@ int config_isadev(struct isa_device *, u_int *);
void config_attach(struct isa_driver *, struct isa_device *);
static void sysbeepstop(int);
/*
* elink_reset: This is the reset code for the dumb 3c50[79] cards
* which is required during probe. The problem is that the two cards
* use the same reset to the ID_PORT and hence the two drivers will
* reset each others cards. This is notably non-optimal.
*/
void
elink_reset()
{
static x;
if(x == 0)
outb(ELINK_ID_PORT, ELINK_RESET);
x = 1;
}
/*
* Configure all ISA devices
*/