[openfirmware] r1180 - cpu/x86/pc cpu/x86/pc/biosload cpu/x86/pc/olpc/via dev/ide

svn at openfirmware.info svn at openfirmware.info
Wed May 13 00:57:45 CEST 2009


Author: wmb
Date: 2009-05-13 00:57:45 +0200 (Wed, 13 May 2009)
New Revision: 1180

Added:
   cpu/x86/pc/olpc/via/startcpuspeed.fth
   dev/ide/idehier.bth
   dev/ide/pciintf.fth
Modified:
   cpu/x86/pc/biosload/fw.bth
   cpu/x86/pc/olpc/via/addrs.fth
   cpu/x86/pc/olpc/via/devices.fth
   cpu/x86/pc/olpc/via/fw.bth
   cpu/x86/pc/olpc/via/ioinit.fth
   cpu/x86/pc/olpc/via/olpc.bth
   cpu/x86/pc/olpc/via/probemem.fth
   cpu/x86/pc/olpc/via/romreset.bth
   cpu/x86/pc/olpc/via/romstart.bth
   cpu/x86/pc/olpc/via/versions.fth
   cpu/x86/pc/rootnode.fth
Log:
OLPC VIA version - checkpoint with, among other things, support for
SD wireless.


Modified: cpu/x86/pc/biosload/fw.bth
===================================================================
--- cpu/x86/pc/biosload/fw.bth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/biosload/fw.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -369,11 +369,6 @@
 \ Also try " console=/dev/ttyS0,9600 console=/dev/tty0" in boot-file
 [then]
 
-\ XXX delete me
-\ [ifdef] linux-support
-\ fload ${BP}/cpu/x86/pc/biosload/linux.fth
-\ [then]
-
 fload ${BP}/cpu/x86/pc/biosload/vmdoor.fth   \ VMware interfaces
 
 fload ${BP}/cpu/x86/pc/biosload/intelfb.fth  \ Intel frame buffer setup

Modified: cpu/x86/pc/olpc/via/addrs.fth
===================================================================
--- cpu/x86/pc/olpc/via/addrs.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/addrs.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -20,7 +20,6 @@
 
 h# 1bc0.0000 value    fw-pa     \ Changed in probemem.fth
 h#   20.0000 constant /fw-ram
-h#   40.0000 constant /fw-area
 [then]
 
 h# 100.0000 constant def-load-base      \ Convenient for initrd
@@ -33,8 +32,9 @@
 
 h#  18.0000 constant heap-size
 
-h# 900.0000 constant dma-size
-fw-pa dma-size - constant dma-base
+h# 20.0000 constant /dma-extra          \ In case the firmware region isn't enough
+/fw-ram /dma-extra + constant dma-size  \ We let the DMA area overlap the FW area
+fw-pa /dma-extra - constant dma-base
 
 h# f.0000 constant suspend-base      \ In the DOS hole
 h# f.0008 constant resume-entry
@@ -56,8 +56,8 @@
 h# fed4.0000 constant wdt-mmio-base
 h# fee0.0000 constant apic-mmio-base
 
-h#      4000 constant acpi-io-base
-h#      4100 constant smbus-io-base
+h#   400 constant acpi-io-base
+h#   500 constant smbus-io-base
 
 h# e0000 constant rsdp-adr
 h# e0040 constant rsdt-adr

Modified: cpu/x86/pc/olpc/via/devices.fth
===================================================================
--- cpu/x86/pc/olpc/via/devices.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/devices.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -34,7 +34,7 @@
 warning @ warning off
 : stand-init-io  ( -- )
    stand-init-io
-\  acpi-calibrate-tsc
+   acpi-calibrate-tsc
    d# 800 to us-factor  d# 800000 to ms-factor
 ;
 warning !

Modified: cpu/x86/pc/olpc/via/fw.bth
===================================================================
--- cpu/x86/pc/olpc/via/fw.bth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/fw.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -105,14 +105,17 @@
 fload ${BP}/cpu/x86/pc/isaio.fth
 fload ${BP}/dev/pci/configm1.fth	\ Generic PCI configuration access
 
-fload ${BP}/cpu/x86/pc/olpc/via/probemem.fth	\ Memory probing
-
 [ifdef] virtual-mode
 fload ${BP}/cpu/x86/loadvmem.fth	\ /mmu node
 
 stand-init: MMU
    " /mmu" open-dev mmu-node !
 ;
