Also fix shift values for SCT constants.

This commit is contained in:
mlelstv 2022-08-01 07:34:28 +00:00
parent ca8cc6f69f
commit 1d93c6307f
8 changed files with 74 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ahcisata_core.c,v 1.105 2021/11/19 23:46:55 rin Exp $ */
/* $NetBSD: ahcisata_core.c,v 1.106 2022/08/01 07:34:28 mlelstv Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.105 2021/11/19 23:46:55 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.106 2022/08/01 07:34:28 mlelstv Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@ -828,8 +828,8 @@ ahci_exec_fis(struct ata_channel *chp, int timeout, int flags, int slot)
*/
return ERROR;
}
aprint_debug("%s port %d: error 0x%x sending FIS\n",
AHCINAME(sc), chp->ch_channel, is);
aprint_debug("%s port %d: error 0x%x sending FIS, t %d\n",
AHCINAME(sc), chp->ch_channel, is, timeout);
return ERR_DF;
}
ata_delay(chp, 10, "ahcifis", flags);
@ -1635,9 +1635,27 @@ ahci_channel_stop(struct ahci_softc *sc, struct ata_channel *chp, int flags)
/* XXX controller reset ? */
return;
}
if (sc->sc_channel_stop)
sc->sc_channel_stop(sc, chp);
if ((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_FRE) == 0)
return;
AHCI_WRITE(sc, AHCI_P_CMD(chp->ch_channel),
AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & ~AHCI_P_CMD_FRE);
/* wait 1s for FIS receive to stop */
for (i = 0; i <100; i++) {
if ((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_FR)
== 0)
break;
if (flags & AT_WAIT)
tsleep(&sc, PRIBIO, "ahcistop", mstohz(10));
else
delay(10000);
}
if (AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_FR) {
printf("%s: channel FIS receive wouldn't stop\n", AHCINAME(sc));
/* XXX controller reset ? */
}
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: bcmgenet.c,v 1.11 2021/12/31 14:25:22 riastradh Exp $ */
/* $NetBSD: bcmgenet.c,v 1.12 2022/08/01 07:34:28 mlelstv Exp $ */
/*-
* Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca>
@ -34,7 +34,7 @@
#include "opt_ddb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.11 2021/12/31 14:25:22 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.12 2022/08/01 07:34:28 mlelstv Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -730,7 +730,8 @@ genet_rxintr(struct genet_softc *sc, int qid)
bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
0, sc->sc_rx.buf_map[index].map->dm_mapsize,
BUS_DMASYNC_POSTREAD);
}
} else
device_printf(sc->sc_dev, "RXINTR empty %d\n",index);
bus_dmamap_unload(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map);
sc->sc_rx.buf_map[index].mbuf = NULL;
@ -784,18 +785,19 @@ genet_txintr(struct genet_softc *sc, int qid)
bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
0, bmap->map->dm_mapsize,
BUS_DMASYNC_POSTWRITE);
}
} else
device_printf(sc->sc_dev, "TXINTR empty %d\n",i);
bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
m_freem(bmap->mbuf);
bmap->mbuf = NULL;
++pkts;
}
ifp->if_flags &= ~IFF_OACTIVE;
i = TX_NEXT(i);
sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0xffff;
}
ifp->if_flags &= ~IFF_OACTIVE;
if_statadd(ifp, if_opackets, pkts);
if (pkts != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: nslm7x.c,v 1.74 2020/09/07 00:32:28 mrg Exp $ */
/* $NetBSD: nslm7x.c,v 1.75 2022/08/01 07:34:28 mlelstv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.74 2020/09/07 00:32:28 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.75 2022/08/01 07:34:28 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2247,6 +2247,7 @@ lm_attach(struct lm_softc *lmsc)
if ((rv = sysmon_envsys_sensor_attach(lmsc->sc_sme,
&lmsc->sensors[i])) != 0) {
sysmon_envsys_destroy(lmsc->sc_sme);
lmsc->sc_sme = NULL;
aprint_error_dev(lmsc->sc_dev,
"sysmon_envsys_sensor_attach() returned %d\n", rv);
return;
@ -2270,6 +2271,7 @@ lm_attach(struct lm_softc *lmsc)
aprint_error_dev(lmsc->sc_dev,
"unable to register with sysmon\n");
sysmon_envsys_destroy(lmsc->sc_sme);
lmsc->sc_sme = NULL;
}
if (!pmf_device_register(lmsc->sc_dev, NULL, NULL))
aprint_error_dev(lmsc->sc_dev,
@ -2285,7 +2287,9 @@ lm_detach(struct lm_softc *lmsc)
{
callout_halt(&lmsc->sc_callout, NULL);
callout_destroy(&lmsc->sc_callout);
sysmon_envsys_unregister(lmsc->sc_sme);
if (lmsc->sc_sme != NULL)
sysmon_envsys_unregister(lmsc->sc_sme);
pmf_device_deregister(lmsc->sc_dev);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nvmereg.h,v 1.17 2022/07/31 11:58:37 mlelstv Exp $ */
/* $NetBSD: nvmereg.h,v 1.18 2022/08/01 07:34:28 mlelstv Exp $ */
/* $OpenBSD: nvmereg.h,v 1.10 2016/04/14 11:18:32 dlg Exp $ */
/*
@ -242,10 +242,10 @@ struct nvme_cqe {
#define NVME_CQE_M __BIT(14)
#define NVME_CQE_SCT_MASK __BITS(9, 11)
#define NVME_CQE_SCT(_f) ((_f) & NVME_CQE_SCT_MASK)
#define NVME_CQE_SCT_GENERIC (0x00 << 8)
#define NVME_CQE_SCT_COMMAND (0x01 << 8)
#define NVME_CQE_SCT_MEDIAERR (0x02 << 8)
#define NVME_CQE_SCT_VENDOR (0x07 << 8)
#define NVME_CQE_SCT_GENERIC (0x00 << 9)
#define NVME_CQE_SCT_COMMAND (0x01 << 9)
#define NVME_CQE_SCT_MEDIAERR (0x02 << 9)
#define NVME_CQE_SCT_VENDOR (0x07 << 9)
#define NVME_CQE_SC_MASK __BITS(1, 8)
#define NVME_CQE_SC(_f) ((_f) & NVME_CQE_SC_MASK)
/* generic command status codes */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nvmevar.h,v 1.24 2022/05/07 08:20:04 skrll Exp $ */
/* $NetBSD: nvmevar.h,v 1.25 2022/08/01 07:34:28 mlelstv Exp $ */
/* $OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
/*
@ -23,7 +23,6 @@
#include <sys/mutex.h>
#include <sys/pool.h>
#include <sys/queue.h>
#include <sys/buf.h>
struct nvme_dmamem {
bus_dmamap_t ndm_map;
@ -199,18 +198,29 @@ void nvme_softintr_msi(void *);
static __inline struct nvme_queue *
nvme_get_q(struct nvme_softc *sc, struct buf *bp, bool waitok)
{
struct cpu_info *ci = (bp && bp->b_ci) ? bp->b_ci : curcpu();
struct nvme_queue *q;
u_int cpunum;
/*
* Find a queue with available ccbs, preferring the originating CPU's queue.
*/
cpunum = cpu_index(curcpu());
for (u_int qoff = 0; qoff < sc->sc_nq; qoff++) {
struct nvme_queue *q = sc->sc_q[(cpu_index(ci) + qoff) % sc->sc_nq];
if (!SIMPLEQ_EMPTY(&q->q_ccb_list) || waitok)
return q;
/* try own queue */
q = sc->sc_q[cpunum % sc->sc_nq];
if (waitok)
return q;
/* if busy, search for an idle queue */
if (SIMPLEQ_EMPTY(&q->q_ccb_list)) {
for (u_int qoff = 1; qoff < sc->sc_nq; qoff++) {
struct nvme_queue *t;
t = sc->sc_q[(cpunum + qoff) % sc->sc_nq];
if (t->q_sq_tail == t->q_cq_head) {
q = t;
break;
}
}
}
return NULL;
return q;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl8169.c,v 1.172 2022/06/25 02:46:15 tsutsui Exp $ */
/* $NetBSD: rtl8169.c,v 1.173 2022/08/01 07:34:28 mlelstv Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.172 2022/06/25 02:46:15 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.173 2022/08/01 07:34:28 mlelstv Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@ -682,8 +682,8 @@ re_attach(struct rtk_softc *sc)
case RTK_HWREV_8168H:
case RTK_HWREV_8411B:
sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_NOJUMBO |
RTKQ_RXDV_GATED | RTKQ_TXRXEN_LATER;
RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
RTKQ_NOJUMBO | RTKQ_RXDV_GATED | RTKQ_TXRXEN_LATER;
break;
case RTK_HWREV_8100E:
case RTK_HWREV_8100E_SPIN2:

View File

@ -1,4 +1,4 @@
/* $NetBSD: tulip.c,v 1.205 2022/06/25 02:46:15 tsutsui Exp $ */
/* $NetBSD: tulip.c,v 1.206 2022/08/01 07:34:28 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.205 2022/06/25 02:46:15 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.206 2022/08/01 07:34:28 mlelstv Exp $");
#include <sys/param.h>
@ -4394,7 +4394,7 @@ tlp_21040_tmsw_init(struct tulip_softc *sc)
*/
/* XXX This should be auto-sense. */
ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_10_T);
ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_10_5);
tlp_print_media(sc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tulipreg.h,v 1.41 2021/08/19 20:43:58 andvar Exp $ */
/* $NetBSD: tulipreg.h,v 1.42 2022/08/01 07:34:28 mlelstv Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -938,19 +938,19 @@ struct tulip_desc {
/* SIA configuration for 10base-T (from the 21040 manual) */
#define SIACONN_21040_10BASET 0x0000ef01
#define SIACONN_21040_10BASET 0x00008f01
#define SIATXRX_21040_10BASET 0x0000ffff
#define SIAGEN_21040_10BASET 0x00000000
/* SIA configuration for 10base-T full-duplex (from the 21040 manual) */
#define SIACONN_21040_10BASET_FDX 0x0000ef01
#define SIACONN_21040_10BASET_FDX 0x00008f01
#define SIATXRX_21040_10BASET_FDX 0x0000fffd
#define SIAGEN_21040_10BASET_FDX 0x00000000
/* SIA configuration for 10base-5 (from the 21040 manual) */
#define SIACONN_21040_AUI 0x0000ef09
#define SIACONN_21040_AUI 0x00008f09
#define SIATXRX_21040_AUI 0x00000705
#define SIAGEN_21040_AUI 0x00000006