Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by msait...
details: https://anonhg.NetBSD.org/src/rev/b9a1852a7ec7
branches: netbsd-8
changeset: 452614:b9a1852a7ec7
user: martin <martin%NetBSD.org@localhost>
date: Wed Jul 17 15:43:18 2019 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #1294):
sys/dev/isa/wbsio.c: revision 1.25
sys/dev/ic/nslm7x.c: revision 1.72
sys/dev/ic/nslm7x.c: revision 1.73
sys/dev/isa/wbsioreg.h: revision 1.9
Use pmf_device_{register,deregister}().
-
Identify Nuvoton NCT6798D correctly. It seems that the bit width of NCT6796D
and newer devices' device ID is 13bit. The previous series was 12bits.
diffstat:
sys/dev/ic/nslm7x.c | 9 ++++-
sys/dev/isa/wbsio.c | 76 +++++++++++++++++++++++++------------------------
sys/dev/isa/wbsioreg.h | 18 +++++++++--
3 files changed, 60 insertions(+), 43 deletions(-)
diffs (210 lines):
diff -r d48669eba583 -r b9a1852a7ec7 sys/dev/ic/nslm7x.c
--- a/sys/dev/ic/nslm7x.c Wed Jul 17 15:37:33 2019 +0000
+++ b/sys/dev/ic/nslm7x.c Wed Jul 17 15:43:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nslm7x.c,v 1.64.10.2 2018/07/26 20:37:42 snj Exp $ */
+/* $NetBSD: nslm7x.c,v 1.64.10.3 2019/07/17 15:43:18 martin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.64.10.2 2018/07/26 20:37:42 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.64.10.3 2019/07/17 15:43:18 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2156,6 +2156,7 @@
{ WBSIO_ID_NCT6793D, "NCT6793D", nct6779d_sensors, NULL },
{ WBSIO_ID_NCT6795D, "NCT6795D", nct6779d_sensors, NULL },
{ WBSIO_ID_NCT6796D, "NCT6796D", nct6779d_sensors, NULL },
+ { WBSIO_ID_NCT6798D, "NCT6798D", nct6779d_sensors, NULL },
{ 0, NULL, NULL, NULL }
};
@@ -2270,6 +2271,9 @@
"unable to register with sysmon\n");
sysmon_envsys_destroy(lmsc->sc_sme);
}
+ if (!pmf_device_register(lmsc->sc_dev, NULL, NULL))
+ aprint_error_dev(lmsc->sc_dev,
+ "couldn't establish power handler\n");
}
/*
@@ -2282,6 +2286,7 @@
callout_halt(&lmsc->sc_callout, NULL);
callout_destroy(&lmsc->sc_callout);
sysmon_envsys_unregister(lmsc->sc_sme);
+ pmf_device_deregister(lmsc->sc_dev);
}
static void
diff -r d48669eba583 -r b9a1852a7ec7 sys/dev/isa/wbsio.c
--- a/sys/dev/isa/wbsio.c Wed Jul 17 15:37:33 2019 +0000
+++ b/sys/dev/isa/wbsio.c Wed Jul 17 15:43:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wbsio.c,v 1.10.10.5 2018/07/26 20:37:42 snj Exp $ */
+/* $NetBSD: wbsio.c,v 1.10.10.6 2019/07/17 15:43:18 martin Exp $ */
/* $OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis%openbsd.org@localhost>
@@ -73,31 +73,32 @@
static const struct wbsio_product {
uint16_t id;
- bool idis12bits;
+ int idbits;
const char *str;
} wbsio_products[] = {
- { WBSIO_ID_W83627HF, false, "W83627HF" },
- { WBSIO_ID_W83697HF, false, "W83697HF" },
- { WBSIO_ID_W83637HF, false, "W83637HF" },
- { WBSIO_ID_W83627THF, false, "W83627THF" },
- { WBSIO_ID_W83687THF, false, "W83687THF" },
- { WBSIO_ID_W83627DHG, true, "W83627DHG" },
- { WBSIO_ID_W83627DHGP, true, "W83627DHG-P" },
- { WBSIO_ID_W83627EHF, true, "W83627EHF" },
- { WBSIO_ID_W83627SF, true, "W83627SF" },
- { WBSIO_ID_W83627UHG, true, "W83627UHG" },
- { WBSIO_ID_W83667HG, true, "W83667HG" },
- { WBSIO_ID_W83667HGB, true, "W83667HGB" },
- { WBSIO_ID_W83697UG, true, "W83697UG" },
- { WBSIO_ID_NCT6775F, true, "NCT6775F" },
- { WBSIO_ID_NCT6776F, true, "NCT6776F" },
- { WBSIO_ID_NCT5104D, true, "NCT5104D or 610[246]D" },
- { WBSIO_ID_NCT6779D, true, "NCT6779D" },
- { WBSIO_ID_NCT6791D, true, "NCT6791D" },
- { WBSIO_ID_NCT6792D, true, "NCT6792D" },
- { WBSIO_ID_NCT6793D, true, "NCT6793D" },
- { WBSIO_ID_NCT6795D, true, "NCT6795D" },
- { WBSIO_ID_NCT6796D, true, "NCT6796D" },
+ { WBSIO_ID_W83627HF, 8, "W83627HF" },
+ { WBSIO_ID_W83697HF, 8, "W83697HF" },
+ { WBSIO_ID_W83637HF, 8, "W83637HF" },
+ { WBSIO_ID_W83627THF, 8, "W83627THF" },
+ { WBSIO_ID_W83687THF, 8, "W83687THF" },
+ { WBSIO_ID_W83627DHG, 12, "W83627DHG" },
+ { WBSIO_ID_W83627DHGP, 12, "W83627DHG-P" },
+ { WBSIO_ID_W83627EHF, 12, "W83627EHF" },
+ { WBSIO_ID_W83627SF, 12, "W83627SF" },
+ { WBSIO_ID_W83627UHG, 12, "W83627UHG" },
+ { WBSIO_ID_W83667HG, 12, "W83667HG" },
+ { WBSIO_ID_W83667HGB, 12, "W83667HGB" },
+ { WBSIO_ID_W83697UG, 12, "W83697UG" },
+ { WBSIO_ID_NCT6775F, 12, "NCT6775F" },
+ { WBSIO_ID_NCT6776F, 12, "NCT6776F" },
+ { WBSIO_ID_NCT5104D, 12, "NCT5104D or 610[246]D" },
+ { WBSIO_ID_NCT6779D, 12, "NCT6779D" },
+ { WBSIO_ID_NCT6791D, 12, "NCT6791D" },
+ { WBSIO_ID_NCT6792D, 12, "NCT6792D" },
+ { WBSIO_ID_NCT6793D, 12, "NCT6793D" },
+ { WBSIO_ID_NCT6795D, 12, "NCT6795D" },
+ { WBSIO_ID_NCT6796D, 13, "NCT6796D" },
+ { WBSIO_ID_NCT6798D, 13, "NCT6798D" },
};
static const struct wbsio_product *wbsio_lookup(uint8_t id, uint8_t rev);
@@ -169,16 +170,19 @@
static const struct wbsio_product *
wbsio_lookup(uint8_t id, uint8_t rev)
{
- uint16_t wid = ((uint16_t)id << 4) | (rev >> 4);
int i;
for (i = 0; i < __arraycount(wbsio_products); i++) {
- if (wbsio_products[i].idis12bits) {
- if (wbsio_products[i].id == wid)
- return &wbsio_products[i];
- } else {
- if (wbsio_products[i].id == id)
- return &wbsio_products[i];
+ const struct wbsio_product *ent = &wbsio_products[i];
+ switch (ent->idbits) {
+ case 13:
+ case 12:
+ case 8:
+ if (ent->id == WBSIO_MAKEID(id, rev, ent->idbits))
+ return ent;
+ break;
+ default:
+ break;
}
}
@@ -266,8 +270,7 @@
aprint_error_dev(self, "Unknown device. Failed to attach\n");
return;
}
- if (product->idis12bits)
- rev &= 0x0f; /* Revision is low 4bits */
+ rev = WBSIO_MAKEREV(rev, product->idbits);
desc = product->str;
if (desc[0] == 'W')
@@ -276,8 +279,8 @@
vendor = "Nuvoton";
aprint_naive("\n");
aprint_normal(": %s LPC Super I/O %s rev ", vendor, desc);
- if (product->idis12bits) {
- /* Revision filed is 4bit only */
+ if (product->idbits >= 12) {
+ /* Revision filed is 4 or 3bits */
aprint_normal("%c\n", 'A' + rev);
} else
aprint_normal("0x%02x\n", rev);
@@ -394,8 +397,7 @@
aprint_error_dev(parent, "%s: Unknown device.\n", __func__);
return -1;
}
- if (product->idis12bits)
- devid = (devid << 4) | (rev >> 4);
+ devid = WBSIO_MAKEID(devid, rev, product->idbits);
sc->sc_ia.ia_nio = 1;
sc->sc_ia.ia_io = &sc->sc_io;
diff -r d48669eba583 -r b9a1852a7ec7 sys/dev/isa/wbsioreg.h
--- a/sys/dev/isa/wbsioreg.h Wed Jul 17 15:37:33 2019 +0000
+++ b/sys/dev/isa/wbsioreg.h Wed Jul 17 15:43:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wbsioreg.h,v 1.5.2.4 2018/07/26 20:37:42 snj Exp $ */
+/* $NetBSD: wbsioreg.h,v 1.5.2.5 2019/07/17 15:43:18 martin Exp $ */
/* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
/*
@@ -48,12 +48,12 @@
#define WBSIO_SFR 0x2F /* Strapping Function Result */
-#define WBSIO_ID_W83627HF 0x52
+#define WBSIO_ID_W83627HF 0x52 /* 8bits */
#define WBSIO_ID_W83697HF 0x60
#define WBSIO_ID_W83637HF 0x70
#define WBSIO_ID_W83627THF 0x82
#define WBSIO_ID_W83687THF 0x85
-#define WBSIO_ID_W83627SF 0x595
+#define WBSIO_ID_W83627SF 0x595 /* 12bits */
#define WBSIO_ID_W83697UG 0x681
#define WBSIO_ID_W83627EHF_A 0x885
#define WBSIO_ID_W83627EHF 0x886
@@ -70,7 +70,17 @@
#define WBSIO_ID_NCT6792D 0xc91
#define WBSIO_ID_NCT6793D 0xd12
#define WBSIO_ID_NCT6795D 0xd35
-#define WBSIO_ID_NCT6796D 0xd42
+#define WBSIO_ID_NCT6796D 0xd420 /* 13bits */
+#define WBSIO_ID_NCT6798D 0xd428
+
+/* Make the above WBSIO_ID_* vaue from WBSIO_ID, WBSIO_REV and IDbits */
+#define WBSIO_MAKEID(id, rev, bits) \
+ (((bits) == 13) ? (((uint16_t)(id) << 8) | ((rev) & 0xf8)) : \
+ ((bits) == 12) ? (((uint16_t)(id) << 4) | ((rev) >> 4)) : (id))
+
+#define WBSIO_MAKEREV(rev, bits) \
+ (((bits) == 13) ? ((rev) & 0x07) : ((bits) == 12) ? ((rev) & 0x0f) : \
+ (rev))
/* Strapping Function Result */
#define WBSIO_SFR_24M48M 0x01
Home |
Main Index |
Thread Index |
Old Index