Author: wmb Date: 2009-06-26 18:10:47 +0200 (Fri, 26 Jun 2009) New Revision: 1225
Added: cpu/x86/pc/olpc/via/smbios.fth Modified: cpu/x86/apic.fth cpu/x86/pc/apic.fth cpu/x86/pc/olpc/via/acpi.fth cpu/x86/pc/olpc/via/addrs.fth cpu/x86/pc/olpc/via/config.fth cpu/x86/pc/olpc/via/dsdt.dsl cpu/x86/pc/olpc/via/fw.bth cpu/x86/pc/olpc/via/ioinit.fth cpu/x86/pc/olpc/via/versions.fth ofw/inet/ip.fth Log: OLPC q3a04 - ACPI and SMBIOS enabled, suspend/resume works from OFW.
Modified: cpu/x86/apic.fth =================================================================== --- cpu/x86/apic.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/apic.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -44,9 +44,9 @@ : id! ( id -- ) d# 24 lshift d# 20 apic! ; : id@ ( -- id ) d# 20 apic@ d# 24 rshift ; : lvt0@ ( -- n ) h# 350 apic@ ; -: lvt0! ( n -- ) h# 350 apic@ ; +: lvt0! ( n -- ) h# 350 apic! ; : lvt1@ ( -- n ) h# 360 apic@ ; -: lvt1! ( n -- ) h# 360 apic@ ; +: lvt1! ( n -- ) h# 360 apic! ;
: lvt0-disable-irq ( -- ) h# 10000 h# 350 apic-set ; \ Disable LINT0 : lvt0-enable-irq ( -- ) h# 10000 h# 350 apic-clr ; \ Enable LINT0 @@ -148,6 +148,8 @@ : 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 then true ;
Modified: cpu/x86/pc/apic.fth =================================================================== --- cpu/x86/pc/apic.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/apic.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -123,10 +123,10 @@
20 0 30 50014 -80 f0 +80 f0 (00) d0 0 e0 ffffffff -f0 10f +f0 10f (1ff) Spurious vector number 320 10000 Timer Masked off 340 10000 PCINT Masked off 350 700 LINT0 vector 0 mode ExtINT (111) Edge Trigger Active High @@ -164,7 +164,7 @@ indirect io apic regs 00 1000000 IOAPIC ID is 1 01 178003 (RO) version -02 1000000 Arb ID is 1 +02 1000000 (RO) Arb ID is 1 03 1 Front side bus message delivery 10,11 0100.0000 . 0001.0000 DD00 . 0000 . 000 ooom . tips MVV ..
Modified: cpu/x86/pc/olpc/via/acpi.fth =================================================================== --- cpu/x86/pc/olpc/via/acpi.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/acpi.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -2,9 +2,13 @@
h# 0. 2constant xsdt-adr
+: set-acpi-table-length ( table-adr -- ) + here over - swap la1+ l! +; + create fadt ( 000 4 ) " FACP" $, \ Signature -( 004 4 ) h# 84 l, \ Table Length +( 004 4 ) h# 84 l, \ Length ( 008 1 ) h# 02 c, \ Revision (supports reset adr) ( 009 1 ) h# 00 c, \ Checksum ( 00A 6 ) " OLPC " $, \ Oem ID @@ -27,24 +31,22 @@ ( 037 1 ) h# 00 c, \ P-State Control ( 038 4 ) h# 400 l, \ PM1A Event Block Address ( 03C 4 ) h# 0 l, \ PM1B Event Block Address -\ ( 040 4 ) h# 9c28 l, \ PM1A Control Block Address ( 040 4 ) h# 404 l, \ PM1A Control Block Address ( 044 4 ) h# 0 l, \ PM1B Control Block Address -( 048 4 ) h# 0 l, \ PM2 Control Block Address (don't support) -\ ( 04C 4 ) h# 9c10 l, \ PM Timer Block Address +( 048 4 ) h# 22 l, \ PM2 Control Block Address ( 04C 4 ) h# 408 l, \ PM Timer Block Address ( 050 4 ) h# 420 l, \ GPE0 Block Address ( 054 4 ) h# 0 l, \ GPE1 Block Address ( 058 1 ) h# 4 c, \ PM1 Event Block Length ( 059 1 ) h# 2 c, \ PM1 Control Block Length -( 05A 1 ) h# 0 c, \ PM2 Control Block Length +( 05A 1 ) h# 1 c, \ PM2 Control Block Length ( 05B 1 ) h# 4 c, \ PM Timer Block Length ( 05C 1 ) h# 4 c, \ GPE0 Block Length ( 05D 1 ) h# 0 c, \ GPE1 Block Length ( 05E 1 ) h# 10 c, \ GPE1 Base Offset ( 05F 1 ) h# 85 c, \ _CST Support -( 060 2 ) h# 1 w, \ C2 Latency -( 062 2 ) h# 1 w, \ C3 Latency +( 060 2 ) d# 10 w, \ C2 Latency (guess) +( 062 2 ) d# 100 w, \ C3 Latency (guess) ( 064 2 ) h# 0 w, \ CPU Cache Size ( 066 2 ) h# 0 w, \ Cache Flush Stride ( 068 1 ) h# 0 c, \ Duty Cycle Offset @@ -59,37 +61,24 @@
( 080 1 ) h# 1 c, \ Reset value ( 081 3 ) 0 c, 0 c, 0 c, \ Reserved -here fadt - constant /fadt +fadt set-acpi-table-length
\ FADT Flags: \ WBINVD is operational : 1 \ WBINVD does not invalidate : 0 \ All CPUs support C1 : 1 \ C2 works on MP system : 0 -\ Power button is generic : 0 -\ Sleep button is generic : 1 +\ Power button is generic : 0 ?? +\ Sleep button is generic : 1 ?? \ RTC wakeup not fixed : 0 \ RTC wakeup/S4 not possible : 1 \ 32-bit PM Timer : 1 \ Docking Supported : 0 \ Reset Register Supported: 1
-create rsdp -( 00 8 ) " RSD PTR " $, \ Signature -( 08 1 ) 00 c, \ Checksum -( 09 6 ) " OLPC " $, \ Oem Id -( 0f 1 ) 2 c, \ ACPI revision (3.0b) -( 10 4 ) rsdt-adr l, \ RSDT Address - -( 14 4 ) d# 36 l, \ Length for extended version -( 18 8 ) xsdt-adr d, \ XSDT Address -( 20 1 ) 0 c, \ extended checksum -( 21 3 ) 0 c, 0 c, 0 c, \ reserved -here rsdp - constant /rsdp - create madt \ Multiple APIC Descriptor Table ( 000 4 ) " APIC" $, \ Signature -( 004 4 ) h# 5a l, \ Table Length +( 004 4 ) h# 5a l, \ Length ( 008 1 ) h# 01 c, \ Revision ( 009 1 ) h# 00 c, \ Checksum ( 00A 6 ) " OLPC " $, \ Oem ID @@ -106,7 +95,6 @@ ( 02f 1 ) 0 c, \ ACPI ID ( 030 4 ) 1 l, \ Flags - 1 means this processor is usable
- ( 034 1 ) 1 c, \ I/O APIC ( 035 1 ) d# 12 c, \ length ( 036 1 ) 1 c, \ I/O APIC ID @@ -133,11 +121,11 @@ ( 053 1 ) 9 c, \ Bus-relative IRQ ( 054 4 ) 9 l, \ Interrupt # that this source will trigger ( 058 2 ) h# f w, \ Flags - active low, level triggered -here madt - constant /madt +madt set-acpi-table-length
create hpet \ High Precision Event Timer table ( 000 4 ) " HPET" $, \ Signature -( 004 4 ) h# 38 l, \ Table Length +( 004 4 ) h# 38 l, \ Length ( 008 1 ) h# 01 c, \ Revision ( 009 1 ) h# 00 c, \ Checksum ( 00A 6 ) " OLPC " $, \ Oem ID @@ -155,13 +143,11 @@ ( 034 1 ) 0 c, \ Sequence ( 035 2 ) 0 w, \ Min tick ( 037 1 ) 0 c, \ flags -here hpet - constant /hpet +hpet set-acpi-table-length
create rsdt ( 00 4 ) " RSDT" $, \ Signature ( 04 4 ) h# 34 l, \ Length -\ ( 04 4 ) h# 30 l, \ Length -\ ( 04 4 ) h# 2c l, \ Length ( 08 1 ) 1 c, \ Revision ( 09 1 ) 00 c, \ Checksum ( 0a 6 ) " OLPC " $, \ Oem Id @@ -176,7 +162,7 @@ \ ( 2c 4 ) dbgp-adr l, \ DBGP Address \ ( 30 4 ) ssdt-adr l, \ SSDT Address \ ( 30 4 ) prtn-adr l, \ PRTN Address -here rsdt - constant /rsdt +rsdt set-acpi-table-length
0 [if] create dbgp @@ -192,7 +178,7 @@ ( 24 1 ) 0 c, \ Full 16550 interface ( 25 3 ) 0 c, 0 c, 0 c, \ reserved ( 28 c ) 1 c, 8 c, 0 c, 1 c, h# 3f8 l, 0 l, \ Port base address (generic register descriptor) -here dbgp - constant /dbgp +dbgp set-acpi-table-length [then]
create facs @@ -205,8 +191,21 @@ ( 18 8 ) 0. d, \ 64-bit waking vector ( 20 1 ) 1 c, \ Version ( 21 1f ) here d# 31 dup allot erase -here facs - constant /facs +facs set-acpi-table-length
+create rsdp +( 00 8 ) " RSD PTR " $, \ Signature +( 08 1 ) 00 c, \ Checksum +( 09 6 ) " OLPC " $, \ Oem Id +( 0f 1 ) 2 c, \ ACPI revision (3.0b) +( 10 4 ) rsdt-adr l, \ RSDT Address + +( 14 4 ) d# 36 l, \ Length for extended version +( 18 8 ) xsdt-adr d, \ XSDT Address +( 20 1 ) 0 c, \ extended checksum +( 21 3 ) 0 c, 0 c, 0 c, \ reserved +here rsdp - constant /rsdp + : fix-checksum ( table /table checksum-offset -- ) >r over >r ( table /table r: cksum-offset table ) 0 -rot bounds ?do i c@ + loop ( sum ) @@ -227,6 +226,12 @@ h# 1000 - \ Safety page ;
+: >acpi-table-len ( adr -- len ) la1+ l@ ; +: copy-acpi-table ( src dst -- ) + tuck over >acpi-table-len move ( dst ) + dup >acpi-table-len 9 fix-checksum +; + : setup-acpi ( -- ) [ifdef] notdef \ This has to agree with the _SB's _INI method, which gets the memory size @@ -234,14 +239,14 @@ memory-limit d# 10 rshift 'ebda h# 180 + l! [then]
- \ Copy rsdt and fadt to low memory + \ Copy tables to low memory + fadt fadt-adr copy-acpi-table + madt madt-adr copy-acpi-table + hpet hpet-adr copy-acpi-table +\ dbgp dbgp-adr copy-acpi-table + facs facs-adr facs >acpi-table-len move + rsdt rsdt-adr copy-acpi-table rsdp rsdp-adr /rsdp move rsdp-adr h# 14 8 fix-checksum rsdp-adr /rsdp h# 20 fix-checksum - rsdt rsdt-adr /rsdt move rsdt-adr /rsdt 9 fix-checksum - fadt fadt-adr /fadt move fadt-adr /fadt 9 fix-checksum - madt madt-adr /madt move madt-adr /madt 9 fix-checksum - hpet hpet-adr /hpet move hpet-adr /hpet 9 fix-checksum -\ dbgp dbgp-adr /dbgp move dbgp-adr /dbgp 9 fix-checksum - facs facs-adr /facs move
\ Copy in the DSDT \ I suppose we could point to it in FLASH - if so don't compress it, @@ -261,10 +266,8 @@ h# ffffffff h# 20 acpi-l! \ Ack all leftover events ;
-.( Not setting up ACPI automatically) cr stand-init: ACPI tables -." Not setting up ACPI automatically" cr -\ setup-acpi + setup-acpi ;
\ Geode h# 6000 constant xp-smbus-base
Modified: cpu/x86/pc/olpc/via/addrs.fth =================================================================== --- cpu/x86/pc/olpc/via/addrs.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/addrs.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -74,6 +74,8 @@ h# fc000 constant dsdt-adr h# fd000 constant ssdt-adr
+h# ffc00 constant smbios-adr + h# 3e.0000 constant inflate-base h# 30.0000 constant workspace
Modified: cpu/x86/pc/olpc/via/config.fth =================================================================== --- cpu/x86/pc/olpc/via/config.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/config.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -9,6 +9,7 @@ [ifdef] xo-board create use-ec [then] +create use-apic
\ --- The environment that "boots" us --- \ - Image Format - Example Media - previous stage bootloader
Modified: cpu/x86/pc/olpc/via/dsdt.dsl =================================================================== --- cpu/x86/pc/olpc/via/dsdt.dsl 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/dsdt.dsl 2009-06-26 16:10:47 UTC (rev 1225) @@ -18,10 +18,12 @@ Store (Arg1, CMSD) } // Processor Objects - Scope(_PR) { - Processor(_PR.CPU0,0x00,0x00000410,0x06){} - } - +Scope(_PR) +{ + Processor(_PR.CPU0,0x00,0x00000410,0x06) + { + } +} // System Sleep States Name(_S0,Package(){0,0,0,0}) Name(_S1,Package(){4,4,4,4}) @@ -888,13 +890,13 @@ ECDX, 2 //USB3 PM capability status register }
- Method(_STA,0) { //Status of the USB3 Device - If(LEqual(_SB.PCI0.USB3.CMDR, 0x00)) { - Return(0x0D) - } Else { - Return(0x0F) - } + Method(_STA,0) { //Status of the USB3 Device + If(LEqual(_SB.PCI0.USB3.CMDR, 0x00)) { + Return(0x0D) + } Else { + Return(0x0F) } + } }
@@ -904,7 +906,7 @@ Name(_PRW, Package(2){0x0E,3})
Name(_S3D, 3) - + OperationRegion(U2F4,PCI_Config,0x00,0xC2) Field(U2F4,ByteAcc,NoLock,Preserve){ Offset(0x00),
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/fw.bth 2009-06-26 16:10:47 UTC (rev 1225) @@ -346,10 +346,11 @@
fload ${BP}/cpu/x86/pc/olpc/via/acpi.fth
+fload ${BP}/cpu/x86/pc/olpc/via/smbios.fth + [ifdef] Later fload ${BP}/cpu/x86/pc/rmtools.fth fload ${BP}/dev/geode/smi.fth -fload ${BP}/cpu/x86/pc/olpc/smbios.fth \ fload ${BP}/cpu/x86/pc/biosload/rmenter.fth fload ${BP}/cpu/x86/pc/biosints.fth fload ${BP}/cpu/x86/pc/olpc/biosresume.fth
Modified: cpu/x86/pc/olpc/via/ioinit.fth =================================================================== --- cpu/x86/pc/olpc/via/ioinit.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/ioinit.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -167,7 +167,7 @@ [then] .( Check RTC century byte mapping to cmos 32 - see d17f0 rx58) cr [ifdef] use-apic - 58 40 40 mreg \ Enable Internal APIC + 58 40 40 mreg \ Enable Internal IO-APIC [then] [ifdef] xo-board 59 ff 1c mreg \ Keyboard (ports 60,64) and ports 62,66 on LPC bus (EC) @@ -257,6 +257,9 @@ [ifdef] use-apic e7 80 80 mreg \ Enable APIC Cycle Reflect to ALL Bus Master Activity Effective Signal [then] +[ifdef] xo-board + ec 04 00 mreg \ C3 state setting +[then] fc 06 04 mreg \ DPSLP# to SLP# Latency Adjustment - 22.5 us end-table
@@ -278,7 +281,7 @@ \ 74 d8 08 mreg \ Lock Cycle Issued by CPU Blocks P2C Cycles (04 bit is reserved) 74 dc 0c mreg \ Lock Cycle Issued by CPU Blocks P2C Cycles - 04 res be like Phx 75 ff 0f mreg \ Use New grant mechanism for PCI arbitration, PCI Master Bus Timeout is 7x16 PCI clock - 76 fd 50 mreg \ Enable PCI parking, Grant to CPU after 2 PC master grants + 76 fd d0 mreg \ Enable PCI parking, Grant to CPU after 2 PC master grants, support IO address 22 for C3 77 58 48 mreg \ PCI1 FIFO empty blocks CPU to PCI read, Read FIFO times out after 1 ms 80 07 07 mreg \ PCI1 and HDAC upstream read does not pass write, APCI blocks upstream write \ 82 3e 20 mreg \ Monitor CCA and SDIO2 @@ -316,4 +319,6 @@ \ 00 to run - Axxxxx hits VGA in normal mode, hits shadow DRAM in SMM \ 01 to access VGA when in SMM (data cycles only)
+\ acpi-io-base h# 26 + port-rb h# 07 bitset al dx out \ Settings to support C4 state +acpi-io-base h# 26 + port-rb h# 06 bitset al dx out \ Settings to support C3 state acpi-io-base h# 4c + port-rl h# 400 bitset ax dx out \ Set USB power high
Added: cpu/x86/pc/olpc/via/smbios.fth =================================================================== --- cpu/x86/pc/olpc/via/smbios.fth (rev 0) +++ cpu/x86/pc/olpc/via/smbios.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -0,0 +1,485 @@ +\ Make SMBIOS tables + + +0 [if] +h# ffbc0 constant 'pciirq +\ http://www.microsoft.com/whdc/archive/pciirq.mspx +\ create pciirq-header +\ h# 52495024 l, \ $PIR +\ h# 0100 w, \ version 1.0 +\ h# 0040 w, \ Total size +\ +\ 0 c, 0 c, \ Bus#, DevFunc# +\ 0 w, \ Exclusive IRQs +\ 0 l, \ Compatible router +\ 0 l, \ miniport data +\ 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, \ res +\ h# b0 c, \ checksum +\ \ Table data goes here + +: make-pciirq-table ( -- ) + 'pciirq h# 40 erase + h# 52495024 'pciirq l! \ $PIR + h# 0100 'pciirq la1+ w! \ version + h# 0040 'pciirq la1+ wa1+ w! \ total size + h# b0 'pciirq h# 1f + c! \ checksum + \ The rest of the table is 0 because the actual routing + \ is now done by ACPI +; +[then] + +: c$, $, 0 c, ; + +0 value #smbios-tables +: copy-smbios-table ( dst-adr table -- dst-adr' ) + #smbios-tables 1+ to #smbios-tables + 2dup 1+ c@ ( dst-adr table dst-adr len ) + dup >r move ( dst-adr r: len ) + r> + ( dst-adr' ) +; + +: smbios-c, ( dst-adr b -- dst-adr' ) over c! 1+ ; +: smbios-w, ( dst-adr w -- dst-adr' ) over le-w! wa1+ ; +: smbios-l, ( dst-adr l -- dst-adr' ) over le-l! la+ ; +: smbios-null ( dst-adr -- dst-adr' ) 0 smbios-c, ; +: end-smbios-table ( dst-adr -- dst-adr' ) smbios-null ; +: +smbios$ ( dst-adr adr len -- dst-adr' ) + 3dup rot swap move ( dst-adr adr len ) + nip + smbios-null +; + +0 value uuid-adr + +create smbios-entry +( 00 ) " _SM_" $, +( 04 ) 0 c, \ Byte checksum - structure must sum to 0 SETME +( 05 ) h# 1f c, \ Entry structure length +( 06 ) h# 02 c, \ Major version +( 07 ) h# 01 c, \ Minor version +( 08 ) h# 100 w, \ Maximum size of a structure +( 0a ) h# 00 c, \ Entry point revision +( 0b ) 0 c, 0 c, 0 c, 0 c, 0 c, \ Formatted area +( 10 ) " _DMI_" $, \ Intermediate anchor string +( 15 ) 0 c, \ Intermediate checksum SETME +( 16 ) 0 w, \ Structure table length SETME +( 18 ) 0 l, \ Structure table address SETME +\ ( 1c ) d# 11 w, \ Number of structures +( 1c ) d# 12 w, \ Number of structures +( 1e ) h# 21 c, \ BCD revision + +create bios-info +( 00 ) 0 c, \ BIOS info type code +( 01 ) h# 13 c, \ Length (one BIOS characteristic extension byte) +( 02 ) h# 0000 w, \ Handle +( 04 ) 1 c, \ Vendor string index +( 05 ) 2 c, \ Version string index +( 06 ) h# f000 w, \ BIOS starting address segment +( 08 ) 3 c, \ Release date index +( 09 ) h# 0f c, \ BIOS ROM size in 64K chunks, minus 1 +( 0a ) h# 99880 l, \ BIOS characteristics - PCI, Reflash, shadowing, CD boot, selectable boot, EDD +( 0e ) 0 l, \ Vendor and system specific BIOS characteristics +( 12 ) 1 c, \ ACPI is supported +\ " OLPC" c$, \ Vendor string +\ " Q2E00" c$, \ Version string +\ " 04/01/2008" c$, \ Release date string +\ 0 c, \ End + +create system-info +( 00 ) 1 c, \ System info type code +( 01 ) h# 19 c, \ Length (for v2.1) +( 02 ) h# 0100 w, \ Handle +( 04 ) 1 c, \ Manufacturer string index +( 05 ) 2 c, \ Product name string index +( 06 ) 3 c, \ Version string index +( 07 ) 4 c, \ Serial number string index +( 08 ) here to uuid-adr h# 10 allot \ SETME +( 18 ) 6 c, \ Wake up type +\ " OLPC" c$, \ 1: Manufacturer +\ " XO" c$, \ 2: Product Name +\ " 1" c$, \ 3: Version +\ " <sn>" c$, \ 4: Serial number +\ 0 c, + +create base-board-info +( 00 ) 2 c, \ System info type code +( 01 ) h# 8 c, \ Length (for v2.1) +( 02 ) h# 0200 w, \ Handle +( 04 ) 1 c, \ Manufacturer string index +( 05 ) 2 c, \ Product string index +( 06 ) 3 c, \ Version string index +( 07 ) 4 c, \ Serial number string index +\ " QUANTA" c$, \ 1: Manufacturer +\ " XO" c$, \ 2: Product Name +\ " 1" c$, \ 3: Version + + +create system-enclosure +( 00 ) 3 c, \ System enclosure type code +( 01 ) h# 0d c, \ Length (for v2.1) +( 02 ) h# 0300 w, \ Handle +( 04 ) 1 c, \ Manufacturer string index +( 05 ) 9 c, \ Type - laptop +( 06 ) 2 c, \ Version number string index +( 07 ) 0 c, \ Serial number string index +( 08 ) 0 c, \ Asset tag string index +( 09 ) 3 c, \ Boot-up state +( 0a ) 3 c, \ Power Supply State +( 0b ) 3 c, \ Thermal State +( 0c ) 5 c, \ Security Status - XXX set to 4 in secure mode +\ " OLPC" c$, \ 2: Manufacturer +\ " 1" c$, \ 3: Version +\ 0 c, + +create processor-info +( 00 ) 4 c, \ Processor info type code +( 01 ) h# 20 c, \ Length (for v2.1) +( 02 ) h# 0400 w, \ Handle +( 04 ) 0 c, \ Reference designator string index +( 05 ) 3 c, \ Type - CPU +( 06 ) 1 c, \ Family - other +( 07 ) 1 c, \ Manufacturer +( 08 ) h# 5a2 l, h# 88a93d l, \ CPUID results - Set dynamically later +( 10 ) 2 c, \ Processor version string index +( 11 ) h# 8c c, \ Processor voltage (h# 80 + 1.2V/10) +( 12 ) d# 33 w, \ External clock (main bus clock) +( 14 ) d# 433 w, \ Max speed +( 16 ) d# 433 w, \ Current speed +( 18 ) h# 41 c, \ CPU present and enabled +( 19 ) 6 c, \ Processor upgrade - None +( 1a ) h# 0701 w, \ L1 Cache Handle +( 1c ) h# 0703 w, \ L2 Cache Handle +( 1e ) h# ffff w, \ L3 Cache Handle +\ " AuthenticAMD" c$, \ 1: Manufacturer +\ 0 c, + +create l1-icache-info +( 00 ) 7 c, \ Cache info type code +( 01 ) h# 13 c, \ Length +( 02 ) h# 0701 w, \ Handle +( 04 ) 0 c, \ Socket string index +( 05 ) h# 180 w, \ Writeback, enabled, internal, not socketed, L1 +( 07 ) h# 8002 w, \ Max size - 128K +( 09 ) h# 8002 w, \ Installed size - 128K +( 0b ) 1 w, \ Supported SRAM type - unknown +( 0d ) 1 w, \ Installed SRAM type - unknown +( 0f ) 0 c, \ Speed (NS) +( 10 ) 1 c, \ ECC - other +( 11 ) 5 c, \ Type - Unified (actually it is split I and D but they are coherent) +( 12 ) 5 c, \ Associativity - 4-way set-associative +\ 0 w, + +0 [if] +create l1-dcache-info +( 00 ) 7 c, \ Cache info type code +( 01 ) h# 13 c, \ Length +( 02 ) h# 0702 w, \ Handle +( 04 ) 0 c, \ Socket string index +( 05 ) h# 180 w, \ Writeback, enabled, internal, not socketed, L1 +( 07 ) h# 8001 w, \ Max size - 64K +( 09 ) h# 8001 w, \ Installed size - 64K +( 0b ) 1 w, \ Supported SRAM type - unknown +( 0d ) 1 w, \ Installed SRAM type - unknown +( 0f ) 0 c, \ Speed (NS) +( 10 ) 3 c, \ ECC - none +( 11 ) 4 c, \ Type - Data +( 12 ) 8 c, \ Associativity - 16-way set-associative +\ 0 w, +[then] + +create l2-cache-info +( 00 ) 7 c, \ Cache info type code +( 01 ) h# 13 c, \ Length +( 02 ) h# 0703 w, \ Handle +( 04 ) 0 c, \ Socket string index +( 05 ) h# 181 w, \ Writeback, enabled, internal, not socketed, L2 +( 07 ) h# 8002 w, \ Max size - 128K +( 09 ) h# 8002 w, \ Installed size - 128K +( 0b ) 1 w, \ Supported SRAM type - unknown +( 0d ) 1 w, \ Installed SRAM type - unknown +( 0f ) 0 c, \ Speed (NS) +\ ( 10 ) 3 c, \ ECC - none +( 10 ) 1 c, \ ECC - other +( 11 ) 5 c, \ Type - Unified +( 12 ) h# a c, \ Associativity - 32-way set-associative +\ 0 w, + +0 value portinfo# +: make-smbios-port ( dst-adr connectortype porttype name$ -- dst-adr' ) + #smbios-tables 1+ to #smbios-tables + 2>r >r >r + 8 smbios-c, 9 smbios-c, + portinfo# h# 800 + smbios-w, portinfo# 1+ to portinfo# + 0 smbios-c, 0 smbios-c, \ Internal Refdes and Internal Connector Type + 1 smbios-c, \ String index + r> smbios-c, \ Connector type + r> smbios-c, \ Port type + 2r> +smbios$ \ Reference designator string + end-smbios-table +; + +create sd-slot-array +( 00 ) d# 9 c, \ physical-memory-array type code +( 01 ) h# 0d c, \ Length +( 02 ) h# d01 w, \ Handle +( 04 ) 1 c, \ Refdes +( 05 ) h# b c, \ Slot type - proprietary +( 06 ) 1 c, \ Bus width - other +( 07 ) 4 c, \ Usage - in use +( 08 ) 3 c, \ Length - short +( 09 ) h# 0000 w, \ ID - meaningless +( 0b ) 4 c, \ Characteristics 1 - 3.3V +( 0c ) 2 c, \ Characteristics 2 - hot plug + +create video-array +( 00 ) d# 10 c, \ onboard device type code +( 01 ) h# 06 c, \ Length +( 02 ) h# a01 w, \ Handle +( 04 ) h# 83 c, \ Enabled, type 3 (video) +( 05 ) 1 c, \ Description string + +create bios-lang-array +( 00 ) d# 13 c, \ BIOS language type code +( 01 ) h# 16 c, \ Length +( 02 ) h# d01 w, \ Handle +( 04 ) 1 c, \ Number of languages +( 05 ) 1 c, \ Flags - abbreviated format +( 06 ) 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, \ Res +( 15 ) 1 c, \ Currrent language string + +create main-memory-array +( 00 ) d# 16 c, \ physical-memory-array type code +( 01 ) h# 0f c, \ Length +( 02 ) h# 1001 w, \ Handle +( 04 ) 3 c, \ Location - onboard +( 05 ) 3 c, \ Use - system memory +( 06 ) 3 c, \ ECC - none +( 07 ) h# 100000 l, \ Maximum size - 1024K KiB (1 GiB) +( 0b ) h# fffe w, \ Memory Error Info Handle - not provided +( 0d ) 1 w, \ Number of devices +\ 0 w, + +create memory-device +( 00 ) d# 17 c, \ physical-memory-array type code +( 01 ) h# 15 c, \ Length +( 02 ) h# 1101 w, \ Handle +( 04 ) h# 1001 w, \ Handle of "parent" memory array +( 06 ) h# fffe w, \ Memory Error Info Handle - not provided +( 08 ) d# 64 w, \ Total width +( 0a ) d# 64 w, \ Data width +( 0c ) h# 400 w, \ Size - 1024 MB +( 0e ) h# 0b c, \ Form factor - row of chips +( 0f ) 0 c, \ Set - not part of a set +( 10 ) 1 c, \ Device Locator string index +( 11 ) 0 c, \ Bank Locator string index +( 12 ) h# 13 c, \ Memory type - DDR3 +( 13 ) h# 0080 w, \ Memory type detail - Synchronous +\ " Soldered" c$, +\ 0 w, + +create ma-mapped-address +( 00 ) d# 19 c, \ memory-array-mapped-address type code +( 01 ) h# 0f c, \ Length +( 02 ) h# 1301 w, \ Handle +( 04 ) 0 l, \ Starting address - first KiB +( 08 ) h# fffff l, \ Ending address - last KiB +( 0c ) h# 31 w, \ Handle of "parent" memory array +( 0e ) h# 1 c, \ Partition width +\ 0 w, + +create pointing-device +( 00 ) d# 21 c, \ system boot info type code +( 01 ) h# 07 c, \ Length +( 02 ) h# 1501 w, \ Handle +( 04 ) 7 c, \ Type - touchpad +( 05 ) 4 c, \ Interface - PS/2 +( 06 ) 2 c, \ #buttons - 2 + + +create system-boot-info +( 00 ) d# 32 c, \ system boot info type code +( 01 ) h# 0b c, \ Length +( 02 ) h# 2000 w, \ Handle +( 04 ) 0 l, 0 w, \ 6 reseved bytes +( 0a ) 0 c, \ Boot status - no errors +\ 0 w, + +create end-array +( 00 ) h# 7f c, \ End type code +( 01 ) h# 04 c, \ Length +( 02 ) h# 7f01 w, \ Handle + + +: test-name$ ( -- $ ) " IE8y2D ScD%g4r2bAIFA." ; +: test-version$ ( -- $ ) " OLPC Ver 1.50.01" ; +: fw-version$ ( -- $ ) + " /openprom" find-package if + " model" rot get-package-property 0= if + get-encoded-string ( adr len ) + dup d# 16 = if + \ We just want the "Q2E00" part + drop 6 + 5 exit + then + 2drop + then + then + " Unknown" +; +d# 10 buffer: fw-date-buf + +\ Convert build-date format "2008-04-14" to SMBIOS format "04/14/2008" +: fw-date$ ( -- $ ) + " xx/xx/xxxx" fw-date-buf swap move + " build-date" evaluate drop ( adr ) + dup fw-date-buf 6 + 4 move ( adr ) \ Year + dup 5 + fw-date-buf 2 move ( adr ) \ Month + 8 + fw-date-buf 3 + 2 move ( ) \ Day + fw-date-buf d# 10 +; +: get-tag$ ( tag$ -- value$ ) find-tag 0= if " Not Available" then ?-null ; + +: too-long? ( dst-adr -- dst-adr flag ) dup pad - h# 10 >= ; +: (uuid) ( -- true | adr len false ) + " U#" find-tag if ( adr len ) + ?-null ( adr len' ) + pad -rot ( dst-adr adr len ) + bounds ?do ( dst-adr ) + too-long? if drop true unloop exit then + i c@ h# 10 digit if ( dst-adr digith ) + i 1+ c@ h# 10 digit if ( dst-adr digith digitl ) + swap 4 lshift or ( dst-adr byte ) + over c! 1+ ( dst-adr' ) + 2 ( dst-adr advance ) + else ( dst-adr digith char ) + 3drop true unloop exit + then ( dst-adr ) + else ( dst-adr char ) + [char] - <> if drop true unloop exit then + 1 ( dst-adr advance ) + then ( dst-adr advance ) + +loop ( dst-adr ) + pad tuck - ( adr len ) + dup h# 10 = if ( adr len ) + false \ Good UUID ( adr len false ) + else ( adr len ) + 2drop true ( true ) + then ( true | adr len false ) + else ( ) + true ( true ) + then ( true | adr len false ) +; +: get-uuid ( -- uuid$ ) + (uuid) if " "(00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff)" then +; + +code get-cpuid ( code -- eax ebx ecx edx ) + ax pop cpuid ax push bx push cx push dx push +c; +0 value ptr +: 0pad ( -- ) pad to ptr ; +: pad, ( n -- ) ptr ! ptr na1+ to ptr ; + +: cpu-family$ ( -- adr len ) + 0 get-cpuid 0pad rot pad, pad, pad, drop + pad d# 12 +; + +: 4scramble ( a b c d -- d c b a ) swap 2swap swap ; +: cpu-name, ( cpuid# -- ) get-cpuid 4scramble pad, pad, pad, pad, ; + +: cpu-name$ ( -- adr len ) + 0pad + h# 8000.0002 cpu-name, + h# 8000.0003 cpu-name, + h# 8000.0004 cpu-name, + pad h# 30 -leading -trailing +; + +: +OLPC ( adr -- adr' ) " OLPC" +smbios$ ; +: setup-smbios ( -- ) + 0 to #smbios-tables + 0 to portinfo# + + smbios-entry smbios-adr h# 1f move + smbios-adr h# 1f + ( adr ) + + bios-info copy-smbios-table ( adr ) + test-name$ +smbios$ + test-version$ +smbios$ +\ +OLPC +\ fw-version$ +smbios$ + fw-date$ +smbios$ + end-smbios-table + + dup >r ( adr r: adr ) + system-info copy-smbios-table ( adr r: adr ) + get-uuid r> 8 + swap move ( adr ) + +OLPC + " XO" +smbios$ + " 1" +smbios$ \ Version + " SN" get-tag$ +smbios$ + end-smbios-table + + base-board-info copy-smbios-table ( adr ) + " QUANTA" +smbios$ + " XO" +smbios$ + " 1.5" +smbios$ \ Version + " SN" get-tag$ +smbios$ + end-smbios-table + + \ XXX might need to amend the security status field + system-enclosure copy-smbios-table ( adr ) + +OLPC + " 1.5" +smbios$ \ Version + end-smbios-table + + dup >r ( adr r: adr ) + processor-info copy-smbios-table ( adr' r: adr ) + 1 get-cpuid nip nip ( adr' eax edx r: adr ) + r@ h# c + l! r> 8 + l! ( adr' ) + cpu-family$ +smbios$ + cpu-name$ +smbios$ + end-smbios-table + + l1-icache-info copy-smbios-table smbios-null end-smbios-table +\ l1-dcache-info copy-smbios-table smbios-null end-smbios-table + l2-cache-info copy-smbios-table smbios-null end-smbios-table + +[ifdef] notdef \ Why bother - XP doesn't collect these + h# 1f h# 1d " Microphone" make-smbios-port + h# 1f h# 1d " Headphone" make-smbios-port + h# 12 h# 10 " USB1" make-smbios-port + h# 12 h# 10 " USB2" make-smbios-port + h# 12 h# 10 " USB3" make-smbios-port + + sd-slot-array copy-smbios-table " SD Slot" +smbios$ end-smbios-table + bios-lang-array copy-smbios-table " enUS" +smbios$ end-smbios-table +[then] + video-array copy-smbios-table " CON" +smbios$ end-smbios-table + + main-memory-array copy-smbios-table smbios-null end-smbios-table + memory-device copy-smbios-table " Soldered" +smbios$ end-smbios-table + ma-mapped-address copy-smbios-table smbios-null end-smbios-table + +\ XP ignores it +\ pointing-device copy-smbios-table smbios-null end-smbios-table + + \ PORTABLE BATTERY (TYPE 22) + +\ XP ignores it +\ system-boot-info copy-smbios-table smbios-null end-smbios-table + + end-array copy-smbios-table smbios-null end-smbios-table ( adr' ) + + \ Fixup the entry structure + smbios-adr h# 1f + tuck - ( tables-adr tables-len ) + smbios-adr h# 16 + w! ( tables-adr ) + smbios-adr h# 18 + l! ( ) + #smbios-tables smbios-adr h# 1c + w! + + smbios-adr h# 1f 4 fix-checksum \ Overall checksum + smbios-adr h# 10 + h# 0f 5 fix-checksum \ Intermediate checksum +; + +stand-init: SMBIOS tables + setup-smbios +;
Modified: cpu/x86/pc/olpc/via/versions.fth =================================================================== --- cpu/x86/pc/olpc/via/versions.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ cpu/x86/pc/olpc/via/versions.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -2,7 +2,7 @@
\ The overall firmware revision macro: FW_MAJOR A -macro: FW_MINOR 03t +macro: FW_MINOR 04
\ The EC microcode macro: EC_VERSION 1_9_1
Modified: ofw/inet/ip.fth =================================================================== --- ofw/inet/ip.fth 2009-06-25 21:23:17 UTC (rev 1224) +++ ofw/inet/ip.fth 2009-06-26 16:10:47 UTC (rev 1225) @@ -76,9 +76,11 @@ then ( 'netmask-c ) ;
-\ either h# ffffffff or h# 0 is broadcast ip addr +\ Matches either h# ffffffff or h# 0 or subnet-specific broadcast addr : broadcast-ip-addr? ( adr-buf -- flag ) - dup broadcast-ip-addr ip= swap unknown-ip-addr? or + dup broadcast-ip-addr ip= + swap def-broadcast-ip ip= or + over unknown-ip-addr? or ;
: netmask ( -- 'ip )