FreeBSD Bugzilla – Attachment 8937 Details for
Bug 18528
realports don't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 6.50 KB, created by
dmlb
on 2000-05-13 12:40:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
dmlb
Created:
2000-05-13 12:40:00 UTC
Size:
6.50 KB
patch
obsolete
>Index: if_xe.c >=================================================================== >RCS file: /steer/ncvs/src/sys/dev/xe/if_xe.c,v >retrieving revision 1.18 >diff -u -r1.18 if_xe.c >--- if_xe.c 2000/05/01 04:41:04 1.18 >+++ if_xe.c 2000/05/08 21:15:19 >@@ -33,7 +33,6 @@ > * I've pushed this fairly far, but there are some things that need to be > * done here. I'm documenting them here in case I get destracted. -- imp > * >- * xe_memwrite -- maybe better handled pccard layer? > * xe_cem56fix -- need to figure out how to map the extra stuff. > */ > >@@ -205,6 +204,7 @@ > /* > * Debug functions > */ >+#define XE_DEBUG 2 > #ifdef XE_DEBUG > #define XE_REG_DUMP(scp) xe_reg_dump((scp)) > #define XE_MII_DUMP(scp) xe_mii_dump((scp)) >@@ -216,91 +216,62 @@ > #endif > > /* >- * Two routines to read from/write to the attribute memory >- * the write portion is used only for fixing up the RealPort cards, >- * the reader portion was needed for debugging info, and duplicated some >- * code in xe_card_init(), so it appears here instead with suitable >- * modifications to xe_card_init() >- * -aDe Lovett >+ * Fixing for RealPort cards - they need a little furtling to get the >+ * ethernet working > */ > static int >-xe_memwrite(device_t dev, off_t offset, u_char byte) >+xe_cem56fix(device_t dev) > { >- /* XXX */ >- return (-1); >-} >- >-/* >- * Hacking for RealPort cards >- */ >-static int >-xe_cem56fix(struct xe_softc *scp) >-{ >-#if XXX /* Need to revisit */ >- int ioport, fail; >- >- /* allocate a new I/O slot for the ethernet */ >- /* XXX: ctrl->mapio() always appears to return 0 (success), so >- * this may cause problems if another device is listening >- * on 0x300 already. In this case, you should choose a >- * known free I/O port address in the kernel config line >- * for the driver. It will be picked up here and used >- * instead of the autodetected value. >- */ >- slt->io[1].window = 1; >- slt->io[1].flags = IODF_WS|IODF_16BIT|IODF_ZEROWS|IODF_ACTIVE; >- slt->io[1].size = 0x10; >- >-#ifdef XE_IOBASE >- >- device_printf(scp->dev, "user requested ioport 0x%x\n", XE_IOBASE ); >- ioport = XE_IOBASE; >- slt->io[1].start = ioport; >- fail = ctrl->mapio(slt, 1); >- >-#else >+ struct xe_softc *sc = (struct xe_softc *) device_get_softc(dev); >+ bus_space_tag_t bst; >+ bus_space_handle_t bsh; >+ struct resource *r; >+ int rid; >+ int ioport; > >- for (ioport = 0x300; ioport < 0x400; ioport += 0x10) { >- slt->io[1].start = ioport; >- if ((fail = ctrl->mapio( slt, 1 )) == 0) >- break; >- } >+#ifdef XE_DEBUG >+ device_printf(dev, "Hacking your Realport, master\n"); >+#endif > >+#if XE_DEBUG > 1 >+ device_printf(dev, "Realport port 0x%0lx, size 0x%0lx\n", >+ bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid), >+ bus_get_resource_count(dev, SYS_RES_IOPORT, sc->port_rid)); > #endif > >- /* did we find one? */ >- if (fail) { >- device_printf(scp->dev, "xe_cem56fix: no free address space\n"); >+ rid = 0; >+ r = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 4 << 10, RF_ACTIVE); >+ if (!r) { >+#if XE_DEBUG > 0 >+ device_printf(dev, "Can't map in attribute memory\n"); >+#endif > return -1; > } > >+ bsh = rman_get_bushandle(r); >+ bst = rman_get_bustag(r); > >- /* munge the id_iobase entry for use by the rest of the driver */ >-#if XE_DEBUG > 1 >- device_printf(scp->dev, "using 0x%x for RealPort ethernet\n", ioport); >-#endif >-#if 0 >- scp->dev->id_iobase = ioport; >-#endif >+ CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY, rid, >+ PCCARD_A_MEM_ATTR); >+ >+ bus_space_write_1(bst, bsh, DINGO_ECOR, DINGO_ECOR_IRQ_LEVEL | >+ DINGO_ECOR_INT_ENABLE | >+ DINGO_ECOR_IOB_ENABLE | >+ DINGO_ECOR_ETH_ENABLE); >+ ioport = bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid); >+ bus_space_write_1(bst, bsh, DINGO_EBAR0, ioport & 0xff); >+ bus_space_write_1(bst, bsh, DINGO_EBAR1, (ioport >> 8) & 0xff); >+ >+ bus_space_write_1(bst, bsh, DINGO_DCOR0, DINGO_DCOR0_SF_INT); >+ bus_space_write_1(bst, bsh, DINGO_DCOR1, DINGO_DCOR1_INT_LEVEL | >+ DINGO_DCOR1_EEDIO); >+ bus_space_write_1(bst, bsh, DINGO_DCOR2, 0x00); >+ bus_space_write_1(bst, bsh, DINGO_DCOR3, 0x00); >+ bus_space_write_1(bst, bsh, DINGO_DCOR4, 0x00); > >- /* magic to set up the ethernet */ >- xe_memwrite( scp->dev, DINGO_ECOR, DINGO_ECOR_IRQ_LEVEL| >- DINGO_ECOR_INT_ENABLE|DINGO_ECOR_IOB_ENABLE| >- DINGO_ECOR_ETH_ENABLE ); >- xe_memwrite( scp->dev, DINGO_EBAR0, ioport & 0xff ); >- xe_memwrite( scp->dev, DINGO_EBAR1, (ioport >> 8) & 0xff ); >- >- xe_memwrite( scp->dev, DINGO_DCOR0, DINGO_DCOR0_SF_INT ); >- xe_memwrite( scp->dev, DINGO_DCOR1, DINGO_DCOR1_INT_LEVEL|DINGO_DCOR1_EEDIO ); >- xe_memwrite( scp->dev, DINGO_DCOR2, 0x00 ); >- xe_memwrite( scp->dev, DINGO_DCOR3, 0x00 ); >- xe_memwrite( scp->dev, DINGO_DCOR4, 0x00 ); >+ bus_release_resource(dev, SYS_RES_MEMORY, rid, r); > >- /* success! */ > return 0; >-#else >- return -1; >-#endif /* XXX */ > } > > /* >@@ -532,7 +503,7 @@ > scp->autoneg_status = 0; > > /* Hack RealPorts into submission */ >- if (scp->dingo && xe_cem56fix(scp) < 0) { >+ if (scp->dingo && xe_cem56fix(dev) < 0) { > device_printf(dev, "Unable to fix your RealPort\n"); > xe_deactivate(dev); > return ENODEV; >@@ -2210,11 +2181,39 @@ > xe_activate(device_t dev) > { > struct xe_softc *sc = device_get_softc(dev); >- int err; >+ int start, err; > >- sc->port_rid = 0; >- sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, >- 0, ~0, 16, RF_ACTIVE); >+ if (!sc->dingo) { >+ sc->port_rid = 0; /* 0 is managed by pccard */ >+ sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, >+ &sc->port_rid, 0, ~0, 16, RF_ACTIVE); >+ } else { >+ /* >+ * Find a 16 byte aligned ioport for the card. >+ */ >+#if XE_DEBUG > 0 >+ device_printf(dev, "Finding an aligned port for RealPort\n"); >+#endif /* XE_DEBUG */ >+ sc->port_rid = 1; /* 0 is managed by pccard */ >+ start = 0x100; >+ do { >+ sc->port_res = bus_alloc_resource(dev, >+ SYS_RES_IOPORT, &sc->port_rid, start, 0x3ff, 16, >+ RF_ACTIVE); >+ if (sc->port_res == 0) >+ break; /* we failed */ >+ if ((rman_get_start(sc->port_res) & 0xf) == 0) >+ break; /* good */ >+ bus_release_resource(dev, SYS_RES_IOPORT, sc->port_rid, >+ sc->port_res); >+ start = (rman_get_start(sc->port_res) + 15) & ~0xf; >+ } while (1); >+#if XE_DEBUG > 2 >+ device_printf(dev, "port 0x%0lx, size 0x%0lx\n", >+ bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid), >+ bus_get_resource_count(dev, SYS_RES_IOPORT, sc->port_rid)); >+#endif /* XE_DEBUG */ >+ } > if (!sc->port_res) { > #if XE_DEBUG > 0 > device_printf(dev, "Cannot allocate ioport\n");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18528
: 8937