+[then]
+
+fload ${BP}/cpu/x86/pc/olpc/via/probemem.fth	\ Memory probing
+
+[ifdef] virtual-mode
 fload ${BP}/cpu/x86/pc/initdict.fth	\ Dynamic dictionary allocation
 [then]
 

Modified: cpu/x86/pc/olpc/via/ioinit.fth
===================================================================
--- cpu/x86/pc/olpc/via/ioinit.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/ioinit.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -31,7 +31,8 @@
    \ Additional Power Management Setup not in coreboot
    0 2 devfunc
    76 08 08 mreg  \ AGTL Power down buffers in S3
-   92 ff 40 mreg  \ ACPI IO Base address
+\   92 ff 00 mreg  \ ACPI IO Base address
+\   93 ff 04 mreg  \ ACPI IO Base address
    end-table
 
    0 4 devfunc
@@ -62,7 +63,7 @@
 
    d# 12 0 devfunc  \ SDIO tuning
    44 01 01 mreg  \ Enable backdoor
-   8b 05 01 mreg  \ Do not report 1.8V support
+\   8b 05 01 mreg  \ Do not report 1.8V support
    8c c3 03 mreg  \ Falling edge trigger for Slots 1 and 2 data in high speed
    8e ff 7e mreg  \ Delay host clock for Slots 1, 2, 3 by 4.8 nS
    8f 09 01 mreg  \ Falling edge trigger on slot 3 output clock under high speed
@@ -79,7 +80,8 @@
    4b ff 20 mreg  \ Drive0 timing
    4c f0 60 mreg  \ Address setup time
    52 df 0e mreg  \ Ultra dma wait strobe timing
-   53 df c6 mreg  \ Ultra DMA mode control
+\   53 df c6 mreg  \ Ultra DMA mode control
+   53 df 06 mreg  \ Ultra DMA mode control
    c4 1d 18 mreg  \ Config 1
 \  d4 ac 24 mreg  \ Config 3
    d4 bc 34 mreg  \ Config 3 - 10 res be like Phx

Modified: cpu/x86/pc/olpc/via/olpc.bth
===================================================================
--- cpu/x86/pc/olpc/via/olpc.bth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/olpc.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -8,8 +8,9 @@
 in: ${BP}/cpu/x86/pc/olpc/via/build/rmstart.img
 in: ${BP}/cpu/x86/pc/olpc/via/build/paging.di
 in: ${BP}/cpu/x86/pc/olpc/via/build/fw.dic
-in: ${BP}/dev/mmc/sdhci/build/sdhci.fc
+in: ${BP}/dev/mmc/sdhci/build/sdhci2.fc
 in: ${BP}/dev/mmc/sdhci/build/sdmmc.fc
+in: ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc
 in: ${BP}/dev/usb2/hcd/ohci/build/ohci.fc
 in: ${BP}/dev/usb2/hcd/ehci/build/ehci.fc
 in: ${BP}/dev/usb2/device/hub/build/hub.fc
@@ -22,7 +23,8 @@
 in: ${BP}/clients/emacs/x86/emacs
 in: ${BP}/cpu/x86/pc/olpc/via/build/verify.img
 in: ${BP}/dev/pci/build/pcibridg.fc
-in: ${BP}/dev/ide/build/leghier.fc
+in: ${BP}/dev/ide/build/idehier.fc
+\ in: ${BP}/dev/ide/build/leghier.fc
 \ in: ${BP}/cpu/x86/pc/olpc/via/build/camera.fc
 \ in: ${BP}/cpu/x86/pc/olpc/via/build/dsdt.aml
 \ in: ${BP}/cpu/x86/pc/olpc/via/build/mcastnand.bin
@@ -87,9 +89,11 @@
 \  " mrv8686.bin" " mrv8686.bin"                                    $add-deflated-dropin
 
    " ${BP}/dev/pci/build/pcibridg.fc"            " class060400"   $add-deflated-dropin
-   " ${BP}/dev/ide/build/leghier.fc"             " class01018a"   $add-deflated-dropin
-   " ${BP}/dev/mmc/sdhci/build/sdhci.fc"         " class080501"   $add-deflated-dropin
+\   " ${BP}/dev/ide/build/leghier.fc"             " class01018a"   $add-deflated-dropin
+   " ${BP}/dev/ide/build/idehier.fc"             " class01018a"   $add-deflated-dropin
+   " ${BP}/dev/mmc/sdhci/build/sdhci2.fc"        " class080501"   $add-deflated-dropin
    " ${BP}/dev/mmc/sdhci/build/sdmmc.fc"         " sdmmc"         $add-deflated-dropin
