Module Name: src Committed By: msaitoh Date: Tue Apr 9 04:04:04 UTC 2019
Modified Files: src/sys/dev/mca: if_le_mca.c Log Message: Fix a bug that the supported media can't passed correctly. Not tested. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/mca/if_le_mca.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/mca/if_le_mca.c diff -u src/sys/dev/mca/if_le_mca.c:1.20 src/sys/dev/mca/if_le_mca.c:1.21 --- src/sys/dev/mca/if_le_mca.c:1.20 Tue Apr 9 03:56:08 2019 +++ src/sys/dev/mca/if_le_mca.c Tue Apr 9 04:04:04 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $ */ +/* $NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -104,7 +104,7 @@ CFATTACH_DECL_NEW(le_mca, sizeof(struct static const uint8_t sknet_mcp_irq[] = { 3, 5, 10, 11 }; -static const uint8_t sknet_mcp_media[] = { +static const int sknet_mcp_media[] = { IFM_ETHER | IFM_10_2, IFM_ETHER | IFM_10_T, IFM_ETHER | IFM_10_5, @@ -131,7 +131,8 @@ le_mca_attach(device_t parent, device_t struct le_mca_softc *lesc = device_private(self); struct lance_softc *sc = &lesc->sc_am7990.lsc; struct mca_attach_args *ma = aux; - int i, pos2, pos3, pos4, irq, membase, supmedia=0; + int i, pos2, pos3, pos4, irq, membase; + const int *supmedia = NULL; const char *typestr; sc->sc_dev = self; @@ -205,7 +206,7 @@ le_mca_attach(device_t parent, device_t membase = 0xc0000 + ((pos3 & 0x0f) * 0x4000); /* Get configured media type */ - supmedia = sknet_mcp_media[(pos4 & 0xc0) >> 6]; + supmedia = &sknet_mcp_media[(pos4 & 0xc0) >> 6]; break; default: aprint_error(": unknown product %d\n", ma->ma_id); @@ -250,10 +251,10 @@ le_mca_attach(device_t parent, device_t * This is merely cosmetic since it's not possible to switch * the media anyway, even for MC2+. */ - if (supmedia != 0) { - sc->sc_supmedia = &supmedia; + if (supmedia != NULL) { + sc->sc_supmedia = supmedia; sc->sc_nsupmedia = 1; - sc->sc_defaultmedia = supmedia; + sc->sc_defaultmedia = *supmedia; } lesc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET,