Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[e16e8f2] | 1 | /* ----------------------------------------------------------------------- * |
---|
| 2 | * |
---|
| 3 | * Copyright 2008 H. Peter Anvin - All Rights Reserved |
---|
| 4 | * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin |
---|
| 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
---|
| 9 | * Boston MA 02110-1301, USA; either version 2 of the License, or |
---|
| 10 | * (at your option) any later version; incorporated herein by reference. |
---|
| 11 | * |
---|
| 12 | * ----------------------------------------------------------------------- */ |
---|
| 13 | |
---|
| 14 | /* |
---|
| 15 | * idle.c: |
---|
| 16 | * |
---|
| 17 | * This function provided protected-mode access to the idle handling. |
---|
| 18 | * It needs to be carefully coordinated with idle.inc, which provides |
---|
| 19 | * idle services to real-mode code. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #include "core.h" |
---|
| 23 | #include <sys/cpu.h> |
---|
| 24 | |
---|
| 25 | #define TICKS_TO_IDLE 4 /* Also in idle.inc */ |
---|
| 26 | |
---|
| 27 | static jiffies_t _IdleTimer; |
---|
| 28 | __export uint16_t NoHalt = 0; |
---|
| 29 | |
---|
| 30 | int (*idle_hook_func)(void); |
---|
| 31 | |
---|
| 32 | void reset_idle(void) |
---|
| 33 | { |
---|
| 34 | _IdleTimer = jiffies(); |
---|
| 35 | sti(); /* Guard against BIOS/PXE brokenness... */ |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | __export void __idle(void) |
---|
| 39 | { |
---|
| 40 | if (jiffies() - _IdleTimer < TICKS_TO_IDLE) |
---|
| 41 | return; |
---|
| 42 | |
---|
| 43 | if (idle_hook_func && idle_hook_func()) |
---|
| 44 | return; /* Nonzero return = do not idle */ |
---|
| 45 | |
---|
| 46 | sti(); |
---|
| 47 | if (NoHalt) |
---|
| 48 | cpu_relax(); |
---|
| 49 | else |
---|
| 50 | hlt(); |
---|
| 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.