| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_xge.c,v 1.33 2020/01/30 06:10:26 thorpej Exp $ */ | | 1 | /* $NetBSD: if_xge.c,v 1.34 2020/03/01 15:54:18 thorpej Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2004, SUNET, Swedish University Computer Network. | | 4 | * Copyright (c) 2004, SUNET, Swedish University Computer Network. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Anders Magnusson for SUNET, Swedish University Computer Network. | | 7 | * Written by Anders Magnusson for SUNET, Swedish University Computer Network. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -33,27 +33,27 @@ | | | @@ -33,27 +33,27 @@ |
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
34 | * POSSIBILITY OF SUCH DAMAGE. | | 34 | * POSSIBILITY OF SUCH DAMAGE. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | /* | | 37 | /* |
38 | * Device driver for the S2io Xframe Ten Gigabit Ethernet controller. | | 38 | * Device driver for the S2io Xframe Ten Gigabit Ethernet controller. |
39 | * | | 39 | * |
40 | * TODO (in no specific order): | | 40 | * TODO (in no specific order): |
41 | * HW VLAN support. | | 41 | * HW VLAN support. |
42 | * IPv6 HW cksum. | | 42 | * IPv6 HW cksum. |
43 | */ | | 43 | */ |
44 | | | 44 | |
45 | #include <sys/cdefs.h> | | 45 | #include <sys/cdefs.h> |
46 | __KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.33 2020/01/30 06:10:26 thorpej Exp $"); | | 46 | __KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.34 2020/03/01 15:54:18 thorpej Exp $"); |
47 | | | 47 | |
48 | | | 48 | |
49 | #include <sys/param.h> | | 49 | #include <sys/param.h> |
50 | #include <sys/systm.h> | | 50 | #include <sys/systm.h> |
51 | #include <sys/mbuf.h> | | 51 | #include <sys/mbuf.h> |
52 | #include <sys/malloc.h> | | 52 | #include <sys/malloc.h> |
53 | #include <sys/kernel.h> | | 53 | #include <sys/kernel.h> |
54 | #include <sys/proc.h> | | 54 | #include <sys/proc.h> |
55 | #include <sys/socket.h> | | 55 | #include <sys/socket.h> |
56 | #include <sys/device.h> | | 56 | #include <sys/device.h> |
57 | | | 57 | |
58 | #include <net/if.h> | | 58 | #include <net/if.h> |
59 | #include <net/if_dl.h> | | 59 | #include <net/if_dl.h> |
| @@ -277,27 +277,31 @@ xge_attach(device_t parent, device_t sel | | | @@ -277,27 +277,31 @@ xge_attach(device_t parent, device_t sel |
277 | struct xge_softc *sc; | | 277 | struct xge_softc *sc; |
278 | struct ifnet *ifp; | | 278 | struct ifnet *ifp; |
279 | pcireg_t memtype; | | 279 | pcireg_t memtype; |
280 | pci_intr_handle_t ih; | | 280 | pci_intr_handle_t ih; |
281 | const char *intrstr = NULL; | | 281 | const char *intrstr = NULL; |
282 | pci_chipset_tag_t pc = pa->pa_pc; | | 282 | pci_chipset_tag_t pc = pa->pa_pc; |
283 | uint8_t enaddr[ETHER_ADDR_LEN]; | | 283 | uint8_t enaddr[ETHER_ADDR_LEN]; |
284 | uint64_t val; | | 284 | uint64_t val; |
285 | int i; | | 285 | int i; |
286 | char intrbuf[PCI_INTRSTR_LEN]; | | 286 | char intrbuf[PCI_INTRSTR_LEN]; |
287 | | | 287 | |
288 | sc = device_private(self); | | 288 | sc = device_private(self); |
289 | sc->sc_dev = self; | | 289 | sc->sc_dev = self; |
290 | sc->sc_dmat = pa->pa_dmat; | | 290 | |
| | | 291 | if (pci_dma64_available(pa)) |
| | | 292 | sc->sc_dmat = pa->pa_dmat64; |
| | | 293 | else |
| | | 294 | sc->sc_dmat = pa->pa_dmat; |
291 | | | 295 | |
292 | /* Get BAR0 address */ | | 296 | /* Get BAR0 address */ |
293 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, XGE_PIF_BAR); | | 297 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, XGE_PIF_BAR); |
294 | if (pci_mapreg_map(pa, XGE_PIF_BAR, memtype, 0, | | 298 | if (pci_mapreg_map(pa, XGE_PIF_BAR, memtype, 0, |
295 | &sc->sc_st, &sc->sc_sh, 0, 0)) { | | 299 | &sc->sc_st, &sc->sc_sh, 0, 0)) { |
296 | aprint_error("%s: unable to map PIF BAR registers\n", XNAME); | | 300 | aprint_error("%s: unable to map PIF BAR registers\n", XNAME); |
297 | return; | | 301 | return; |
298 | } | | 302 | } |
299 | | | 303 | |
300 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, XGE_TXP_BAR); | | 304 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, XGE_TXP_BAR); |
301 | if (pci_mapreg_map(pa, XGE_TXP_BAR, memtype, 0, | | 305 | if (pci_mapreg_map(pa, XGE_TXP_BAR, memtype, 0, |
302 | &sc->sc_txt, &sc->sc_txh, 0, 0)) { | | 306 | &sc->sc_txt, &sc->sc_txh, 0, 0)) { |
303 | aprint_error("%s: unable to map TXP BAR registers\n", XNAME); | | 307 | aprint_error("%s: unable to map TXP BAR registers\n", XNAME); |