From deaa15c8a6725740075ae11072ca211d71ae4b95 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 12 Feb 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-02-12 --- pc/ether509.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pc/ether509.c b/pc/ether509.c index 20fe185f886845ff7e55147571cf2402f6b7c42f..6fd2781360a3562d33fc4fd28291402da3d3ca73 100644 --- a/pc/ether509.c +++ b/pc/ether509.c @@ -381,25 +381,23 @@ idseq(void) } static ulong -activate(Ether *ether) +activate(void) { int i; ushort x, acr; + ulong port; /* * Do the little configuration dance: * - * 2. get to command state, reset, then return to command state + * 2. write the ID sequence to get to command state. */ idseq(); - outb(IDport, 0xC1); - delay(2); - idseq(); /* * 3. Read the Manufacturer ID from the EEPROM. * This is done by writing the IDPort with 0x87 (0x80 - * is the 'read EEPROM command, 0x07 is the offset of + * is the 'read EEPROM' command, 0x07 is the offset of * the Manufacturer ID field in the EEPROM). * The data comes back 1 bit at a time. * We seem to need a delay here between reading the bits. @@ -413,8 +411,8 @@ activate(Ether *ether) x <<= 1; x |= inb(IDport) & 0x01; } - if((x & 0xF0FF) != 0x6D50) - return -1; + if(x != 0x6D50) + return 0; /* * 3. Read the Address Configuration from the EEPROM. @@ -436,10 +434,10 @@ activate(Ether *ether) * * Enable the adapter. */ - ether->port = (acr & 0x1F)*0x10 + 0x200; - outb(ether->port+ConfigControl, 0x01); + port = (acr & 0x1F)*0x10 + 0x200; + outb(port+ConfigControl, 0x01); - return ether->port; + return port; } static ulong @@ -458,7 +456,7 @@ tcm579(Ether *ether) if(slot == 1 && strncmp((char*)(KZERO|0xFFFD9), "EISA", 4)) return 0; - while(slot < 8){ + while(slot < 16){ port = slot++*0x1000; if(ins(port+0xC80+ManufacturerID) != 0x6D50) continue;