summaryrefslogtreecommitdiff
path: root/usr/src/uts
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-09-18 11:51:27 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-09-18 11:51:27 +0000
commit5ae8f87cd03318a02cdd5d0ab2e51e015122e299 (patch)
treea8bf0e68e84b8eff6f7e30853f18f460075a2121 /usr/src/uts
parenta2435eea0fd4937d2779dd36ee4c494704d07472 (diff)
parent24571f7b017865fbad5f588fb0694b558c94e14d (diff)
downloadillumos-joyent-5ae8f87cd03318a02cdd5d0ab2e51e015122e299.tar.gz
[illumos-gate merge]
commit 24571f7b017865fbad5f588fb0694b558c94e14d 13075 No console messages after early boot on non-VGA graphics commit 3d21c6bf2078598ab053d382b8a9af3b70b8e995 11064 md_clear is misspelt commit 73439c833efecf3010718112f4fce6bb183a6803 13080 Add support for cxgbe temp/volt sensor commit b7a7784945b3504d0b69ea02a08e1cddb5578907 13111 Want futimes(), lutimes() and timespec/timeval conversion macros
Diffstat (limited to 'usr/src/uts')
-rw-r--r--usr/src/uts/common/io/cxgbe/t4nex/adapter.h4
-rw-r--r--usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c105
-rw-r--r--usr/src/uts/common/sys/time.h27
-rw-r--r--usr/src/uts/i86pc/io/gfx_private/gfxp_fb.c12
-rw-r--r--usr/src/uts/i86pc/os/cpuid.c2
5 files changed, 144 insertions, 6 deletions
diff --git a/usr/src/uts/common/io/cxgbe/t4nex/adapter.h b/usr/src/uts/common/io/cxgbe/t4nex/adapter.h
index 48edc44341..1192eeb43e 100644
--- a/usr/src/uts/common/io/cxgbe/t4nex/adapter.h
+++ b/usr/src/uts/common/io/cxgbe/t4nex/adapter.h
@@ -559,6 +559,10 @@ struct adapter {
kmutex_t sfl_lock; /* same cache-line as sc_lock? but that's ok */
TAILQ_HEAD(, sge_fl) sfl;
timeout_id_t sfl_timer;
+
+ /* Sensors */
+ id_t temp_sensor;
+ id_t volt_sensor;
};
enum {
diff --git a/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c b/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c
index ec590228b6..05732e47a1 100644
--- a/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c
+++ b/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c
@@ -37,6 +37,7 @@
#include <sys/mkdev.h>
#include <sys/queue.h>
#include <sys/containerof.h>
+#include <sys/sensors.h>
#include "version.h"
#include "common/common.h"
@@ -180,6 +181,18 @@ static kmutex_t t4_uld_list_lock;
static SLIST_HEAD(, uld_info) t4_uld_list;
#endif
+static int t4_temperature_read(void *, sensor_ioctl_scalar_t *);
+static int t4_voltage_read(void *, sensor_ioctl_scalar_t *);
+static const ksensor_ops_t t4_temp_ops = {
+ .kso_kind = ksensor_kind_temperature,
+ .kso_scalar = t4_temperature_read
+};
+
+static const ksensor_ops_t t4_volt_ops = {
+ .kso_kind = ksensor_kind_voltage,
+ .kso_scalar = t4_voltage_read
+};
+
int
_init(void)
{
@@ -758,7 +771,23 @@ ofld_queues:
}
sc->flags |= INTR_ALLOCATED;
- ASSERT(rc == DDI_SUCCESS);
+ if ((rc = ksensor_create_scalar_pcidev(dip, SENSOR_KIND_TEMPERATURE,
+ &t4_temp_ops, sc, "temp", &sc->temp_sensor)) != 0) {
+ cxgb_printf(dip, CE_WARN, "failed to create temperature "
+ "sensor: %d", rc);
+ rc = DDI_FAILURE;
+ goto done;
+ }
+
+ if ((rc = ksensor_create_scalar_pcidev(dip, SENSOR_KIND_VOLTAGE,
+ &t4_volt_ops, sc, "vdd", &sc->volt_sensor)) != 0) {
+ cxgb_printf(dip, CE_WARN, "failed to create voltage "
+ "sensor: %d", rc);
+ rc = DDI_FAILURE;
+ goto done;
+ }
+
+
ddi_report_dev(dip);
/*
@@ -849,6 +878,7 @@ t4_devo_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
}
/* Safe to call no matter what */
+ (void) ksensor_remove(dip, KSENSOR_ALL_IDS);
ddi_prop_remove_all(dip);
ddi_remove_minor_node(dip, NULL);
@@ -2919,3 +2949,76 @@ t4_iterate(void (*func)(int, void *), void *arg)
}
#endif
+
+static int
+t4_sensor_read(struct adapter *sc, uint32_t diag, uint32_t *valp)
+{
+ int rc;
+ struct port_info *pi = sc->port[0];
+ uint32_t param, val;
+
+ rc = begin_synchronized_op(pi, 1, 1);
+ if (rc != 0) {
+ return (rc);
+ }
+ param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
+ V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) |
+ V_FW_PARAMS_PARAM_Y(diag);
+ rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, &param, &val);
+ end_synchronized_op(pi, 1);
+
+ if (rc != 0) {
+ return (rc);
+ }
+
+ if (val == 0) {
+ return (EIO);
+ }
+
+ *valp = val;
+ return (0);
+}
+
+static int
+t4_temperature_read(void *arg, sensor_ioctl_scalar_t *scalar)
+{
+ int ret;
+ struct adapter *sc = arg;
+ uint32_t val;
+
+ ret = t4_sensor_read(sc, FW_PARAM_DEV_DIAG_TMP, &val);
+ if (ret != 0) {
+ return (ret);
+ }
+
+ /*
+ * The device measures temperature in units of 1 degree Celsius. We
+ * don't know its precision.
+ */
+ scalar->sis_unit = SENSOR_UNIT_CELSIUS;
+ scalar->sis_gran = 1;
+ scalar->sis_prec = 0;
+ scalar->sis_value = val;
+
+ return (0);
+}
+
+static int
+t4_voltage_read(void *arg, sensor_ioctl_scalar_t *scalar)
+{
+ int ret;
+ struct adapter *sc = arg;
+ uint32_t val;
+
+ ret = t4_sensor_read(sc, FW_PARAM_DEV_DIAG_VDD, &val);
+ if (ret != 0) {
+ return (ret);
+ }
+
+ scalar->sis_unit = SENSOR_UNIT_VOLTS;
+ scalar->sis_gran = 1000;
+ scalar->sis_prec = 0;
+ scalar->sis_value = val;
+
+ return (0);
+}
diff --git a/usr/src/uts/common/sys/time.h b/usr/src/uts/common/sys/time.h
index a69bf4dd63..f6cfa1a7e5 100644
--- a/usr/src/uts/common/sys/time.h
+++ b/usr/src/uts/common/sys/time.h
@@ -16,6 +16,8 @@
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Joyent, Inc.
+ *
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
*/
/*
@@ -365,14 +367,14 @@ extern todinfo_t utc_to_tod(time_t);
extern time_t tod_to_utc(todinfo_t);
extern int hr_clock_lock(void);
extern void hr_clock_unlock(int);
-extern hrtime_t gethrtime(void);
-extern hrtime_t gethrtime_unscaled(void);
+extern hrtime_t gethrtime(void);
+extern hrtime_t gethrtime_unscaled(void);
extern hrtime_t gethrtime_max(void);
extern hrtime_t gethrtime_waitfree(void);
extern void scalehrtime(hrtime_t *);
extern uint64_t unscalehrtime(hrtime_t);
-extern void gethrestime(timespec_t *);
-extern time_t gethrestime_sec(void);
+extern void gethrestime(timespec_t *);
+extern time_t gethrestime_sec(void);
extern void gethrestime_lasttick(timespec_t *);
extern void hrt2ts(hrtime_t, timestruc_t *);
extern hrtime_t ts2hrt(const timestruc_t *);
@@ -408,6 +410,7 @@ int futimesat(int, const char *, const struct timeval *);
int getitimer(int, struct itimerval *);
int utimes(const char *, const struct timeval *);
+
#if defined(_XPG4_2)
int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
struct itimerval *_RESTRICT_KYWD);
@@ -418,6 +421,22 @@ int setitimer(int, struct itimerval *_RESTRICT_KYWD,
#endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
+#if !defined(_KERNEL) && !defined(_STRICT_SYMBOLS)
+int futimes(int, const struct timeval *);
+int lutimes(const char *, const struct timeval *);
+
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+ (tv)->tv_sec = (ts)->tv_sec; \
+ (tv)->tv_usec = (ts)->tv_nsec / 1000; \
+}
+
+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
+ (ts)->tv_sec = (tv)->tv_sec; \
+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \
+}
+
+#endif /* !defined(_KERNEL) && !defined(_STRICT_SYMBOLS) */
+
/*
* gettimeofday() and settimeofday() were included in SVr4 due to their
* common use in BSD based applications. They were to be included exactly
diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_fb.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_fb.c
index 6d1a99ea05..0d2d1fe1de 100644
--- a/usr/src/uts/i86pc/io/gfx_private/gfxp_fb.c
+++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_fb.c
@@ -11,6 +11,7 @@
/*
* Copyright 2016 Toomas Soome <tsoome@me.com>
+ * Copyright 2020 RackTop Systems, Inc.
*/
/*
@@ -81,6 +82,17 @@ gfxp_check_for_console(dev_info_t *devi, struct gfxp_fb_softc *softc,
uint16_t data16;
/*
+ * fb_info is filled in by data gathered by the bootloader.
+ * In particular we are interested in "paddr" which is the physical
+ * address of the framebuffer. If that is not zero, then we have
+ * a valid framebuffer and we can use this device as a console.
+ */
+ if (fb_info.paddr != 0) {
+ softc->flags |= GFXP_FLAG_CONSOLE;
+ return;
+ }
+
+ /*
* Based on Section 11.3, "PCI Display Subsystem Initialization",
* of the 1.1 PCI-to-PCI Bridge Architecture Specification
* determine if this is the boot console device. First, see
diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c
index fc0cf6622f..ae450f1d9b 100644
--- a/usr/src/uts/i86pc/os/cpuid.c
+++ b/usr/src/uts/i86pc/os/cpuid.c
@@ -1431,7 +1431,7 @@ static char *x86_feature_names[NUM_X86_FEATURES] = {
"tbm",
"avx512_vnni",
"amd_pcec",
- "mb_clear",
+ "md_clear",
"mds_no",
"core_thermal",
"pkg_thermal",