OsdSchedule.c (88900) | OsdSchedule.c (91128) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/acpica/Osd/OsdSchedule.c 88900 2002-01-05 08:47:13Z jhb $ | 27 * $FreeBSD: head/sys/dev/acpica/Osd/OsdSchedule.c 91128 2002-02-23 05:31:38Z msmith $ |
28 */ 29 30/* 31 * 6.3 : Scheduling services 32 */ 33 34#include "acpi.h" 35 --- 11 unchanged lines hidden (view full) --- 47#include <sys/taskqueue.h> 48#include <machine/clock.h> 49 50#include <sys/bus.h> 51 52#include <dev/acpica/acpivar.h> 53 54#define _COMPONENT ACPI_OS_SERVICES | 28 */ 29 30/* 31 * 6.3 : Scheduling services 32 */ 33 34#include "acpi.h" 35 --- 11 unchanged lines hidden (view full) --- 47#include <sys/taskqueue.h> 48#include <machine/clock.h> 49 50#include <sys/bus.h> 51 52#include <dev/acpica/acpivar.h> 53 54#define _COMPONENT ACPI_OS_SERVICES |
55MODULE_NAME("SCHEDULE") | 55ACPI_MODULE_NAME("SCHEDULE") |
56 57/* 58 * This is a little complicated due to the fact that we need to build and then 59 * free a 'struct task' for each task we enqueue. 60 */ 61 62MALLOC_DEFINE(M_ACPITASK, "acpitask", "ACPI deferred task"); 63 --- 95 unchanged lines hidden (view full) --- 159#endif 160 161ACPI_STATUS 162AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *Context) 163{ 164 struct acpi_task *at; 165 int pri; 166 | 56 57/* 58 * This is a little complicated due to the fact that we need to build and then 59 * free a 'struct task' for each task we enqueue. 60 */ 61 62MALLOC_DEFINE(M_ACPITASK, "acpitask", "ACPI deferred task"); 63 --- 95 unchanged lines hidden (view full) --- 159#endif 160 161ACPI_STATUS 162AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *Context) 163{ 164 struct acpi_task *at; 165 int pri; 166 |
167 FUNCTION_TRACE(__func__); | 167 ACPI_FUNCTION_TRACE(__func__); |
168 169 if (Function == NULL) 170 return_ACPI_STATUS(AE_BAD_PARAMETER); 171 172 at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT); /* Interrupt Context */ 173 if (at == NULL) 174 return_ACPI_STATUS(AE_NO_MEMORY); 175 bzero(at, sizeof(*at)); --- 26 unchanged lines hidden (view full) --- 202static void 203AcpiOsExecuteQueue(void *arg, int pending) 204{ 205 struct acpi_task *at; 206 struct acpi_task_queue *atq; 207 OSD_EXECUTION_CALLBACK Function; 208 void *Context; 209 | 168 169 if (Function == NULL) 170 return_ACPI_STATUS(AE_BAD_PARAMETER); 171 172 at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT); /* Interrupt Context */ 173 if (at == NULL) 174 return_ACPI_STATUS(AE_NO_MEMORY); 175 bzero(at, sizeof(*at)); --- 26 unchanged lines hidden (view full) --- 202static void 203AcpiOsExecuteQueue(void *arg, int pending) 204{ 205 struct acpi_task *at; 206 struct acpi_task_queue *atq; 207 OSD_EXECUTION_CALLBACK Function; 208 void *Context; 209 |
210 FUNCTION_TRACE(__func__); | 210 ACPI_FUNCTION_TRACE(__func__); |
211 212 at = (struct acpi_task *)arg; 213 atq = NULL; 214 Function = NULL; 215 Context = NULL; 216 217#ifdef ACPI_USE_THREADS 218 atq = malloc(sizeof(*atq), M_ACPITASK, M_NOWAIT); --- 24 unchanged lines hidden (view full) --- 243 * make do with that. 244 */ 245void 246AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds) 247{ 248 int timo; 249 static int dummy; 250 | 211 212 at = (struct acpi_task *)arg; 213 atq = NULL; 214 Function = NULL; 215 Context = NULL; 216 217#ifdef ACPI_USE_THREADS 218 atq = malloc(sizeof(*atq), M_ACPITASK, M_NOWAIT); --- 24 unchanged lines hidden (view full) --- 243 * make do with that. 244 */ 245void 246AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds) 247{ 248 int timo; 249 static int dummy; 250 |
251 FUNCTION_TRACE(__func__); | 251 ACPI_FUNCTION_TRACE(__func__); |
252 253 timo = (Seconds * hz) + Milliseconds * hz / 1000; 254 if (timo == 0) 255 timo = 1; 256 tsleep(&dummy, 0, "acpislp", timo); 257 return_VOID; 258} 259 260void 261AcpiOsStall (UINT32 Microseconds) 262{ | 252 253 timo = (Seconds * hz) + Milliseconds * hz / 1000; 254 if (timo == 0) 255 timo = 1; 256 tsleep(&dummy, 0, "acpislp", timo); 257 return_VOID; 258} 259 260void 261AcpiOsStall (UINT32 Microseconds) 262{ |
263 FUNCTION_TRACE(__func__); | 263 ACPI_FUNCTION_TRACE(__func__); |
264 265 DELAY(Microseconds); 266 return_VOID; 267} 268 269UINT32 270AcpiOsGetThreadId (void) 271{ 272 /* XXX do not add FUNCTION_TRACE here, results in recursive call */ 273 274 KASSERT(curproc != NULL, (__func__ ": curproc is NULL!")); 275 return(curproc->p_pid + 1); /* can't return 0 */ 276} | 264 265 DELAY(Microseconds); 266 return_VOID; 267} 268 269UINT32 270AcpiOsGetThreadId (void) 271{ 272 /* XXX do not add FUNCTION_TRACE here, results in recursive call */ 273 274 KASSERT(curproc != NULL, (__func__ ": curproc is NULL!")); 275 return(curproc->p_pid + 1); /* can't return 0 */ 276} |