Author: wmb
Date: 2008-01-18 18:46:07 +0100 (Fri, 18 Jan 2008)
New Revision: 781
Added:
cpu/x86/pc/biosload/c32vesa.fth
cpu/x86/pc/biosload/preofhdr.fth
cpu/x86/pc/biosload/usb.fth
Modified:
cpu/x86/pc/biosload/addrs.fth
cpu/x86/pc/biosload/callbios.fth
cpu/x86/pc/biosload/config.fth
cpu/x86/pc/biosload/devices.fth
cpu/x86/pc/biosload/fw.bth
cpu/x86/pc/biosload/mbootsec.fth
cpu/x86/pc/biosload/ofw.bth
cpu/x86/pc/biosload/pcinode.fth
cpu/x86/pc/biosload/probemem.fth
cpu/x86/pc/biosload/reset.bth
cpu/x86/pc/biosload/rmenter.fth
cpu/x86/pc/resetend.fth
cpu/x86/pc/tsccal.fth
Log:
Generic PC version - omnibus checkin of a lot of new stuff relating to i945 and conventional BIOS support.
Modified: cpu/x86/pc/biosload/addrs.fth
===================================================================
--- cpu/x86/pc/biosload/addrs.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/addrs.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -20,6 +20,12 @@
h# 08.0000 constant dropin-size
[then]
+[ifdef] preof-loaded
+h# 2000.0000 constant ramsize
+h# fff8.0020 constant dropin-base \ Location of payload in ROM
+h# 08.0000 constant dropin-size
+[then]
+
\needs dropin-base h# 198.0000 constant dropin-base
\needs dropin-size h# 8.0000 constant dropin-size
\needs ResetBase dropin-base h# 20 + constant ResetBase \ Location of "reset" dropin in ROM
Added: cpu/x86/pc/biosload/c32vesa.fth
===================================================================
--- cpu/x86/pc/biosload/c32vesa.fth (rev 0)
+++ cpu/x86/pc/biosload/c32vesa.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -0,0 +1,197 @@
+purpose: Call VESA BIOS functions via syslinux c32 callback
+
+[ifdef] notdef-get-com32-ptr
+\ sp 0 #) mov \ Save COM32 stack pointer to get parameters
+[then]
+[ifdef] notdef-getvbe
+ \ There is an extra return address on the stack from the e9 call above
+ d# 16 [sp] bp mov \ COM32 intcall helper function
+ d# 20 [sp] dx mov \ bounce buffer address
+
+ h# 4f00 # d# 36 [dx] mov \ AX
+
+ dx ax mov
+ h# 200 # ax add
+ h# 32454256 # 0 [ax] mov \ VBE2
+
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ dx push dx push h# 10 # push bp call d# 12 # sp add
+ d# 36 [dx] ax mov ax 4 #) mov \ AX
+[then]
+
+[ifdef] notdef-findmode
+ \ Registers:
+ \ edx: pointer to register array for calling the gateway function
+ \ ebp: address of gateway function
+ \ ecx: pointer to result array
+ \ esi: moving pointer to mode number array
+ \ eax: scratch
+
+ \ There is an extra return address on the stack from the e9 call above
+ d# 16 [sp] bp mov \ COM32 intcall helper function
+ d# 20 [sp] dx mov \ bounce buffer address
+
+ dx push dx push h# 10 # push
+
+ h# 4f00 # d# 36 [dx] mov \ AX
+
+ dx cx mov
+ h# 100 # cx add \ ecx: pointer to result buffer
+
+ h# 32454256 # 0 [cx] mov \ 'VBE2' to signature field of result buffer - probably unnecessary (we don't need the OEM string)
+
+ cx ax mov
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ bp call
+
+ \ Extract the mode list pointer and convert it to a linear address
+ si si xor
+ op: h# 10 [cx] si mov \ Segment portion of mode list pointer
+ 4 # si shl \ Move into position
+ ax ax xor
+ op: h# 0e [cx] ax mov \ Offset portion of mode list pointer
+ ax si add \ esi: Linear address of mode list pointer
+
+ \ Get a new result buffer so as not to overwrite the mode list
+ h# 100 # cx add
+ cx ax mov
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ h# 0 # ax mov ax 8 #) mov \ Clear the output value
+
+ begin
+ op: ax lods \ Get mode number
+ op: h# ffff # ax cmp
+ <> while \ Exit if all modes have been tested
+ op: ax d# 32 [dx] mov \ CX - Mode number
+ op: ax bx mov
+
+ h# 4f01 # d# 36 [dx] mov \ AX - GetMode function number
+ bp call
+
+ op: 0 [cx] ax mov \ Mode attributes
+ 1 # al test 0<> if \ Is the mode supported?
+ h# 12 [cx] ax mov \ Yres.Xres
+ TARGET_RES # ax cmp = if
+ h# 19 [cx] al mov \ BPP
+ TARGET_BPP # al cmp = if
+ op: bx 8 #) mov \ Mode number
+ op: h# 10 [cx] ax mov
+ op: ax h# a #) mov \ Stride
+ then
+ then
+ then
+ repeat
+ d# 12 # sp add
+[then]
+
+[ifndef] notdef-modemap
+ \ Registers:
+ \ edx: pointer to register array for calling the gateway function
+ \ ebp: address of gateway function
+ \ ecx: pointer to result array
+ \ esi: moving pointer to mode number array
+ \ eax: scratch
+ \ ebx: output pointer
+
+ \ There is an extra return address on the stack from the e9 call above
+ d# 16 [sp] bp mov \ COM32 intcall helper function
+ d# 20 [sp] dx mov \ bounce buffer address
+
+ dx push dx push h# 10 # push
+
+ h# 4f00 # d# 36 [dx] mov \ AX
+
+ dx cx mov
+ h# 100 # cx add \ ecx: pointer to result buffer
+
+ h# 32454256 # 0 [cx] mov \ 'VBE2' to signature field of result buffer - probably unnecessary (we don't need the OEM string)
+
+ cx ax mov
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ bp call
+
+ \ Extract the mode list pointer and convert it to a linear address
+ si si xor
+ op: h# 10 [cx] si mov \ Segment portion of mode list pointer
+ 4 # si shl \ Move into position
+ ax ax xor
+ op: h# 0e [cx] ax mov \ Offset portion of mode list pointer
+ ax si add \ esi: Linear address of mode list pointer
+
+ \ Get a new result buffer so as not to overwrite the mode list
+ h# 100 # cx add
+ cx ax mov
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ h# 40300 # bx mov
+
+ begin
+ op: ax lods \ Get mode number
+ op: ax 0 [bx] mov
+ op: h# ffff # ax cmp
+ <> while \ Exit if all modes have been tested
+ op: ax d# 32 [dx] mov \ CX - Mode number
+
+ h# 4f01 # d# 36 [dx] mov \ AX - GetMode function number
+ bp call
+
+ h# 12 [cx] ax mov ax 2 [bx] mov \ Yres.Xres
+ ax ax xor
+ h# 19 [cx] al mov op: ax 6 [bx] mov \ BPP
+ op: h# 10 [cx] ax mov op: ax 8 [bx] mov \ Stride
+ ax ax xor
+ op: ax h# a [bx] mov ax h# c [bx] mov \ Clear trailing
+ h# 10 # bx add
+ repeat
+ d# 12 # sp add
+[then]
+
+[ifdef] notdef-setmode
+ \ There is an extra return address on the stack from the e9 call above
+ d# 16 [sp] bp mov \ COM32 intcall helper function
+ d# 20 [sp] dx mov \ bounce buffer address
+
+ dx push dx push h# 10 # push
+
+ dx cx mov
+ h# 100 # cx add \ ecx: pointer to result buffer
+
+ cx ax mov
+ op: ax d# 08 [dx] mov \ DI - result pointer offset
+ d# 16 # ax shr \ Discard lower 16 bits
+ d# 12 # ax shl \ Shift segment into place
+ op: ax d# 04 [dx] mov \ ES - result pointer segment
+
+ h# 4f01 # d# 36 [dx] mov \ AX - GetMode function number
+ h# 0117 # d# 32 [dx] mov \ CX - Mode number
+ bp call
+
+ h# 28 [cx] ax mov ax 0 #) mov \ Frame buffer address
+ ax ax xor op: h# 10 [cx] ax mov ax 4 #) mov \ Stride
+
+ h# 4f02 # d# 36 [dx] mov \ AX
+ h# c117 # d# 24 [dx] mov \ BX 1024x768x16 linear
+
+ bp call
+
+ d# 12 # sp add
+[then]
Modified: cpu/x86/pc/biosload/callbios.fth
===================================================================
--- cpu/x86/pc/biosload/callbios.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/callbios.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -173,15 +173,15 @@
: bios-config-w! ( w adr -- ) lwsplit h# 1a { h# b10c ax bx rm-di ! rm-cx ! } ;
: bios-config-l! ( l adr -- ) lwsplit h# 1a { h# b10d ax bx rm-di ! rm-cx ! } ;
: disk-status ( -- stat ) h# 13 { h# 0100 ax } rm-ax @ ;
-0 value sect/trk
-0 value trk/head
+0 value #sects
+0 value #cyls
0 value #heads
: get-drive-params ( -- )
h# 13 { 8 ah h# 80 dx }
rm-flags @ 1 and if true exit then
rm-cx @ wbsplit ( cl ch )
- over h# 3f and to sect/trk ( cl ch )
- swap 6 rshift bwjoin 1+ to trk/head ( )
+ over h# 3f and to #sects ( cl ch )
+ swap 6 rshift bwjoin 1+ to #cyls ( )
rm-dx @ 8 rshift 1+ to #heads ( )
;
: #drive-sectors ( -- n )
@@ -203,9 +203,10 @@
: write-sectors ( sector1 cyl0 head0 drive0 #sectors -- ) 3 do-rw ;
: lbn>sch ( lbn -- sector cyl head )
- sect/trk /mod swap 1+ swap ( sector rem )
- trk/head /mod ( sector cyl head )
- dup #heads > abort" LBN out of range"
+ #sects /mod swap 1+ swap ( sector rem )
+ #heads /mod ( sector head cyl )
+ dup #cyls > abort" LBN out of range"
+ swap ( sector cyl head )
;
: lbn-read-sectors ( lbn drive #sectors -- ) 2>r lbn>sch 2r> read-sectors ;
: lbn-write-sectors ( lbn drive #sectors -- ) 2>r lbn>sch 2r> write-sectors ;
Modified: cpu/x86/pc/biosload/config.fth
===================================================================
--- cpu/x86/pc/biosload/config.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/config.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -1,9 +1,9 @@
\ See license at end of file
purpose: Establish configuration definitions
-create pc \ Demo version for generic PC
+\ create pc \ Demo version for generic PC
\ create pc-linux \ Demo version for generic PC and Linux
-\ create pc-serial \ Demo version for generic PC
+create pc-serial \ Demo version for generic PC
\ --- The environment that "boots" OFW ---
\ - Image Format - Example Media - previous stage bootloader
@@ -24,11 +24,18 @@
\ Load and run in qemu
\ create qemu-loaded
+\ Load from ROM by preOF code from Intel
+\ create preof-loaded
+
[ifdef] pc-serial
create serial-console
create pc
[then]
+[ifdef] qemu-loaded \ LinuxBIOS+OFW under QEMU currently doesn't do VGA right
+create serial-console
+[then]
+
[ifdef] etherboot-variant
create debug-startup
create serial-console
@@ -67,6 +74,20 @@
create no-floppy-node
[then]
+[ifdef] preof-loaded
+create serial-console
+create use-timestamp-counter
+create resident-packages
+create addresses-assigned \ Don't reassign PCI addresses
+\ create virtual-mode
+create use-root-isa
+create use-isa-ide
+create use-elf
+create use-watch-all
+create use-null-nvram
+create no-floppy-node
+[then]
+
fload ${BP}/cpu/x86/pc/biosload/addrs.fth
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
Modified: cpu/x86/pc/biosload/devices.fth
===================================================================
--- cpu/x86/pc/biosload/devices.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/devices.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -32,6 +32,8 @@
" /pci" " init" execute-device-method drop
;
+fload ${BP}/cpu/x86/pc/biosload/i945.fth \ Intel 945 hacks
+
fload ${BP}/dev/pciprobe.fth \ Generic PCI probing
[ifdef] use-timestamp-counter
@@ -52,7 +54,9 @@
end-package
[then]
+[ifndef] use-timestamp-counter
fload ${BP}/cpu/x86/pc/getms.fth
+[then]
[ifdef] use-mediagx
fload ${BP}/dev/mediagx/reg.fth \ MediaGX constants and access
@@ -141,7 +145,7 @@
devalias mouse /isa/8042/mouse
[ifdef] use-timestamp-counter
-fload ${BP}/cpu/x86/pc/tsccal.fth
+fload ${BP}/cpu/x86/pc/tsccal1.fth
[then]
[ifdef] use-ega
@@ -176,10 +180,12 @@
fload ${BP}/cpu/x86/pc/cpunode.fth
+[ifndef] serial-console
fload ${BP}/ofw/core/bailout.fth
stand-init: Keyboard overrides
?bailout
;
+[then]
fload ${BP}/ofw/core/countdwn.fth \ Startup countdown
fload ${BP}/forth/lib/pattern.fth \ Text string pattern matching
Modified: cpu/x86/pc/biosload/fw.bth
===================================================================
--- cpu/x86/pc/biosload/fw.bth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/fw.bth 2008-01-18 17:46:07 UTC (rev 781)
@@ -181,14 +181,36 @@
[then]
devalias nfs net//obp-tftp:last//nfs
+fload ${BP}/ofw/inet/loadtcp.fth
+support-package: http
+ fload ${BP}/ofw/inet/http.fth \ HTTP client
+end-support-package
+
+[ifndef] use-timestamp-counter
fload ${BP}/cpu/x86/pc/mscal.fth
+[then]
fload ${BP}/cpu/x86/pc/boot.fth
+hex
+\ If there is a PCI ethernet adapter, use it as the default net device,
+\ otherwise use any ethernet that can be found in the device tree.
+: report-net ( -- )
+ " /pci/ethernet" 2dup find-package if ( name$ phandle )
+ drop ( name$ )
+ else ( name$ )
+ 2drop " /ethernet" ( name$' )
+ then ( name$ )
+ " net" 2swap $devalias ( )
+;
+
+fload ${BP}/cpu/x86/pc/biosload/usb.fth
+\ fload ${BP}/cpu/x86/pc/biosload/callbios.fth
+fload ${BP}/cpu/x86/pc/biosload/rmenter.fth
+
\ false to stand-init-debug?
true to stand-init-debug?
-
hex
stand-init-debug? [if]
warning @ warning off
@@ -198,7 +220,7 @@
standalone? if
cr ." Type 'i' to interrupt stand-init sequence" cr
- d# 500 ms
+ d# 2000 ms
key? if
key upc ascii I = if ." Interacting" cr hex interact then
then
@@ -210,26 +232,12 @@
warning !
[then]
-fload ${BP}/cpu/x86/pc/biosload/mbootsec.fth
-
: (.firmware) ( -- )
." Open Firmware " .built cr
." Copyright 1999 FirmWorks All Rights Reserved" cr
;
' (.firmware) to .firmware
-hex
-\ If there is a PCI ethernet adapter, use it as the default net device,
-\ otherwise use any ethernet that can be found in the device tree.
-: report-net ( -- )
- " /pci/ethernet" 2dup find-package if ( name$ phandle )
- drop ( name$ )
- else ( name$ )
- 2drop " /ethernet" ( name$' )
- then ( name$ )
- " net" 2swap $devalias ( )
-;
-
: linux-logo ( -- )
" penguin.txt" find-drop-in if page type then
;
@@ -242,6 +250,7 @@
[ifdef] probe-isa-modem
probe-isa-modem
[then]
+ probe-usb
report-disk
report-net
report-pci-fb
@@ -257,10 +266,7 @@
auto-banner? if
" Probing" ?type probe-all
- \ install-console doesn't work with qemu, use -serial `tty` instead
- [ifndef] qemu-loaded
" Install console" ?type install-console
- [then]
banner
then
@@ -307,9 +313,11 @@
fload ${BP}/cpu/x86/pc/biosload/vmdoor.fth \ VMware interfaces
+fload ${BP}/cpu/x86/pc/biosload/intelfb.fth \ Intel frame buffer setup
+
" dhcp" ' ip-address set-config-string-default
-.( Saving fw.dic ...)
+.( SAVING FW.dic ...)
" fw.dic" $save-forth cr
.( Saving fw.img ...)
Modified: cpu/x86/pc/biosload/mbootsec.fth
===================================================================
--- cpu/x86/pc/biosload/mbootsec.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/mbootsec.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -5,8 +5,6 @@
\ create make-boot-sector-only
-: $, ( adr len -- ) here over allot swap move ;
-
create ofw-boot-sectors
here
fload ${BP}/cpu/x86/pc/biosload/build/bootsec.hex
@@ -77,6 +75,7 @@
." Open Firmware bootable floppy image created." cr
." Please copy OFW.IMG to the floppy." cr
;
+
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
Modified: cpu/x86/pc/biosload/ofw.bth
===================================================================
--- cpu/x86/pc/biosload/ofw.bth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/ofw.bth 2008-01-18 17:46:07 UTC (rev 781)
@@ -19,6 +19,7 @@
\ in: ${BP}/ofw/disklabel/build/disklabel.di
\ in: ${BP}/ofw/inet/build/obptftp.di
in: ${BP}/dev/pci/build/pcibridg.fc
+in: ${BP}/dev/ide/build/leghier.fc
in: ${BP}/cpu/x86/pc/biosload/linux.fth
build-now
@@ -67,6 +68,19 @@
bz-hdr /bz-hdr 0 " bz-header" write-dropin
[then]
+[ifdef] preof-loaded
+ : pad-file ( location -- )
+ ofd @ fsize
+ 2dup u< abort" The ROM image is too large"
+ ?do h# ff ofd @ fputc loop
+ ;
+
+ .( --- Saving as ofw.rom - Binary ROM image format for preOF) cr
+ fload ${BP}/cpu/x86/pc/biosload/preofhdr.fth
+ writing ofw.rom
+ preof-hdr /preof-hdr ofd @ fputs
+[then]
+
[ifdef] real-mode-entry
" biostart.img" $add-file
[then]
@@ -75,6 +89,7 @@
" ${BP}/cpu/x86/build/inflate.bin" " inflate" $add-dropin
" fw.img" " firmware" $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/usb2/hcd/uhci/build/uhci.fc" " class0c0300" $add-deflated-dropin
" ${BP}/dev/usb2/hcd/ohci/build/ohci.fc" " class0c0310" $add-deflated-dropin
@@ -107,6 +122,8 @@
[then]
" ${BP}/ofw/fcode/memtest.fth" " memtest.fth" $add-deflated-dropin
+ " ${BP}/ofw/inet/telnetd.fth" " telnetd" $add-deflated-dropin
+
" ${BP}/ofw/inet/httpdemo/index.htm" " index.htm" $add-dropin
" ${BP}/ofw/inet/httpdemo/config.htm" " config.htm" $add-dropin
\ " ${BP}/ofw/inet/httpdemo/post.htm" " post.htm" $add-dropin
@@ -130,4 +147,10 @@
pad 4 ofd @ fputs \ Patch memory size
[then]
+[ifdef] preof-loaded
+ h# 60000 pad-file
+ " preof.img" $add-file
+ ofd @ fsize dropin-size <> if ." Size is wrong" cr then
+[then]
+
ofd @ fclose
Modified: cpu/x86/pc/biosload/pcinode.fth
===================================================================
--- cpu/x86/pc/biosload/pcinode.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/pcinode.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -106,10 +106,13 @@
\ The io-base handling really ought to be in the root node, but
\ that would require more changes than I'm willing to do at present.
+warning @ warning off
: map-out ( vaddr size -- )
over io-base u>= if 2drop exit then ( vaddr size )
map-out ( )
;
+warning !
+
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
Added: cpu/x86/pc/biosload/preofhdr.fth
===================================================================
--- cpu/x86/pc/biosload/preofhdr.fth (rev 0)
+++ cpu/x86/pc/biosload/preofhdr.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -0,0 +1,27 @@
+\ See license at end of file
+purpose: Create header for starting Forth from preOF, 32-bit protected mode
+
+command: &builder &this
+build-now
+
+\needs start-assembling fload ${BP}/cpu/x86/asmtools.fth
+
+hex
+
+start-assembling
+
+label preof-hdr
+
+\ This code begins execution in 32-bit mode.
+
+[ifdef] ramsize
+ ramsize # mem-info-pa 1 la+ #) mov
+ 0 # mem-info-pa 2 la+ #) mov
+[then]
+ ResetBase # ax mov
+ ax jmp
+ h# 20 pad-to
+end-code
+
+end-assembling
+here preof-hdr - constant /preof-hdr
Modified: cpu/x86/pc/biosload/probemem.fth
===================================================================
--- cpu/x86/pc/biosload/probemem.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/probemem.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -38,9 +38,12 @@
[else]
fw-pa h# 10.0000 u> if
h# 10.0000 fw-pa over - release
+ fw-pa /fw-ram + heap-base heap-size + umax /ram release
then
- dropin-base dropin-size + /ram over - release
+ dropin-base /ram u< if
+ dropin-base dropin-size + /ram over - release
+ then
[then]
;
Modified: cpu/x86/pc/biosload/reset.bth
===================================================================
--- cpu/x86/pc/biosload/reset.bth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/reset.bth 2008-01-18 17:46:07 UTC (rev 781)
@@ -16,6 +16,7 @@
hex
fload ${BP}/cpu/x86/pc/finddi.fth \ find-dropin and other tools
+fload ${BP}/cpu/x86/pc/port80.fth \ Port 80 output
h# 3e.0000 constant inflate-base
h# 30.0000 constant workspace
@@ -32,14 +33,107 @@
[then]
fload ${BP}/cpu/x86/pc/ramfind.fth \ find-dropin
+\ uint16_t gs; /* Offset 0 */
+\ uint16_t fs; /* Offset 2 */
+\ uint16_t es; /* Offset 4 */
+\ uint16_t ds; /* Offset 6 */
+\ reg32_t edi; /* Offset 8 */
+\ reg32_t esi; /* Offset 12 */
+\ reg32_t ebp; /* Offset 16 */
+\ reg32_t _unused_esp; /* Offset 20 */
+\ reg32_t ebx; /* Offset 24 */
+\ reg32_t edx; /* Offset 28 */
+\ reg32_t ecx; /* Offset 32 */
+\ reg32_t eax; /* Offset 36 */
+\
+\ reg32_t eflags; /* Offset 40 */
+
+\ VESA modes:
+\ RESv BPP> 4 8 15 16 24
+\ 320x200 10d 10e 10f
+\ 640x400 100
+\ 640x480 101 110 111 112
+\ 800x600 102 103 113 114 115
+\ 1024x768 104 105 116 117 118
+\ 1280x1024 106 107 119 11a 11b
+
+d# 1024 d# 768 wljoin constant TARGET_RES
+d# 16 constant TARGET_BPP
+
label startup
+ h# 10 port80
cli cld
+[ifdef] syslinux-loaded
+ fload ${BP}/cpu/x86/pc/biosload/c32vesa.fth
+[then]
+
+ h# 11 port80
80 70 isa-c! \ Disable NMI
71 # dx mov dx al in \ Why do we do this?
[ifdef] debug-startup
+h# 8000.f880 # ax mov h# cf8 # dx mov ax dx out
+h# 140f.0010 # ax mov h# cfc # dx mov ax dx out \ Set LPC decoding
+
+h# 8000.f8f0 # ax mov h# cf8 # dx mov ax dx out
+h# fed1.c001 # ax mov h# cfc # dx mov ax dx out \ Root complex BAR
+
+\ h# 0004.2210 # ax mov ax h# fed1f100 #) mov \ Int route dev31 SMIP:INTB SATA:INTB PATA:INTA (default)
+\ h# 0000.2100 # ax mov ax h# fed1f104 #) mov \ Int route dev30 AMIP:INTB AAIP:INTA (default)
+\ h# 1000.4321 # ax mov ax h# fed1f108 #) mov \ Int route dev29 EIP:INTA U3P:INTD U2P:INTC U1P:INTB U0P:INTA (def)
+\ h# 0021.4321 # ax mov ax h# fed1f10c #) mov \ Int route dev28 P6IP:B P5IP:A P4IP:D P3IP:C P2IP:B P1IP:A (def)
+
+h# 0146.0132 # ax mov ax h# fed1f140 #) mov \ Int route dev30 D:PIRQA C:PIRQB B:PIRQE A:PIRQG
+ \ Int route dev31 D:PIRQA C:PIRQB B:PIRQD A:PIRQC
+h# 3201.0237 # ax mov ax h# fed1f144 #) mov \ Int route dev28 D:PIRQD C:PIRQC B:PIRQA A:PIRQB
+ \ Int route dev29 D:PIRQA C:PIRQB B:PIRQD A:PIRQH
+h# 0000.0146 # ax mov ax h# fed1f148 #) mov \ Int route dev27 D:PIRQA C:PIRQB B:PIRQE A:PIRQG
+
+h# 3 # al mov al h# fed1f1ff #) mov \ Enable APIC (Root complex other interrupt control register)
+
+h# 0000.0004 # ax mov ax h# fed1f400 #) mov \ Enable upper half of CMOS RAM
+h# 0000.0080 # ax mov ax h# fed1f404 #) mov \ Enable High Precision Timer at fed0.0000 - fed0.03ff
+h# 0032.0061 # ax mov ax h# fed1f418 #) mov \ Disable PCIe 6,5,2, AC97 modem, AC97 audio
+h# 0000.0001 # ax mov ax h# fed1f41c #) mov \ Enable PCIe root port static clock gating
+
+h# 55 # al mov al h# 2e # out \ Superio Config mode
+
+\ h# 7 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Select LPT
+\ h# 60 # al mov al h# 2e # out h# 3 # al mov al h# 2f # out \ High address
+\ h# 61 # al mov al h# 2e # out h# 78 # al mov al h# 2f # out \ Low address
+\ h# 70 # al mov al h# 2e # out h# 7 # al mov al h# 2f # out \ IRQ
+\ h# 74 # al mov al h# 2e # out h# 4 # al mov al h# 2f # out \ DMA channel
+\ h# f0 # al mov al h# 2e # out h# 3a # al mov al h# 2f # out \ PP Mode
+\ h# f1 # al mov al h# 2e # out h# 0 # al mov al h# 2f # out \ PP Mode2
+\ h# f8 # al mov al h# 2e # out h# 4 # al mov al h# 2f # out \ PP Mapping
+\ h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
+h# 7 # al mov al h# 2e # out h# 3 # al mov al h# 2f # out \ Select COM1
+h# 60 # al mov al h# 2e # out h# 3 # al mov al h# 2f # out \ High address
+h# 61 # al mov al h# 2e # out h# f8 # al mov al h# 2f # out \ Low address
+h# 70 # al mov al h# 2e # out h# 4 # al mov al h# 2f # out \ IRQ
+h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
+\ h# 7 # al mov al h# 2e # out h# 4 # al mov al h# 2f # out \ Select Power control
+\ h# 60 # al mov al h# 2e # out h# 6 # al mov al h# 2f # out \ High address
+\ h# 61 # al mov al h# 2e # out h# c0 # al mov al h# 2f # out \ Low address
+\ h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
+\ h# 7 # al mov al h# 2e # out h# 5 # al mov al h# 2f # out \ Select mouse
+\ h# 70 # al mov al h# 2e # out h# c # al mov al h# 2f # out \ IRQ
+\ h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
+h# 7 # al mov al h# 2e # out h# 6 # al mov al h# 2f # out \ Select keyboard
+h# 70 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ IRQ
+h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
+\ h# 7 # al mov al h# 2e # out h# 4 # al mov al h# 2f # out \ Select GPIO
+\ h# 60 # al mov al h# 2e # out h# 6 # al mov al h# 2f # out \ High address
+\ h# 61 # al mov al h# 2e # out h# 80 # al mov al h# 2f # out \ Low address
+\ h# 30 # al mov al h# 2e # out h# 1 # al mov al h# 2f # out \ Enable
+
init-com1
carret report
@@ -49,6 +143,7 @@
ascii r report
[then]
+ h# 12 port80
" start" $find-dropin, \ Assemble call to find-dropin with literal arg
\ What should we do it this fails? Perhaps call a default routine
\ to try to initialize com1 and display a message?
@@ -56,6 +151,7 @@
d# 32 # ax add \ Skip dropin header
ax call \ Execute the dropin
+ h# 13 port80
fload ${BP}/cpu/x86/pc/resetend.fth
end-code
Modified: cpu/x86/pc/biosload/rmenter.fth
===================================================================
--- cpu/x86/pc/biosload/rmenter.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/biosload/rmenter.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -3,11 +3,27 @@
: seg:off> ( offset segment -- linear ) 4 lshift + ;
: seg:off@ ( adr -- linear ) dup w@ swap wa1+ w@ seg:off> ;
+[ifdef] syslinux-loaded
h# 8 constant rm-cs
h# 18 constant rm-ds
h# 20 constant pm-cs
h# 28 constant pm-ds
+: fix-gdt ;
+[then]
+[ifdef] preof-loaded
+h# 38 constant rm-cs
+h# 30 constant rm-ds
+h# 10 constant pm-cs
+h# 18 constant pm-ds
+: fix-gdt
+ gdtr@ gdt-pa swap 1+ move
+ h# ffff gdt-pa h# 38 + l! \ Limit ffff
+ h# 9a00 gdt-pa h# 3c + l! \ Base 00000, 16-bit code
+ gdt-pa gdtr@ nip h# 3f max 1+ gdtr!
+;
+[then]
+
h# 0.0000 constant rm-base
: +rm ( offset -- adr ) rm-base + ;
@@ -21,6 +37,7 @@
\ size is 2e
h# f30 +rm constant 'rm-idt \ For loading RM IDT with LIDT
+h# f36 +rm constant 'rm-int \ Incoming interrupt number
h# f38 +rm constant 'rm-sp \ SS:SP For loading RM SP with LSS
h# f3c +rm constant 'pm-sp \ Save/restore area for PM SP
h# f40 +rm constant 'pm-gdt \ For loading PM GDT with LGDT
@@ -54,6 +71,21 @@
: rm-al! caller-regs >rm-eax c! ;
: rm-ax@ caller-regs >rm-eax w@ ;
: rm-ax! caller-regs >rm-eax w! ;
+
+: rm-bh@ caller-regs >rm-ebx 1+ c@ ;
+: rm-bh! caller-regs >rm-ebx 1+ c! ;
+: rm-bl@ caller-regs >rm-ebx c@ ;
+: rm-bl! caller-regs >rm-ebx c! ;
+: rm-bx@ caller-regs >rm-ebx w@ ;
+: rm-bx! caller-regs >rm-ebx w! ;
+
+: rm-ch@ caller-regs >rm-ecx 1+ c@ ;
+: rm-ch! caller-regs >rm-ecx 1+ c! ;
+: rm-cl@ caller-regs >rm-ecx c@ ;
+: rm-cl! caller-regs >rm-ecx c! ;
+: rm-cx@ caller-regs >rm-ecx w@ ;
+: rm-cx! caller-regs >rm-ecx w! ;
+
: rm-dh@ caller-regs >rm-edx 1+ c@ ;
: rm-dh! caller-regs >rm-edx 1+ c! ;
: rm-dl@ caller-regs >rm-edx c@ ;
@@ -61,9 +93,12 @@
: rm-dx@ caller-regs >rm-edx w@ ;
: rm-dx! caller-regs >rm-edx w! ;
-: rm-set-cf caller-regs >rm-flags dup w@ 1 or swap w! ;
-: rm-clr-cf caller-regs >rm-flags dup w@ 1 or swap w! ;
+: rm-flags@ caller-regs >rm-flags w@ ;
+: rm-flags! caller-regs >rm-flags w! ;
+: rm-set-cf rm-flags@ 1 or rm-flags! ;
+: rm-clr-cf rm-flags@ 1 or rm-flags! ;
+
\ 80ff0 is the target address of the interrupt vector
\ We use different segment:offset representations of that address in
\ the vector table, so the handler code can determine the vector
@@ -88,8 +123,10 @@
\ CS:IP return address (from INT)
\ (low) EDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX (high)
\ (low) GS,FS,ES,DS (high)
- \ CS for vector
+ \ CS from interrupt vector, which is the interrupt number
+ cs: 'rm-int #) pop \ Save interrupt vector CS, i.e. the int#
+
cli \ This is unnecessary since we got here from an INT
cs push ds pop
@@ -173,6 +210,7 @@
0 value rm-prepped?
: prep-rm ( -- )
rm-prepped? if exit then true to rm-prepped?
+ fix-gdt
0 saved-rm-vectors h# 400 move
make-vector-table
@@ -190,11 +228,245 @@
'rm-regs 'rm-sp seg:off! \ Initial stack pointer below regs
;
+: get-font ( -- )
+ rm-al@ h# 30 = if
+ ." Int 10 get-font called - BH = " rm-bh@ . cr
+ else
+ ." Int 10 set-font called" cr
+ then
+;
+
+: video-int ( -- )
+ rm-ah@ case
+ h# 0 of ( rm-al@ set-video-mode ) endof \ Set mode - Should blank the screen
+ h# a of rm-al@ emit endof \ Write character
+ h# e of rm-al@ emit endof \ Write character
+ h# 11 of get-font endof \ get or set font
+ h# 12 of 0 rm-bx! endof \ Attribute for blanked lines while scrolling - Wrong, I think
+ h# 20 of endof
+
+ ( default ) ." Unimplemented video int - AH = " dup . cr rm-set-cf
+ endcase
+;
+: sysinfo-int ( -- ) h# 26 rm-ax! ;
+
+0 value disk-ih
+: disk-read-sectors ( adr sector# #sectors -- #read )
+ " read-blocks" disk-ih $call-method
+;
+
+0 [if]
+h# 200 constant /sector
+: disk-seek ( sector# -- error? )
+ /sector um* ( adr len d.byte# )
+ " seek" disk-ih $call-method dup if ( error? )
+ rm-set-cf 4 rm-ah! ( error? )
+ then ( error? )
+;
+: disk-read ( adr #sectors -- #sectors-read )
+ /sector * ( adr #bytes )
+ " read" disk-ih $call-method ( #bytes-read )
+ /sector / ( #sectors-read )
+;
+[then]
+
+: check-drive ( -- error? )
+ rm-dl@ h# 80 <> if rm-set-cf 7 rm-ah! true exit then
+ disk-ih if false exit then
+\ " disk:0" open-dev to disk-ih
+ " /ide@0" open-dev to disk-ih
+ disk-ih dup 0= if rm-set-cf h# aa rm-ah! then
+;
+: read-sectors ( -- )
+ check-drive if exit then
+ disk-ih 0= if rm-set-cf h# aa rm-ah! exit then
+ rm-ch@ rm-cl@ 6 rshift bwjoin ( cylinder# )
+ h# ff * rm-dh@ + ( trk# ) \ 255 heads
+ h# 3f * rm-cl@ h# 3f and 1- + ( sector# ) \ 63 is max sector#
+
+ rm-bx@ caller-regs >rm-es w@ seg:off> ( sector# adr )
+ swap rm-al@ ( adr sector# #sectors )
+ disk-read-sectors rm-al!
+
+\ disk-seek if exit then
+\ rm-bx@ caller-regs >rm-es w@ seg:off> rm-al@ ( adr #sectors )
+\ disk-read rm-al!
+;
+: drive-params ( -- )
+ check-drive if exit then
+\ " size" disk-ih $call-method ( d.#bytes )
+\ /sector um/mod nip ( #sectors )
+ " #blocks" disk-ih $call-method ( #sectors )
+ h# 3f / ( #tracks )
+ h# ff / 1- ( maxcyl ) \ Max 255 heads is traditional
+ wbsplit ( maxcyl.lo maxcyl.hi )
+ 3 min 6 lshift h# 3f or rm-cl! ( maxcyl.lo ) \ High cyl, max sector
+ rm-ch! ( ) \ Low byte of max cylinder
+ h# fe rm-dh! ( ) \ Max head number
+ h# 01 rm-dl! ( ) \ Number of drives
+ rm-clr-cf
+;
+
+: lba-read ( -- )
+ check-drive if exit then
+ caller-regs >rm-esi w@ caller-regs >rm-ds w@ seg:off> ( packet-adr )
+ >r r@ 4 + seg:off@ r@ 8 + l@ r@ 2+ w@ disk-read-sectors r> 2+ w!
+\ dup 8 + l@ ( packet-adr sector# )
+\ disk-seek if drop exit then ( packet-adr )
+\ dup 4 + seg:off@ over 2+ w@ ( packet-adr adr #sectors )
+\ disk-read
+\ swap 2+ w!
+;
+
+: check-disk-extensions ( -- )
+ check-drive if 0 rm-bx! exit then
+ rm-bx@ h# 55aa <> if exit then
+ h# aa55 rm-bx!
+ h# 20 rm-ah! 1 rm-cx!
+;
+
+: disk-int ( -- ) \ INT 13 handler
+ rm-ah@ case
+ h# 02 of read-sectors endof
+ h# 08 of drive-params endof
+ h# 41 of check-disk-extensions endof
+ h# 42 of lba-read endof
+ ( default ) ." Unsupported disk INT 13 - AH = " dup . cr
+ endcase
+;
+
+: memory-limit ( -- limit )
+ " /memory" find-package 0= abort" No /memory node" ( phandle )
+ " available" rot get-package-property abort" No available property" ( $ )
+ -1 >r ( $ ) ( r: limit )
+ begin dup 0> while ( $ )
+ decode-int >r decode-int r> + ( $ piece-end )
+ dup 1meg u<= if drop else ( $ piece-end )
+ r> umin >r ( $ ) ( r: limit' )
+ then ( $ )
+ repeat ( $ )
+ 2drop r> ( limit )
+;
+
+: /1k d# 10 rshift ;
+: bigmem-16bit ( -- )
+ memory-limit
+ dup h# 100.0000 min h# 10.0000 - 0 max /1k dup rm-ax! rm-cx!
+ h# 100.0000 - 0 max d# 16 rshift dup rm-bx! rm-dx!
+;
+: bigmem-int ( -- )
+ rm-clr-cf
+ rm-al@ case
+ h# 01 of bigmem-16bit endof
+\ h# 20 of system-memory-map endof
+\ h# 81 of pm-system-memory-map endof
+ ( default ) rm-set-cf
+ ." Unsupported Bigmem int 15 AH=e8 AL=" dup . cr
+ endcase
+;
+
+: apm ( -- )
+ ." APM not supported yet" cr
+ rm-set-cf h# 86 rm-ah!
+;
+
+create sysconf 8 w, h# fc c, 1 c, 0 c, h# 70 c, 0 c, 0 c,
+: get-conf ( -- )
+ sysconf 'rm-regs 8 move
+ 'rm-regs >seg:off 0 caller-regs >rm-es w! rm-bx!
+;
+
+: system-int ( -- ) \ INT 15 handler
+ rm-ah@ case
+ h# 53 of apm endof
+ h# 86 of rm-dx@ rm-cx@ wljoin us endof \ Delay microseconds
+ h# 8a of memory-limit h# 400.0000 - 0 max /1k lwsplit rm-dx! rm-ax! endof
+ h# 88 of h# fffc rm-ax! endof \ Extended memory - at least 64 MB
+ h# c0 of get-conf endof
+ h# c1 of rm-set-cf h# 86 rm-ah! endof
+ h# e8 of bigmem-int endof
+ ( default ) rm-set-cf
+ ." Unsupported INT 15 AH=" dup . cr
+ endcase
+;
+
+: poll-key ( -- )
+ key? if
+ key rm-al! 0 rm-ah! \ ASCII in AL, scancode in AH
+ rm-flags@ h# 40 invert and rm-flags!
+ else
+ rm-flags@ h# 40 or rm-flags!
+ then
+;
+
+: keyboard-int ( -- ) \ INT 15 handler
+ rm-ah@ case
+ 1 of poll-key endof
+ 2 of 0 rm-al! endof \ Claim that no shift keys are active
+ ( bit 7:sysrq 6:capslock 5:numlock 4:scrlock 3:ralt 2:rctrl 1:lalt 0:lctrl )
+ ( default ) ." Keyboard INT called with AH = " dup . cr
+ endcase
+;
+
+: cfgadr ( -- adr )
+ caller-regs >rm-edi c@ rm-bx@ 8 lshift or
+;
+: pcibios-installed ( -- )
+ h# 20494350 caller-regs >rm-edx ! \ "PCI " in little-endian
+ 1 rm-al! \ Config method 1
+ h# 201 rm-bx! \ Version 2.1
+ 1 rm-cl! \ Number of last PCI bus - XXX get this from PCI node
+;
+: pcibios ( -- )
+ rm-clr-cf
+ rm-ah@ case
+ h# 01 of pcibios-installed endof
+\ h# 02 of find-pci-device ( cx:devid dx:vendid si:index -> bh:bus# bl:devfn ) endof
+\ h# 03 of find-pci-class-code ( ecx:0,classcode si:index -> bh:bus# bl:devfn ) endof
+\ h# 06 of pci-special-cycle ( bh:bus# edx:special_cycle_data ) endof
+ h# 08 of cfgadr config-b@ rm-cl! endof
+ h# 09 of cfgadr config-w@ rm-cx! endof
+ h# 0a of cfgadr config-l@ caller-regs >rm-ecx l! endof
+ h# 0b of rm-cl@ cfgadr config-b! endof
+ h# 0c of rm-cx@ cfgadr config-w! endof
+ h# 0d of caller-regs >rm-ecx l@ cfgadr config-l! endof
+ \ h# 0e of pci-int-rout endof
+ \ h# 0f of set-pci-int endof
+
+ ( default ) h# 81 rm-ah! rm-set-cf
+ ." Unimplemented PCI BIOS INT - AH = " dup . cr
+ endcase
+;
+
+: get-timer-ticks ( -- )
+ get-msecs d# 55 / lwsplit rm-cx! rm-dx!
+ 0 rm-al! \ Should be nonzero if midnight happened since last call
+;
+
+: int-1a ( -- )
+ rm-ah@ case
+ h# 0 of get-timer-ticks endof
+ h# b1 of pcibios endof
+ ( default ) ." Unimplemented INT 1a - AH = " dup . rm-set-cf
+ endcase
+;
+
+: showint
+ ." INT " 'rm-int w@ . ." AH " rm-ah@ . ." AL " rm-al@ . cr
+;
+
: handle-bios-call ( -- )
- 'rm-sp seg:off@ w@ h# ff and ( int# )
- 'rm-sp w@ 2+ 'rm-sp w! ( int# )
- ." Interrupt " . cr
- interact
+ 'rm-int w@ case
+ h# 10 of video-int endof
+ h# 11 of sysinfo-int endof
+ h# 13 of disk-int endof
+showint
+ h# 12 of h# a0000 /1k rm-ax! endof \ Low memory size
+ h# 15 of system-int endof
+ h# 16 of keyboard-int endof
+ h# 1a of int-1a endof
+ ( default ) ." Interrupt " dup . cr interact
+ endcase
;
: rm-go ( -- )
\ Load boot image at 7c00
@@ -212,3 +484,14 @@
h# 7c00 h# 3f 1 " read-blocks" r@ $call-method .
r> close-dev
;
+: .lreg ( adr -- adr' ) 4 - dup l@ 9 u.r ;
+: .wreg ( adr -- adr' ) 2 - dup w@ 5 u.r ;
+: .caller-regs ( -- )
+ ." AX CX BX DX SP BP SI DI" cr
+ caller-regs >rm-eax 4 + 8 0 do .lreg loop cr
+ cr
+ ." DS ES FS GS PC FLAGS" cr
+ 4 0 do .wreg loop
+ caller-regs >rm-retaddr seg:off@ 9 u.r 2 spaces
+ caller-regs >rm-flags w@ 5 u.r cr
+;
Added: cpu/x86/pc/biosload/usb.fth
===================================================================
--- cpu/x86/pc/biosload/usb.fth (rev 0)
+++ cpu/x86/pc/biosload/usb.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -0,0 +1,90 @@
+purpose: USB elaborations for the BIOS loaded OFW
+\ See license at end of file
+
+0 config-int usb-delay \ Milliseconds to wait before set-address
+
+devalias u /usb/disk
+
+\ 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@1d,7" open-dev ?dup if close-dev then
+ " /usb" $nopage-show-devs
+
+ ." USB1 devices:" cr
+ " /usb@1d,3" open-dev ?dup if close-dev then
+ " /usb@1d,3" $nopage-show-devs
+ " /usb@1d,2" open-dev ?dup if close-dev then
+ " /usb@1d,2" $nopage-show-devs
+ " /usb@1d,1" open-dev ?dup if close-dev then
+ " /usb@1d,1" $nopage-show-devs
+ " /usb@1d,0" open-dev ?dup if close-dev then
+ " /usb@1d,0" $nopage-show-devs
+;
+alias p2 probe-usb
+
+: ?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
+;
+
+: 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
+
+\ 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
Modified: cpu/x86/pc/resetend.fth
===================================================================
--- cpu/x86/pc/resetend.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/resetend.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -5,6 +5,8 @@
\ memory.
[ifndef] qemu-loaded
+[ifndef] syslinux-loaded
+[ifndef] preof-loaded
\ Move GDT to low memory. We use the first location at gdt-pa as
\ scratch memory for sgdt, and put the actual gdt at gdt-pa + 0x10
gdt-pa # ax mov
@@ -42,7 +44,6 @@
ax fs mov
ax gs mov
ax ss mov
-[then]
h# 20 # al mov al h# 80 # out
@@ -50,6 +51,9 @@
gdt-pa /page round-up # ax mov \ Current low-memory high water mark
ax mem-info-pa 2 la+ #) mov \ Store in memory info area
[then]
+[then]
+[then]
+[then]
cld
Modified: cpu/x86/pc/tsccal.fth
===================================================================
--- cpu/x86/pc/tsccal.fth 2008-01-18 17:38:46 UTC (rev 780)
+++ cpu/x86/pc/tsccal.fth 2008-01-18 17:46:07 UTC (rev 781)
@@ -58,7 +58,8 @@
;
stand-init: Calibrating millisecond timer
calibrate-ms
-;\ LICENSE_BEGIN
+;
+\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
\ Permission is hereby granted, free of charge, to any person obtaining