smu.c (208841) | smu.c (212054) |
---|---|
1/*- 2 * Copyright (c) 2009 Nathan Whitehorn 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009 Nathan Whitehorn 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/smu.c 208841 2010-06-05 17:50:20Z nwhitehorn $"); | 29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/smu.c 212054 2010-08-31 15:27:46Z nwhitehorn $"); |
30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/systm.h> 34#include <sys/module.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/clock.h> --- 122 unchanged lines hidden (view full) --- 160static void smu_attach_i2c(device_t dev, phandle_t i2croot); 161static void smu_attach_fans(device_t dev, phandle_t fanroot); 162static void smu_attach_sensors(device_t dev, phandle_t sensroot); 163static void smu_fan_management_proc(void *xdev); 164static void smu_manage_fans(device_t smu); 165static void smu_set_sleepled(void *xdev, int onoff); 166static int smu_server_mode(SYSCTL_HANDLER_ARGS); 167static void smu_doorbell_intr(void *xdev); | 30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/systm.h> 34#include <sys/module.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/clock.h> --- 122 unchanged lines hidden (view full) --- 160static void smu_attach_i2c(device_t dev, phandle_t i2croot); 161static void smu_attach_fans(device_t dev, phandle_t fanroot); 162static void smu_attach_sensors(device_t dev, phandle_t sensroot); 163static void smu_fan_management_proc(void *xdev); 164static void smu_manage_fans(device_t smu); 165static void smu_set_sleepled(void *xdev, int onoff); 166static int smu_server_mode(SYSCTL_HANDLER_ARGS); 167static void smu_doorbell_intr(void *xdev); |
168static void smu_shutdown(void *xdev, int howto); |
|
168 169/* where to find the doorbell GPIO */ 170 171static device_t smu_doorbell = NULL; 172 173static device_method_t smu_methods[] = { 174 /* Device interface */ 175 DEVMETHOD(device_probe, smu_probe), --- 210 unchanged lines hidden (view full) --- 386 powerpc_config_intr(rman_get_start(sc->sc_doorbellirq), 387 INTR_TRIGGER_EDGE, INTR_POLARITY_LOW); 388 389 /* 390 * Connect RTC interface. 391 */ 392 clock_register(dev, 1000); 393 | 169 170/* where to find the doorbell GPIO */ 171 172static device_t smu_doorbell = NULL; 173 174static device_method_t smu_methods[] = { 175 /* Device interface */ 176 DEVMETHOD(device_probe, smu_probe), --- 210 unchanged lines hidden (view full) --- 387 powerpc_config_intr(rman_get_start(sc->sc_doorbellirq), 388 INTR_TRIGGER_EDGE, INTR_POLARITY_LOW); 389 390 /* 391 * Connect RTC interface. 392 */ 393 clock_register(dev, 1000); 394 |
395 /* 396 * Learn about shutdown events 397 */ 398 EVENTHANDLER_REGISTER(shutdown_final, smu_shutdown, dev, 399 SHUTDOWN_PRI_LAST); 400 |
|
394 return (bus_generic_attach(dev)); 395} 396 397static const struct ofw_bus_devinfo * 398smu_get_devinfo(device_t bus, device_t dev) 399{ 400 401 return (device_get_ivars(dev)); --- 708 unchanged lines hidden (view full) --- 1110 1111 cmd.len = 3; 1112 cmd.data[1] = 0; 1113 cmd.data[2] = SMU_WAKEUP_AC_INSERT; 1114 1115 return (smu_run_cmd(smu, &cmd, 1)); 1116} 1117 | 401 return (bus_generic_attach(dev)); 402} 403 404static const struct ofw_bus_devinfo * 405smu_get_devinfo(device_t bus, device_t dev) 406{ 407 408 return (device_get_ivars(dev)); --- 708 unchanged lines hidden (view full) --- 1117 1118 cmd.len = 3; 1119 cmd.data[1] = 0; 1120 cmd.data[2] = SMU_WAKEUP_AC_INSERT; 1121 1122 return (smu_run_cmd(smu, &cmd, 1)); 1123} 1124 |
1125static void 1126smu_shutdown(void *xdev, int howto) 1127{ 1128 device_t smu = xdev; 1129 struct smu_cmd cmd; 1130 1131 cmd.cmd = SMU_POWER; 1132 if (howto & RB_HALT) 1133 strcpy(cmd.data, "SHUTDOWN"); 1134 else 1135 strcpy(cmd.data, "RESTART"); 1136 1137 cmd.len = strlen(cmd.data); 1138 1139 smu_run_cmd(smu, &cmd, 1); 1140 1141 for (;;); 1142} 1143 |
|
1118static int 1119smu_gettime(device_t dev, struct timespec *ts) 1120{ 1121 struct smu_cmd cmd; 1122 struct clocktime ct; 1123 1124 cmd.cmd = SMU_RTC; 1125 cmd.len = 1; --- 239 unchanged lines hidden --- | 1144static int 1145smu_gettime(device_t dev, struct timespec *ts) 1146{ 1147 struct smu_cmd cmd; 1148 struct clocktime ct; 1149 1150 cmd.cmd = SMU_RTC; 1151 cmd.len = 1; --- 239 unchanged lines hidden --- |