From: Philip Homburg Date: Fri, 2 Dec 2005 14:45:10 +0000 (+0000) Subject: PCI support in a separate driver. X-Git-Tag: v3.1.2a~483 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.named.html?a=commitdiff_plain;h=24cf667abb5b485b8503b81a63ac6ca0690bec81;p=minix.git PCI support in a separate driver. --- diff --git a/drivers/Makefile b/drivers/Makefile index 4eb46eadf..29431b934 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -16,7 +16,6 @@ usage: build: all all install depend clean: cd ./libdriver && $(MAKE) $@ - cd ./libpci && $(MAKE) $@ cd ./tty && $(MAKE) $@ cd ./memory && $(MAKE) $@ cd ./at_wini && $(MAKE) $@ @@ -32,13 +31,14 @@ all install depend clean: cd ./dp8390 && $(MAKE) $@ cd ./sb16 && $(MAKE) $@ cd ./lance && $(MAKE) $@ + cd ./pci && $(MAKE) $@ image: cd ./libdriver && $(MAKE) build - cd ./libpci && $(MAKE) build cd ./tty && $(MAKE) build cd ./memory && $(MAKE) build cd ./at_wini && $(MAKE) build cd ./floppy && $(MAKE) build cd ./bios_wini && $(MAKE) build cd ./log && $(MAKE) build + cd ./pci && $(MAKE) build diff --git a/drivers/at_wini/Makefile b/drivers/at_wini/Makefile index b21d03e69..738e75567 100644 --- a/drivers/at_wini/Makefile +++ b/drivers/at_wini/Makefile @@ -19,18 +19,14 @@ LIBS = -lsysutil -lsys -ltimers OBJ = at_wini.o LIBDRIVER = $d/libdriver/driver.o $d/libdriver/drvlib.o -LIBPCI = $p/pci.o $p/pci_table.o # build local binary all build: $(DRIVER) -$(DRIVER): $(OBJ) $(LIBDRIVER) $(LIBPCI) - $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS) $(LIBPCI) +$(DRIVER): $(OBJ) $(LIBDRIVER) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS) install -S 8k $(DRIVER) -$(LIBPCI): - cd $p && $(MAKE) - $(LIBDRIVER): cd $d/libdriver && $(MAKE) diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 59421efb0..985f0baa7 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -15,11 +15,11 @@ */ #include "at_wini.h" -#include "../libpci/pci.h" #include #include #include +#include #define ATAPI_DEBUG 0 /* To debug ATAPI code. */ @@ -416,6 +416,10 @@ PRIVATE void init_params_pci(int skip) pci_attr_r8(devind, PCI_SCR) != 0x01) { continue; } + + printf("init_params_pci: found device %04x/%04x at index %d\n", + vid, did, devind); + /* Found a controller. * Programming interface register tells us more. */ diff --git a/drivers/dp8390/Makefile b/drivers/dp8390/Makefile index 555b97c41..a3a133dba 100644 --- a/drivers/dp8390/Makefile +++ b/drivers/dp8390/Makefile @@ -16,17 +16,13 @@ LDFLAGS = -i LIBS = -lsys -lsysutil -ltimers OBJ = 3c503.o dp8390.o ne2000.o rtl8029.o wdeth.o -LIBPCI = $d/libpci/pci.o $d/libpci/pci_table.o # build local binary all build: $(DRIVER) -$(DRIVER): $(OBJ) $(LIBPCI) - $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS) +$(DRIVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) install -S 4096 $(DRIVER) -$(LIBPCI): - cd $d/libpci && $(MAKE) - # install with other drivers install: /usr/sbin/$(DRIVER) /usr/sbin/$(DRIVER): $(DRIVER) @@ -37,7 +33,7 @@ clean: rm -f *.o *.bak $(DRIVER) depend: - /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend # Include generated dependencies. include .depend diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index 76fa8cf52..2d31d6291 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -12,9 +12,9 @@ Created: April 2000 by Philip Homburg #include #include #include +#include #include "assert.h" -#include "../libpci/pci.h" #include "local.h" #include "dp8390.h" diff --git a/drivers/fxp/Makefile b/drivers/fxp/Makefile index 01ca57f6f..dbd5c7d3d 100644 --- a/drivers/fxp/Makefile +++ b/drivers/fxp/Makefile @@ -16,17 +16,13 @@ LDFLAGS = -i LIBS = -lsys -lsysutil -ltimers OBJ = fxp.o mii.o -LIBPCI = $d/libpci/pci.o $d/libpci/pci_table.o # build local binary all build: $(DRIVER) -$(DRIVER): $(OBJ) $(LIBPCI) - $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS) +$(DRIVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) install -S 4096 $(DRIVER) -$(LIBPCI): - cd $d/libpci && $(MAKE) - # install with other drivers install: /usr/sbin/$(DRIVER) /usr/sbin/$(DRIVER): $(DRIVER) @@ -37,7 +33,7 @@ clean: rm -f *.o *.bak $(DRIVER) depend: - /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend # Include generated dependencies. include .depend diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index f3b1cfc9b..f6d287e96 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -58,7 +59,6 @@ #define vm_1phys2bus(p) (p) #include "assert.h" -#include "../libpci/pci.h" #include "fxp.h" #include "mii.h" @@ -585,12 +585,24 @@ fxp_t *fp; case FXP_REV_82559C: str= "82559C"; /* 0x08 */ fp->fxp_type= FT_82559; break; - case FXP_REV_82559ERA: str= "82559ER-A"; break; /* 0x09 */ - case FXP_REV_82550_1: str= "82550(1)"; break; /* 0x0C */ - case FXP_REV_82550_2: str= "82550(2)"; break; /* 0x0D */ - case FXP_REV_82550_3: str= "82550(3)"; break; /* 0x0E */ - case FXP_REV_82551_1: str= "82551(1)"; break; /* 0x0F */ - case FXP_REV_82551_2: str= "82551(2)"; break; /* 0x10 */ + case FXP_REV_82559ERA: str= "82559ER-A"; /* 0x09 */ + fp->fxp_type= FT_82559; + break; + case FXP_REV_82550_1: str= "82550(1)"; /* 0x0C */ + fp->fxp_type= FT_82559; + break; + case FXP_REV_82550_2: str= "82550(2)"; /* 0x0D */ + fp->fxp_type= FT_82559; + break; + case FXP_REV_82550_3: str= "82550(3)"; /* 0x0E */ + fp->fxp_type= FT_82559; + break; + case FXP_REV_82551_1: str= "82551(1)"; /* 0x0F */ + fp->fxp_type= FT_82559; + break; + case FXP_REV_82551_2: str= "82551(2)"; /* 0x10 */ + fp->fxp_type= FT_82559; + break; } #if VERBOSE diff --git a/drivers/lance/Makefile b/drivers/lance/Makefile index a157c4344..fa0048dc6 100644 --- a/drivers/lance/Makefile +++ b/drivers/lance/Makefile @@ -17,17 +17,13 @@ LIBS = -lsys -lsysutil #-lutils -ltimers OBJ = lance.o -LIBPCI = $d/libpci/pci.o $d/libpci/pci_table.o # build local binary all build: $(DRIVER) -$(DRIVER): $(OBJ) $(LIBPCI) - $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS) +$(DRIVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) install -S 1k $(DRIVER) -$(LIBPCI): - cd $d/libpci && $(MAKE) - # install with other drivers install: /usr/sbin/$(DRIVER) /usr/sbin/$(DRIVER): $(DRIVER) @@ -38,7 +34,7 @@ clean: rm -f *.o *.bak $(DRIVER) depend: - /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend # Include generated dependencies. include .depend diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index da174fe08..a09940b6a 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -52,9 +52,9 @@ #include #include +#include #include "lance.h" -#include "../libpci/pci.h" /*#include "proc.h"*/ #include diff --git a/drivers/libpci/Makefile b/drivers/libpci/Makefile deleted file mode 100644 index 96acf0bb1..000000000 --- a/drivers/libpci/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Makefile for PCI bus library - -# Directories -u = /usr -i = $u/include -s = $i/sys -b = $i/ibm -m = $i/minix - -# Programs, flags, etc. -CC = exec cc -CFLAGS = -I$i -LDFLAGS = -i -LIBS = -lsys -lsysutil - -OBJECTS = pci.o pci_table.o - -all build install: $(OBJECTS) - -# $(CC) -c $@ $(LDFLAGS) $(OBJ) $(LIBS) - -clean: - rm -f *.o *.bak - -depend: - /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend - -# Include generated dependencies. -include .depend - diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile new file mode 100644 index 000000000..049937487 --- /dev/null +++ b/drivers/pci/Makefile @@ -0,0 +1,40 @@ +# Makefile for PCI support +DRIVER = pci + +# directories +u = /usr +i = $u/include +s = $i/sys +m = $i/minix +b = $i/ibm +d = .. + +# programs, flags, etc. +CC = cc +CFLAGS = -I$i +LDFLAGS = -i +LIBS = -lsys -lsysutil -ltimers + +OBJ = main.o pci.o pci_table.o + +# build local binary +all build: $(DRIVER) +$(DRIVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) + install -S 4096 $(DRIVER) + +# install with other drivers +install: /usr/sbin/$(DRIVER) +/usr/sbin/$(DRIVER): $(DRIVER) + install -o root -cs $? $@ + +# clean up local files +clean: + rm -f *.o *.bak $(DRIVER) + +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend + +# Include generated dependencies. +include .depend + diff --git a/drivers/pci/main.c b/drivers/pci/main.c new file mode 100644 index 000000000..84caad186 --- /dev/null +++ b/drivers/pci/main.c @@ -0,0 +1,301 @@ +/* +main.c +*/ + +#include "../drivers.h" + +#include + +FORWARD _PROTOTYPE( void do_init, (message *mp) ); +FORWARD _PROTOTYPE( void do_first_dev, (message *mp) ); +FORWARD _PROTOTYPE( void do_next_dev, (message *mp) ); +FORWARD _PROTOTYPE( void do_find_dev, (message *mp) ); +FORWARD _PROTOTYPE( void do_ids, (message *mp) ); +FORWARD _PROTOTYPE( void do_dev_name, (message *mp) ); +FORWARD _PROTOTYPE( void do_slot_name, (message *mp) ); +FORWARD _PROTOTYPE( void do_reserve, (message *mp) ); +FORWARD _PROTOTYPE( void do_attr_r8, (message *mp) ); +FORWARD _PROTOTYPE( void do_attr_r32, (message *mp) ); +FORWARD _PROTOTYPE( void do_attr_w32, (message *mp) ); + +int main(void) +{ + int r; + message m; + + printf("PCI says: hello world\n"); + + pci_init(); + + for(;;) + { + r= receive(ANY, &m); + if (r < 0) + { + printf("PCI: receive from ANY failed: %d\n", r); + break; + } + switch(m.m_type) + { + case BUSC_PCI_INIT: do_init(&m); break; + case BUSC_PCI_FIRST_DEV: do_first_dev(&m); break; + case BUSC_PCI_NEXT_DEV: do_next_dev(&m); break; + case BUSC_PCI_FIND_DEV: do_find_dev(&m); break; + case BUSC_PCI_IDS: do_ids(&m); break; + case BUSC_PCI_DEV_NAME: do_dev_name(&m); break; + case BUSC_PCI_SLOT_NAME: do_slot_name(&m); break; + case BUSC_PCI_RESERVE: do_reserve(&m); break; + case BUSC_PCI_ATTR_R8: do_attr_r8(&m); break; + case BUSC_PCI_ATTR_R32: do_attr_r32(&m); break; + case BUSC_PCI_ATTR_W32: do_attr_w32(&m); break; + default: + printf("got message from %d, type %d\n", + m.m_source, m.m_type); + break; + } + } + + return 0; +} + +PRIVATE void do_init(mp) +message *mp; +{ + int r; + + /* NOP for the moment */ + + mp->m_type= 0; + r= send(mp->m_source, mp); + if (r != 0) + printf("do_init: unable to send to %d: %d\n", mp->m_source, r); +} + +PRIVATE void do_first_dev(mp) +message *mp; +{ + int r, devind; + u16_t vid, did; + + r= pci_first_dev(&devind, &vid, &did); + if (r == 1) + { + mp->m1_i1= devind; + mp->m1_i2= vid; + mp->m1_i3= did; + } + mp->m_type= r; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_first_dev: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_next_dev(mp) +message *mp; +{ + int r, devind; + u16_t vid, did; + + devind= mp->m1_i1; + + r= pci_next_dev(&devind, &vid, &did); + if (r == 1) + { + mp->m1_i1= devind; + mp->m1_i2= vid; + mp->m1_i3= did; + } + mp->m_type= r; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_next_dev: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_find_dev(mp) +message *mp; +{ + int r, devind; + u8_t bus, dev, func; + + bus= mp->m1_i1; + dev= mp->m1_i2; + func= mp->m1_i3; + + r= pci_find_dev(bus, dev, func, &devind); + if (r == 1) + mp->m1_i1= devind; + mp->m_type= r; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_find_dev: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_ids(mp) +message *mp; +{ + int r, devind; + u16_t vid, did; + + devind= mp->m1_i1; + + pci_ids(devind, &vid, &did); + mp->m1_i1= vid; + mp->m1_i2= did; + mp->m_type= OK; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_ids: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_dev_name(mp) +message *mp; +{ + int r, name_len, len; + u16_t vid, did; + char *name_ptr, *name; + + vid= mp->m1_i1; + did= mp->m1_i2; + name_len= mp->m1_i3; + name_ptr= mp->m1_p1; + + name= pci_dev_name(vid, did); + if (name == NULL) + { + /* No name */ + r= ENOENT; + } + else + { + len= strlen(name)+1; + if (len > name_len) + len= name_len; + r= sys_vircopy(SELF, D, (vir_bytes)name, mp->m_source, D, + (vir_bytes)name_ptr, len); + } + + mp->m_type= r; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_dev_name: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_slot_name(mp) +message *mp; +{ + int r, devind, name_len, len; + char *name_ptr, *name; + + devind= mp->m1_i1; + name_len= mp->m1_i2; + name_ptr= mp->m1_p1; + + name= pci_slot_name(devind); + + len= strlen(name)+1; + if (len > name_len) + len= name_len; + r= sys_vircopy(SELF, D, (vir_bytes)name, mp->m_source, D, + (vir_bytes)name_ptr, len); + + mp->m_type= r; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_slot_name: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_reserve(mp) +message *mp; +{ + int r, devind; + + devind= mp->m1_i1; + + pci_reserve(devind); + mp->m_type= OK; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_reserve: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_attr_r8(mp) +message *mp; +{ + int r, devind, port; + u8_t v; + + devind= mp->m2_i1; + port= mp->m2_i2; + + v= pci_attr_r8(devind, port); + mp->m2_l1= v; + mp->m_type= OK; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_attr_r8: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_attr_r32(mp) +message *mp; +{ + int r, devind, port; + u32_t v; + + devind= mp->m2_i1; + port= mp->m2_i2; + + v= pci_attr_r32(devind, port); + mp->m2_l1= v; + mp->m_type= OK; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_attr_r32: unable to send to %d: %d\n", + mp->m_source, r); + } +} + +PRIVATE void do_attr_w32(mp) +message *mp; +{ + int r, devind, port; + u32_t v; + + devind= mp->m2_i1; + port= mp->m2_i2; + v= mp->m2_l1; + + pci_attr_w32(devind, port, v); + mp->m_type= OK; + r= send(mp->m_source, mp); + if (r != 0) + { + printf("do_attr_w32: unable to send to %d: %d\n", + mp->m_source, r); + } +} + diff --git a/drivers/libpci/pci.c b/drivers/pci/pci.c similarity index 99% rename from drivers/libpci/pci.c rename to drivers/pci/pci.c index b242db218..539203f45 100644 --- a/drivers/libpci/pci.c +++ b/drivers/pci/pci.c @@ -116,7 +116,7 @@ PUBLIC unsigned pci_inb(U16_t port) { return value; } PUBLIC unsigned pci_inw(U16_t port) { - U16_t value; + u32_t value; int s; if ((s=sys_inw(port, &value)) !=OK) printf("PCI: warning, sys_inw failed: %d\n", s); diff --git a/drivers/libpci/pci.h b/drivers/pci/pci.h similarity index 78% rename from drivers/libpci/pci.h rename to drivers/pci/pci.h index 41385445e..25651ec1d 100644 --- a/drivers/libpci/pci.h +++ b/drivers/pci/pci.h @@ -13,21 +13,6 @@ _PROTOTYPE( void pci_outb, (U16_t port, U8_t value) ); _PROTOTYPE( void pci_outw, (U16_t port, U16_t value) ); _PROTOTYPE( void pci_outl, (U16_t port, U32_t value) ); -/* pci.c */ -_PROTOTYPE( void pci_init, (void) ); -_PROTOTYPE( int pci_find_dev, (U8_t bus, U8_t dev, U8_t func, - int *devindp) ); -_PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) ); -_PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) ); -_PROTOTYPE( void pci_reserve, (int devind) ); -_PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) ); -_PROTOTYPE( char *pci_slot_name, (int devind) ); -_PROTOTYPE( char *pci_dev_name, (U16_t vid, U16_t did) ); -_PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) ); -_PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) ); -_PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) ); -_PROTOTYPE( void pci_attr_w16, (int devind, int port, U16_t value) ); -_PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) ); #define PCI_VID 0x00 /* Vendor ID, 16-bit */ #define PCI_DID 0x02 /* Device ID, 16-bit */ diff --git a/drivers/libpci/pci_amd.h b/drivers/pci/pci_amd.h similarity index 100% rename from drivers/libpci/pci_amd.h rename to drivers/pci/pci_amd.h diff --git a/drivers/libpci/pci_intel.h b/drivers/pci/pci_intel.h similarity index 100% rename from drivers/libpci/pci_intel.h rename to drivers/pci/pci_intel.h diff --git a/drivers/libpci/pci_sis.h b/drivers/pci/pci_sis.h similarity index 100% rename from drivers/libpci/pci_sis.h rename to drivers/pci/pci_sis.h diff --git a/drivers/libpci/pci_table.c b/drivers/pci/pci_table.c similarity index 100% rename from drivers/libpci/pci_table.c rename to drivers/pci/pci_table.c diff --git a/drivers/libpci/pci_via.h b/drivers/pci/pci_via.h similarity index 100% rename from drivers/libpci/pci_via.h rename to drivers/pci/pci_via.h diff --git a/drivers/rtl8139/Makefile b/drivers/rtl8139/Makefile index 83be7bd15..bc595d82f 100644 --- a/drivers/rtl8139/Makefile +++ b/drivers/rtl8139/Makefile @@ -17,18 +17,13 @@ LDFLAGS = -i LIBS = -lsys -lsysutil -ltimers OBJ = rtl8139.o -LIBPCI = $d/libpci/pci.o $d/libpci/pci_table.o - # build local binary all build: $(DRIVER) -$(DRIVER): $(OBJ) $(PCI) - $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS) +$(DRIVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) install -S 50kw $(DRIVER) -$(PCI): - cd $d/libpci && $(MAKE) - # install with other drivers install: /usr/sbin/$(DRIVER) /usr/sbin/$(DRIVER): $(DRIVER) @@ -39,7 +34,7 @@ clean: rm -f $(DRIVER) *.o *.bak depend: - /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend # Include generated dependencies. include .depend diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 982dfc8fc..7546ef62c 100755 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -81,9 +82,8 @@ #define printW() ((void)0) #define vm_1phys2bus(p) (p) -#define VERBOSE 0 /* display message during init */ +#define VERBOSE 1 /* display message during init */ -#include "../libpci/pci.h" #include "rtl8139.h" #define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE @@ -189,7 +189,7 @@ static unsigned my_inb(U16_t port) { return value; } static unsigned my_inw(U16_t port) { - U16_t value; + u32_t value; int s; if ((s=sys_inw(port, &value)) !=OK) printf("RTL8139: warning, sys_inw failed: %d\n", s); @@ -775,7 +775,7 @@ re_t *rep; printf("RTL8139: error, couldn't enable interrupts: %d\n", s); #if VERBOSE /* stay silent during startup, can always get status later */ - if (rep->re_mode) { + if (rep->re_model) { printf("%s: model %s\n", rep->re_name, rep->re_model); } else { @@ -825,14 +825,18 @@ re_t *rep; #endif /* Reset the device */ + printf("rl_reset_hw: (before reset) port = 0x%x, RL_CR = 0x%x\n", + port, rl_inb(port, RL_CR)); rl_outb(port, RL_CR, RL_CR_RST); getuptime(&t0); do { if (!(rl_inb(port, RL_CR) & RL_CR_RST)) break; } while (getuptime(&t1)==OK && (t1-t0) < HZ); + printf("rl_reset_hw: (after reset) port = 0x%x, RL_CR = 0x%x\n", + port, rl_inb(port, RL_CR)); if (rl_inb(port, RL_CR) & RL_CR_RST) - panic("rtl8139","reset failed to complete", NO_NUM); + printf("rtl8139: reset failed to complete"); t= rl_inl(port, RL_TCR); switch(t & (RL_TCR_HWVER_AM | RL_TCR_HWVER_BM))