+   " ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc" " mv8686"        $add-deflated-dropin
    " builton.fth"                       " probe-"          $add-dropin
 
    " ${BP}/clients/emacs/x86/emacs"             " emacs"         $add-deflated-dropin

Modified: cpu/x86/pc/olpc/via/probemem.fth
===================================================================
--- cpu/x86/pc/olpc/via/probemem.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/probemem.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -37,8 +37,9 @@
 : release-range  ( start-adr end-adr -- )  over - release  ;
 
 : probe  ( -- )
-[ifdef] relocated-fw
-   system-ram /fw-area - to fw-pa
+[ifdef] virtual-mode
+   origin >physical  to fw-pa
+   fw-pa /dma-extra - to dma-base
 [then]
 
    0 total-ram  reg   \ Report extant memory

Modified: cpu/x86/pc/olpc/via/romreset.bth
===================================================================
--- cpu/x86/pc/olpc/via/romreset.bth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/romreset.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -105,9 +105,9 @@
 
 1 [if]
  \ This turns an OS reboot into a real cold start - from coreboot
-   4001 8888 config-ww   \ Set ACPI base address
+   acpi-io-base 1 + 8888 config-ww   \ Set ACPI base address
    8c 8881 config-wb   \ Enable ACPI regs, 32-bit PM timer, guard RTC against power glitches
-   4004 port-rw        \ Get APCI Status register
+   acpi-io-base 4 + port-rw           \ Get APCI Status register
    d# 10 # ax shr  7 # ax and  1 # ax cmp  <>  if  \ Not a wakeup from S3
       380 config-rb  ax ax or  0<>  if             \ C-page shadowing not on yet
          6 cf9 port-wb                             \ Force a full system reset
@@ -135,6 +135,7 @@
 \   e2 2e port-wb   7 2f port-wb
 
    fload ${BP}/cpu/x86/pc/olpc/via/startmemtop.fth
+   fload ${BP}/cpu/x86/pc/olpc/via/startcpuspeed.fth
 
    h# 1f port80
    char r report

Modified: cpu/x86/pc/olpc/via/romstart.bth
===================================================================
--- cpu/x86/pc/olpc/via/romstart.bth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/romstart.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -64,7 +64,7 @@
    fload ${BP}/cpu/x86/pc/olpc/via/startmtrrinit.fth
    fload ${BP}/cpu/x86/pc/olpc/via/ioinit.fth
 
-1 [if]
+0 [if]
    0 3 devfunc
    86 c4 84 mreg  \ Enable top SMM memory (04) of size 4 MB (80 in c0 field)
    end-table
@@ -75,6 +75,7 @@
 [then]
 
    fload ${BP}/cpu/x86/pc/olpc/via/startmemtop.fth
+   fload ${BP}/cpu/x86/pc/olpc/via/startcpuspeed.fth
 
    h# 1f port80
    char r report

Added: cpu/x86/pc/olpc/via/startcpuspeed.fth
===================================================================
--- cpu/x86/pc/olpc/via/startcpuspeed.fth	                        (rev 0)
+++ cpu/x86/pc/olpc/via/startcpuspeed.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -0,0 +1,5 @@
+   h# 10000 h# 1a0 bitset-msr   \ Enable performance state changes
+   h# 198 rmsr                  \ Get performance state info - min.max in %edx, current in %eax
+   ax ax xor  op: dx ax mov     \ MSR.low for new performance state - from max field in %edx
+   dx dx xor                    \ MSR.high = 0
+   h# 199 wmsr                  \ We should start going faster now

Modified: cpu/x86/pc/olpc/via/versions.fth
===================================================================
--- cpu/x86/pc/olpc/via/versions.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/olpc/via/versions.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -2,7 +2,7 @@
 
 \ The overall firmware revision
 macro: FW_MAJOR A
-macro: FW_MINOR 01
+macro: FW_MINOR 02a
 
 \ The EC microcode
 macro: EC_VERSION e34

Modified: cpu/x86/pc/rootnode.fth
===================================================================
--- cpu/x86/pc/rootnode.fth	2009-05-12 22:53:43 UTC (rev 1179)
+++ cpu/x86/pc/rootnode.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -51,14 +51,16 @@
 [then]
 ;
 
-dma-base   dup dma-size +  2constant dma-range
+: dma-range  ( -- start end )  dma-base   dup dma-size +  ;
 
