PERFORCE change 187714 for review
John Baldwin
jhb at FreeBSD.org
Tue Jan 11 22:17:49 UTC 2011
http://p4web.freebsd.org/@@187714?ac=10
Change 187714 by jhb at jhb_jhbbsd on 2011/01/11 22:17:04
IFC @187713
Affected files ...
.. //depot/projects/smpng/sys/arm/include/metadata.h#7 integrate
.. //depot/projects/smpng/sys/conf/files#269 integrate
.. //depot/projects/smpng/sys/dev/acpica/Osd/OsdInterrupt.c#19 integrate
.. //depot/projects/smpng/sys/dev/acpica/acpi.c#130 integrate
.. //depot/projects/smpng/sys/dev/usb/serial/uplcom.c#20 integrate
.. //depot/projects/smpng/sys/kern/kern_intr.c#107 integrate
.. //depot/projects/smpng/sys/kern/sched_ule.c#113 integrate
.. //depot/projects/smpng/sys/powerpc/powermac/fcu.c#2 integrate
.. //depot/projects/smpng/sys/sys/priority.h#6 integrate
Differences ...
==== //depot/projects/smpng/sys/arm/include/metadata.h#7 (text+ko) ====
@@ -23,12 +23,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/arm/include/metadata.h,v 1.7 2010/07/11 21:11:23 raj Exp $
+ * $FreeBSD: src/sys/arm/include/metadata.h,v 1.8 2011/01/11 22:07:39 marcel Exp $
*/
#ifndef _MACHINE_METADATA_H_
#define _MACHINE_METADATA_H_
-#define MODINFOMD_DTBP 0x1001
+#define MODINFOMD_BOOTINFO 0x1001
+#define MODINFOMD_DTBP 0x1002
#endif /* !_MACHINE_METADATA_H_ */
==== //depot/projects/smpng/sys/conf/files#269 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1552 2011/01/03 20:37:31 rmacklem Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1553 2011/01/11 21:46:29 thompsa Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -1812,6 +1812,20 @@
#
dev/usb/wlan/if_rum.c optional rum
dev/usb/wlan/if_run.c optional run
+runfw.c optional runfw \
+ compile-with "${AWK} -f $S/tools/fw_stub.awk runfw:runfw -mrunfw -c${.TARGET}" \
+ no-implicit-rule before-depend local \
+ clean "runfw.c"
+runfw.fwo optional runfw \
+ dependency "runfw" \
+ compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} runfw" \
+ no-implicit-rule \
+ clean "runfw.fwo"
+runfw optional runfw \
+ dependency "$S/contrib/dev/run/rt2870.fw.uu" \
+ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/run/rt2870.fw.uu" \
+ no-obj no-implicit-rule \
+ clean "runfw"
dev/usb/wlan/if_uath.c optional uath
dev/usb/wlan/if_upgt.c optional upgt
dev/usb/wlan/if_ural.c optional ural
==== //depot/projects/smpng/sys/dev/acpica/Osd/OsdInterrupt.c#19 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdInterrupt.c,v 1.26 2011/01/10 21:09:38 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdInterrupt.c,v 1.27 2011/01/11 19:20:01 jkim Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -91,6 +91,18 @@
return (FILTER_STRAY);
}
+static void
+acpi_intr_destroy(device_t dev, struct acpi_intr *ai)
+{
+
+ if (ai->ai_handle != NULL)
+ bus_teardown_intr(dev, ai->ai_irq, ai->ai_handle);
+ if (ai->ai_irq != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, ai->ai_rid, ai->ai_irq);
+ bus_delete_resource(dev, SYS_RES_IRQ, ai->ai_rid);
+ free(ai, M_ACPIINTR);
+}
+
ACPI_STATUS
AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
ACPI_OSD_HANDLER ServiceRoutine, void *Context)
@@ -123,6 +135,8 @@
ai->ai_number = InterruptNumber;
ai->ai_handler = ServiceRoutine;
ai->ai_context = Context;
+ SLIST_INSERT_HEAD(&acpi_intr_list, ai, ai_link);
+ mtx_unlock(&acpi_intr_lock);
/*
* If the MADT contained an interrupt override directive for the SCI,
@@ -151,19 +165,13 @@
device_printf(sc->acpi_dev, "could not set up interrupt\n");
goto error;
}
- SLIST_INSERT_HEAD(&acpi_intr_list, ai, ai_link);
- mtx_unlock(&acpi_intr_lock);
return_ACPI_STATUS (AE_OK);
error:
+ mtx_lock(&acpi_intr_lock);
+ SLIST_REMOVE(&acpi_intr_list, ai, acpi_intr, ai_link);
mtx_unlock(&acpi_intr_lock);
- if (ai->ai_handle != NULL)
- bus_teardown_intr(sc->acpi_dev, ai->ai_irq, ai->ai_handle);
- if (ai->ai_irq != NULL)
- bus_release_resource(sc->acpi_dev, SYS_RES_IRQ, ai->ai_rid,
- ai->ai_irq);
- bus_delete_resource(sc->acpi_dev, SYS_RES_IRQ, ai->ai_rid);
- free(ai, M_ACPIINTR);
+ acpi_intr_destroy(sc->acpi_dev, ai);
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
@@ -195,10 +203,7 @@
mtx_unlock(&acpi_intr_lock);
if (ai == NULL)
return_ACPI_STATUS (AE_NOT_EXIST);
- bus_teardown_intr(sc->acpi_dev, ai->ai_irq, ai->ai_handle);
- bus_release_resource(sc->acpi_dev, SYS_RES_IRQ, ai->ai_rid, ai->ai_irq);
- bus_delete_resource(sc->acpi_dev, SYS_RES_IRQ, ai->ai_rid);
- free(ai, M_ACPIINTR);
+ acpi_intr_destroy(sc->acpi_dev, ai);
return_ACPI_STATUS (AE_OK);
}
==== //depot/projects/smpng/sys/dev/acpica/acpi.c#130 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.297 2010/12/23 18:50:14 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.298 2011/01/11 19:26:39 jkim Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -3044,6 +3044,20 @@
/*
* ACPICA Event Handlers (FixedEvent, also called from button notify handler)
*/
+static void
+acpi_invoke_sleep_eventhandler(void *context)
+{
+
+ EVENTHANDLER_INVOKE(acpi_sleep_event, *(int *)context);
+}
+
+static void
+acpi_invoke_wake_eventhandler(void *context)
+{
+
+ EVENTHANDLER_INVOKE(acpi_wakeup_event, *(int *)context);
+}
+
UINT32
acpi_event_power_button_sleep(void *context)
{
@@ -3051,8 +3065,9 @@
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- EVENTHANDLER_INVOKE(acpi_sleep_event, sc->acpi_power_button_sx);
-
+ if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER,
+ acpi_invoke_sleep_eventhandler, &sc->acpi_power_button_sx)))
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
@@ -3063,8 +3078,9 @@
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- EVENTHANDLER_INVOKE(acpi_wakeup_event, sc->acpi_power_button_sx);
-
+ if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER,
+ acpi_invoke_wake_eventhandler, &sc->acpi_power_button_sx)))
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
@@ -3075,8 +3091,9 @@
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- EVENTHANDLER_INVOKE(acpi_sleep_event, sc->acpi_sleep_button_sx);
-
+ if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER,
+ acpi_invoke_sleep_eventhandler, &sc->acpi_sleep_button_sx)))
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
@@ -3087,8 +3104,9 @@
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- EVENTHANDLER_INVOKE(acpi_wakeup_event, sc->acpi_sleep_button_sx);
-
+ if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER,
+ acpi_invoke_wake_eventhandler, &sc->acpi_sleep_button_sx)))
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
==== //depot/projects/smpng/sys/dev/usb/serial/uplcom.c#20 (text+ko) ====
@@ -1,7 +1,7 @@
/* $NetBSD: uplcom.c,v 1.21 2001/11/13 06:24:56 lukem Exp $ */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/serial/uplcom.c,v 1.28 2011/01/11 13:59:06 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/serial/uplcom.c,v 1.29 2011/01/11 19:05:55 gavin Exp $");
/*-
* Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama at jp.FreeBSD.org>.
@@ -254,12 +254,12 @@
UPLCOM_DEV(ALCOR, AU9720), /* Alcor AU9720 USB 2.0-RS232 */
UPLCOM_DEV(ANCHOR, SERIAL), /* Anchor Serial adapter */
UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */
- UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */
+ UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 USB to Serial */
UPLCOM_DEV(COREGA, CGUSBRS232R), /* Corega CG-USBRS232R */
UPLCOM_DEV(EPSON, CRESSI_EDY), /* Cressi Edy diving computer */
UPLCOM_DEV(EPSON, N2ITION3), /* Zeagle N2iTion3 diving computer */
- UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT */
- UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT */
+ UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT Serial Adapter */
+ UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT Serial Adapter */
UPLCOM_DEV(HAL, IMR001), /* HAL Corporation Crossam2+USB */
UPLCOM_DEV(HP, LD220), /* HP LD220 POS Display */
UPLCOM_DEV(IODATA, USBRSAQ), /* I/O DATA USB-RSAQ */
@@ -285,17 +285,17 @@
UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */
UPLCOM_DEV(PROLIFIC, UIC_MSR206), /* UIC MSR206 Card Reader */
UPLCOM_DEV(PROLIFIC2, PL2303), /* Prolific adapter */
- UPLCOM_DEV(RADIOSHACK, USBCABLE),
+ UPLCOM_DEV(RADIOSHACK, USBCABLE), /* Radio Shack USB Adapter */
UPLCOM_DEV(RATOC, REXUSB60), /* RATOC REX-USB60 */
UPLCOM_DEV(SAGEM, USBSERIAL), /* Sagem USB-Serial Controller */
UPLCOM_DEV(SAMSUNG, I330), /* Samsung I330 phone cradle */
UPLCOM_DEV(SANWA, KB_USB2), /* Sanwa KB-USB2 Multimeter cable */
- UPLCOM_DEV(SIEMENS3, EF81), /* Seimens EF81 */
- UPLCOM_DEV(SIEMENS3, SX1), /* Seimens SX1 */
- UPLCOM_DEV(SIEMENS3, X65), /* Seimens X65 */
- UPLCOM_DEV(SIEMENS3, X75), /* Seimens X75 */
+ UPLCOM_DEV(SIEMENS3, EF81), /* Siemens EF81 */
+ UPLCOM_DEV(SIEMENS3, SX1), /* Siemens SX1 */
+ UPLCOM_DEV(SIEMENS3, X65), /* Siemens X65 */
+ UPLCOM_DEV(SIEMENS3, X75), /* Siemens X75 */
UPLCOM_DEV(SITECOM, SERIAL), /* Sitecom USB to Serial */
- UPLCOM_DEV(SMART, PL2303), /* SMART Technologies */
+ UPLCOM_DEV(SMART, PL2303), /* SMART Technologies USB to Serial */
UPLCOM_DEV(SONY, QN3), /* Sony QN3 phone cable */
UPLCOM_DEV(SONYERICSSON, DATAPILOT), /* Sony Ericsson Datapilot */
UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson DCU-10 Cable */
@@ -305,7 +305,7 @@
UPLCOM_DEV(SYNTECH, CPT8001C), /* Syntech CPT-8001C Barcode scanner */
UPLCOM_DEV(TDK, UHA6400), /* TDK USB-PHS Adapter UHA6400 */
UPLCOM_DEV(TDK, UPA9664), /* TDK USB-PHS Adapter UPA9664 */
- UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R */
+ UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R USB to Serial */
UPLCOM_DEV(YCCABLE, PL2303), /* YC Cable USB-Serial */
};
#undef UPLCOM_DEV
==== //depot/projects/smpng/sys/kern/kern_intr.c#107 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.177 2010/06/10 16:14:05 mav Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.178 2011/01/11 22:15:30 jhb Exp $");
#include "opt_ddb.h"
@@ -130,22 +130,18 @@
INTR_TYPE_CAM | INTR_TYPE_MISC | INTR_TYPE_CLK | INTR_TYPE_AV);
switch (flags) {
case INTR_TYPE_TTY:
- pri = PI_TTYLOW;
+ pri = PI_TTY;
break;
case INTR_TYPE_BIO:
- /*
- * XXX We need to refine this. BSD/OS distinguishes
- * between tape and disk priorities.
- */
pri = PI_DISK;
break;
case INTR_TYPE_NET:
pri = PI_NET;
break;
case INTR_TYPE_CAM:
- pri = PI_DISK; /* XXX or PI_CAM? */
+ pri = PI_DISK;
break;
- case INTR_TYPE_AV: /* Audio/video */
+ case INTR_TYPE_AV:
pri = PI_AV;
break;
case INTR_TYPE_CLK:
@@ -1082,7 +1078,7 @@
*eventp = ie;
}
error = intr_event_add_handler(ie, name, NULL, handler, arg,
- (pri * RQ_PPQ) + PI_SOFT, flags, cookiep);
+ PI_SWI(pri), flags, cookiep);
if (error)
return (error);
if (pri == SWI_CLOCK) {
@@ -1656,18 +1652,13 @@
case PI_AV:
db_printf("AV ");
break;
- case PI_TTYHIGH:
- case PI_TTYLOW:
+ case PI_TTY:
db_printf("TTY ");
break;
- case PI_TAPE:
- db_printf("TAPE");
- break;
case PI_NET:
db_printf("NET ");
break;
case PI_DISK:
- case PI_DISKLOW:
db_printf("DISK");
break;
case PI_DULL:
==== //depot/projects/smpng/sys/kern/sched_ule.c#113 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.287 2011/01/10 20:48:10 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.288 2011/01/11 22:13:19 jhb Exp $");
#include "opt_hwpmc_hooks.h"
#include "opt_kdtrace.h"
@@ -1388,7 +1388,7 @@
int score;
int pri;
- if (td->td_pri_class != PRI_TIMESHARE)
+ if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE)
return;
/*
* If the score is interactive we place the thread in the realtime
@@ -2124,7 +2124,7 @@
ts = td->td_sched;
if (td->td_pri_class & PRI_FIFO_BIT)
return;
- if (td->td_pri_class == PRI_TIMESHARE) {
+ if (PRI_BASE(td->td_pri_class) == PRI_TIMESHARE) {
/*
* We used a tick; charge it to the thread so
* that we can compute our interactivity.
==== //depot/projects/smpng/sys/powerpc/powermac/fcu.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/powermac/fcu.c,v 1.1 2010/10/15 20:08:16 andreast Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/powermac/fcu.c,v 1.2 2011/01/11 21:18:29 andreast Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -62,19 +62,20 @@
#define FCU_PWM_FAIL 0x2b
#define FCU_PWM_AVAILABLE 0x2c
#define FCU_PWM_ACTIVE 0x2d
-#define FCU_PWM_READ(x) 0x31 + (x) * 2
-#define FCU_PWM_SET(x) 0x30 + (x) * 2
+#define FCU_PWM_RPM(x) 0x31 + (x) * 2 /* Get RPM. */
+#define FCU_PWM_SGET(x) 0x30 + (x) * 2 /* Set or get PWM. */
struct fcu_fan {
int id;
- cell_t min_rpm;
- cell_t max_rpm;
+ cell_t min;
+ cell_t max;
char location[32];
enum {
FCU_FAN_RPM,
FCU_FAN_PWM
} type;
int setpoint;
+ int rpm;
};
struct fcu_softc {
@@ -85,6 +86,14 @@
int sc_nfans;
};
+/* We can read the PWM and the RPM from a PWM controlled fan.
+ * Offer both values via sysctl.
+ */
+enum {
+ FCU_PWM_SYSCTL_PWM = 1 << 8,
+ FCU_PWM_SYSCTL_RPM = 2 << 8
+};
+
static int fcu_rpm_shift;
/* Regular bus attachment functions */
@@ -96,6 +105,9 @@
static int fcu_fill_fan_prop(device_t dev);
static int fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm);
static int fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm);
+static int fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm);
+static int fcu_fan_get_pwm(device_t dev, struct fcu_fan *fan, int *pwm,
+ int *rpm);
static int fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS);
static void fcu_start(void *xdev);
static int fcu_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buf,
@@ -246,34 +258,21 @@
sc = device_get_softc(dev);
/* Clamp to allowed range */
- rpm = max(fan->min_rpm, rpm);
- rpm = min(fan->max_rpm, rpm);
+ rpm = max(fan->min, rpm);
+ rpm = min(fan->max, rpm);
if (fan->type == FCU_FAN_RPM) {
reg = FCU_RPM_SET(fan->id);
fan->setpoint = rpm;
- } else if (fan->type == FCU_FAN_PWM) {
- reg = FCU_PWM_SET(fan->id);
- if (rpm > 3500)
- rpm = 3500;
- if (rpm < 500)
- rpm = 500;
- fan->setpoint = rpm;
- /* PWM 30: 550 rpm, PWM 255: 3400 rpm. */
- rpm = (rpm * 255) / 3500;
} else {
device_printf(dev, "Unknown fan type: %d\n", fan->type);
return (EIO);
}
- if (fan->type == FCU_FAN_RPM) {
- buf[0] = rpm >> (8 - fcu_rpm_shift);
- buf[1] = rpm << fcu_rpm_shift;
- fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2);
- } else {
- buf[0] = rpm;
- fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1);
- }
+ buf[0] = rpm >> (8 - fcu_rpm_shift);
+ buf[1] = rpm << fcu_rpm_shift;
+
+ fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2);
return (0);
}
@@ -313,7 +312,63 @@
return (ENXIO);
}
reg = FCU_RPM_READ(fan->id);
- } else if (fan->type == FCU_FAN_PWM) {
+
+ } else {
+ device_printf(dev, "Unknown fan type: %d\n", fan->type);
+ return (EIO);
+ }
+
+ /* It seems that we can read the fans rpm. */
+ fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff);
+
+ *rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift;
+
+ return (0);
+}
+
+static int
+fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm)
+{
+ uint8_t reg;
+ struct fcu_softc *sc;
+ uint8_t buf[2];
+
+ sc = device_get_softc(dev);
+
+ /* Clamp to allowed range */
+ pwm = max(fan->min, pwm);
+ pwm = min(fan->max, pwm);
+
+ if (fan->type == FCU_FAN_PWM) {
+ reg = FCU_PWM_SGET(fan->id);
+ if (pwm > 100)
+ pwm = 100;
+ if (pwm < 30)
+ pwm = 30;
+ fan->setpoint = pwm;
+ } else {
+ device_printf(dev, "Unknown fan type: %d\n", fan->type);
+ return (EIO);
+ }
+
+ buf[0] = (pwm * 2550) / 1000;
+
+ fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1);
+
+ return (0);
+}
+
+static int
+fcu_fan_get_pwm(device_t dev, struct fcu_fan *fan, int *pwm, int *rpm)
+{
+ uint8_t reg;
+ struct fcu_softc *sc;
+ uint8_t buf[2];
+ uint8_t active = 0, avail = 0, fail = 0;
+
+ sc = device_get_softc(dev);
+
+ if (fan->type == FCU_FAN_PWM) {
/* Check if the fan is available. */
reg = FCU_PWM_AVAILABLE;
fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail);
@@ -337,16 +392,21 @@
fan->id);
return (ENXIO);
}
- reg = FCU_PWM_READ(fan->id);
+ reg = FCU_PWM_SGET(fan->id);
} else {
device_printf(dev, "Unknown fan type: %d\n", fan->type);
return (EIO);
}
- /* It seems that we can read the fans rpm. */
- fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff);
+ /* It seems that we can read the fans pwm. */
+ fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf);
+
+ *pwm = (buf[0] * 1000) / 2550;
- *rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift;
+ /* Now read the rpm. */
+ reg = FCU_PWM_RPM(fan->id);
+ fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf);
+ *rpm = (buf[0] << (8 - fcu_rpm_shift)) | buf[1] >> fcu_rpm_shift;
return (0);
}
@@ -412,18 +472,41 @@
device_t fcu;
struct fcu_softc *sc;
struct fcu_fan *fan;
- int rpm = 0, error;
+ int rpm = 0, pwm = 0, error;
fcu = arg1;
sc = device_get_softc(fcu);
- fan = &sc->sc_fans[arg2];
- fcu_fan_get_rpm(fcu, fan, &rpm);
- error = sysctl_handle_int(oidp, &rpm, 0, req);
+ fan = &sc->sc_fans[arg2 & 0x00ff];
+ if (fan->type == FCU_FAN_RPM) {
+ fcu_fan_get_rpm(fcu, fan, &rpm);
+ error = sysctl_handle_int(oidp, &rpm, 0, req);
+ } else {
+ fcu_fan_get_pwm(fcu, fan, &pwm, &rpm);
+
+ switch (arg2 & 0xff00) {
+ case FCU_PWM_SYSCTL_PWM:
+ error = sysctl_handle_int(oidp, &pwm, 0, req);
+ break;
+ case FCU_PWM_SYSCTL_RPM:
+ error = sysctl_handle_int(oidp, &rpm, 0, req);
+ break;
+ default:
+ /* This should never happen */
+ error = -1;
+ };
+ }
+
+ /* We can only read the RPM from a PWM controlled fan, so return. */
+ if ((arg2 & 0xff00) == FCU_PWM_SYSCTL_RPM)
+ return (0);
if (error || !req->newptr)
return (error);
- return (fcu_fan_set_rpm(fcu, fan, rpm));
+ if (fan->type == FCU_FAN_RPM)
+ return (fcu_fan_set_rpm(fcu, fan, rpm));
+ else
+ return (fcu_fan_set_pwm(fcu, fan, pwm));
}
static void
@@ -432,7 +515,6 @@
struct fcu_softc *sc;
struct sysctl_oid *oid, *fanroot_oid;
struct sysctl_ctx_list *ctx;
- phandle_t child;
char sysctl_name[32];
int i, j;
@@ -440,8 +522,6 @@
sc->sc_nfans = 0;
- child = ofw_bus_get_node(dev);
-
/* Count the actual number of fans. */
sc->sc_nfans = fcu_fill_fan_prop(dev);
@@ -472,35 +552,69 @@
}
sysctl_name[j] = 0;
- sc->sc_fans[i].min_rpm = 2400 >> fcu_rpm_shift;
- sc->sc_fans[i].max_rpm = 56000 >> fcu_rpm_shift;
- fcu_fan_get_rpm(dev, &sc->sc_fans[i], &sc->sc_fans[i].setpoint);
+ if (sc->sc_fans[i].type == FCU_FAN_RPM) {
+ sc->sc_fans[i].min = 2400 >> fcu_rpm_shift;
+ sc->sc_fans[i].max = 56000 >> fcu_rpm_shift;
+ fcu_fan_get_rpm(dev, &sc->sc_fans[i],
+ &sc->sc_fans[i].setpoint);
+
+ oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid),
+ OID_AUTO, sysctl_name,
+ CTLFLAG_RD, 0, "Fan Information");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "minrpm", CTLTYPE_INT | CTLFLAG_RD,
+ &(sc->sc_fans[i].min), sizeof(cell_t),
+ "Minimum allowed RPM");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "maxrpm", CTLTYPE_INT | CTLFLAG_RD,
+ &(sc->sc_fans[i].max), sizeof(cell_t),
+ "Maximum allowed RPM");
+ /* I use i to pass the fan id. */
+ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "rpm", CTLTYPE_INT | CTLFLAG_RW, dev, i,
+ fcu_fanrpm_sysctl, "I", "Fan RPM");
+ } else {
+ sc->sc_fans[i].min = 30;
+ sc->sc_fans[i].max = 100;
+ fcu_fan_get_pwm(dev, &sc->sc_fans[i],
+ &sc->sc_fans[i].setpoint,
+ &sc->sc_fans[i].rpm);
- oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid),
- OID_AUTO, sysctl_name, CTLFLAG_RD, 0,
- "Fan Information");
- SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minrpm",
- CTLTYPE_INT | CTLFLAG_RD,
- &(sc->sc_fans[i].min_rpm), sizeof(cell_t),
- "Minimum allowed RPM");
- SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxrpm",
- CTLTYPE_INT | CTLFLAG_RD,
- &(sc->sc_fans[i].max_rpm), sizeof(cell_t),
- "Maximum allowed RPM");
- /* I use i to pass the fan id. */
- SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm",
- CTLTYPE_INT | CTLFLAG_RW, dev, i,
- fcu_fanrpm_sysctl, "I", "Fan RPM");
+ oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid),
+ OID_AUTO, sysctl_name,
+ CTLFLAG_RD, 0, "Fan Information");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "minpwm", CTLTYPE_INT | CTLFLAG_RD,
+ &(sc->sc_fans[i].min), sizeof(cell_t),
+ "Minimum allowed PWM in %");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "maxpwm", CTLTYPE_INT | CTLFLAG_RD,
+ &(sc->sc_fans[i].max), sizeof(cell_t),
+ "Maximum allowed PWM in %");
+ /* I use i to pass the fan id or'ed with the type
+ * of info I want to display/modify.
+ */
+ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "pwm", CTLTYPE_INT | CTLFLAG_RW, dev,
+ FCU_PWM_SYSCTL_PWM | i,
+ fcu_fanrpm_sysctl, "I", "Fan PWM in %");
+ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+ "rpm", CTLTYPE_INT | CTLFLAG_RD, dev,
+ FCU_PWM_SYSCTL_RPM | i,
+ fcu_fanrpm_sysctl, "I", "Fan RPM");
+ }
}
/* Dump fan location, type & RPM. */
if (bootverbose) {
device_printf(dev, "Fans\n");
for (i = 0; i < sc->sc_nfans; i++) {
- device_printf(dev, "Location: %s type: %d ID: %d RPM: %d\n",
- sc->sc_fans[i].location,
+ device_printf(dev, "Location: %s type: %d ID: %d "
+ "RPM: %d\n", sc->sc_fans[i].location,
sc->sc_fans[i].type, sc->sc_fans[i].id,
- sc->sc_fans[i].setpoint);
+ (sc->sc_fans[i].type == FCU_FAN_RPM) ?
+ sc->sc_fans[i].setpoint :
+ sc->sc_fans[i].rpm );
}
}
}
==== //depot/projects/smpng/sys/sys/priority.h#6 (text+ko) ====
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/sys/priority.h,v 1.5 2011/01/06 22:09:37 jhb Exp $
+ * $FreeBSD: src/sys/sys/priority.h,v 1.6 2011/01/11 22:15:30 jhb Exp $
*/
#ifndef _SYS_PRIORITY_H_
@@ -85,14 +85,12 @@
#define PI_REALTIME (PRI_MIN_ITHD + 0)
#define PI_AV (PRI_MIN_ITHD + 4)
-#define PI_TTYHIGH (PRI_MIN_ITHD + 8)
-#define PI_TAPE (PRI_MIN_ITHD + 12)
-#define PI_NET (PRI_MIN_ITHD + 16)
-#define PI_DISK (PRI_MIN_ITHD + 20)
-#define PI_TTYLOW (PRI_MIN_ITHD + 24)
-#define PI_DISKLOW (PRI_MIN_ITHD + 28)
-#define PI_DULL (PRI_MIN_ITHD + 32)
-#define PI_SOFT (PRI_MIN_ITHD + 36)
+#define PI_NET (PRI_MIN_ITHD + 8)
+#define PI_DISK (PRI_MIN_ITHD + 12)
+#define PI_TTY (PRI_MIN_ITHD + 16)
+#define PI_DULL (PRI_MIN_ITHD + 20)
+#define PI_SOFT (PRI_MIN_ITHD + 24)
+#define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ)
#define PRI_MIN_KERN (64)
#define PRI_MAX_KERN (PRI_MIN_REALTIME - 1)
More information about the p4-projects
mailing list