aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2012-05-13 12:18:36 -0400
committerKevin O'Connor <kevin@koconnor.net>2012-05-20 18:10:45 -0400
commit9d254d4614746687a4e324a6b85756a71f775b7b (patch)
tree546073d022835606c16b7cd3cf40d7df46442c39 /src
parent46b82624c95b951e8825fab117d9352faeae0ec8 (diff)
downloadseabios-9d254d4614746687a4e324a6b85756a71f775b7b.tar.gz
Convert timer code EBDA variables to VARLOW variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/biosvar.h6
-rw-r--r--src/clock.c32
2 files changed, 17 insertions, 21 deletions
diff --git a/src/biosvar.h b/src/biosvar.h
index 99c2565b..8f94b244 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -226,8 +226,6 @@ struct extended_bios_data_area_s {
u8 ps2ctr;
struct usbkeyinfo usbkey_last;
- int RTCusers;
-
// El Torito Emulation data
struct cdemu_s cdemu;
@@ -238,10 +236,6 @@ struct extended_bios_data_area_s {
u8 cdrom_locks[CONFIG_MAX_EXTDRIVE];
u16 boot_sequence;
-
- /* TSC emulation timekeepers */
- u64 tsc_8254;
- int last_tsc_8254;
} PACKED;
// The initial size and location of EBDA
diff --git a/src/clock.c b/src/clock.c
index e8a48a13..c66c3f0f 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -108,22 +108,24 @@ calibrate_tsc(void)
dprintf(1, "CPU Mhz=%u\n", hz / 1000000);
}
+/* TSC emulation timekeepers */
+u64 TSC_8254 VARLOW;
+int Last_TSC_8254 VARLOW;
+
static u64
emulate_tsc(void)
{
- int cnt, d;
- u16 ebda_seg = get_ebda_seg();
- u64 ret;
/* read timer 0 current count */
- ret = GET_EBDA2(ebda_seg, tsc_8254);
- /* readback mode has slightly shifted registers, works on all 8254, readback PIT0 latch */
+ u64 ret = GET_LOW(TSC_8254);
+ /* readback mode has slightly shifted registers, works on all
+ * 8254, readback PIT0 latch */
outb(PM_SEL_READBACK | PM_READ_VALUE | PM_READ_COUNTER0, PORT_PIT_MODE);
- cnt = (inb(PORT_PIT_COUNTER0) | (inb(PORT_PIT_COUNTER0) << 8));
- d = GET_EBDA2(ebda_seg, last_tsc_8254) - cnt;
+ int cnt = (inb(PORT_PIT_COUNTER0) | (inb(PORT_PIT_COUNTER0) << 8));
+ int d = GET_LOW(Last_TSC_8254) - cnt;
/* Determine the ticks count from last invocation of this function */
ret += (d > 0) ? d : (PIT_TICK_INTERVAL + d);
- SET_EBDA2(ebda_seg, last_tsc_8254, cnt);
- SET_EBDA2(ebda_seg, tsc_8254, ret);
+ SET_LOW(Last_TSC_8254, cnt);
+ SET_LOW(TSC_8254, ret);
return ret;
}
@@ -545,12 +547,13 @@ handle_08(void)
* Periodic timer
****************************************************************/
+int RTCusers VARLOW;
+
void
useRTC(void)
{
- u16 ebda_seg = get_ebda_seg();
- int count = GET_EBDA2(ebda_seg, RTCusers);
- SET_EBDA2(ebda_seg, RTCusers, count+1);
+ int count = GET_LOW(RTCusers);
+ SET_LOW(RTCusers, count+1);
if (count)
return;
// Turn on the Periodic Interrupt timer
@@ -561,9 +564,8 @@ useRTC(void)
void
releaseRTC(void)
{
- u16 ebda_seg = get_ebda_seg();
- int count = GET_EBDA2(ebda_seg, RTCusers);
- SET_EBDA2(ebda_seg, RTCusers, count-1);
+ int count = GET_LOW(RTCusers);
+ SET_LOW(RTCusers, count-1);
if (count != 1)
return;
// Clear the Periodic Interrupt.