[OpenBIOS] r825 - in cpu/x86/pc: lxdevel olpc
svn at openbios.org
svn at openbios.org
Wed May 21 23:16:50 CEST 2008
Author: wmb
Date: 2008-05-21 23:16:50 +0200 (Wed, 21 May 2008)
New Revision: 825
Removed:
cpu/x86/pc/lxdevel/usb8388.bth
cpu/x86/pc/olpc/draminit.fth
cpu/x86/pc/olpc/gpio.fth
cpu/x86/pc/olpc/linux.fth
cpu/x86/pc/olpc/startmacros.fth
cpu/x86/pc/olpc/usb.fth
Log:
Deleted files that the previous checkin moved to more generic locations.
Deleted: cpu/x86/pc/lxdevel/usb8388.bth
===================================================================
--- cpu/x86/pc/lxdevel/usb8388.bth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/lxdevel/usb8388.bth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,25 +0,0 @@
-purpose: Fetch the firmware for the Marvell 8388 wireless LAN module
-
-command: &builder &this
-build-now
-
-fload ${BP}/cpu/x86/pc/olpc/versions.fth
-
-" wget -O - http://www.laptop.org/teamwiki/images/6/60/Libertas-firmware.tgz | tar xfz -" $sh
-" grep version: libertas-fw-${WLAN_DATE}/RELEASE_NOTES | cut -d ' ' -f 3 | tr -d \\n >libertas.version" expand$ $sh
-
-reading libertas.version
-here dup d# 50 ifd @ fgets ( adr len )
-ifd @ fclose ( adr len )
-
-" ${WLAN_VERSION}" expand$ $= 0= [if]
-.( Wrong Libertas version ) cr
-error-exit
-[then]
-
-" cp libertas-fw-${WLAN_DATE}/usb8388.bin ." expand$ $sh
-
-\ This forces the creation of an .log file, so we don't re-fetch
-writing usb8388.version
-" ${WLAN_VERSION}"n" expand$ ofd @ fputs
-ofd @ fclose
Deleted: cpu/x86/pc/olpc/draminit.fth
===================================================================
--- cpu/x86/pc/olpc/draminit.fth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/olpc/draminit.fth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,117 +0,0 @@
- h# 18 # al mov al h# 80 # out
- h# 1430 # dx mov dx ax in h# 9999 # ax cmp = if
- h# 34 # al mov al h# 70 # out \ Write to CMOS 0x34
- h# 18 # al mov al h# 71 # out \ Write value 01
- then
-
- \ Enable DLL, load Extended Mode Register by set and clear PROG_DRAM
- 20000018 rmsr
- 10000001 bitset 20000018 wmsr
- 10000001 bitclr 20000018 wmsr
-
- \ Reset DLL (bit 27 is undocumented in GX datasheet, but is in the LX one)
- 08000001 bitset 20000018 wmsr
- 08000001 bitclr 20000018 wmsr
-
- \ Here we are supposed to wait 200 SDCLK cycles to let the DLL settle.
- \ That is approximately 2 uS. The ROM instruction access is so slow that
- \ anything we do will take quite a bit longer than that, so we just let the
- \ "rmsr, bitset" sequence take care of the time delay for us.
-
- \ In the following sequence of writes the 2000.0018 MSR, we
- \ take advantage of the fact that the existing value stays
- \ in EAX/EDX, so we don't have to re-read the value.
-
- \ Generate 2 refresh requests. The refresh queue is 8 deep, and we
- \ need to make sure 2 refreshes hit the chips, so we have to issue
- \ 10 requests to the queue. According to the GX datasheet, we don't
- \ have to clear the REF_TST bit (8) explicitly between writes
- 20000018 rmsr 8 bitset
- wrmsr wrmsr wrmsr wrmsr wrmsr wrmsr wrmsr wrmsr wrmsr wrmsr
- 8 bitclr
-
-\ LinuxBIOS LX raminit.c has a big delay here, using Port 61
-
- \ Load Mode Register
- 1 bitset 20000018 wmsr
- 1 bitclr 20000018 wmsr
-
- \ Set up a descriptor to give access to memory
- \ GLIU0 P2D Base Mask Descriptors - page 85
- 20000000.000fff00. 10000020 set-msr \ memory - 0..fffff
-
- \ The RAM DLL needs a write to lock on
- ax h# ffff0 #) mov
-
- h# 19 # al mov al h# 80 # out
- h# 1430 # dx mov dx ax in h# 9999 # ax cmp = if
- h# 34 # al mov al h# 70 # out \ Write to CMOS 0x34
- h# 19 # al mov al h# 71 # out \ Write value 01
- then
-
- \ Turn on the cache
- cr0 ax mov
- 6000.0000 bitclr \ Cache-disable off, coherent
- ax cr0 mov
- invd
-
- h# 1a # al mov al h# 80 # out
- h# 1430 # dx mov dx ax in h# 9999 # ax cmp = if
- h# 34 # al mov al h# 70 # out \ Write to CMOS 0x34
- h# 1a # al mov al h# 71 # out \ Write value 01
- then
-
- 0000f001.00001400. 5140000f set-msr \ PMS BAR
-
- \ It is tempting to test bit 0 of PM register 5c, but a 5536 erratum
- \ prevents that bit from working. Bit 1 works, but LX errata 34
- \ sometimes requires that we reset the system to fix the memory DLL,
- \ which destroys all the bits of PM register 5c. So we put a breadcrumb
- \ in a PM register that we don't otherwise use.
- 1430 port-rl h# 9999 # ax cmp = if \ Wakeup event flag
- 0 1430 port-wl
- h# 1b # al mov al h# 80 # out
- h# 34 # al mov al h# 70 # out \ Write to CMOS 0x34
- h# 1b # al mov al h# 71 # out \ Write value 01
-
- char r 3f8 port-wb begin 3fd port-rb 40 bitand 0<> until
-
- resume-data # sp mov
- resume-entry # ax mov ax call \ This might return if checksumming fails
- char x 3f8 port-wb begin 3fd port-rb 40 bitand 0<> until
- then
-
- h# 1c # al mov al h# 80 # out
- h# 1808 rmsr \ Default region configuration properties MSR
- h# 0fffff00 # ax and \ Top of System Memory field
- 4 # ax shl \ Shift into place
- ax mem-info-pa 4 + #) mov \ Put it where resetend.fth can find it
-
- \ char D 3f8 port-wb begin 3fd port-rb 40 bitand 0<> until
-
- \ Memory is now on
- h# 8.0000 # sp mov \ Setup a stack pointer for later code
-
- h# 1d # al mov al h# 80 # out
-\ Some optional debugging stuff ...
-[ifdef] debug-startup
-init-com1
-
-carret report
-linefeed report
-ascii F report
-ascii o report
-ascii r report
-[then]
-
-\ fload ${BP}/cpu/x86/pc/ramtest.fth
-
-0 [if]
-ax ax xor
-h# 12345678 # bx mov
-bx 0 [ax] mov
-h# 5555aaaa # 4 [ax] mov
-0 [ax] dx mov
-dx bx cmp <> if ascii B report ascii A report ascii D report begin again then
-[then]
-
Deleted: cpu/x86/pc/olpc/gpio.fth
===================================================================
--- cpu/x86/pc/olpc/gpio.fth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/olpc/gpio.fth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,61 +0,0 @@
-\ See license at end of file
-purpose: Access to GPIO registers
-
-\ GPIO registers
-h# 00 constant OUT_VAL
-h# 04 constant OUT_EN
-h# 08 constant OUT_OD_EN
-h# 0c constant OUT_INVRT_EN
-h# 10 constant OUT_AUX1
-h# 14 constant OUT_AUX2
-h# 18 constant PU_EN
-h# 1c constant PD_EN
-h# 20 constant IN_EN
-h# 24 constant INV_EN
-h# 28 constant IN_FLTR_EN
-h# 2c constant EVNTCNT_EN
-h# 30 constant READ_BACK
-h# 38 constant EVNT_EN
-
-h# 1000 value gpio-base \ stand-init sets this from an MSR
-: gpio@ ( offset -- 0 ) gpio-base + pl@ ;
-: gpio! ( l offset -- ) gpio-base + pl! ;
-
-alias >set noop ( mask -- mask' )
-: >clr ( mask -- mask' ) d# 16 lshift ;
-
-: >hi ( reg# -- reg#' ) h# 80 + ; \ High bank for GPIO bits 16..31
-
-: gpio-data@ ( -- l ) h# 30 gpio@ ;
-
-
-h# 5140000C constant MSR_LBAR_GPIO
-
-stand-init: gpio
- MSR_LBAR_GPIO rdmsr ( lo hi )
- h# 0000f001 <> abort" GPIO not enabled"
- h# ff00 and to gpio-base
-;
-\ LICENSE_BEGIN
-\ Copyright (c) 2006 FirmWorks
-\
-\ Permission is hereby granted, free of charge, to any person obtaining
-\ a copy of this software and associated documentation files (the
-\ "Software"), to deal in the Software without restriction, including
-\ without limitation the rights to use, copy, modify, merge, publish,
-\ distribute, sublicense, and/or sell copies of the Software, and to
-\ permit persons to whom the Software is furnished to do so, subject to
-\ the following conditions:
-\
-\ The above copyright notice and this permission notice shall be
-\ included in all copies or substantial portions of the Software.
-\
-\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-\
-\ LICENSE_END
Deleted: cpu/x86/pc/olpc/linux.fth
===================================================================
--- cpu/x86/pc/olpc/linux.fth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/olpc/linux.fth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,534 +0,0 @@
-\ See license at end of file
-purpose: Linux bzImage program loading
-
-\ \needs ramdisk " disk:\boot\initrd.img" d# 128 config-string ramdisk
-\ " ro root=LABEL=OLPCRoot rootfstype=ext3 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" ' boot-file set-config-string-default
-\ " disk:\boot\vmlinuz" ' boot-device set-config-string-default
-
-\ \needs ramdisk " " d# 128 config-string ramdisk
-\ " nand:\boot\vmlinuz" ' boot-device set-config-string-default
-\ " ro root=mtd0 rootfstype=jffs2 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" ' boot-file set-config-string-default
-
-\needs ramdisk " " d# 128 config-string ramdisk
-" " ' boot-file set-config-string-default \ Let the olpcboot.fth file set the cmdline
-" disk:\boot\olpc.fth sd:\boot\olpc.fth nand:\boot\olpc.fth /prober /usb/ethernet /usb/wlan" ' boot-device set-config-string-default
-
-0 value ramdisk-adr
-0 value /ramdisk
-
-0 [if] \ From include/asm-i386/setup.h
-#define PARAM (boot_params)
-#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
-#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
-#define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
-#define E820_MAP_NR (*(char*) (PARAM+E820NR))
-#define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
-#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
-#define IST_INFO (*(struct ist_info *) (PARAM+0x60))
-#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
-#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
-#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
-#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
-#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
-#define EFI_MEMMAP ((void *) *((unsigned long *)(PARAM+0x1d0)))
-#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4)))
-#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
-#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
-#define VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA))
-#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
-#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
-#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
-#define KERNEL_START (*(unsigned long *) (PARAM+0x214))
-#define INITRD_START (*(unsigned long *) (PARAM+0x218))
-#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
-#define EDID_INFO (*(struct edid_info *) (PARAM+0x140))
-#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
-#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
-#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
-#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
-
-#define PARAM_SIZE 4096
-#define COMMAND_LINE_SIZE 256
-
-#define OLD_CL_MAGIC_ADDR 0x90020
-#define OLD_CL_MAGIC 0xA33F
-#define OLD_CL_BASE_ADDR 0x90000
-#define OLD_CL_OFFSET 0x90022
-#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
-
-\ From arch/i386/kernel/setup.c
-#define RAMDISK_IMAGE_START_MASK 0x07FF
-#define RAMDISK_PROMPT_FLAG 0x8000
-#define RAMDISK_LOAD_FLAG 0x4000
-[then]
-
-create screen-info \ See struct screen_info in include/linux/tty.h
- 0 c, \ 0 x position
- 0 c, \ 1 y position
- 0 w, \ 2 plug in memory size here
- 0 w, \ 4 video page
- 0 c, \ 6 video mode - 7 means monochrome, anything else is color
- d# 80 c, \ 7 columns
- 0 w, \ 8 unused
- 0 w, \ a ega_bx - anything but 0x10
- 0 w, \ c unused
- d# 25 c, \ e lines
- 0 c, \ f isVGA?
- d# 16 w, \ 10 font height
-here screen-info - constant /screen-info
-
-
-h# 9.0000 constant linux-params
-h# 10.0000 value linux-base
-: code16-size ( -- #bytes ) load-base h# 1f1 + c@ 1+ d# 512 * ;
-0 value cmdline-offset
-
-\ Find the end of the largest piece of memory
-: memory-limit ( -- limit )
- " /memory" find-package 0= abort" No /memory node" ( phandle )
- " available" rot get-package-property abort" No memory node available property" ( $ )
- \ Find the memory piece that starts at 1 Meg
- begin dup 8 >= while ( $ )
- decode-int h# 10.0000 = if ( $ ) \ Found the one we want
- decode-int h# 10.0000 + ( $ limit )
- nip nip exit
- then ( $ )
- decode-int drop ( $ )
- repeat ( $ )
- 2drop true abort" No suitable memory piece"
-;
-
-d# 20 constant /root-dev-buf
-/root-dev-buf buffer: root-dev-buf
-
-: make-root-dev$ ( idx -- root-dev$ )
- root-dev-buf /root-dev-buf 0 fill
- " root=/dev/hda" rot
- 1+ base @ >r d# 10 base ! (.) r> base !
- $cat2
- 2dup 2>r root-dev-buf swap move
- 2r> free-mem
- root-dev-buf /root-dev-buf
-;
-: +lp ( offset -- adr ) linux-params + ;
-
-0 [if]
-: add-root-dev ( cmdline$ -- cmdline$' )
- 2>r " root=" 2r@ sindex -1 = if
- 2r>
- " disk:root,\" $partition-idx dup -1 <> if
- make-root-dev$ $cat2
- else
- drop
- then
- else
- 2r>
- then
-;
-[else]
-: add-root-dev ( cmdline$ -- cmdline$' )
-;
-[then]
-
-: set-parameters ( cmdline$ -- )
- screen-info linux-params /screen-info move \ Ostensibly screen info
-
- memory-limit ( #bytes )
- d# 1023 invert and d# 1024 / ( #kbytes )
- d# 1024 - h# 002 +lp w! \ Kbytes of extended (not the 1st meg) memory
-
- memory-limit ( #bytes )
- d# 1023 invert and d# 1024 / ( #kbytes )
- d# 1024 - h# 1e0 +lp l! \ Alternate amount of extended memory
-
- 0 h# 1f2 +lp w! \ root flags - non0 to mount root read-only
- 0 h# 1f8 +lp w! \ Ramdisk flags
-
-\ 301 for /dev/hda, 100 for /dev/ram0, 0 for nothing (set it from cmdline)
-\ h# 301 h# 1fc +lp w! \ root_dev - see init/main.c:parse_root_dev
-\ h# 100 h# 1fc +lp w! \ root_dev - see init/main.c:parse_root_dev
- h# 0 h# 1fc +lp w! \ root_dev - see init/main.c:parse_root_dev
-
- 0 h# 1ff +lp c! \ Aux device - set to AA if PS2 mouse present
- /ramdisk 0<> h# 210 +lp w! \ loader type - set non0 to enable ramdisk info
-\ h# 100000 h# 214 +lp l! \ kernel start - unused
- ramdisk-adr h# 218 +lp l! \ initrd start
- /ramdisk h# 21c +lp l! \ initrd size
-
- \ Put Open Firmware signature and IDT pointer in the params area
- " OFW " drop @ h# b0 +lp l! \ Validator for this area
- 1 h# b4 +lp l! \ Number of additional items (version#)
- cif-handler h# b8 +lp l! \ Client interface handler
- idt drop h# bc +lp l! \ So Linux can preserve our debug vectors
-
- \ Command line goes after the 16-bit wad
- ( cmdline$ ) add-root-dev
- ( cmdline$ ) cmdline-offset +lp swap 1+ move
- h# a33f h# 20 +lp w! \ Command line validator (magic number)
- cmdline-offset h# 22 +lp w! \ Command line offset
- cmdline-offset +lp h# 228 +lp l! \ New command line address
-;
-
-: linux-fixup ( -- )
-[ifdef] linux-logo linux-logo [then]
- args-buf cscount set-parameters ( )
- h# ff h# 21 pc! \ Squelch the timer interrupt and others
-
- linux-base linux-params (init-program)
- linux-params to %esi
-;
-
-d# 256 buffer: ramdisk-buf
-' ramdisk-buf " ramdisk" chosen-string
-
-defer load-ramdisk
-: $load-ramdisk ( name$ -- )
- 0 to /ramdisk ( name$ )
-
- ['] load-path behavior >r ( name$ r: xt )
- ['] ramdisk-buf to load-path ( name$ r: xt )
-
- ." Loading ramdisk image from " 2dup type ." ..." ( name$ r: xt )
- ['] boot-read catch ( throw-code r: xt )
- cr ( throw-code r: xt )
- r> to load-path ( throw-code )
- throw
- loaded to /ramdisk to ramdisk-adr
-;
-: cv-load-ramdisk ( -- )
- " ramdisk" eval dup 0= if 2drop exit then ( name$ )
- $load-ramdisk
-;
-' cv-load-ramdisk to load-ramdisk
-
-: claim-params ( -- )
-[ifdef] virtual-mode
- 0 0 1meg -1 mmu-map ( ) \ Make the parameter area accessible
-[then]
- 0 +lp h# 1000 0 mem-claim drop \ Play nice with memory reporting
- 0 +lp h# 1000 erase
-;
-
-0 value linux-loaded?
-: ?linux-elf-map-in ( va size -- )
- \ The Linux startup code really wants the physical address to be
- \ virtual_address AND 0x0fff.ffff. We recognize Linux by the virtual
- \ address range that it uses (0xc0xx.xxxx)
- over h# f000.0000 and h# c000.0000 = if
- h# 40.0000 to linux-base
- h# 800 to cmdline-offset
- true to linux-loaded?
- over h# 0fff.ffff and ( va size pa )
- -rot -1 ( pa va size mode )
- mmu-map
- exit
- then
- (elf-map-in)
-;
-' ?linux-elf-map-in is elf-map-in
-
-: init-bzimage? ( -- flag )
- loaded ( adr len )
- h# 202 /string ( adr' len' )
- 4 < if drop false exit then ( adr )
- " HdrS" comp if false exit then ( )
- h# 10.0000 to linux-base
- code16-size to cmdline-offset \ Save in case we clobber load-base
- load-base 0 +lp code16-size move \ Copy the 16-bit stuff
- loaded code16-size /string linux-base swap move \ Copy the 32-bit stuff
- true to linux-loaded?
- true
-;
-
-warning @ warning off
-: init-program ( -- )
- init-bzimage? if exit then
- init-program
-;
-
-: ?memtest-elf-map-in ( vaddr size -- )
- \ We recognize memtest by its virtual address of 0x10000
- \ It expects that virtual = physical; we depend on the fact
- \ that we have low memory mapped V=P
- over h# 10000 = if ( vaddr size )
- \ Map the frame buffer (virtual=physical)
- h# 910 config-l@ dup 100.0000 -1 mmu-map
- then
-
- \ If it's not memtest, chain to the linux recognizer
- ?linux-elf-map-in
-;
-' ?memtest-elf-map-in is elf-map-in
-
-: memtest ( -- ) unfreeze " rom:memtest" $boot ;
-
-: sym ( "name" -- adr )
- parse-word $sym> 0= if err-sym-not-found throw then
-;
-warning !
-
-warning @ warning off
-: init-program ( -- )
- false to linux-loaded?
- init-program
- linux-loaded? if
- claim-params
- ['] load-ramdisk guarded
- linux-fixup
- then
-;
-warning !
-
-: mcr ( -- ) cr exit? throw ;
-: help-debug ( -- )
- red-letters
- ." Debugging the Linux kernel requires a few patches to keep Linux from" mcr
- ." overwriting the firmware debug vector." mcr mcr
- black-letters
-
- ." COMMAND STACK EFFECT DESCRIPTION" mcr
- ." .registers ( -- ) Display registers" mcr
- ." go ( -- ) Resume execution" mcr
- ." step ( -- ) Single-step" mcr
- ." ^T ( -- ) (Control-T) Keystroke shortcut for 'step'" mcr
- ." steps ( n -- ) Single-step n times" mcr
- ." hop ( -- ) Step over subroutine calls" mcr
- ." hops ( n -- ) Hop n times" mcr
- ." dis ( addr -- ) Disassemble starting at given address" mcr
- ." +dis ( -- ) Continue disassembling" mcr
- ." bp ( addr -- ) Set breakpoint at given address" mcr
- ." till ( addr -- ) Set breakpoint at given address and go" mcr
- ." -bp ( addr -- ) Delete breakpoint at given address" mcr
- ." --bp ( -- ) Delete last breakpoint" mcr
- ." .bp ( -- ) Show breakpoints" mcr
- ." return ( -- ) Finish execution of current subroutine" mcr
- ." finish-loop ( -- ) Finish execution of current loop" mcr
- ." %eax ( -- n ) Push EAX (etc.) register value on stack" mcr
- ." %eip ( -- n ) Push EIP register value on stack" mcr
- ." %pc ( -- n ) Same as %eip" mcr
- ." to %eax ( n -- ) Set EAX (etc.) register value from stack" mcr
- ." to %eip ( n -- ) Set EIP register value from stack" mcr
- ." sym <name> ( -- n ) Push value of named kernel symbol on stack" mcr
- ." .adr ( n -- ) Display symbol name closest to n" mcr
- ." Examples: " mcr
- ." %pc dis Disassemble starting at program counter" mcr
- ." %ebx u. Display saved value of EBX register" mcr
- ." step Single step once" mcr
- ." 10 hops Step 10 times, don't go down into subroutines" mcr
- ." 1234 to %ebp Set EBP register to (hex) 1234" mcr
- ." sym kbd_init dis Disassemble starting at kbd_init" mcr
- ." sym kbd_init till Set breakpoint at kbd_init and go" mcr
- ." %pc 5 + to %pc Add 5 to the program counter register" mcr
-
- mcr
- ." More information: http://firmworks.com/QuickRef.html" cr
-;
-
-d# 34 to default-#lines
-
-warning @ warning off
-: help ( -- )
- blue-letters ." UPDATES:" black-letters mcr
- ." flash u:\q2c18.rom Rewrite the firmware from USB key" mcr
- ." flash nand:\q2c18.rom Rewrite the firmware from NAND file" mcr
- ." copy-nand u:\boot\nand290.img Rewrite the OS on NAND from USB key" mcr
- mcr
- blue-letters ." DIRECTORY LISTING:" black-letters mcr
- ." dir u:\ List USB key root directory" mcr
- ." dir u:\boot\ List USB key /boot directory" mcr
- ." dir nand:\boot\ List NAND FLASH /boot directory" mcr
- ." dir nand:\boot\*.rom List .rom files in NAND FLASH /boot directory" mcr
- mcr
- blue-letters ." BOOTING:" black-letters mcr
- ." boot Load the OS from list of default locations" mcr
- ." 'printenv boot-device' shows the list" mcr
- ." boot <cmdline> Load the OS, passing <cmdline> to kernel" mcr
- ." boot u:\boot\vmlinuz Load the OS from a specific location" mcr
- mcr
- blue-letters ." CONFIGURATION VARIABLES FOR BOOTING:" black-letters mcr
- ." boot-device Kernel or boot script path. Example: nand:\boot\olpc.fth" mcr
- ." boot-file Default cmdline. Example: console=ttyS0,115200" mcr
- ." ramdisk initrd pathname. Example: disk:\boot\initrd.imz" mcr
- mcr
- blue-letters ." MANAGING CONFIGURATION VARIABLES:" black-letters mcr
- ." printenv [ <name> ] Show configuration variables" mcr
- ." setenv <name> <value> Set configuration variable" mcr
- ." editenv <name> Edit configuration variable" mcr
- mcr
- blue-letters ." DIAGNOSTICS:" black-letters mcr
- ." test <device-name> Test device. Example: test mouse" mcr
- ." test-all Test all devices that have test routines" mcr
- mcr
- ." More information: "
- green-letters ." http://wiki.laptop.org/go/OFW_FAQ" black-letters cr
-;
-warning !
-
-0 [if]
-
-: linux ( "cmdline" -- )
- load-ramdisk
- load
- ." Linux start address at " %eip u. cr
- ." Type 'go' to start it or 'help-debug' to see debugger commands." cr
-;
-
-\ " load_ramdisk=1 root=/dev/ram0 console=/dev/ttyS0,9600 console=/dev/tty0"
-
-
-: uint8_t ( offset -- offset' )
- create dup , /c + does> @ the-struct + c@ ( b )
-;
-: uint16_t ( offset -- offset' )
- create dup , /w + does> @ the-struct + w@ ( w )
-;
-: uint32_t ( offset -- offset' )
- create dup , /l + does> @ the-struct + l@ ( l )
-;
-: uint8s ( offset size -- offset' ) sfield ;
-
-: reserved + ;
-: ends-at ( offset n -- ) nip ;
-struct \ x86_linux_header
- h# 1f1 reserved \ 0x000
- uint8_t setup_sects \ 0x1f1
- uint16_t root_flags \ 0x1f2
- uint16_t syssize \ 0x1f4
- uint16_t swapdev \ 0x1f6
- uint16_t ramdisk_flags \ 0x1f8
- uint16_t vid_mode \ 0x1fa
- uint16_t root_dev \ 0x1fc
- uint16_t boot_sector_magic \ 0x1fe
- \ 2.00+
- 2 reserved \ 0x200
- 4 uint8s header_magic \ 0x202
- uint16_t protocol_version \ 0x206
- uint32_t realmode_swtch \ 0x208
- uint16_t start_sys \ 0x20c
- uint16_t kver_addr \ 0x20e
- uint8_t type_of_loader \ 0x210
- uint8_t loadflags \ 0x211
- uint16_t setup_move_size \ 0x212
- uint32_t code32_start \ 0x214
- uint32_t ramdisk_image \ 0x218
- uint32_t ramdisk_size \ 0x21c
- 4 reserved \ 0x220
- \ 2.01+
- uint16_t heap_end_ptr \ 0x224
- 2 reserved \ 0x226
- \ 2.02+
- uint32_t cmd_line_ptr \ 0x228
- \ 2.03+
- uint32_t initrd_addr_max \ 0x22c
-[ifdef] TENATIVE
- \ 2.04+
- uint16_t entry32_off \ 0x230
- uint16_t internal_cmdline_off \ 0x232
- uint32_t low_base \ 0x234
- uint32_t low_memsz \ 0x238
- uint32_t low_filesz \ 0x23c
- uint32_t real_base \ 0x240
- uint32_t real_memsz \ 0x244
- uint32_t real_filesz \ 0x248
- uint32_t high_base \ 0x24C
- uint32_t high_memsz \ 0x250
- uint32_t high_filesz \ 0x254
- 0 field tail \ 0x258
-[else]
- 0 field tail \ 0x230
-[then]
- d# 32 d# 1024 * ends-at
-
-constant /x86-linux-header
-
-\ Not used, but possibly interesting to know
-: kernel-version ( -- cstr ) load-base d# 512 + kver_addr + ;
-
-Where stuff wants to load:
-
-16-bit segment at h# 9.0000
-32-bit segment at h# 10.0000
-ramdisk at h# 80.0000
-
-command line goes in 16-bit segment at command_line_off (first location after kern16_size)
-start16 code goes in 16-bit segment at setup16_off
-start32 code goes in 16-bit segment at setup32_off
-
-h# 90000 constant rm-seg
-h# 10.0000 constant seg32
-: +rm ( n -- adr ) rm-seg + ;
-
-: setup-linux ( -- )
- XXX need descriptors at GDT 60 and 68
-
- load-base rm-seg kern16-size move \ Copy real-mode code
-
- cmdline kern16-size +rm swap 1+ move \ Copy command line
- h# a33f h# 20 +rm w! \ CL_MAGIC_VALUE -> cl_magic
- kern16-size h# 22 w! \ cl_offset
-
- protocol_version h# 0202 >= if
- kern16-size +rm h# 228 +rm l!
- then
-
- h# ff h# 210 +rm c! \ LOADER_TYPE_UNKNOWN
-
- \ XXX ramdisk must have been copied to h# 800000 already
- ramdisk h# 21c +rm l! h# 218 l! \ address and length
-
- 0 to %eax 0 to %ebx 0 to %ecx 0 to %edx
- 0 +rm to %esi 0 to %edi 0 +rm to %esp seg32 to %eip
-
- loaded kern16-size /string seg32 swap move
-
- set-fb-info
- set-mem-info
-;
-
-
-What x86-setup-32.S does:
-
-finds the actual address of its data structures because
-it has been loaded at somewhere other than its link address
-
-calls x86_setup_state (might be unnecessary)
-
-Load a GDT with
- 0 - pointer to GDT
- 0x10 4GB flat code segment
- 0x18 4GB flat data segment
- 0x60 4GB flat code segment
- 0x68 4GB flat data segment
- .. other descriptors empty
-
- sets CS to 0x10
- sets DS,ES,SS,FS,GS to 0x18
-
- loads the general registers with values from the array
- jumps to the eip from the array
-
-[then]
-
-\ LICENSE_BEGIN
-\ Copyright (c) 2006 FirmWorks
-\
-\ Permission is hereby granted, free of charge, to any person obtaining
-\ a copy of this software and associated documentation files (the
-\ "Software"), to deal in the Software without restriction, including
-\ without limitation the rights to use, copy, modify, merge, publish,
-\ distribute, sublicense, and/or sell copies of the Software, and to
-\ permit persons to whom the Software is furnished to do so, subject to
-\ the following conditions:
-\
-\ The above copyright notice and this permission notice shall be
-\ included in all copies or substantial portions of the Software.
-\
-\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-\
-\ LICENSE_END
Deleted: cpu/x86/pc/olpc/startmacros.fth
===================================================================
--- cpu/x86/pc/olpc/startmacros.fth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/olpc/startmacros.fth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,131 +0,0 @@
-\ See license at end of file
-
-\ Some x86 assembler macros for writing Geode early startup code
-\ in a clean, compact way. Most of the Geode initialization is
-\ done with 64-bit MSRs (Machine Specific Registers). These
-\ macros make it easy to set MSRs to specific values and to
-\ set and clear individual bits.
-
-\ The code keeps the MSR register number in %ecx, the low 32 bits
-\ of the value in %eax, and the high 32 bits in %edx, consistent
-\ with the way the rdmsr and wrmsr machine instructions work.
-\ The bitset and bitclr operations work on %eax, and the -hi versions
-\ work on %edx.
-\ In addition to the MSR operations, there are similar ones for
-\ I/O ports. They leave the data in %eax, so you can use bitset
-\ and bitclr with them too.
-
--1 value last-cx
-also 386-assembler definitions
-
-: forget-msr -1 to last-cx ;
-
-\ set-cx is an internal implementation factor used by wmsr and rmsr.
-\ It assembles code to put an MSR number in %ecx, optimizing out
-\ unnecessary code by remembering what was last put there.
-: set-cx ( reg# -- )
- [ also forth ]
- dup last-cx = if
- drop
- else
- dup to last-cx
- [ previous ] # cx mov [ also forth ]
- then
- [ previous ]
-;
-
-\ Read/write an MSR to/from %edx,%eax
-: rmsr ( reg# -- ) set-cx h# 0f c, h# 32 c, ;
-: wmsr ( reg# -- ) set-cx h# 0f c, h# 30 c, ;
-
-\ These bit operations can be used between "rmsr" and "wmsr"
-
-\ Bit operations on the low 32-bit value in %eax
-: bitset ( mask -- ) # ax or ;
-: bitand ( mask -- ) # ax and ;
-: bitclr ( mask -- ) invert bitand ;
-
-\ Bit operations on the high 32-bit value in %edx
-: bitset-hi ( mask -- ) # dx or ;
-: bitand-hi ( mask -- ) # dx and ;
-: bitclr-hi ( mask -- ) invert bitand-hi ;
-
-\ Set an MSR to a verbatim 64-bit value
-: set-msr ( d.val reg# -- ) -rot # dx mov # ax mov wmsr ;
-
-\ Set or clear bits in an MSR (read-modify-write the register)
-: bitset-msr ( mask reg# -- ) tuck rmsr bitset wmsr ;
-: bitclr-msr ( mask reg# -- ) tuck rmsr bitclr wmsr ;
-
-\ Some I/O port operations
-\ These could be optimized to generate the immediate forms of in and out
-\ for 8-bit port numbers, but it's not worth the trouble because we
-\ access very few low-numbered ports.
-: port-wb ( b port# -- ) swap # al mov # dx mov al dx out ;
-: port-rb ( port# -- ) # dx mov dx al in ;
-: port-ww ( w port# -- ) swap # ax mov # dx mov op: ax dx out ;
-: port-rw ( port# -- ) ax ax xor # dx mov op: dx ax in ;
-: port-wl ( l port# -- ) swap # ax mov # dx mov ax dx out ;
-: port-rl ( port# -- ) # dx mov dx ax in ;
-
-: config-setup ( config-adr -- )
- [ also forth ]
- dup 3 invert and h# 8000.0000 or ( config-adr cf8-value )
- [ previous ]
- # ax mov ( config-adr )
- h# cf8 # dx mov ( config-adr )
- ax dx out ( config-adr )
- [ also forth ]
- 3 and h# cfc or ( data-port )
- [ previous ]
- # dx mov
-;
-: config-wl ( l config-adr -- )
- config-setup ( l )
- # ax mov
- ax dx out
-;
-: config-rl ( config-adr -- ) \ Returns value in EAX
- config-setup
- dx ax in
-;
-: config-ww ( w config-adr -- )
- config-setup ( w )
- op: # ax mov ( )
- op: ax dx out
-;
-: config-rw ( config-adr -- ) \ Returns value AX
- config-setup ( )
- ax ax xor
- op: dx ax in
-;
-
-: set-base ( adr -- ) # bx mov ;
-: reg-save ( offset -- ) [bx] ax mov ax stos ;
-: reg-restore ( offset -- ) ax lods ax swap [bx] mov ;
-
-previous definitions
-
-\ LICENSE_BEGIN
-\ Copyright (c) 2006 FirmWorks
-\
-\ Permission is hereby granted, free of charge, to any person obtaining
-\ a copy of this software and associated documentation files (the
-\ "Software"), to deal in the Software without restriction, including
-\ without limitation the rights to use, copy, modify, merge, publish,
-\ distribute, sublicense, and/or sell copies of the Software, and to
-\ permit persons to whom the Software is furnished to do so, subject to
-\ the following conditions:
-\
-\ The above copyright notice and this permission notice shall be
-\ included in all copies or substantial portions of the Software.
-\
-\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-\
-\ LICENSE_END
Deleted: cpu/x86/pc/olpc/usb.fth
===================================================================
--- cpu/x86/pc/olpc/usb.fth 2008-05-21 21:12:54 UTC (rev 824)
+++ cpu/x86/pc/olpc/usb.fth 2008-05-21 21:16:50 UTC (rev 825)
@@ -1,156 +0,0 @@
-purpose: USB elaborations for the OLPC platform
-\ See license at end of file
-
-0 config-int usb-delay \ Milliseconds to wait before set-address
-
-devalias usb1 /usb at f,4
-devalias usb2 /usb at f,5
-devalias u /usb/disk
-devalias net /usb/wlan
-
-\ If there is a USB ethernet adapter, use it as the default net device.
-: report-net ( -- )
- " /usb/ethernet" 2dup find-package if ( name$ phandle )
- drop ( name$ )
- " net" 2swap $devalias ( )
- else ( name$ )
- 2drop ( )
- then
-;
-
-[ifdef] notdef \ We have the graphical penguin
-: linux-logo ( -- )
- " penguin.txt" find-drop-in if page type then
-;
-[then]
-
-\ Like $show-devs, but ignores pagination keystrokes
-: $nopage-show-devs ( nodename$ -- )
- ['] exit? behavior >r ['] false to exit?
- $show-devs
- r> to exit?
-;
-
-: probe-usb ( -- )
- ." USB2 devices:" cr
- " /usb at f,5" open-dev ?dup if close-dev then
- " /usb at f,5" $nopage-show-devs
-
- ." USB1 devices:" cr
- " /usb at f,4" open-dev ?dup if close-dev then
- " /usb at f,4" $nopage-show-devs
-
- report-disk
- report-net
- report-keyboard
-;
-alias probe-usb2 probe-usb
-alias p2 probe-usb2
-
-: ?usb-keyboard ( -- )
- " keyboard" expand-alias if ( devspec$ )
- drop " /usb" comp 0= if ( )
- red-letters ." Using USB keyboard." cr black-letters
- " keyboard" input
- then
- then
-;
-
-\ Unlink every node whose phys.hi component matches port
-: port-match? ( port -- flag )
- get-unit if drop false exit then
- get-encoded-int =
-;
-: rm-usb-children ( port -- )
- device-context? 0= if drop exit then
- also ( port )
- 'child ( port prev )
- first-child begin while ( port prev )
- over port-match? if ( port prev )
- 'peer link@ over link! ( port prev ) \ Disconnect
- else ( port prev )
- drop 'peer ( port prev' )
- then ( port prev )
- next-child repeat ( port prev )
- 2drop ( )
- previous definitions
-;
-
-0 value usb-power-done-time
-
-\ This version assumes that power has been applied already, and
-\ all we have to do is wait enough time for the devices to be ready.
-: wait-usb-power ( -- )
- begin usb-power-done-time get-msecs - 0<= until ( )
-;
-
-: usb-quiet ( -- )
- [ ' go-hook behavior compile, ] \ Chain to old behavior
- " usb1" " reset-usb" execute-device-method drop
- " usb2" " reset-usb" execute-device-method drop
-;
-' usb-quiet to go-hook
-
-0 0 " " " /" begin-package
- " prober" device-name
- : open
- " /usb at f,5" open-dev ?dup if close-dev then
- " /usb at f,4" open-dev ?dup if close-dev then
- report-disk
- report-net
- report-keyboard
- false
- ;
- : close ;
-end-package
-
-stand-init: USB setup
- \ Set up an address routing to the USB Option Controller
- h# efc00000.efc00001. h# 5100.0029 wrmsr
- h# 400000ef.c00fffff. h# 5101.0020 wrmsr
- h# 00000002.efc00000. h# 5120.000b wrmsr
-[ifdef] virtual-mode
- h# efc00000 h# 1000 0 mmu-claim drop \ UOC
- h# efc00000 dup h# 1000 -1 mmu-map \ UOC
- h# fe01a000 h# 1000 0 mmu-claim drop \ OHCI
- h# fe01a000 dup h# 1000 -1 mmu-map \ OHCI
-[then]
- \ Configure the assignment of 2 USB Power Enable pins to USB ports
- \ to correspond to the way they are wired on the board.
- \ USB port 1 is PWR_EN2, USB ports 2-4 are PWR_EN1
- usb-port-power-map h# efc00000 l!
- 2 h# efc00004 l!
- h# 1 h# fe01a008 l! \ Reset OHCI host controller
- h# 1e.0000 h# fe01a04c l! \ Configure ports for individual power
- h# 100 h# fe01a058 l! \ Power-on ports 2 and 3
- d# 10 ms \ Stagger for glitch-prevention
- h# 100 h# fe01a054 l! \ Power-on port 1
- h# 100 h# fe01a05c l! \ Power-on port 3
- h# 100 h# fe01a060 l! \ Power-on port 4
- get-msecs d# 1000 + to usb-power-done-time
-;
-
-
-\ LICENSE_BEGIN
-\ Copyright (c) 2007 FirmWorks
-\
-\ Permission is hereby granted, free of charge, to any person obtaining
-\ a copy of this software and associated documentation files (the
-\ "Software"), to deal in the Software without restriction, including
-\ without limitation the rights to use, copy, modify, merge, publish,
-\ distribute, sublicense, and/or sell copies of the Software, and to
-\ permit persons to whom the Software is furnished to do so, subject to
-\ the following conditions:
-\
-\ The above copyright notice and this permission notice shall be
-\ included in all copies or substantial portions of the Software.
-\
-\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-\
-\ LICENSE_END
More information about the OpenBIOS
mailing list