+0 [if]  \ This is fairly useless since the DMA ranges can be dynamic
 \ We hereby establish the convention that the implied "#address-cells"
 \ for the (nonexistent) parent of the root node is 0, so the parent
 \ address portion of the ranges property is empty.
 0 0 encode-bytes
    dma-base encode-int encode+  dma-size encode-int encode+
 " dma-ranges" property
+[then]
 
 \ x86 caches are coherent
 h# 3 constant dma-map-mode		\ Cacheable

Added: dev/ide/idehier.bth
===================================================================
--- dev/ide/idehier.bth	                        (rev 0)
+++ dev/ide/idehier.bth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -0,0 +1,35 @@
+purpose: Load file for IDE driver FCode
+
+\ This version of the load file uses the following configuration:
+\   IDE controller on PCI bus
+\   Supports 4 drives (primary/secondary * master/slave)
+\   IDE controller accessed via dynamically-assigned PCI addresses
+\   DMA support present and enabled
+\   Two-level hierarchy, i.e. pci-ide/ide at 1/disk at 1
+\ This is the version that works with MacOS
+
+command: &tokenize &this
+in: ${BP}/dev/ide/build/node.fc
+build-now
+
+silent on
+
+begin-tokenizing idehier.fc
+
+FCode-version2
+
+: $, ( adr len -- )  here over allot  swap move  ;
+create node-fcode
+fload node.hex
+
+fload ${BP}/dev/ide/pciintf.fth
+fload ${BP}/dev/ide/generic.fth
+fload ${BP}/dev/ide/twolevel.fth
+fload ${BP}/dev/ide/dmaide.fth
+\ To disable DMA, use the following line; do not omit the dmaide.fth
+\ file from the load, because it contains not only DMA code but also
+\ a workaround for the Winbond chip's PIO bug.
+\ pio
+end0
+
+end-tokenizing

Added: dev/ide/pciintf.fth
===================================================================
--- dev/ide/pciintf.fth	                        (rev 0)
+++ dev/ide/pciintf.fth	2009-05-12 22:57:45 UTC (rev 1180)
@@ -0,0 +1,53 @@
+purpose: PCI IDE controller in native mode
+copyright: Copyright 1997 Firmworks  All Rights Reserved
+
+\ Use PCI IDE controller into native mode
+
+: int+  ( adr len n -- adr' len' )  encode-int encode+  ;
+
+\ This device has five base registers, used as follows:
+\ base	maps
+\ 10	1f0-1f7
+\ 14	3f6
+\ 18	170-177
+\ 1c	376
+\ 20	bus mastering regs
+
+my-address my-space  encode-phys  0 int+ 0 int+
+my-address my-space  h# 100.0010 + encode-phys  encode+  0 int+ 8 int+
+my-address my-space  h# 100.0014 + encode-phys  encode+  0 int+ 4 int+
+my-address my-space  h# 100.0018 + encode-phys  encode+  0 int+ 8 int+
+my-address my-space  h# 100.001c + encode-phys  encode+  0 int+ 4 int+
+my-address my-space  h# 100.0020 + encode-phys  encode+  0 int+ h# 10 int+
+
+\ The base address register at offset 24 exists only on Symphony Labs/Winbond
+\ parts.  Listing it on other devices can cause address assignment failures.
+\ my-address my-space  h# 100.0024 + encode-phys  encode+  0 int+ h# 10 int+
+
+" reg" property
+
+: +map-in  ( offset size -- virt )
+   >r my-address rot my-space +  r> " map-in" $call-parent
+;
+: map-out  ( virt size -- )  " map-out" $call-parent  ;
+
+\ Map the device into virtual address space
+: (map)  ( -- base1 dor1 base2 dor2 )
+   my-space 9 + dup " config-b@"  $call-parent
+       05 or  swap  " config-b!"  $call-parent	\ Native mode
+
+   h# 100.0010 8 +map-in
+   h# 100.0014 4 +map-in  2 +
+   h# 100.0018 8 +map-in
+   h# 100.001c 4 +map-in  2 +
+
+   my-space 4 + dup " config-w@"  $call-parent
+        1 or  swap  " config-w!"  $call-parent	\ Enable
+;
+\ Release the mapping resources used by the device
+: (unmap)  ( base1 dor1 base2 dor2 -- )
+   my-space 4 + dup " config-w@"  $call-parent
+        1 invert and  swap  " config-w!"  $call-parent	\ Disable
+
+   2 - 4 map-out  8 map-out  2 - 4 map-out  8 map-out
+;




More information about the openfirmware mailing list