summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_fxpvar.h
diff options
context:
space:
mode:
authorgallatin <gallatin@FreeBSD.org>1999-09-30 19:03:12 +0000
committergallatin <gallatin@FreeBSD.org>1999-09-30 19:03:12 +0000
commit2be6fce1fa8c6a2f0969b67f4b4d4c5f8c96a172 (patch)
treefe521c61e966c1ad4f10877a35e9039e70e5cde0 /sys/pci/if_fxpvar.h
parentcb50d7f72c35cc4a3713dbc64619e390391e7848 (diff)
downloadFreeBSD-src-2be6fce1fa8c6a2f0969b67f4b4d4c5f8c96a172.zip
FreeBSD-src-2be6fce1fa8c6a2f0969b67f4b4d4c5f8c96a172.tar.gz
Make the fxp driver work on alpha, rather than panic the machine on boot
and/or when using the card. o Convert the driver to using bus_space. This allows alphas with fxp's to boot, rather than panic'ing because rman_get_virtual() doesn't really return a virtual address on alphas. o Fix an alpha unaligned access error caused by some misfeature of gcc/egcs: if link_addr & rbd_addr in the fxp_rfa struct are 32 bit quantities, egcs will assume they are naturally aligned. So it will do a ldl & some shifty/masky to twiddle 16 bit values in fxp_lwcopy(). However, if they are 16-bit aligned, the ldl will actually be done on a 16-bit aligned value & we will panic with an unaligned access error... Changing their definition to an array of chars seems to fix this. I obtained this from NetBSD. I've tested this on both i386 & alpha.
Diffstat (limited to 'sys/pci/if_fxpvar.h')
-rw-r--r--sys/pci/if_fxpvar.h20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/pci/if_fxpvar.h b/sys/pci/if_fxpvar.h
index 7c4717d..97c2b40 100644
--- a/sys/pci/if_fxpvar.h
+++ b/sys/pci/if_fxpvar.h
@@ -42,16 +42,15 @@ struct fxp_softc {
#if defined(__NetBSD__)
struct device sc_dev; /* generic device structures */
void *sc_ih; /* interrupt handler cookie */
- bus_space_tag_t sc_st; /* bus space tag */
- bus_space_handle_t sc_sh; /* bus space handle */
struct ethercom sc_ethercom; /* ethernet common part */
#else
struct arpcom arpcom; /* per-interface network data */
- caddr_t csr; /* control/status registers */
struct resource *mem; /* resource descriptor for registers */
struct resource *irq; /* resource descriptor for interrupt */
void *ih; /* interrupt handler cookie */
#endif /* __NetBSD__ */
+ bus_space_tag_t sc_st; /* bus space tag */
+ bus_space_handle_t sc_sh; /* bus space handle */
struct mbuf *rfa_headm; /* first mbuf in receive frame area */
struct mbuf *rfa_tailm; /* last mbuf in receive frame area */
struct fxp_cb_tx *cbl_first; /* first active TxCB in list */
@@ -71,7 +70,6 @@ struct fxp_softc {
};
/* Macros to ease CSR access. */
-#if defined(__NetBSD__)
#define CSR_READ_1(sc, reg) \
bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg))
#define CSR_READ_2(sc, reg) \
@@ -84,20 +82,6 @@ struct fxp_softc {
bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val))
#define CSR_WRITE_4(sc, reg, val) \
bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
-#else
-#define CSR_READ_1(sc, reg) \
- (*((u_int8_t *)((sc)->csr + (reg))))
-#define CSR_READ_2(sc, reg) \
- (*((u_int16_t *)((sc)->csr + (reg))))
-#define CSR_READ_4(sc, reg) \
- (*((u_int32_t *)((sc)->csr + (reg))))
-#define CSR_WRITE_1(sc, reg, val) \
- (*((u_int8_t *)((sc)->csr + (reg)))) = (val)
-#define CSR_WRITE_2(sc, reg, val) \
- (*((u_int16_t *)((sc)->csr + (reg)))) = (val)
-#define CSR_WRITE_4(sc, reg, val) \
- (*((u_int32_t *)((sc)->csr + (reg)))) = (val)
-#endif /* __NetBSD__ */
/* Deal with slight differences in software interfaces. */
#if defined(__NetBSD__)
OpenPOWER on IntegriCloud