Module Name: src Committed By: martin Date: Fri Jan 31 11:14:51 UTC 2020
Modified Files: src/sys/dev/ic [netbsd-9]: am79900reg.h rt2860.c src/sys/dev/ieee1394 [netbsd-9]: firewire.c fwohci.c fwohcireg.h src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_bce.c if_mcx.c if_pcn.c pccbbreg.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #671): sys/dev/pci/if_bce.c: revision 1.53 sys/dev/pci/pccbbreg.h: revision 1.16 sys/dev/ic/rt2860.c: revision 1.34 sys/dev/pci/if_alc.c: revision 1.45 sys/dev/pci/if_mcx.c: revision 1.5 sys/dev/pci/if_pcn.c: revision 1.72 sys/dev/pci/if_ale.c: revision 1.37 sys/dev/pci/if_age.c: revision 1.65 sys/dev/ieee1394/fwohcireg.h: revision 1.20 sys/dev/ieee1394/fwohci.c: revision 1.143 sys/dev/ieee1394/firewire.c: revision 1.49 sys/dev/ic/am79900reg.h: revision 1.10 Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.94.1 src/sys/dev/ic/am79900reg.h cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/dev/ic/rt2860.c cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/dev/ieee1394/firewire.c cvs rdiff -u -r1.142.2.1 -r1.142.2.2 src/sys/dev/ieee1394/fwohci.c cvs rdiff -u -r1.19 -r1.19.8.1 src/sys/dev/ieee1394/fwohcireg.h cvs rdiff -u -r1.60.2.4 -r1.60.2.5 src/sys/dev/pci/if_age.c cvs rdiff -u -r1.38.2.3 -r1.38.2.4 src/sys/dev/pci/if_alc.c cvs rdiff -u -r1.33.2.2 -r1.33.2.3 src/sys/dev/pci/if_ale.c cvs rdiff -u -r1.52.2.1 -r1.52.2.2 src/sys/dev/pci/if_bce.c cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/dev/pci/if_mcx.c cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/if_pcn.c cvs rdiff -u -r1.15 -r1.15.70.1 src/sys/dev/pci/pccbbreg.h 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/ic/am79900reg.h diff -u src/sys/dev/ic/am79900reg.h:1.9 src/sys/dev/ic/am79900reg.h:1.9.94.1 --- src/sys/dev/ic/am79900reg.h:1.9 Mon Apr 28 20:23:49 2008 +++ src/sys/dev/ic/am79900reg.h Fri Jan 31 11:14:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: am79900reg.h,v 1.9 2008/04/28 20:23:49 martin Exp $ */ +/* $NetBSD: am79900reg.h,v 1.9.94.1 2020/01/31 11:14:51 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ struct leinit { }; /* Receive message descriptor 1 (rmd1_bits) */ -#define LE_R1_OWN (1<<31) /* LANCE owns the packet */ +#define LE_R1_OWN (1U<<31) /* LANCE owns the packet */ #define LE_R1_ERR (1<<30) /* error summary */ #define LE_R1_FRAM (1<<29) /* framing error */ #define LE_R1_OFLO (1<<28) /* overflow error */ @@ -111,7 +111,7 @@ struct leinit { "\20\40OWN\37ERR\36FRAM\35OFLO\34CRC\33BUFF\32STP\31ENP" /* Transmit message descriptor 1 (tmd1_bits) */ -#define LE_T1_OWN (1<<31) /* LANCE owns the packet */ +#define LE_T1_OWN (1U<<31) /* LANCE owns the packet */ #define LE_T1_ERR (1<<30) /* error summary */ #define LE_T1_ADD_FCS (1<<29) /* add FCS (PCnet-PCI) */ #define LE_T1_NO_FCS (1<<29) /* no FCS (ILACC) */ Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.33 src/sys/dev/ic/rt2860.c:1.33.4.1 --- src/sys/dev/ic/rt2860.c:1.33 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/ic/rt2860.c Fri Jan 31 11:14:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: rt2860.c,v 1.33.4.1 2020/01/31 11:14:51 martin Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */ @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.33.4.1 2020/01/31 11:14:51 martin Exp $"); #include <sys/param.h> #include <sys/sockio.h> @@ -2233,7 +2233,7 @@ static void rt2860_enable_mrr(struct rt2860_softc *sc) { #define CCK(mcs) (mcs) -#define OFDM(mcs) (1 << 3 | (mcs)) +#define OFDM(mcs) (1U << 3 | (mcs)) RAL_WRITE(sc, RT2860_LG_FBK_CFG0, OFDM(6) << 28 | /* 54->48 */ OFDM(5) << 24 | /* 48->36 */ @@ -3294,7 +3294,7 @@ b4inc(uint32_t b32, int8_t delta) b4 = 0; else if (b4 > 0xf) b4 = 0xf; - b32 = b32 >> 4 | b4 << 28; + b32 = b32 >> 4 | (uint32_t)b4 << 28; } return b32; } Index: src/sys/dev/ieee1394/firewire.c diff -u src/sys/dev/ieee1394/firewire.c:1.48 src/sys/dev/ieee1394/firewire.c:1.48.4.1 --- src/sys/dev/ieee1394/firewire.c:1.48 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/ieee1394/firewire.c Fri Jan 31 11:14:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: firewire.c,v 1.48.4.1 2020/01/31 11:14:51 martin Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48.4.1 2020/01/31 11:14:51 martin Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -1407,12 +1407,12 @@ fw_reset_csr(struct firewire_comm *fc) CSRARC(fc, BANDWIDTH_AV) = 4915; CSRARC(fc, CHANNELS_AV_HI) = 0xffffffff; CSRARC(fc, CHANNELS_AV_LO) = 0xffffffff; - CSRARC(fc, IP_CHANNELS) = (1 << 31); + CSRARC(fc, IP_CHANNELS) = (1U << 31); CSRARC(fc, CONF_ROM) = 0x04 << 24; CSRARC(fc, CONF_ROM + 4) = 0x31333934; /* means strings 1394 */ CSRARC(fc, CONF_ROM + 8) = - 1 << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8; + 1U << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8; CSRARC(fc, CONF_ROM + 0xc) = 0; /* DV depend CSRs see blue book */ Index: src/sys/dev/ieee1394/fwohci.c diff -u src/sys/dev/ieee1394/fwohci.c:1.142.2.1 src/sys/dev/ieee1394/fwohci.c:1.142.2.2 --- src/sys/dev/ieee1394/fwohci.c:1.142.2.1 Wed Nov 27 14:03:14 2019 +++ src/sys/dev/ieee1394/fwohci.c Fri Jan 31 11:14:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fwohci.c,v 1.142.2.1 2019/11/27 14:03:14 martin Exp $ */ +/* $NetBSD: fwohci.c,v 1.142.2.2 2020/01/31 11:14:51 martin Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa @@ -37,7 +37,7 @@ * */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142.2.1 2019/11/27 14:03:14 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142.2.2 2020/01/31 11:14:51 martin Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -224,7 +224,7 @@ static void fwohci_arcv(struct fwohci_so #define OHCI_ATRETRY 0x008 #define OHCI_CROMHDR 0x018 #define OHCI_BUS_OPT 0x020 -#define OHCI_BUSIRMC (1 << 31) +#define OHCI_BUSIRMC (1U << 31) #define OHCI_BUSCMC (1 << 30) #define OHCI_BUSISC (1 << 29) #define OHCI_BUSBMC (1 << 28) @@ -250,7 +250,7 @@ static void fwohci_arcv(struct fwohci_so #define OHCI_SID_BUF 0x064 #define OHCI_SID_CNT 0x068 -#define OHCI_SID_ERR (1 << 31) +#define OHCI_SID_ERR (1U << 31) #define OHCI_SID_CNT_MASK 0xffc #define OHCI_IT_STAT 0x090 @@ -752,7 +752,7 @@ fwohci_set_bus_manager(struct firewire_c OWRITE(sc, OHCI_CSR_DATA, node); OWRITE(sc, OHCI_CSR_COMP, 0x3f); OWRITE(sc, OHCI_CSR_CONT, OHCI_BUS_MANAGER_ID); - for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1<<31)) && (i < 1000); i++) + for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1U <<31)) && (i < 1000); i++) DELAY(10); bm = OREAD(sc, OHCI_CSR_DATA); if ((bm & 0x3f) == 0x3f) @@ -1296,7 +1296,7 @@ fwohci_reset(struct fwohci_softc *sc) /* AT Retries */ OWRITE(sc, FWOHCI_RETRY, /* CycleLimit PhyRespRetries ATRespRetries ATReqRetries */ - (0xffff << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f); + (0xffffU << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f); sc->atrq.top = STAILQ_FIRST(&sc->atrq.db_trq); sc->atrs.top = STAILQ_FIRST(&sc->atrs.db_trq); @@ -2013,7 +2013,7 @@ fwohci_intr_core(struct fwohci_softc *sc OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R); /* Allow async. request to us */ - OWRITE(sc, OHCI_AREQHI, 1 << 31); + OWRITE(sc, OHCI_AREQHI, 1U << 31); if (firewire_phydma_enable) { /* allow from all nodes */ OWRITE(sc, OHCI_PREQHI, 0x7fffffff); Index: src/sys/dev/ieee1394/fwohcireg.h diff -u src/sys/dev/ieee1394/fwohcireg.h:1.19 src/sys/dev/ieee1394/fwohcireg.h:1.19.8.1 --- src/sys/dev/ieee1394/fwohcireg.h:1.19 Sat Mar 31 14:50:45 2018 +++ src/sys/dev/ieee1394/fwohcireg.h Fri Jan 31 11:14:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fwohcireg.h,v 1.19 2018/03/31 14:50:45 sevan Exp $ */ +/* $NetBSD: fwohcireg.h,v 1.19.8.1 2020/01/31 11:14:51 martin Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa @@ -285,13 +285,13 @@ struct ohci_registers { fwohcireg_t link_cntl_clr; /* Chip control clear 0xe4*/ #define FWOHCI_NODEID 0xe8 fwohcireg_t node; /* Node ID 0xe8 */ -#define OHCI_NODE_VALID (1 << 31) +#define OHCI_NODE_VALID (1U << 31) #define OHCI_NODE_ROOT (1 << 30) #define OHCI_ASYSRCBUS 1 fwohcireg_t phy_access; /* PHY cntl 0xec */ -#define PHYDEV_RDDONE (1<<31) +#define PHYDEV_RDDONE (1U<<31) #define PHYDEV_RDCMD (1<<15) #define PHYDEV_WRCMD (1<<14) #define PHYDEV_REGADDR 8 @@ -442,7 +442,7 @@ struct fwohci_trailer { #define OHCI_INT_ERR (0x1 << 24) #define OHCI_INT_CYC_LONG (0x1 << 25) #define OHCI_INT_PHY_REG (0x1 << 26) -#define OHCI_INT_EN (0x1 << 31) +#define OHCI_INT_EN (0x1U << 31) #define IP_CHANNELS 0x0234 #define FWOHCI_MAXREC 2048 Index: src/sys/dev/pci/if_age.c diff -u src/sys/dev/pci/if_age.c:1.60.2.4 src/sys/dev/pci/if_age.c:1.60.2.5 --- src/sys/dev/pci/if_age.c:1.60.2.4 Tue Nov 26 08:20:47 2019 +++ src/sys/dev/pci/if_age.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $ */ +/* $NetBSD: if_age.c,v 1.60.2.5 2020/01/31 11:14:50 martin Exp $ */ /* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */ /*- @@ -31,7 +31,7 @@ /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.5 2020/01/31 11:14:50 martin Exp $"); #include "vlan.h" @@ -2291,7 +2291,7 @@ age_rxfilter(struct age_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); Index: src/sys/dev/pci/if_alc.c diff -u src/sys/dev/pci/if_alc.c:1.38.2.3 src/sys/dev/pci/if_alc.c:1.38.2.4 --- src/sys/dev/pci/if_alc.c:1.38.2.3 Tue Nov 26 08:20:47 2019 +++ src/sys/dev/pci/if_alc.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_alc.c,v 1.38.2.3 2019/11/26 08:20:47 martin Exp $ */ +/* $NetBSD: if_alc.c,v 1.38.2.4 2020/01/31 11:14:50 martin Exp $ */ /* $OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon <yong...@freebsd.org> @@ -3459,7 +3459,7 @@ alc_iff(struct alc_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); Index: src/sys/dev/pci/if_ale.c diff -u src/sys/dev/pci/if_ale.c:1.33.2.2 src/sys/dev/pci/if_ale.c:1.33.2.3 --- src/sys/dev/pci/if_ale.c:1.33.2.2 Tue Nov 26 08:20:47 2019 +++ src/sys/dev/pci/if_ale.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ale.c,v 1.33.2.2 2019/11/26 08:20:47 martin Exp $ */ +/* $NetBSD: if_ale.c,v 1.33.2.3 2020/01/31 11:14:50 martin Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon <yong...@freebsd.org> @@ -32,7 +32,7 @@ /* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.33.2.2 2019/11/26 08:20:47 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.33.2.3 2020/01/31 11:14:50 martin Exp $"); #include "vlan.h" @@ -2012,7 +2012,7 @@ ale_rxfilter(struct ale_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); Index: src/sys/dev/pci/if_bce.c diff -u src/sys/dev/pci/if_bce.c:1.52.2.1 src/sys/dev/pci/if_bce.c:1.52.2.2 --- src/sys/dev/pci/if_bce.c:1.52.2.1 Wed Oct 23 19:38:52 2019 +++ src/sys/dev/pci/if_bce.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bce.c,v 1.52.2.1 2019/10/23 19:38:52 martin Exp $ */ +/* $NetBSD: if_bce.c,v 1.52.2.2 2020/01/31 11:14:50 martin Exp $ */ /* * Copyright (c) 2003 Clifford Wright. All rights reserved. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.52.2.1 2019/10/23 19:38:52 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.52.2.2 2020/01/31 11:14:50 martin Exp $"); #include "vlan.h" @@ -1015,7 +1015,7 @@ bce_add_mac(struct bce_softc *sc, uint8_ uint32_t rval; bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_FILT_LOW, - mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]); + (uint32_t)mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]); bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_FILT_HI, mac[0] << 8 | mac[1] | 0x10000); /* MAGIC */ bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_FILT_CTL, Index: src/sys/dev/pci/if_mcx.c diff -u src/sys/dev/pci/if_mcx.c:1.1.2.7 src/sys/dev/pci/if_mcx.c:1.1.2.8 --- src/sys/dev/pci/if_mcx.c:1.1.2.7 Sun Jan 26 11:17:11 2020 +++ src/sys/dev/pci/if_mcx.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mcx.c,v 1.1.2.7 2020/01/26 11:17:11 martin Exp $ */ +/* $NetBSD: if_mcx.c,v 1.1.2.8 2020/01/31 11:14:50 martin Exp $ */ /* $OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */ /* @@ -130,7 +130,7 @@ #define MCX_CMDQ_DOORBELL 0x0018 #define MCX_STATE 0x01fc -#define MCX_STATE_MASK (1 << 31) +#define MCX_STATE_MASK (1U << 31) #define MCX_STATE_INITIALIZING (1 << 31) #define MCX_STATE_READY (0 << 31) #define MCX_STATE_INTERFACE_MASK (0x3 << 24) @@ -1330,7 +1330,7 @@ CTASSERT(sizeof(struct mcx_wq_ctx) == 0x struct mcx_sq_ctx { uint32_t sq_flags; -#define MCX_SQ_CTX_RLKEY (1 << 31) +#define MCX_SQ_CTX_RLKEY (1U << 31) #define MCX_SQ_CTX_FRE_SHIFT (1 << 29) #define MCX_SQ_CTX_FLUSH_IN_ERROR (1 << 28) #define MCX_SQ_CTX_MIN_WQE_INLINE_SHIFT 24 @@ -1440,7 +1440,7 @@ struct mcx_cmd_destroy_sq_out { struct mcx_rq_ctx { uint32_t rq_flags; -#define MCX_RQ_CTX_RLKEY (1 << 31) +#define MCX_RQ_CTX_RLKEY (1U << 31) #define MCX_RQ_CTX_VLAN_STRIP_DIS (1 << 28) #define MCX_RQ_CTX_MEM_RQ_TYPE_SHIFT 24 #define MCX_RQ_CTX_STATE_SHIFT 20 @@ -6527,7 +6527,7 @@ mcx_media_add_types(struct mcx_softc *sc proto_cap = be32toh(ptys.rp_eth_proto_cap); for (i = 0; i < __arraycount(mcx_eth_cap_map); i++) { - if ((proto_cap & (1 << i)) && (mcx_eth_cap_map[i] != 0)) + if ((proto_cap & (1U << i)) && (mcx_eth_cap_map[i] != 0)) ifmedia_add(&sc->sc_media, IFM_ETHER | mcx_eth_cap_map[i], 0, NULL); } @@ -6557,7 +6557,7 @@ mcx_media_status(struct ifnet *ifp, stru media_oper = 0; for (i = 0; i < __arraycount(mcx_eth_cap_map); i++) { - if (proto_oper & (1 << i)) { + if (proto_oper & (1U << i)) { media_oper = mcx_eth_cap_map[i]; } } Index: src/sys/dev/pci/if_pcn.c diff -u src/sys/dev/pci/if_pcn.c:1.71 src/sys/dev/pci/if_pcn.c:1.71.2.1 --- src/sys/dev/pci/if_pcn.c:1.71 Tue May 28 07:41:49 2019 +++ src/sys/dev/pci/if_pcn.c Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pcn.c,v 1.71 2019/05/28 07:41:49 msaitoh Exp $ */ +/* $NetBSD: if_pcn.c,v 1.71.2.1 2020/01/31 11:14:50 martin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.71 2019/05/28 07:41:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.71.2.1 2020/01/31 11:14:50 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1708,12 +1708,13 @@ pcn_init(struct ifnet *ifp) sc->sc_initblock.init_rdra = htole32(PCN_CDRXADDR(sc, 0)); sc->sc_initblock.init_tdra = htole32(PCN_CDTXADDR(sc, 0)); sc->sc_initblock.init_mode = htole32(sc->sc_mode | - ((ffs(PCN_NTXDESC) - 1) << 28) | + (((uint32_t)ffs(PCN_NTXDESC) - 1) << 28) | ((ffs(PCN_NRXDESC) - 1) << 20)); /* Set the station address in the init block. */ sc->sc_initblock.init_padr[0] = htole32(enaddr[0] | - (enaddr[1] << 8) | (enaddr[2] << 16) | (enaddr[3] << 24)); + (enaddr[1] << 8) | (enaddr[2] << 16) | + ((uint32_t)enaddr[3] << 24)); sc->sc_initblock.init_padr[1] = htole32(enaddr[4] | (enaddr[5] << 8)); Index: src/sys/dev/pci/pccbbreg.h diff -u src/sys/dev/pci/pccbbreg.h:1.15 src/sys/dev/pci/pccbbreg.h:1.15.70.1 --- src/sys/dev/pci/pccbbreg.h:1.15 Tue Dec 15 22:17:12 2009 +++ src/sys/dev/pci/pccbbreg.h Fri Jan 31 11:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pccbbreg.h,v 1.15 2009/12/15 22:17:12 snj Exp $ */ +/* $NetBSD: pccbbreg.h,v 1.15.70.1 2020/01/31 11:14:50 martin Exp $ */ /* * Copyright (c) 1999 HAYAKAWA Koichi. All rights reserved. @@ -67,7 +67,7 @@ /* PCI_CB_LSCP_REG */ #define PCI_CB_LATENCY_SHIFT 24 -#define PCI_CB_LATENCY_MASK 0xff +#define PCI_CB_LATENCY_MASK 0xffU #define PCI_CB_LATENCY(x) (((x) >> PCI_CB_LATENCY_SHIFT) & PCI_CB_LATENCY_MASK)