[openfirmware] r1317 - cpu/x86
svn at openfirmware.info
svn at openfirmware.info
Sat Aug 22 01:34:36 CEST 2009
Author: wmb
Date: 2009-08-22 01:34:36 +0200 (Sat, 22 Aug 2009)
New Revision: 1317
Modified:
cpu/x86/apic.fth
Log:
APIC - added save and restore methods to APIC driver in anticipation
of eventually restoring the interrupt state after wakeup.
Modified: cpu/x86/apic.fth
===================================================================
--- cpu/x86/apic.fth 2009-08-21 09:28:53 UTC (rev 1316)
+++ cpu/x86/apic.fth 2009-08-21 23:34:36 UTC (rev 1317)
@@ -73,24 +73,30 @@
spiv!
;
+: setup-apic ( -- )
+ apic-on
+ taskpri@ h# ff invert and taskpri! \ "Accept All"
+ soft-on
+ \ Virtual wire mode
+ \ REMOTE_IRR (4000), SEND_PENDING (1000), DELIVERY_MODE_EXTINT (700)
+ lvt0@ h# 1ff00 invert and h# 5700 or lvt0!
+ \ REMOTE_IRR (4000), SEND_PENDING (1000), DELIVERY_MODE_NMI (400)
+ lvt1@ h# 1ff00 invert and h# 5400 or lvt1!
+;
: open ( -- okay? )
apic-base 0= if
apic-mmio-base h# 400 " map-in" $call-parent to apic-base
- apic-on
- taskpri@ h# ff invert and taskpri! \ "Accept All"
- soft-on
- \ Virtual wire mode
- \ REMOTE_IRR (4000), SEND_PENDING (1000), DELIVERY_MODE_EXTINT (700)
- lvt0@ h# 1ff00 invert and h# 5700 or lvt0!
- \ REMOTE_IRR (4000), SEND_PENDING (1000), DELIVERY_MODE_NMI (400)
- lvt1@ h# 1ff00 invert and h# 5400 or lvt1!
+ setup-apic
then
true
;
: close ( -- ) ;
+: save ( -- ) ;
+: restore ( -- ) setup-apic ;
+
end-package
0 0 " fec00000" " /" begin-package
@@ -145,16 +151,23 @@
: trigger-irq ( irq# -- ) io-apic-base h# 20 + c! ;
: eoi ( vector -- ) io-apic-base h# 40 + c! ;
+: setup-io-apic ( -- )
+ 1 d# 24 lshift 0 io-apic! \ I/O APIC ID
+ 1 3 io-apic! \ Front side bus message delivery
+;
+
: open ( -- okay? )
io-apic-base 0= if
io-apic-mmio-base h# 80 " map-in" $call-parent to io-apic-base
- 1 d# 24 lshift 0 io-apic! \ I/O APIC ID
- 1 3 io-apic! \ Front side bus message delivery
+ setup-io-apic
then
true
;
: close ( -- ) ;
+: save ( -- ) ;
+: restore ( -- ) setup-io-apic ;
+
end-package
0 value apic-ih
More information about the openfirmware
mailing list