Author: wmb
Date: 2009-02-02 07:47:25 +0100 (Mon, 02 Feb 2009)
New Revision: 1096
Modified:
cpu/x86/pc/olpc/vsapci.fth
dev/geode/msr.fth
Log:
OLPC trac 9226 - virtualize AC97 PCI config base address so Windows
XO Audio driver works whether or not the audio device is enabled
at Windows boot.
Modified: cpu/x86/pc/olpc/vsapci.fth
===================================================================
--- cpu/x86/pc/olpc/vsapci.fth 2009-01-29 17:03:19 UTC (rev 1095)
+++ cpu/x86/pc/olpc/vsapci.fth 2009-02-02 06:47:25 UTC (rev 1096)
@@ -242,11 +242,18 @@
h# 51010081 2 pick 4 and if msr-set else msr-clr then
;
: ac97-cmd-reg ( object value -- )
- set-cmd-reg ( adr value )
+ set-cmd-reg
+ h# 300 ?bus-master ( adr value )
+ 1 and if ( adr )
+ >bar-info ( base-adr size )
+ 2dup 1 h# 5100.0026 set-io-rconf ( base-adr size )
+ h# a h# 5101.00e1 set-iod-bm ( )
+ else ( adr )
+ drop ( )
+ h# 5100.0026 rconf-off ( )
+ h# 5101.00e1 iod-bm-off ( )
+ then
- h# 300 ?bus-master ( adr value )
-
- 2drop
\ The MSRs are:
\ 5101.00e1 a0000001.480fff80. IOD_BM
\ 5100.0026 014f0001.01480001. io-rconf
Modified: dev/geode/msr.fth
===================================================================
--- dev/geode/msr.fth 2009-01-29 17:03:19 UTC (rev 1095)
+++ dev/geode/msr.fth 2009-02-02 06:47:25 UTC (rev 1096)
@@ -36,7 +36,7 @@
: p2d-range-off ( msr# -- ) p2d-range-disabled rot msr! ;
-: >p2d-bm ( ( base size type -- d.msrval )
+: >p2d-bm ( base size type -- d.msrval )
>r ( base size r: type )
negate page# ( base mask-page r: type )
swap page# ( base-page mask-page r: type )
@@ -59,6 +59,15 @@
: p2d-bm-off ( msr# -- ) p2d-bm-disabled rot msr! ;
+: >iod-bm ( base size type -- d.msrval )
+ >r ( base size r: type )
+ negate h# fffff and ( base mask r: type )
+ swap ( mask base r: type )
+ 0 r> p2d-format ( msr.low msr.hi' )
+;
+: set-iod-bm ( base size type msr# -- ) >r >iod-bm r> msr! ;
+alias iod-bm-off p2d-bm-off
+
: >rconf ( base-adr size mode -- d.msrval )
>r ( base-adr size r: mode )
bounds ( end-adr base-adr r: mode )
@@ -69,6 +78,15 @@
: set-rconf ( base-adr size mode msr# -- ) >r >rconf r> msr! ;
+: >io-rconf ( base-adr size mode -- d.msrval )
+ >r ( base-adr size r: mode )
+ bounds ( end-adr base-adr r: mode )
+ d# 12 lshift r> or ( end-adr msr.low )
+ swap 4 - d# 12 lshift 1 or ( msr.low msr.high )
+;
+
+: set-io-rconf ( base-adr size mode msr# -- ) >r >io-rconf r> msr! ;
+
: rconf-off ( msr# -- ) rconf-disabled rot msr! ;