Fail* directories reorganized, Code-cleanup (-> coding-style), Typos+comments fixed.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1321 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-08 20:09:43 +00:00
parent d474a5b952
commit 2575604b41
866 changed files with 1848 additions and 1879 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,120 @@
# Copyright (C) 2001 MandrakeSoft S.A.
#
# MandrakeSoft S.A.
# 43, rue d'Aboukir
# 75002 Paris - France
# http://www.linux-mandrake.com/
# http://www.mandrakesoft.com/
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Makefile for the BIOS component of bochs
@SUFFIX_LINE@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = /bin/sh
@SET_MAKE@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
RANLIB = @RANLIB@
BCC = bcc
GCC = gcc
GCC32 = gcc -m32 -fno-stack-protector
AS86 = as86
BX_INCDIRS = -I.. -I$(srcdir)/.. -I../iodev -I$(srcdir)/../iodev
LOCAL_CXXFLAGS =
BUILDDATE = `date '+%m/%d/%y'`
BIOS_BUILD_DATE = "-DBIOS_BUILD_DATE=\"$(BUILDDATE)\""
#
# -------- end configurable options --------------------------
#
.@CPP_SUFFIX@.o:
$(CXX) -c $(BX_INCDIRS) $(CXXFLAGS) $(LOCAL_CXXFLAGS) @CXXFP@$< @OFP@$@
bios: biossums BIOS-bochs-latest BIOS-bochs-legacy
clean:
@RMCOMMAND@ *.o *.a *.s _rombios*_.c rombios*.txt rombios*.sym
@RMCOMMAND@ usage biossums rombios16.bin
@RMCOMMAND@ rombios32.bin rombios32.out
dist-clean: clean
@RMCOMMAND@ Makefile
bios-clean:
@RMCOMMAND@ BIOS-bochs-*
BIOS-bochs-legacy: rombios.c apmbios.S biossums rombios.h
$(GCC32) $(BIOS_BUILD_DATE) -DLEGACY -E -P $< > _rombiosl_.c
$(BCC) -o rombiosl.s -C-c -D__i86__ -0 -S _rombiosl_.c
sed -e 's/^\.text//' -e 's/^\.data//' rombiosl.s > _rombiosl_.s
$(AS86) _rombiosl_.s -b tmpl.bin -u- -w- -g -0 -j -O -l rombiosl.txt
-perl ${srcdir}/makesym.perl < rombiosl.txt > rombiosl.sym
mv tmpl.bin $@
./biossums $@
@RMCOMMAND@ _rombiosl_.s
rombios16.bin: rombios.c apmbios.S biossums rombios.h
$(GCC32) $(BIOS_BUILD_DATE) -E -P $< > _rombios_.c
$(BCC) -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c
sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s
$(AS86) _rombios_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombios.txt
-perl ${srcdir}/makesym.perl < rombios.txt > rombios.sym
mv tmp.bin rombios16.bin
./biossums rombios16.bin
@RMCOMMAND@ _rombios_.s
rombios32.bin: rombios32.out rombios.h
objcopy -O binary $< $@
./biossums -pad $@
rombios32.out: rombios32start.o rombios32.o rombios32.ld
ld -o $@ -T $(srcdir)/rombios32.ld rombios32start.o rombios32.o
rombios32.o: rombios32.c acpi-dsdt.hex rombios.h
$(GCC32) -O2 -Wall -c -o $@ $<
ifeq ("1", "0")
acpi-dsdt.hex: acpi-dsdt.dsl
cpp -P $< $<.i
iasl -tc -p $@ $<.i
rm $<.i
sed -i -e's/^unsigned/const unsigned/' $@
endif
rombios32start.o: rombios32start.S
$(GCC32) -c -o $@ $<
BIOS-bochs-latest: rombios16.bin rombios32.bin
cat rombios32.bin rombios16.bin > $@
biossums: biossums.o

Binary file not shown.

View File

@ -0,0 +1,9 @@
The VGA BIOS from Elpin Systems, Inc. (http://www.elpin.com/)
is now permanently licensed for use with bochs, courtesy
of MandrakeSoft, creators of the leading "Linux-Mandrake"
distribution (http://www.linux-mandrake.com/). You may
freely use/distribute it with bochs, as long as it is used
in bochs for the intended use as a VGA BIOS.
Please check out Elpin Systems. They make cool software games,
educational software, and VGA development products.

View File

@ -0,0 +1,226 @@
Plex86/Bochs VGABios
--------------------
The goal of this project is to have a LGPL'd Video Bios in plex86,
Bochs and qemu.
This VGA Bios is very specific to the emulated VGA card.
It is NOT meant to drive a physical vga card.
Cirrus SVGA extension
---------------------
The Cirrus SVGA extension is designed for the Cirrus emulation in Bochs and
qemu. The initial patch for the Cirrus extension has been written by Makoto
Suzuki (suzu).
Install
-------
To compile the VGA Bios you will need :
- gcc
- bcc
- as86
- ld86
Untar the archive, and type make. You should get a "VGABIOS-lgpl-latest.bin"
file. Alternatively, you can use the binary file "VGABIOS-lgpl-latest.bin",
i have compiled for you.
Edit your plex86/bochs conf file, and modify the load-rom command in the
VGA BIOS section, to point to the new vgabios image file.
Debugging
---------
You can get a very basic debugging system: messages printed by the vgabios.
You have to register the "unmapped" device driver in plex86 or bochs, and make
sure it grabs port 0xfff0.
Comment the #undef DEBUG at the beginning of vgabios.c.
You can then use the "printf" function in the bios.
Testing
-------
Look at the "testvga.c" file in the archive. This is a minimal Turbo C 2.0
source file that calls a few int10 functions. Feel free to modify it to suit
your needs.
Copyright and License
---------------------
This program has been written by Christophe Bothamy
It is protected by the GNU Lesser Public License, which you should
have received a copy of along with this package.
Reverse Engineering
-------------------
The VGA Bios has been written without reverse-engineering any existing Bios.
Acknowledgment
--------------
The source code contains code ripped from rombios.c of plex86, written
by Kevin Lawton <kevin2001@yahoo.com>
The source code contains fonts from fntcol16.zip (c) by Joseph Gil avalable at :
ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
These fonts are public domain
The source code is based on information taken from :
- Kevin Lawton's vga card emulation for bochs/plex86
- Ralf Brown's interrupts list avalaible at
http://www.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html
- Finn Thogersons' VGADOC4b available at http://home.worldonline.dk/~finth/
- Michael Abrash's Graphics Programming Black Book
- Francois Gervais' book "programmation des cartes graphiques cga-ega-vga"
edited by sybex
- DOSEMU 1.0.1 source code for several tables values and formulas
Feedback
--------
Please report any bugs, comments, patches for this VGA Bios to info@vruppert.de
You can find the latest release at : http://www.nongnu.org/vgabios/
For any information on bochs, visit the website http://bochs.sourceforge.net/
For any information on qemu, visit the website http://fabrice.bellard.free.fr/qemu/
History
-------
vgabios-0.6c : Apr 08 2009
- Volker
. added DPMS support to cirrus vgabios (patch from Gleb Natapov)
. use VBE LFB address from PCI base address if present
. added support for a lot more non-standard VBE modes (e.g. widescreen modes)
. minor bugfixes
vgabios-0.6b : May 30 2008
- Volker
. added PCI data structure for the Cirrus VGABIOS images
. minor bugfixes in biossums utility, VBE support and makefile
vgabios-0.6a : Aug 19 2006
- Volker
. added minimal support for the video parameter table (VPT)
. Cirrus SVGA now supports the "no clear" bit in Cirrus and VESA mode
. Bochs VBE protected mode interface improved
. save/restore video state support for Bochs VBE and standard VGA added
. generate vbetables.h dynamicly
. VBE video memory increased to 8 MB (VBE dispi ID changed to B0C4)
. lots of 4bpp VBE fixes (all 4bpp VBE modes now enabled)
. VGA compatible setup for VBE modes added
vgabios-0.5d : Dec 29 2005
- Volker
. Bochs VBE protected mode interface added (based on a patch by malc@pulsesoft.com)
. biossums utility now supports VGABIOS sizes up to 64 kBytes
. VGA mode 0x11: all color planes must be enabled in this 2-color VGA mode
vgabios-0.5c : Jul 07 2005
- Volker
. BIOS configuration word usually reports initial mode 80x25 color text
. vgabios function 0x0e (write teletype): linefeed (0x0a) only increments the
cursor row value
vgabios-0.5b : May 24 2005
- Volker
. fixed return value for the default case in the VBE section (non-debug mode)
. removed unused stuff
vgabios-0.5a : Mar 07 2005
- Volker
. Cirrus SVGA extension (initial patches from Makoto Suzuki, improvements
from Fabrice Bellard)
. vgabios image size is now exactly 32k with a checksum
. a lot of vgabios and vbe functions rewritten in assembler
. dynamicly generated VBE mode info list
. write character function for CGA and LINEAR8 modes
. read/write graphics pixel for some graphics modes
. text scroll feature for some graphics modes
. VBE 8-bit DAC support
vgabios-0.4c : Nov 06 2003
- Christophe
. fix font problem on initial screen of NT4 Loader
vgabios-0.4b : Nov 04 2003
- Volker
. fix offset of character tables
. optimizations of CRT controller accesses
. VBE i/o registers changed to 0x01CE/CF
(suggestion from Daniel Gimpelevich)
. "noclear" flag stored in BIOS area
. fix character height returned by get_font_info function
vgabios-0.4a : Aug 17 2003
- Volker
. VBE mode search rewritten (VBE modes with LFB bit removed)
. many bugfixes and optimizations
. write character function implemented for graphics modes
. support for 15bpp, 16bpp, 24bpp and 32bpp VBE modes added
. SVGA mode 0x6A added
. VBE modes 0x102, 0x117, 0x118 and 0x142 (Bochs specific)
vgabios-0.3b : Nov 23 2002
- Christophe
. added lfb-mode numbers (patch from mathis)
. updated the Makefile
. removed display of copyrights.
. changed the Copyright string to "LGPL VGABios developers"
- Volker
. set the cursor shape depending on the current font height
. clear BL before calling int 0x10 function 0x1103 in vgabios_init_func
. added some text font functions
- Jeroen
. Forced to new DISPI (0xb0c1) interface (requires latest bochs vbe code)
. Added multibuffering support
. Added new DISPI interface for: virt width, height, x offset, y offset
. Added LFB modes (to be used with the vbe-lfb patch in bochs)
see VBE_HAVE_LFB in vbe.c (currently default enabled)
. updated TODO & docs for changes after bochs 1.4
vgabios-0.3a : Mar 10 2002
- Christophe
. Fixed bug in function ah=13
- Jeroen
. updated vbebios implementation to new api
. added vbe_display_api documentation
. added 640x400x8, 640x480x8, 800x600x8, 1024x768
(>640x480 needs a special bochs patch atm)
. added 320x200x8 vbe support (uses the standard 320x200x8 vga mode to
display, this allows for testing & having something on screen as well,
at least until bochs host side display is up & running)
. adding lfbprof (vbe) testprogram (+some small fixes to it)
. merging with vbebios 0.2
vgabios-0.2b : Nov 19 2001
- Christophe
. Fixed bug in function ah=13
vgabios-0.2a : Nov 09 2001
- Christophe
. Included bugfix from techt@pikeonline.net about grayscale summing
. Added the "IBM" string at org 0x1e as Bart Oldeman suggested
. Fixed DS and ES that where inverted in the int10 parameters list!
. The following have been implemented :
- function ax=1a00, ax=1a01, ah=1b
- function ax=1130
. Added debug messages for unimplemented/unknown functions
Must be compiled with DEBUG defined. The output is trapped
by the unknown-ioport driver of plex/bochs (port 0xfff0 is used)
vgabios-0.1a : May 8 2001
- Christophe
. First release. The work has been focused only on text mode.
. The following have been implemented :
- inits
- int 10 handler
- functions ah=00, ah=01, ah=02, ah=03, ah=05, ah=06, ah=07, ah=08
ah=09, ah=0a, ah=0e, ah=0f, ax=1000, ax=1001, ax=1002, ax=1003
ax=1007, ax=1008, ax=1009, ax=1010, ax=1012, ax=1013, ax=1015
ax=1017, ax=1018, ax=1019, ax=101a, ax=101b, ah=12 bl=10,
ah=12 bl=30, ah=12 bl=31, ah=12 bl=32, ah=12 bl=33, ah=12 bl=34
ah=13

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,594 @@
/*
* Bochs/QEMU ACPI DSDT ASL definition
*
* Copyright (c) 2006 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
DefinitionBlock (
"acpi-dsdt.aml", // Output Filename
"DSDT", // Signature
0x01, // DSDT Compliance Revision
"BXPC", // OEMID
"BXDSDT", // TABLE ID
0x1 // OEM Revision
)
{
Scope (\)
{
/* Debug Output */
OperationRegion (DBG, SystemIO, 0xb044, 0x04)
Field (DBG, DWordAcc, NoLock, Preserve)
{
DBGL, 32,
}
}
/* PCI Bus definition */
Scope(\_SB) {
Device(PCI0) {
Name (_HID, EisaId ("PNP0A03"))
Name (_ADR, 0x00)
Name (_UID, 1)
Name(_PRT, Package() {
/* PCI IRQ routing table, example from ACPI 2.0a specification,
section 6.2.8.1 */
/* Note: we provide the same info as the PCI routing
table of the Bochs BIOS */
// PCI Slot 0
Package() {0x0000ffff, 0, LNKD, 0},
Package() {0x0000ffff, 1, LNKA, 0},
Package() {0x0000ffff, 2, LNKB, 0},
Package() {0x0000ffff, 3, LNKC, 0},
// PCI Slot 1
Package() {0x0001ffff, 0, LNKA, 0},
Package() {0x0001ffff, 1, LNKB, 0},
Package() {0x0001ffff, 2, LNKC, 0},
Package() {0x0001ffff, 3, LNKD, 0},
// PCI Slot 2
Package() {0x0002ffff, 0, LNKB, 0},
Package() {0x0002ffff, 1, LNKC, 0},
Package() {0x0002ffff, 2, LNKD, 0},
Package() {0x0002ffff, 3, LNKA, 0},
// PCI Slot 3
Package() {0x0003ffff, 0, LNKC, 0},
Package() {0x0003ffff, 1, LNKD, 0},
Package() {0x0003ffff, 2, LNKA, 0},
Package() {0x0003ffff, 3, LNKB, 0},
// PCI Slot 4
Package() {0x0004ffff, 0, LNKD, 0},
Package() {0x0004ffff, 1, LNKA, 0},
Package() {0x0004ffff, 2, LNKB, 0},
Package() {0x0004ffff, 3, LNKC, 0},
// PCI Slot 5
Package() {0x0005ffff, 0, LNKA, 0},
Package() {0x0005ffff, 1, LNKB, 0},
Package() {0x0005ffff, 2, LNKC, 0},
Package() {0x0005ffff, 3, LNKD, 0},
})
Name (_CRS, ResourceTemplate ()
{
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
0x0000, // Address Space Granularity
0x0000, // Address Range Minimum
0x00FF, // Address Range Maximum
0x0000, // Address Translation Offset
0x0100, // Address Length
,, )
IO (Decode16,
0x0CF8, // Address Range Minimum
0x0CF8, // Address Range Maximum
0x01, // Address Alignment
0x08, // Address Length
)
WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x0000, // Address Space Granularity
0x0000, // Address Range Minimum
0x0CF7, // Address Range Maximum
0x0000, // Address Translation Offset
0x0CF8, // Address Length
,, , TypeStatic)
WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x0000, // Address Space Granularity
0x0D00, // Address Range Minimum
0xFFFF, // Address Range Maximum
0x0000, // Address Translation Offset
0xF300, // Address Length
,, , TypeStatic)
DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
0x00000000, // Address Space Granularity
0x000A0000, // Address Range Minimum
0x000BFFFF, // Address Range Maximum
0x00000000, // Address Translation Offset
0x00020000, // Address Length
,, , AddressRangeMemory, TypeStatic)
DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
0x00000000, // Address Space Granularity
0xC0000000, // Address Range Minimum
0xFEBFFFFF, // Address Range Maximum
0x00000000, // Address Translation Offset
0x3EC00000, // Address Length
,, , AddressRangeMemory, TypeStatic)
})
}
#ifdef BX_QEMU
Device(HPET) {
Name(_HID, EISAID("PNP0103"))
Name(_UID, 0)
Method (_STA, 0, NotSerialized) {
Return(0x0F)
}
Name(_CRS, ResourceTemplate() {
DWordMemory(
ResourceConsumer, PosDecode, MinFixed, MaxFixed,
NonCacheable, ReadWrite,
0x00000000,
0xFED00000,
0xFED003FF,
0x00000000,
0x00000400 /* 1K memory: FED00000 - FED003FF */
)
})
}
#endif
}
Scope(\_SB.PCI0) {
Device (VGA) {
Name (_ADR, 0x00020000)
Method (_S1D, 0, NotSerialized)
{
Return (0x00)
}
Method (_S2D, 0, NotSerialized)
{
Return (0x00)
}
Method (_S3D, 0, NotSerialized)
{
Return (0x00)
}
}
/* PIIX3 ISA bridge */
Device (ISA) {
Name (_ADR, 0x00010000)
/* PIIX PCI to ISA irq remapping */
OperationRegion (P40C, PCI_Config, 0x60, 0x04)
/* Real-time clock */
Device (RTC)
{
Name (_HID, EisaId ("PNP0B00"))
Name (_CRS, ResourceTemplate ()
{
IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
IRQNoFlags () {8}
IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
})
}
/* Keyboard seems to be important for WinXP install */
Device (KBD)
{
Name (_HID, EisaId ("PNP0303"))
Method (_STA, 0, NotSerialized)
{
Return (0x0f)
}
Method (_CRS, 0, NotSerialized)
{
Name (TMP, ResourceTemplate ()
{
IO (Decode16,
0x0060, // Address Range Minimum
0x0060, // Address Range Maximum
0x01, // Address Alignment
0x01, // Address Length
)
IO (Decode16,
0x0064, // Address Range Minimum
0x0064, // Address Range Maximum
0x01, // Address Alignment
0x01, // Address Length
)
IRQNoFlags ()
{1}
})
Return (TMP)
}
}
/* PS/2 mouse */
Device (MOU)
{
Name (_HID, EisaId ("PNP0F13"))
Method (_STA, 0, NotSerialized)
{
Return (0x0f)
}
Method (_CRS, 0, NotSerialized)
{
Name (TMP, ResourceTemplate ()
{
IRQNoFlags () {12}
})
Return (TMP)
}
}
/* PS/2 floppy controller */
Device (FDC0)
{
Name (_HID, EisaId ("PNP0700"))
Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}
Method (_CRS, 0, NotSerialized)
{
Name (BUF0, ResourceTemplate ()
{
IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
IRQNoFlags () {6}
DMA (Compatibility, NotBusMaster, Transfer8) {2}
})
Return (BUF0)
}
}
/* Parallel port */
Device (LPT)
{
Name (_HID, EisaId ("PNP0400"))
Method (_STA, 0, NotSerialized)
{
Store (\_SB.PCI0.PX13.DRSA, Local0)
And (Local0, 0x80000000, Local0)
If (LEqual (Local0, 0))
{
Return (0x00)
}
Else
{
Return (0x0F)
}
}
Method (_CRS, 0, NotSerialized)
{
Name (BUF0, ResourceTemplate ()
{
IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
IRQNoFlags () {7}
})
Return (BUF0)
}
}
/* Serial Ports */
Device (COM1)
{
Name (_HID, EisaId ("PNP0501"))
Name (_UID, 0x01)
Method (_STA, 0, NotSerialized)
{
Store (\_SB.PCI0.PX13.DRSC, Local0)
And (Local0, 0x08000000, Local0)
If (LEqual (Local0, 0))
{
Return (0x00)
}
Else
{
Return (0x0F)
}
}
Method (_CRS, 0, NotSerialized)
{
Name (BUF0, ResourceTemplate ()
{
IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
IRQNoFlags () {4}
})
Return (BUF0)
}
}
Device (COM2)
{
Name (_HID, EisaId ("PNP0501"))
Name (_UID, 0x02)
Method (_STA, 0, NotSerialized)
{
Store (\_SB.PCI0.PX13.DRSC, Local0)
And (Local0, 0x80000000, Local0)
If (LEqual (Local0, 0))
{
Return (0x00)
}
Else
{
Return (0x0F)
}
}
Method (_CRS, 0, NotSerialized)
{
Name (BUF0, ResourceTemplate ()
{
IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
IRQNoFlags () {3}
})
Return (BUF0)
}
}
}
/* PIIX4 PM */
Device (PX13) {
Name (_ADR, 0x00010003)
OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
Field (P13C, DWordAcc, NoLock, Preserve)
{
DRSA, 32,
DRSB, 32,
DRSC, 32,
DRSE, 32,
DRSF, 32,
DRSG, 32,
DRSH, 32,
DRSI, 32,
DRSJ, 32
}
}
}
/* PCI IRQs */
Scope(\_SB) {
Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
{
PRQ0, 8,
PRQ1, 8,
PRQ2, 8,
PRQ3, 8
}
Device(LNKA){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 1)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveLow, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
{
Store (0x0B, Local0)
If (And (0x80, PRQ0, Local1))
{
Store (0x09, Local0)
}
Return (Local0)
}
Method (_DIS, 0, NotSerialized)
{
Or (PRQ0, 0x80, PRQ0)
}
Method (_CRS, 0, NotSerialized)
{
Name (PRR0, ResourceTemplate ()
{
IRQ (Level, ActiveLow, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
Store (PRQ0, Local0)
If (LLess (Local0, 0x80))
{
ShiftLeft (One, Local0, TMP)
}
Else
{
Store (Zero, TMP)
}
Return (PRR0)
}
Method (_SRS, 1, NotSerialized)
{
CreateWordField (Arg0, 0x01, TMP)
FindSetRightBit (TMP, Local0)
Decrement (Local0)
Store (Local0, PRQ0)
}
}
Device(LNKB){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 2)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveLow, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
{
Store (0x0B, Local0)
If (And (0x80, PRQ1, Local1))
{
Store (0x09, Local0)
}
Return (Local0)
}
Method (_DIS, 0, NotSerialized)
{
Or (PRQ1, 0x80, PRQ1)
}
Method (_CRS, 0, NotSerialized)
{
Name (PRR0, ResourceTemplate ()
{
IRQ (Level, ActiveLow, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
Store (PRQ1, Local0)
If (LLess (Local0, 0x80))
{
ShiftLeft (One, Local0, TMP)
}
Else
{
Store (Zero, TMP)
}
Return (PRR0)
}
Method (_SRS, 1, NotSerialized)
{
CreateWordField (Arg0, 0x01, TMP)
FindSetRightBit (TMP, Local0)
Decrement (Local0)
Store (Local0, PRQ1)
}
}
Device(LNKC){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 3)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveLow, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
{
Store (0x0B, Local0)
If (And (0x80, PRQ2, Local1))
{
Store (0x09, Local0)
}
Return (Local0)
}
Method (_DIS, 0, NotSerialized)
{
Or (PRQ2, 0x80, PRQ2)
}
Method (_CRS, 0, NotSerialized)
{
Name (PRR0, ResourceTemplate ()
{
IRQ (Level, ActiveLow, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
Store (PRQ2, Local0)
If (LLess (Local0, 0x80))
{
ShiftLeft (One, Local0, TMP)
}
Else
{
Store (Zero, TMP)
}
Return (PRR0)
}
Method (_SRS, 1, NotSerialized)
{
CreateWordField (Arg0, 0x01, TMP)
FindSetRightBit (TMP, Local0)
Decrement (Local0)
Store (Local0, PRQ2)
}
}
Device(LNKD){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 4)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveLow, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
{
Store (0x0B, Local0)
If (And (0x80, PRQ3, Local1))
{
Store (0x09, Local0)
}
Return (Local0)
}
Method (_DIS, 0, NotSerialized)
{
Or (PRQ3, 0x80, PRQ3)
}
Method (_CRS, 0, NotSerialized)
{
Name (PRR0, ResourceTemplate ()
{
IRQ (Level, ActiveLow, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
Store (PRQ3, Local0)
If (LLess (Local0, 0x80))
{
ShiftLeft (One, Local0, TMP)
}
Else
{
Store (Zero, TMP)
}
Return (PRR0)
}
Method (_SRS, 1, NotSerialized)
{
CreateWordField (Arg0, 0x01, TMP)
FindSetRightBit (TMP, Local0)
Decrement (Local0)
Store (Local0, PRQ3)
}
}
}
/*
* S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
* must match piix4 emulation.
*/
Name (\_S3, Package (0x04)
{
0x01, /* PM1a_CNT.SLP_TYP */
0x01, /* PM1b_CNT.SLP_TYP */
Zero, /* reserved */
Zero /* reserved */
})
Name (\_S4, Package (0x04)
{
Zero, /* PM1a_CNT.SLP_TYP */
Zero, /* PM1b_CNT.SLP_TYP */
Zero, /* reserved */
Zero /* reserved */
})
Name (\_S5, Package (0x04)
{
Zero, /* PM1a_CNT.SLP_TYP */
Zero, /* PM1b_CNT.SLP_TYP */
Zero, /* reserved */
Zero /* reserved */
})
}

View File

@ -0,0 +1,273 @@
/*
*
* Intel ACPI Component Architecture
* ASL Optimizing Compiler version 20090320 [Oct 24 2009]
* Copyright (C) 2000 - 2009 Intel Corporation
* Supports ACPI Specification Revision 3.0a
*
* Compilation of "acpi-dsdt.dsl.i" - Sun Dec 20 15:20:28 2009
*
* C source code output
*
*/
const unsigned char AmlCode[] =
{
0x44,0x53,0x44,0x54,0x0D,0x08,0x00,0x00, /* 00000000 "DSDT...." */
0x01,0x95,0x42,0x58,0x50,0x43,0x00,0x00, /* 00000008 "..BXPC.." */
0x42,0x58,0x44,0x53,0x44,0x54,0x00,0x00, /* 00000010 "BXDSDT.." */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x20,0x03,0x09,0x20,0x10,0x1C,0x5C,0x00, /* 00000020 " .. ..\." */
0x5B,0x80,0x44,0x42,0x47,0x5F,0x01,0x0B, /* 00000028 "[.DBG_.." */
0x44,0xB0,0x0A,0x04,0x5B,0x81,0x0B,0x44, /* 00000030 "D...[..D" */
0x42,0x47,0x5F,0x03,0x44,0x42,0x47,0x4C, /* 00000038 "BG_.DBGL" */
0x20,0x10,0x49,0x1F,0x5F,0x53,0x42,0x5F, /* 00000040 " .I._SB_" */
0x5B,0x82,0x41,0x1F,0x50,0x43,0x49,0x30, /* 00000048 "[.A.PCI0" */
0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000050 "._HID.A." */
0x0A,0x03,0x08,0x5F,0x41,0x44,0x52,0x00, /* 00000058 "..._ADR." */
0x08,0x5F,0x55,0x49,0x44,0x01,0x08,0x5F, /* 00000060 "._UID.._" */
0x50,0x52,0x54,0x12,0x47,0x15,0x18,0x12, /* 00000068 "PRT.G..." */
0x0B,0x04,0x0B,0xFF,0xFF,0x00,0x4C,0x4E, /* 00000070 "......LN" */
0x4B,0x44,0x00,0x12,0x0B,0x04,0x0B,0xFF, /* 00000078 "KD......" */
0xFF,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000080 "..LNKA.." */
0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x02,0x4C, /* 00000088 ".......L" */
0x4E,0x4B,0x42,0x00,0x12,0x0C,0x04,0x0B, /* 00000090 "NKB....." */
0xFF,0xFF,0x0A,0x03,0x4C,0x4E,0x4B,0x43, /* 00000098 "....LNKC" */
0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01, /* 000000A0 "........" */
0x00,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 000000A8 "..LNKA.." */
0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x01, /* 000000B0 "........" */
0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04, /* 000000B8 "LNKB...." */
0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,0x4C, /* 000000C0 ".......L" */
0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C, /* 000000C8 "NKC....." */
0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,0x4E, /* 000000D0 "......LN" */
0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000000D8 "KD......" */
0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,0x42, /* 000000E0 "....LNKB" */
0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02, /* 000000E8 "........" */
0x00,0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000000F0 "..LNKC.." */
0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A, /* 000000F8 "........" */
0x02,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E, /* 00000100 ".LNKD..." */
0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03, /* 00000108 "........" */
0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04, /* 00000110 "LNKA...." */
0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,0x4E, /* 00000118 "......LN" */
0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000120 "KC......" */
0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,0x44, /* 00000128 "....LNKD" */
0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03, /* 00000130 "........" */
0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00, /* 00000138 "...LNKA." */
0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00, /* 00000140 "........" */
0x0A,0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 00000148 "..LNKB.." */
0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00, /* 00000150 "........" */
0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04, /* 00000158 "LNKD...." */
0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C,0x4E, /* 00000160 "......LN" */
0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000168 "KA......" */
0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000170 ".....LNK" */
0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000178 "B......." */
0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43, /* 00000180 "....LNKC" */
0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05, /* 00000188 "........" */
0x00,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000190 "..LNKA.." */
0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x01, /* 00000198 "........" */
0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04, /* 000001A0 "LNKB...." */
0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,0x4C, /* 000001A8 ".......L" */
0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C, /* 000001B0 "NKC....." */
0xFF,0xFF,0x05,0x00,0x0A,0x03,0x4C,0x4E, /* 000001B8 "......LN" */
0x4B,0x44,0x00,0x08,0x5F,0x43,0x52,0x53, /* 000001C0 "KD.._CRS" */
0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00, /* 000001C8 ".B..n..." */
0x02,0x0C,0x00,0x00,0x00,0x00,0x00,0xFF, /* 000001D0 "........" */
0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8, /* 000001D8 ".....G.." */
0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00, /* 000001E0 "........" */
0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7, /* 000001E8 "........" */
0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00, /* 000001F0 "........" */
0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF, /* 000001F8 "........" */
0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00, /* 00000200 "........" */
0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00, /* 00000208 "........" */
0x00,0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00, /* 00000210 "........" */
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x87, /* 00000218 "........" */
0x17,0x00,0x00,0x0C,0x01,0x00,0x00,0x00, /* 00000220 "........" */
0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xBF, /* 00000228 "........" */
0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xC0, /* 00000230 "........" */
0x3E,0x79,0x00,0x10,0x4D,0x2B,0x2E,0x5F, /* 00000238 ">y..M+._" */
0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x5B, /* 00000240 "SB_PCI0[" */
0x82,0x2A,0x56,0x47,0x41,0x5F,0x08,0x5F, /* 00000248 ".*VGA_._" */
0x41,0x44,0x52,0x0C,0x00,0x00,0x02,0x00, /* 00000250 "ADR....." */
0x14,0x08,0x5F,0x53,0x31,0x44,0x00,0xA4, /* 00000258 ".._S1D.." */
0x00,0x14,0x08,0x5F,0x53,0x32,0x44,0x00, /* 00000260 "..._S2D." */
0xA4,0x00,0x14,0x08,0x5F,0x53,0x33,0x44, /* 00000268 "...._S3D" */
0x00,0xA4,0x00,0x5B,0x82,0x42,0x23,0x49, /* 00000270 "...[.B#I" */
0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,0x52, /* 00000278 "SA_._ADR" */
0x0C,0x00,0x00,0x01,0x00,0x5B,0x80,0x50, /* 00000280 ".....[.P" */
0x34,0x30,0x43,0x02,0x0A,0x60,0x0A,0x04, /* 00000288 "40C..`.." */
0x5B,0x82,0x2D,0x52,0x54,0x43,0x5F,0x08, /* 00000290 "[.-RTC_." */
0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B, /* 00000298 "_HID.A.." */
0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x18, /* 000002A0 ".._CRS.." */
0x0A,0x15,0x47,0x01,0x70,0x00,0x70,0x00, /* 000002A8 "..G.p.p." */
0x10,0x02,0x22,0x00,0x01,0x47,0x01,0x72, /* 000002B0 ".."..G.r" */
0x00,0x72,0x00,0x02,0x06,0x79,0x00,0x5B, /* 000002B8 ".r...y.[" */
0x82,0x44,0x04,0x4B,0x42,0x44,0x5F,0x08, /* 000002C0 ".D.KBD_." */
0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x03, /* 000002C8 "_HID.A.." */
0x03,0x14,0x09,0x5F,0x53,0x54,0x41,0x00, /* 000002D0 "..._STA." */
0xA4,0x0A,0x0F,0x14,0x29,0x5F,0x43,0x52, /* 000002D8 "....)_CR" */
0x53,0x00,0x08,0x54,0x4D,0x50,0x5F,0x11, /* 000002E0 "S..TMP_." */
0x18,0x0A,0x15,0x47,0x01,0x60,0x00,0x60, /* 000002E8 "...G.`.`" */
0x00,0x01,0x01,0x47,0x01,0x64,0x00,0x64, /* 000002F0 "...G.d.d" */
0x00,0x01,0x01,0x22,0x02,0x00,0x79,0x00, /* 000002F8 "..."..y." */
0xA4,0x54,0x4D,0x50,0x5F,0x5B,0x82,0x33, /* 00000300 ".TMP_[.3" */
0x4D,0x4F,0x55,0x5F,0x08,0x5F,0x48,0x49, /* 00000308 "MOU_._HI" */
0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09, /* 00000310 "D.A....." */
0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F, /* 00000318 "_STA...." */
0x14,0x19,0x5F,0x43,0x52,0x53,0x00,0x08, /* 00000320 ".._CRS.." */
0x54,0x4D,0x50,0x5F,0x11,0x08,0x0A,0x05, /* 00000328 "TMP_...." */
0x22,0x00,0x10,0x79,0x00,0xA4,0x54,0x4D, /* 00000330 ""..y..TM" */
0x50,0x5F,0x5B,0x82,0x47,0x04,0x46,0x44, /* 00000338 "P_[.G.FD" */
0x43,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000340 "C0._HID." */
0x41,0xD0,0x07,0x00,0x14,0x09,0x5F,0x53, /* 00000348 "A....._S" */
0x54,0x41,0x00,0xA4,0x0A,0x0F,0x14,0x2C, /* 00000350 "TA.....," */
0x5F,0x43,0x52,0x53,0x00,0x08,0x42,0x55, /* 00000358 "_CRS..BU" */
0x46,0x30,0x11,0x1B,0x0A,0x18,0x47,0x01, /* 00000360 "F0....G." */
0xF2,0x03,0xF2,0x03,0x00,0x04,0x47,0x01, /* 00000368 "......G." */
0xF7,0x03,0xF7,0x03,0x00,0x01,0x22,0x40, /* 00000370 "......"@" */
0x00,0x2A,0x04,0x00,0x79,0x00,0xA4,0x42, /* 00000378 ".*..y..B" */
0x55,0x46,0x30,0x5B,0x82,0x4B,0x05,0x4C, /* 00000380 "UF0[.K.L" */
0x50,0x54,0x5F,0x08,0x5F,0x48,0x49,0x44, /* 00000388 "PT_._HID" */
0x0C,0x41,0xD0,0x04,0x00,0x14,0x28,0x5F, /* 00000390 ".A....(_" */
0x53,0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E, /* 00000398 "STA.p^^^" */
0x2E,0x50,0x58,0x31,0x33,0x44,0x52,0x53, /* 000003A0 ".PX13DRS" */
0x41,0x60,0x7B,0x60,0x0C,0x00,0x00,0x00, /* 000003A8 "A`{`...." */
0x80,0x60,0xA0,0x06,0x93,0x60,0x00,0xA4, /* 000003B0 ".`...`.." */
0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21, /* 000003B8 ".......!" */
0x5F,0x43,0x52,0x53,0x00,0x08,0x42,0x55, /* 000003C0 "_CRS..BU" */
0x46,0x30,0x11,0x10,0x0A,0x0D,0x47,0x01, /* 000003C8 "F0....G." */
0x78,0x03,0x78,0x03,0x08,0x08,0x22,0x80, /* 000003D0 "x.x..."." */
0x00,0x79,0x00,0xA4,0x42,0x55,0x46,0x30, /* 000003D8 ".y..BUF0" */
0x5B,0x82,0x41,0x06,0x43,0x4F,0x4D,0x31, /* 000003E0 "[.A.COM1" */
0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 000003E8 "._HID.A." */
0x05,0x01,0x08,0x5F,0x55,0x49,0x44,0x01, /* 000003F0 "..._UID." */
0x14,0x28,0x5F,0x53,0x54,0x41,0x00,0x70, /* 000003F8 ".(_STA.p" */
0x5E,0x5E,0x5E,0x2E,0x50,0x58,0x31,0x33, /* 00000400 "^^^.PX13" */
0x44,0x52,0x53,0x43,0x60,0x7B,0x60,0x0C, /* 00000408 "DRSC`{`." */
0x00,0x00,0x00,0x08,0x60,0xA0,0x06,0x93, /* 00000410 "....`..." */
0x60,0x00,0xA4,0x00,0xA1,0x04,0xA4,0x0A, /* 00000418 "`......." */
0x0F,0x14,0x21,0x5F,0x43,0x52,0x53,0x00, /* 00000420 "..!_CRS." */
0x08,0x42,0x55,0x46,0x30,0x11,0x10,0x0A, /* 00000428 ".BUF0..." */
0x0D,0x47,0x01,0xF8,0x03,0xF8,0x03,0x00, /* 00000430 ".G......" */
0x08,0x22,0x10,0x00,0x79,0x00,0xA4,0x42, /* 00000438 "."..y..B" */
0x55,0x46,0x30,0x5B,0x82,0x42,0x06,0x43, /* 00000440 "UF0[.B.C" */
0x4F,0x4D,0x32,0x08,0x5F,0x48,0x49,0x44, /* 00000448 "OM2._HID" */
0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55, /* 00000450 ".A...._U" */
0x49,0x44,0x0A,0x02,0x14,0x28,0x5F,0x53, /* 00000458 "ID...(_S" */
0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E,0x2E, /* 00000460 "TA.p^^^." */
0x50,0x58,0x31,0x33,0x44,0x52,0x53,0x43, /* 00000468 "PX13DRSC" */
0x60,0x7B,0x60,0x0C,0x00,0x00,0x00,0x80, /* 00000470 "`{`....." */
0x60,0xA0,0x06,0x93,0x60,0x00,0xA4,0x00, /* 00000478 "`...`..." */
0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21,0x5F, /* 00000480 "......!_" */
0x43,0x52,0x53,0x00,0x08,0x42,0x55,0x46, /* 00000488 "CRS..BUF" */
0x30,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8, /* 00000490 "0....G.." */
0x02,0xF8,0x02,0x00,0x08,0x22,0x08,0x00, /* 00000498 ".....".." */
0x79,0x00,0xA4,0x42,0x55,0x46,0x30,0x5B, /* 000004A0 "y..BUF0[" */
0x82,0x40,0x05,0x50,0x58,0x31,0x33,0x08, /* 000004A8 ".@.PX13." */
0x5F,0x41,0x44,0x52,0x0C,0x03,0x00,0x01, /* 000004B0 "_ADR...." */
0x00,0x5B,0x80,0x50,0x31,0x33,0x43,0x02, /* 000004B8 ".[.P13C." */
0x0A,0x5C,0x0A,0x24,0x5B,0x81,0x33,0x50, /* 000004C0 ".\.$[.3P" */
0x31,0x33,0x43,0x03,0x44,0x52,0x53,0x41, /* 000004C8 "13C.DRSA" */
0x20,0x44,0x52,0x53,0x42,0x20,0x44,0x52, /* 000004D0 " DRSB DR" */
0x53,0x43,0x20,0x44,0x52,0x53,0x45,0x20, /* 000004D8 "SC DRSE " */
0x44,0x52,0x53,0x46,0x20,0x44,0x52,0x53, /* 000004E0 "DRSF DRS" */
0x47,0x20,0x44,0x52,0x53,0x48,0x20,0x44, /* 000004E8 "G DRSH D" */
0x52,0x53,0x49,0x20,0x44,0x52,0x53,0x4A, /* 000004F0 "RSI DRSJ" */
0x20,0x10,0x4F,0x2E,0x5F,0x53,0x42,0x5F, /* 000004F8 " .O._SB_" */
0x5B,0x81,0x24,0x2F,0x03,0x50,0x43,0x49, /* 00000500 "[.$/.PCI" */
0x30,0x49,0x53,0x41,0x5F,0x50,0x34,0x30, /* 00000508 "0ISA_P40" */
0x43,0x01,0x50,0x52,0x51,0x30,0x08,0x50, /* 00000510 "C.PRQ0.P" */
0x52,0x51,0x31,0x08,0x50,0x52,0x51,0x32, /* 00000518 "RQ1.PRQ2" */
0x08,0x50,0x52,0x51,0x33,0x08,0x5B,0x82, /* 00000520 ".PRQ3.[." */
0x4E,0x0A,0x4C,0x4E,0x4B,0x41,0x08,0x5F, /* 00000528 "N.LNKA._" */
0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F, /* 00000530 "HID.A..." */
0x08,0x5F,0x55,0x49,0x44,0x01,0x08,0x5F, /* 00000538 "._UID.._" */
0x50,0x52,0x53,0x11,0x09,0x0A,0x06,0x23, /* 00000540 "PRS....#" */
0xF8,0x1E,0x18,0x79,0x00,0x14,0x1A,0x5F, /* 00000548 "...y..._" */
0x53,0x54,0x41,0x00,0x70,0x0A,0x0B,0x60, /* 00000550 "STA.p..`" */
0xA0,0x0D,0x7B,0x0A,0x80,0x50,0x52,0x51, /* 00000558 "..{..PRQ" */
0x30,0x61,0x70,0x0A,0x09,0x60,0xA4,0x60, /* 00000560 "0ap..`.`" */
0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D, /* 00000568 ".._DIS.}" */
0x50,0x52,0x51,0x30,0x0A,0x80,0x50,0x52, /* 00000570 "PRQ0..PR" */
0x51,0x30,0x14,0x3F,0x5F,0x43,0x52,0x53, /* 00000578 "Q0.?_CRS" */
0x00,0x08,0x50,0x52,0x52,0x30,0x11,0x09, /* 00000580 "..PRR0.." */
0x0A,0x06,0x23,0x02,0x00,0x18,0x79,0x00, /* 00000588 "..#...y." */
0x8B,0x50,0x52,0x52,0x30,0x01,0x54,0x4D, /* 00000590 ".PRR0.TM" */
0x50,0x5F,0x70,0x50,0x52,0x51,0x30,0x60, /* 00000598 "P_pPRQ0`" */
0xA0,0x0C,0x95,0x60,0x0A,0x80,0x79,0x01, /* 000005A0 "...`..y." */
0x60,0x54,0x4D,0x50,0x5F,0xA1,0x07,0x70, /* 000005A8 "`TMP_..p" */
0x00,0x54,0x4D,0x50,0x5F,0xA4,0x50,0x52, /* 000005B0 ".TMP_.PR" */
0x52,0x30,0x14,0x1B,0x5F,0x53,0x52,0x53, /* 000005B8 "R0.._SRS" */
0x01,0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F, /* 000005C0 "..h.TMP_" */
0x82,0x54,0x4D,0x50,0x5F,0x60,0x76,0x60, /* 000005C8 ".TMP_`v`" */
0x70,0x60,0x50,0x52,0x51,0x30,0x5B,0x82, /* 000005D0 "p`PRQ0[." */
0x4F,0x0A,0x4C,0x4E,0x4B,0x42,0x08,0x5F, /* 000005D8 "O.LNKB._" */
0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F, /* 000005E0 "HID.A..." */
0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,0x08, /* 000005E8 "._UID..." */
0x5F,0x50,0x52,0x53,0x11,0x09,0x0A,0x06, /* 000005F0 "_PRS...." */
0x23,0xF8,0x1E,0x18,0x79,0x00,0x14,0x1A, /* 000005F8 "#...y..." */
0x5F,0x53,0x54,0x41,0x00,0x70,0x0A,0x0B, /* 00000600 "_STA.p.." */
0x60,0xA0,0x0D,0x7B,0x0A,0x80,0x50,0x52, /* 00000608 "`..{..PR" */
0x51,0x31,0x61,0x70,0x0A,0x09,0x60,0xA4, /* 00000610 "Q1ap..`." */
0x60,0x14,0x11,0x5F,0x44,0x49,0x53,0x00, /* 00000618 "`.._DIS." */
0x7D,0x50,0x52,0x51,0x31,0x0A,0x80,0x50, /* 00000620 "}PRQ1..P" */
0x52,0x51,0x31,0x14,0x3F,0x5F,0x43,0x52, /* 00000628 "RQ1.?_CR" */
0x53,0x00,0x08,0x50,0x52,0x52,0x30,0x11, /* 00000630 "S..PRR0." */
0x09,0x0A,0x06,0x23,0x02,0x00,0x18,0x79, /* 00000638 "...#...y" */
0x00,0x8B,0x50,0x52,0x52,0x30,0x01,0x54, /* 00000640 "..PRR0.T" */
0x4D,0x50,0x5F,0x70,0x50,0x52,0x51,0x31, /* 00000648 "MP_pPRQ1" */
0x60,0xA0,0x0C,0x95,0x60,0x0A,0x80,0x79, /* 00000650 "`...`..y" */
0x01,0x60,0x54,0x4D,0x50,0x5F,0xA1,0x07, /* 00000658 ".`TMP_.." */
0x70,0x00,0x54,0x4D,0x50,0x5F,0xA4,0x50, /* 00000660 "p.TMP_.P" */
0x52,0x52,0x30,0x14,0x1B,0x5F,0x53,0x52, /* 00000668 "RR0.._SR" */
0x53,0x01,0x8B,0x68,0x01,0x54,0x4D,0x50, /* 00000670 "S..h.TMP" */
0x5F,0x82,0x54,0x4D,0x50,0x5F,0x60,0x76, /* 00000678 "_.TMP_`v" */
0x60,0x70,0x60,0x50,0x52,0x51,0x31,0x5B, /* 00000680 "`p`PRQ1[" */
0x82,0x4F,0x0A,0x4C,0x4E,0x4B,0x43,0x08, /* 00000688 ".O.LNKC." */
0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C, /* 00000690 "_HID.A.." */
0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x03, /* 00000698 ".._UID.." */
0x08,0x5F,0x50,0x52,0x53,0x11,0x09,0x0A, /* 000006A0 "._PRS..." */
0x06,0x23,0xF8,0x1E,0x18,0x79,0x00,0x14, /* 000006A8 ".#...y.." */
0x1A,0x5F,0x53,0x54,0x41,0x00,0x70,0x0A, /* 000006B0 "._STA.p." */
0x0B,0x60,0xA0,0x0D,0x7B,0x0A,0x80,0x50, /* 000006B8 ".`..{..P" */
0x52,0x51,0x32,0x61,0x70,0x0A,0x09,0x60, /* 000006C0 "RQ2ap..`" */
0xA4,0x60,0x14,0x11,0x5F,0x44,0x49,0x53, /* 000006C8 ".`.._DIS" */
0x00,0x7D,0x50,0x52,0x51,0x32,0x0A,0x80, /* 000006D0 ".}PRQ2.." */
0x50,0x52,0x51,0x32,0x14,0x3F,0x5F,0x43, /* 000006D8 "PRQ2.?_C" */
0x52,0x53,0x00,0x08,0x50,0x52,0x52,0x30, /* 000006E0 "RS..PRR0" */
0x11,0x09,0x0A,0x06,0x23,0x02,0x00,0x18, /* 000006E8 "....#..." */
0x79,0x00,0x8B,0x50,0x52,0x52,0x30,0x01, /* 000006F0 "y..PRR0." */
0x54,0x4D,0x50,0x5F,0x70,0x50,0x52,0x51, /* 000006F8 "TMP_pPRQ" */
0x32,0x60,0xA0,0x0C,0x95,0x60,0x0A,0x80, /* 00000700 "2`...`.." */
0x79,0x01,0x60,0x54,0x4D,0x50,0x5F,0xA1, /* 00000708 "y.`TMP_." */
0x07,0x70,0x00,0x54,0x4D,0x50,0x5F,0xA4, /* 00000710 ".p.TMP_." */
0x50,0x52,0x52,0x30,0x14,0x1B,0x5F,0x53, /* 00000718 "PRR0.._S" */
0x52,0x53,0x01,0x8B,0x68,0x01,0x54,0x4D, /* 00000720 "RS..h.TM" */
0x50,0x5F,0x82,0x54,0x4D,0x50,0x5F,0x60, /* 00000728 "P_.TMP_`" */
0x76,0x60,0x70,0x60,0x50,0x52,0x51,0x32, /* 00000730 "v`p`PRQ2" */
0x5B,0x82,0x4F,0x0A,0x4C,0x4E,0x4B,0x44, /* 00000738 "[.O.LNKD" */
0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000740 "._HID.A." */
0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A, /* 00000748 "..._UID." */
0x04,0x08,0x5F,0x50,0x52,0x53,0x11,0x09, /* 00000750 ".._PRS.." */
0x0A,0x06,0x23,0xF8,0x1E,0x18,0x79,0x00, /* 00000758 "..#...y." */
0x14,0x1A,0x5F,0x53,0x54,0x41,0x00,0x70, /* 00000760 ".._STA.p" */
0x0A,0x0B,0x60,0xA0,0x0D,0x7B,0x0A,0x80, /* 00000768 "..`..{.." */
0x50,0x52,0x51,0x33,0x61,0x70,0x0A,0x09, /* 00000770 "PRQ3ap.." */
0x60,0xA4,0x60,0x14,0x11,0x5F,0x44,0x49, /* 00000778 "`.`.._DI" */
0x53,0x00,0x7D,0x50,0x52,0x51,0x33,0x0A, /* 00000780 "S.}PRQ3." */
0x80,0x50,0x52,0x51,0x33,0x14,0x3F,0x5F, /* 00000788 ".PRQ3.?_" */
0x43,0x52,0x53,0x00,0x08,0x50,0x52,0x52, /* 00000790 "CRS..PRR" */
0x30,0x11,0x09,0x0A,0x06,0x23,0x02,0x00, /* 00000798 "0....#.." */
0x18,0x79,0x00,0x8B,0x50,0x52,0x52,0x30, /* 000007A0 ".y..PRR0" */
0x01,0x54,0x4D,0x50,0x5F,0x70,0x50,0x52, /* 000007A8 ".TMP_pPR" */
0x51,0x33,0x60,0xA0,0x0C,0x95,0x60,0x0A, /* 000007B0 "Q3`...`." */
0x80,0x79,0x01,0x60,0x54,0x4D,0x50,0x5F, /* 000007B8 ".y.`TMP_" */
0xA1,0x07,0x70,0x00,0x54,0x4D,0x50,0x5F, /* 000007C0 "..p.TMP_" */
0xA4,0x50,0x52,0x52,0x30,0x14,0x1B,0x5F, /* 000007C8 ".PRR0.._" */
0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x54, /* 000007D0 "SRS..h.T" */
0x4D,0x50,0x5F,0x82,0x54,0x4D,0x50,0x5F, /* 000007D8 "MP_.TMP_" */
0x60,0x76,0x60,0x70,0x60,0x50,0x52,0x51, /* 000007E0 "`v`p`PRQ" */
0x33,0x08,0x5F,0x53,0x33,0x5F,0x12,0x06, /* 000007E8 "3._S3_.." */
0x04,0x01,0x01,0x00,0x00,0x08,0x5F,0x53, /* 000007F0 "......_S" */
0x34,0x5F,0x12,0x06,0x04,0x00,0x00,0x00, /* 000007F8 "4_......" */
0x00,0x08,0x5F,0x53,0x35,0x5F,0x12,0x06, /* 00000800 ".._S5_.." */
0x04,0x00,0x00,0x00,0x00,
};

View File

@ -0,0 +1,365 @@
// APM BIOS support for the Bochs BIOS
// Copyright (C) 2004 Fabrice Bellard
//
// Debugging extensions, 16-bit interface and extended power options
// Copyright (C) 2005 Struan Bartlett
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if defined(APM_REAL)
#define APMSYM(s) apmreal_ ## s
#elif defined(APM_PROT16)
#define APMSYM(s) apm16_ ## s
#elif defined(APM_PROT32)
#define APMSYM(s) apm32_ ## s
#else
#error unsupported APM mode
#endif
APMSYM(out_str):
push eax
push ebx
mov ebx, eax
APMSYM(out_str1):
SEG CS
mov al, byte ptr [bx]
cmp al, #0
je APMSYM(out_str2)
outb dx, al
inc ebx
jmp APMSYM(out_str1)
APMSYM(out_str2):
pop ebx
pop eax
ret
APMSYM(07_poweroff_str):
.ascii "Shutdown"
db 0
APMSYM(07_suspend_str):
.ascii "Suspend"
db 0
APMSYM(07_standby_str):
.ascii "Standby"
db 0
#if DEBUG_APM
APMSYM(put_str):
push edx
mov dx, #INFO_PORT
call APMSYM(out_str)
pop edx
ret
; print the hex number in eax
APMSYM(put_num):
push eax
push ebx
push ecx
push edx
mov ecx, eax
mov bx, #8
mov dx, #INFO_PORT
APMSYM(put_num1):
mov eax, ecx
shr eax, #28
add al, #0x30
cmp al, #0x39
jbe APMSYM(put_num2)
add al, #0x27
APMSYM(put_num2):
outb dx, al
shl ecx, #4
dec bx
jne APMSYM(put_num1)
pop edx
pop ecx
pop ebx
pop eax
ret
APMSYM(put_reg):
outb dx, al
shr eax, #8
outb dx, al
shr eax, #8
outb dx, al
shr eax, #8
outb dx, al
mov eax,ebx
call APMSYM(put_num)
mov al, #0x3b
outb dx,al
mov al, #0x20
outb dx,al
ret
APMSYM(put_regs):
push eax
push edx
push ebx
mov dx, #INFO_PORT
mov ebx, eax
mov eax, #0x3d584145 // 'EAX='
call APMSYM(put_reg)
pop ebx
push ebx
mov eax, #0x3d584245 // 'EBX='
call APMSYM(put_reg)
mov ebx, ecx
mov eax, #0x3d584345 // 'ECX='
call APMSYM(put_reg)
mov ebx, edx
mov eax, #0x3d584445 // 'EDX='
call APMSYM(put_reg)
mov ebx, esi
mov eax, #0x3d495345 // 'ESI='
call APMSYM(put_reg)
mov ebx, edi
mov eax, #0x3d494445 // 'EDI='
call APMSYM(put_reg)
mov al, #0x0a
outb dx, al
pop ebx
pop edx
pop eax
ret
#endif
#if defined(APM_PROT32)
_apm32_entry:
#endif
#if defined(APM_PROT16)
_apm16_entry:
#endif
pushf
#if defined(APM_REAL)
_apmreal_entry:
#endif
#if DEBUG_APM
call APMSYM(put_regs)
#endif
#if defined(APM_REAL)
;-----------------
; APM installation check
APMSYM(00):
cmp al, #0x00
jne APMSYM(01)
mov ah, #1 // APM major version
mov al, #2 // APM minor version
mov bh, #0x50 // 'P'
mov bl, #0x4d // 'M'
// bit 0 : 16 bit interface supported
// bit 1 : 32 bit interface supported
mov cx, #0x3
jmp APMSYM(ok)
;-----------------
; APM real mode interface connect
APMSYM(01):
cmp al, #0x01
jne APMSYM(02)
jmp APMSYM(ok)
;-----------------
; APM 16 bit protected mode interface connect
APMSYM(02):
cmp al, #0x02
jne APMSYM(03)
mov bx, #_apm16_entry
mov ax, #0xf000 // 16 bit code segment base
mov si, #0xfff0 // 16 bit code segment size
mov cx, #0xf000 // data segment address
mov di, #0xfff0 // data segment length
jmp APMSYM(ok)
;-----------------
; APM 32 bit protected mode interface connect
APMSYM(03):
cmp al, #0x03
jne APMSYM(04)
mov ax, #0xf000 // 32 bit code segment base
mov ebx, #_apm32_entry
mov cx, #0xf000 // 16 bit code segment base
// 32 bit code segment size (low 16 bits)
// 16 bit code segment size (high 16 bits)
mov esi, #0xfff0fff0
mov dx, #0xf000 // data segment address
mov di, #0xfff0 // data segment length
jmp APMSYM(ok)
#endif
;-----------------
; APM interface disconnect
APMSYM(04):
cmp al, #0x04
jne APMSYM(05)
jmp APMSYM(ok)
;-----------------
; APM cpu idle
APMSYM(05):
cmp al, #0x05
jne APMSYM(07)
sti
hlt
jmp APMSYM(ok)
;-----------------
; APM Set Power State
APMSYM(07):
cmp al, #0x07
jne APMSYM(08)
cmp bx, #1
jne APMSYM(ok)
cmp cx, #3
je APMSYM(07_poweroff)
cmp cx, #2
je APMSYM(07_suspend)
cmp cx, #1
je APMSYM(07_standby)
jne APMSYM(ok)
APMSYM(07_poweroff):
// send power off event to emulator
cli
mov dx, #0x8900
mov ax, #APMSYM(07_poweroff_str)
call APMSYM(out_str)
APMSYM(07_1):
hlt
jmp APMSYM(07_1)
APMSYM(07_suspend):
push edx
mov dx, #0x8900
mov ax, #APMSYM(07_suspend_str)
call APMSYM(out_str)
pop edx
jmp APMSYM(ok)
APMSYM(07_standby):
push edx
mov dx, #0x8900
mov ax, #APMSYM(07_standby_str)
call APMSYM(out_str)
pop edx
jmp APMSYM(ok)
;-----------------
; APM Enable / Disable
APMSYM(08):
cmp al, #0x08
jne APMSYM(0a)
jmp APMSYM(ok)
;-----------------
; Get Power Status
APMSYM(0a):
cmp al, #0x0a
jne APMSYM(0b)
mov bh, #0x01 // on line
// mov bh, #0x02 // battery
mov bl, #0xff // unknown battery status
// mov bl, #0x03 // charging
mov ch, #0x80 // no system battery
// mov ch, #0x8 // charging
mov cl, #0xff // unknown remaining time
// mov cl, #50
mov dx, #0xffff // unknown remaining time
mov si, #0 // zero battery
// mov si, #1 // one battery
jmp APMSYM(ok)
;-----------------
; Get PM Event
APMSYM(0b):
cmp al, #0x0b
jne APMSYM(0e)
mov ah, #0x80 // no event pending
jmp APMSYM(error)
;-----------------
; APM Driver Version
APMSYM(0e):
cmp al, #0x0e
jne APMSYM(0f)
mov ah, #1
mov al, #2
jmp APMSYM(ok)
;-----------------
; APM Engage / Disengage
APMSYM(0f):
cmp al, #0x0f
jne APMSYM(10)
jmp APMSYM(ok)
;-----------------
; APM Get Capabilities
APMSYM(10):
cmp al, #0x10
jne APMSYM(unimplemented)
mov bl, #0
mov cx, #0
jmp APMSYM(ok)
;-----------------
APMSYM(ok):
popf
clc
#if defined(APM_REAL)
jmp iret_modify_cf
#else
retf
#endif
APMSYM(unimplemented):
APMSYM(error):
popf
stc
#if defined(APM_REAL)
jmp iret_modify_cf
#else
retf
#endif
#undef APM_PROT32
#undef APM_PROT16
#undef APM_REAL
#undef APMSYM

View File

@ -0,0 +1,4 @@
#!/bin/csh -f
gcc -E rombios.c | grep "^\.org" | sed -e 's/\.org //' | sed -e 's/ .*//' | sort >! temp.usage
usage rombios.bin temp.usage
/bin/rm temp.usage

View File

@ -0,0 +1,589 @@
/*
* $Id$
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* biossums.c --- written by Eike W. for the Bochs BIOS */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef unsigned char byte;
void check( int value, char* message );
#define LEN_BIOS_DATA 0x10000
#define MAX_OFFSET (LEN_BIOS_DATA - 1)
#define BIOS_OFFSET 0xFFFF
long chksum_bios_get_offset( byte* data, long offset );
byte chksum_bios_calc_value( byte* data, long offset );
byte chksum_bios_get_value( byte* data, long offset );
void chksum_bios_set_value( byte* data, long offset, byte value );
#define _32__LEN 9
#define _32__CHKSUM 10
#define _32__MINHDR 16
long chksum__32__get_offset( byte* data, long offset );
byte chksum__32__calc_value( byte* data, long offset );
byte chksum__32__get_value( byte* data, long offset );
void chksum__32__set_value( byte* data, long offset, byte value );
#define _MP__LEN 8
#define _MP__CHKSUM 10
#define _MP__MINHDR 16
long chksum__mp__get_offset( byte* data, long offset );
byte chksum__mp__calc_value( byte* data, long offset );
byte chksum__mp__get_value( byte* data, long offset );
void chksum__mp__set_value( byte* data, long offset, byte value );
#define PCMP_BASELEN 4
#define PCMP_CHKSUM 7
#define PCMP_EXT_LEN 40
#define PCMP_EXT_CHKSUM 42
#define PCMP_MINHDR 42
long chksum_pcmp_get_offset( byte* data, long offset );
byte chksum_pcmp_calc_value( byte* data, long offset );
byte chksum_pcmp_get_value( byte* data, long offset );
void chksum_pcmp_set_value( byte* data, long offset, byte value );
#define _PIR_LEN 6
#define _PIR_CHKSUM 31
#define _PIR_MINHDR 32
long chksum__pir_get_offset( byte *data, long offset );
byte chksum__pir_calc_value( byte* data, long offset );
byte chksum__pir_get_value( byte* data, long offset );
void chksum__pir_set_value( byte* data, long offset, byte value );
#define _PNP_LEN 5
#define _PNP_CHKSUM 8
#define _PNP_MINHDR 32
long chksum__pnp_get_offset( byte *data, long offset );
byte chksum__pnp_calc_value( byte* data, long offset );
byte chksum__pnp_get_value( byte* data, long offset );
void chksum__pnp_set_value( byte* data, long offset, byte value );
byte bios_data[LEN_BIOS_DATA];
long bios_len;
int main(int argc, char* argv[]) {
FILE* stream;
long offset, tmp_offset;
byte cur_val = 0, new_val = 0;
int arg = 1, hits, pad = 0;
if ((argc == 3) && (!strcmp(argv[1], "-pad"))) {
pad = 1;
arg = 2;
} else if (argc != 2) {
printf("Error. Need a file-name as an argument.\n");
exit(EXIT_FAILURE);
}
memset(bios_data, 0xff, LEN_BIOS_DATA);
if ((stream = fopen(argv[arg], "rb")) == NULL) {
printf("Error opening %s for reading.\n", argv[arg]);
exit(EXIT_FAILURE);
}
bios_len = fread(bios_data, 1, LEN_BIOS_DATA, stream);
if ((bios_len < LEN_BIOS_DATA) && (pad == 0)) {
printf("Error reading 64KBytes from %s.\n", argv[arg]);
fclose(stream);
exit(EXIT_FAILURE);
}
fclose(stream);
if (pad == 1) goto write_bios;
hits = 0;
offset = 0L;
while( (tmp_offset = chksum__32__get_offset( bios_data, offset )) != -1L ) {
offset = tmp_offset;
cur_val = chksum__32__get_value( bios_data, offset );
new_val = chksum__32__calc_value( bios_data, offset );
printf( "\n\nPCI-Bios header at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X ", new_val );
hits++;
}
if( hits == 1 && cur_val != new_val ) {
printf( "Setting checksum." );
chksum__32__set_value( bios_data, offset, new_val );
}
if( hits >= 2 ) {
printf( "Multiple PCI headers! No checksum set." );
}
if( hits ) {
printf( "\n" );
}
hits = 0;
offset = 0L;
while( (tmp_offset = chksum__mp__get_offset( bios_data, offset )) != -1L ) {
offset = tmp_offset;
cur_val = chksum__mp__get_value( bios_data, offset );
new_val = chksum__mp__calc_value( bios_data, offset );
printf( "\n\nMP header at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X ", new_val );
hits++;
}
if( hits == 1 && cur_val != new_val ) {
printf( "Setting checksum." );
chksum__mp__set_value( bios_data, offset, new_val );
}
if( hits >= 2 ) {
printf( "Warning! Multiple MP headers. No checksum set." );
}
if( hits ) {
printf( "\n" );
}
hits = 0;
offset = 0L;
while( (tmp_offset = chksum_pcmp_get_offset( bios_data, offset )) != -1L ) {
offset = tmp_offset;
cur_val = chksum_pcmp_get_value( bios_data, offset );
new_val = chksum_pcmp_calc_value( bios_data, offset );
printf( "\n\nPCMP header at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X ", new_val );
hits++;
}
if( hits == 1 && cur_val != new_val ) {
printf( "Setting checksum." );
chksum_pcmp_set_value( bios_data, offset, new_val );
}
if( hits >= 2 ) {
printf( "Warning! Multiple PCMP headers. No checksum set." );
}
if( hits ) {
printf( "\n" );
}
hits = 0;
offset = 0L;
while( (tmp_offset = chksum__pir_get_offset( bios_data, offset )) != -1L ) {
offset = tmp_offset;
cur_val = chksum__pir_get_value( bios_data, offset );
new_val = chksum__pir_calc_value( bios_data, offset );
printf( "\n\n$PIR header at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X\n ", new_val );
hits++;
}
if( hits == 1 && cur_val != new_val ) {
printf( "Setting checksum." );
chksum__pir_set_value( bios_data, offset, new_val );
}
if( hits >= 2 ) {
printf( "Warning! Multiple $PIR headers. No checksum set." );
}
if( hits ) {
printf( "\n" );
}
hits = 0;
offset = 0L;
while( (tmp_offset = chksum__pnp_get_offset( bios_data, offset )) != -1L ) {
offset = tmp_offset;
cur_val = chksum__pnp_get_value( bios_data, offset );
new_val = chksum__pnp_calc_value( bios_data, offset );
printf( "\n\n$PnP header at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X\n ", new_val );
hits++;
}
if( hits == 1 && cur_val != new_val ) {
printf( "Setting checksum." );
chksum__pnp_set_value( bios_data, offset, new_val );
}
if( hits >= 2 ) {
printf( "Warning! Multiple $PnP headers. No checksum set." );
}
if( hits ) {
printf( "\n" );
}
offset = 0L;
offset = chksum_bios_get_offset( bios_data, offset );
cur_val = chksum_bios_get_value( bios_data, offset );
new_val = chksum_bios_calc_value( bios_data, offset );
printf( "\n\nBios checksum at: 0x%4lX\n", offset );
printf( "Current checksum: 0x%02X\n", cur_val );
printf( "Calculated checksum: 0x%02X ", new_val );
if( cur_val != new_val ) {
printf( "Setting checksum." );
chksum_bios_set_value( bios_data, offset, new_val );
}
printf( "\n" );
write_bios:
if ((stream = fopen(argv[arg], "wb")) == NULL) {
printf("Error opening %s for writing.\n", argv[arg]);
exit(EXIT_FAILURE);
}
if (fwrite(bios_data, 1, LEN_BIOS_DATA, stream) < LEN_BIOS_DATA) {
printf("Error writing 64KBytes to %s.\n", argv[arg]);
fclose(stream);
exit(EXIT_FAILURE);
}
fclose(stream);
return(EXIT_SUCCESS);
}
void check(int okay, char* message) {
if (!okay) {
printf("\n\nError. %s.\n", message);
exit(EXIT_FAILURE);
}
}
long chksum_bios_get_offset( byte* data, long offset ) {
return( BIOS_OFFSET );
}
byte chksum_bios_calc_value( byte* data, long offset ) {
int i;
byte sum;
sum = 0;
for( i = 0; i < MAX_OFFSET; i++ ) {
sum = sum + *( data + i );
}
sum = -sum; /* iso ensures -s + s == 0 on unsigned types */
return( sum );
}
byte chksum_bios_get_value( byte* data, long offset ) {
return( *( data + BIOS_OFFSET ) );
}
void chksum_bios_set_value( byte* data, long offset, byte value ) {
*( data + BIOS_OFFSET ) = value;
}
byte chksum__32__calc_value( byte* data, long offset ) {
int i;
int len;
byte sum;
check( offset + _32__MINHDR <= MAX_OFFSET, "_32_ header out of bounds" );
len = *( data + offset + _32__LEN ) << 4;
check( offset + len <= MAX_OFFSET, "_32_ header-length out of bounds" );
sum = 0;
for( i = 0; i < len; i++ ) {
if( i != _32__CHKSUM ) {
sum = sum + *( data + offset + i );
}
}
sum = -sum;
return( sum );
}
long chksum__32__get_offset( byte* data, long offset ) {
long result = -1L;
offset = offset + 0x0F;
offset = offset & ~( 0x0F );
while( offset + 16 < MAX_OFFSET ) {
offset = offset + 16;
if( *( data + offset + 0 ) == '_' && \
*( data + offset + 1 ) == '3' && \
*( data + offset + 2 ) == '2' && \
*( data + offset + 3 ) == '_' ) {
result = offset;
break;
}
}
return( result );
}
byte chksum__32__get_value( byte* data, long offset ) {
check( offset + _32__CHKSUM <= MAX_OFFSET, "PCI-Bios checksum out of bounds" );
return( *( data + offset + _32__CHKSUM ) );
}
void chksum__32__set_value( byte* data, long offset, byte value ) {
check( offset + _32__CHKSUM <= MAX_OFFSET, "PCI-Bios checksum out of bounds" );
*( data + offset + _32__CHKSUM ) = value;
}
byte chksum__mp__calc_value( byte* data, long offset ) {
int i;
int len;
byte sum;
check( offset + _MP__MINHDR <= MAX_OFFSET, "_MP_ header out of bounds" );
len = *( data + offset + _MP__LEN ) << 4;
check( offset + len <= MAX_OFFSET, "_MP_ header-length out of bounds" );
sum = 0;
for( i = 0; i < len; i++ ) {
if( i != _MP__CHKSUM ) {
sum = sum + *( data + offset + i );
}
}
sum = -sum;
return( sum );
}
long chksum__mp__get_offset( byte* data, long offset ) {
long result = -1L;
offset = offset + 0x0F;
offset = offset & ~( 0x0F );
while( offset + 16 < MAX_OFFSET ) {
offset = offset + 16;
if( *( data + offset + 0 ) == '_' && \
*( data + offset + 1 ) == 'M' && \
*( data + offset + 2 ) == 'P' && \
*( data + offset + 3 ) == '_' ) {
result = offset;
break;
}
}
return( result );
}
byte chksum__mp__get_value( byte* data, long offset ) {
check( offset + _MP__CHKSUM <= MAX_OFFSET, "MP checksum out of bounds" );
return( *( data + offset + _MP__CHKSUM ) );
}
void chksum__mp__set_value( byte* data, long offset, byte value ) {
check( offset + _MP__CHKSUM <= MAX_OFFSET, "MP checksum out of bounds" );
*( data + offset + _MP__CHKSUM ) = value;
}
byte chksum_pcmp_calc_value( byte* data, long offset ) {
int i;
int len;
byte sum;
check( offset + PCMP_MINHDR <= MAX_OFFSET, "PCMP header out of bounds" );
len = *( data + offset + PCMP_BASELEN ) + \
( *( data + offset + PCMP_BASELEN + 1 ) << 8 );
check( offset + len <= MAX_OFFSET, "PCMP header-length out of bounds" );
if( *( data + offset + PCMP_EXT_LEN ) | \
*( data + offset + PCMP_EXT_LEN + 1 ) | \
*( data + offset + PCMP_EXT_CHKSUM ) ) {
check( 0, "PCMP header indicates extended tables (unsupported)" );
}
sum = 0;
for( i = 0; i < len; i++ ) {
if( i != PCMP_CHKSUM ) {
sum = sum + *( data + offset + i );
}
}
sum = -sum;
return( sum );
}
long chksum_pcmp_get_offset( byte* data, long offset ) {
long result = -1L;
offset = offset + 0x0F;
offset = offset & ~( 0x0F );
while( offset + 16 < MAX_OFFSET ) {
offset = offset + 16;
if( *( data + offset + 0 ) == 'P' && \
*( data + offset + 1 ) == 'C' && \
*( data + offset + 2 ) == 'M' && \
*( data + offset + 3 ) == 'P' ) {
result = offset;
break;
}
}
return( result );
}
byte chksum_pcmp_get_value( byte* data, long offset ) {
check( offset + PCMP_CHKSUM <= MAX_OFFSET, "PCMP checksum out of bounds" );
return( *( data + offset + PCMP_CHKSUM ) );
}
void chksum_pcmp_set_value( byte* data, long offset, byte value ) {
check( offset + PCMP_CHKSUM <= MAX_OFFSET, "PCMP checksum out of bounds" );
*( data + offset + PCMP_CHKSUM ) = value;
}
byte chksum__pir_calc_value( byte* data, long offset ) {
int i;
int len;
byte sum;
check( offset + _PIR_MINHDR <= MAX_OFFSET, "$PIR header out of bounds" );
len = *( data + offset + _PIR_LEN ) + \
( *( data + offset + _PIR_LEN + 1 ) << 8 );
check( offset + len <= MAX_OFFSET, "$PIR header-length out of bounds" );
sum = 0;
for( i = 0; i < len; i++ ) {
if( i != _PIR_CHKSUM ) {
sum = sum + *( data + offset + i );
}
}
sum = -sum;
return( sum );
}
long chksum__pir_get_offset( byte* data, long offset ) {
long result = -1L;
offset = offset + 0x0F;
offset = offset & ~( 0x0F );
while( offset + 16 < MAX_OFFSET ) {
offset = offset + 16;
if( *( data + offset + 0 ) == '$' && \
*( data + offset + 1 ) == 'P' && \
*( data + offset + 2 ) == 'I' && \
*( data + offset + 3 ) == 'R' ) {
result = offset;
break;
}
}
return( result );
}
byte chksum__pir_get_value( byte* data, long offset ) {
check( offset + _PIR_CHKSUM <= MAX_OFFSET, "$PIR checksum out of bounds" );
return( *( data + offset + _PIR_CHKSUM ) );
}
void chksum__pir_set_value( byte* data, long offset, byte value ) {
check( offset + _PIR_CHKSUM <= MAX_OFFSET, "$PIR checksum out of bounds" );
*( data + offset + _PIR_CHKSUM ) = value;
}
byte chksum__pnp_calc_value( byte* data, long offset ) {
int i;
int len;
byte sum;
check( offset + _PNP_MINHDR <= MAX_OFFSET, "$PnP header out of bounds" );
len = *( data + offset + _PNP_LEN );
check( offset + len <= MAX_OFFSET, "$PnP header-length out of bounds" );
sum = 0;
for( i = 0; i < len; i++ ) {
if( i != _PNP_CHKSUM ) {
sum = sum + *( data + offset + i );
}
}
sum = -sum;
return( sum );
}
long chksum__pnp_get_offset( byte* data, long offset ) {
long result = -1L;
offset = offset + 0x0F;
offset = offset & ~( 0x0F );
while( offset + 16 < MAX_OFFSET ) {
offset = offset + 16;
if( *( data + offset + 0 ) == '$' && \
*( data + offset + 1 ) == 'P' && \
*( data + offset + 2 ) == 'n' && \
*( data + offset + 3 ) == 'P' ) {
result = offset;
break;
}
}
return( result );
}
byte chksum__pnp_get_value( byte* data, long offset ) {
check( offset + _PNP_CHKSUM <= MAX_OFFSET, "$PnP checksum out of bounds" );
return( *( data + offset + _PNP_CHKSUM ) );
}
void chksum__pnp_set_value( byte* data, long offset, byte value ) {
check( offset + _PNP_CHKSUM <= MAX_OFFSET, "$PnP checksum out of bounds" );
*( data + offset + _PNP_CHKSUM ) = value;
}

View File

@ -0,0 +1,43 @@
#!/usr/bin/perl
#
# $Id$
#
# Read output file from as86 (e.g. rombios.txt) and write out a symbol
# table suitable for the Bochs debugger.
#
use strict;
use warnings;
my $WHERE_BEFORE_SYM_TABLE = 0;
my $WHERE_IN_SYM_TABLE = 1;
my $WHERE_AFTER_SYM_TABLE = 2;
my $where = $WHERE_BEFORE_SYM_TABLE;
while (<STDIN>) {
chop;
if ($where == $WHERE_BEFORE_SYM_TABLE && /^Symbols:/) {
$where = $WHERE_IN_SYM_TABLE;
} elsif ($where == $WHERE_IN_SYM_TABLE && /^$/) {
$where = $WHERE_AFTER_SYM_TABLE;
}
if ($where == $WHERE_IN_SYM_TABLE) {
my $name;
my $junk;
foreach my $f (split(/\s+/)) {
if ($f =~ /^[[:xdigit:]]{4,}$/) {
if (defined($name)) {
print '000f', lc($f), ' ', $name, "\n";
undef($name);
undef($junk);
next;
}
}
$name = $junk
if (defined($junk));
$junk = $f;
}
}
}
exit(0);

View File

@ -0,0 +1,44 @@
####################
# Read Disk Sector #
####################
System programming:
-------------------
(Int 13h, ah=2)
in 1f7 until BSY cleared
out 1f2, AL # number of sectors
out 1f3, cl (bits 0-5) # starting sector number
out 1f4, ch # cylinder number bits 0..7, 0 based
out 1f5, cl (bits 6,7) & dh (bits 6,7) # cyl, bits 8..9, 10..11
out 1f6, dh (bits 0..3) --> bits 0..3 # head number
dh (bits 4..5) --> ??? # head number
dl (bit 0) --> bit 4 # drive number
out 1f7, 0x20 # read sectors command normal
Drive response:
---------------
* drive sets the busy bit in Status Reg to 1
* if command parameters are wrong:
> drive sets the aborted-command bit in the Error register and
error bit in the Status register to 1.
> Drive also sets the busy bit in the Status register to 0.
> Drive then generates an interrupt to the system.
* else:
> drive executes an implied seek to desired track and
reads sectors into sector buffer
> when sector buffer is filled and the data is ready to be
transferred, the drive sets the data-request bit to 1, sets
the busy bit to 0, and generates an interrupt.
> on a single-sector transfer, after the system has transferred
the data, the drive sets the data-request bit and the busy bit to 0.
> on a multiple-sector transfer, after the system has transferred
the first sector of data, the drive sets the data-request bit to 0,
and the busy bit to 1. When each subsequent sector is ready to be
transferred, the drive sets the data-request bit to 1, the busy bit to 0,
and generates an interrupt. When the system has tranferred the last sector,
the drive sets the data-request bit and busy bit to 0.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,248 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2006 Volker Ruppert
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/* define it to include QEMU specific code */
//#define BX_QEMU
#ifndef LEGACY
# define BX_ROMBIOS32 1
#else
# define BX_ROMBIOS32 0
#endif
#define DEBUG_ROMBIOS 0
#define DEBUG_ATA 0
#define DEBUG_INT13_HD 0
#define DEBUG_INT13_CD 0
#define DEBUG_INT13_ET 0
#define DEBUG_INT13_FL 0
#define DEBUG_INT15 0
#define DEBUG_INT16 0
#define DEBUG_INT1A 0
#define DEBUG_INT74 0
#define DEBUG_APM 0
#define PANIC_PORT 0x400
#define PANIC_PORT2 0x401
#define INFO_PORT 0x402
#define DEBUG_PORT 0x403
#define BIOS_PRINTF_HALT 1
#define BIOS_PRINTF_SCREEN 2
#define BIOS_PRINTF_INFO 4
#define BIOS_PRINTF_DEBUG 8
#define BIOS_PRINTF_ALL (BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO)
#define BIOS_PRINTF_DEBHALT (BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO | BIOS_PRINTF_HALT)
#define printf(format, p...) bios_printf(BIOS_PRINTF_SCREEN, format, ##p)
// Defines the output macros.
// BX_DEBUG goes to INFO port until we can easily choose debug info on a
// per-device basis. Debug info are sent only in debug mode
#if DEBUG_ROMBIOS
# define BX_DEBUG(format, p...) bios_printf(BIOS_PRINTF_INFO, format, ##p)
#else
# define BX_DEBUG(format, p...)
#endif
#define BX_INFO(format, p...) bios_printf(BIOS_PRINTF_INFO, format, ##p)
#define BX_PANIC(format, p...) bios_printf(BIOS_PRINTF_DEBHALT, format, ##p)
/* put the MP float table and ACPI RSDP in EBDA and the MP and ACPI tables in
high memory. Linux kernels < 2.6.30 might not work with this configuration */
//#define BX_USE_EBDA_TABLES
#define ACPI_DATA_SIZE 0x00010000L
#define MPTABLE_MAX_SIZE 0x00002000
#define PM_IO_BASE 0xb000
#define SMB_IO_BASE 0xb100
#define SMP_MSR_ADDR 0x0510
// Define the application NAME
#if defined(BX_QEMU)
# define BX_APPNAME "QEMU"
# define BX_APPVENDOR "QEMU"
#else
# define BX_APPNAME "Bochs"
# define BX_APPVENDOR "The Bochs Project"
#endif
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
#define E820_UNUSABLE 5
#define BX_CPU 3
#define BX_USE_PS2_MOUSE 1
#define BX_CALL_INT15_4F 1
#define BX_USE_EBDA 1
#define BX_SUPPORT_FLOPPY 1
#define BX_FLOPPY_ON_CNT 37 /* 2 seconds */
#define BX_PCIBIOS 1
#define BX_APM 1
#define BX_PNPBIOS 1
/* define it if the (emulated) hardware supports SMM mode */
#define BX_USE_SMM
#define BX_USE_ATADRV 1
#define BX_ELTORITO_BOOT 1
#define BX_MAX_ATA_INTERFACES 4
#define BX_MAX_ATA_DEVICES (BX_MAX_ATA_INTERFACES*2)
#define BX_VIRTUAL_PORTS 1 /* normal output to Bochs ports */
#define BX_DEBUG_SERIAL 0 /* output to COM1 */
/* model byte 0xFC = AT */
#define SYS_MODEL_ID 0xFC
#define SYS_SUBMODEL_ID 0x00
#define BIOS_REVISION 1
#define BIOS_CONFIG_TABLE 0xe6f5
#ifndef BIOS_BUILD_DATE
# define BIOS_BUILD_DATE "06/23/99"
#endif
// 1K of base memory used for Extended Bios Data Area (EBDA)
// EBDA is used for PS/2 mouse support, and IDE BIOS, etc.
#define EBDA_SEG 0x9FC0
#define EBDA_SIZE 1 // In KiB
#define BASE_MEM_IN_K (640 - EBDA_SIZE)
/* IPL_SIZE bytes at 0x9ff00 are used for the IPL boot table. */
#define IPL_SEG 0x9ff0
#define IPL_TABLE_OFFSET 0x0000
#define IPL_TABLE_ENTRIES 8
#define IPL_COUNT_OFFSET 0x0080 /* u16: number of valid table entries */
#define IPL_SEQUENCE_OFFSET 0x0082 /* u16: next boot device */
#define IPL_BOOTFIRST_OFFSET 0x0084 /* u16: user selected device */
#define IPL_SIZE 0x86
#define IPL_TYPE_FLOPPY 0x01
#define IPL_TYPE_HARDDISK 0x02
#define IPL_TYPE_CDROM 0x03
#define IPL_TYPE_BEV 0x80
/* Ports */
#define PORT_DMA_ADDR_2 0x0004
#define PORT_DMA_CNT_2 0x0005
#define PORT_DMA1_MASK_REG 0x000a
#define PORT_DMA1_MODE_REG 0x000b
#define PORT_DMA1_CLEAR_FF_REG 0x000c
#define PORT_DMA1_MASTER_CLEAR 0x000d
#define PORT_PIC1_CMD 0x0020
#define PORT_PIC1_DATA 0x0021
#define PORT_PIT_COUNTER0 0x0040
#define PORT_PIT_MODE 0x0043
#define PORT_PS2_DATA 0x0060
#define PORT_PS2_CTRLB 0x0061
#define PORT_PS2_STATUS 0x0064
#define PORT_CMOS_INDEX 0x0070
#define PORT_CMOS_DATA 0x0071
#define PORT_DIAG 0x0080
#define PORT_DMA_PAGE_2 0x0081
#define PORT_A20 0x0092
#define PORT_PIC2_CMD 0x00a0
#define PORT_PIC2_DATA 0x00a1
#define PORT_DMA2_MASK_REG 0x00d4
#define PORT_DMA2_MODE_REG 0x00d6
#define PORT_DMA2_MASTER_CLEAR 0x00da
#define PORT_ATA2_CMD_BASE 0x0170
#define PORT_ATA1_CMD_BASE 0x01f0
#define PORT_FD_DOR 0x03f2
#define PORT_FD_STATUS 0x03f4
#define PORT_FD_DATA 0x03f5
#define CPUID_MSR (1 << 5)
#define CPUID_APIC (1 << 9)
#define CPUID_MTRR (1 << 12)
#define APIC_BASE ((uint8_t *)0xfee00000)
#define APIC_ICR_LOW 0x300
#define APIC_SVR 0x0F0
#define APIC_ID 0x020
#define APIC_LVT3 0x370
#define APIC_ENABLED 0x0100
#define AP_BOOT_ADDR 0x9f000
#define SMI_CMD_IO_ADDR 0xb2
#define BIOS_TMP_STORAGE 0x00030000 /* 64 KB used to copy the BIOS to shadow RAM */
#define MSR_MTRRcap 0x000000fe
#define MSR_MTRRfix64K_00000 0x00000250
#define MSR_MTRRfix16K_80000 0x00000258
#define MSR_MTRRfix16K_A0000 0x00000259
#define MSR_MTRRfix4K_C0000 0x00000268
#define MSR_MTRRfix4K_C8000 0x00000269
#define MSR_MTRRfix4K_D0000 0x0000026a
#define MSR_MTRRfix4K_D8000 0x0000026b
#define MSR_MTRRfix4K_E0000 0x0000026c
#define MSR_MTRRfix4K_E8000 0x0000026d
#define MSR_MTRRfix4K_F0000 0x0000026e
#define MSR_MTRRfix4K_F8000 0x0000026f
#define MSR_MTRRdefType 0x000002ff
#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
#define MTRR_MEMTYPE_UC 0
#define MTRR_MEMTYPE_WC 1
#define MTRR_MEMTYPE_WT 4
#define MTRR_MEMTYPE_WP 5
#define MTRR_MEMTYPE_WB 6
#define QEMU_CFG_CTL_PORT 0x510
#define QEMU_CFG_DATA_PORT 0x511
#define QEMU_CFG_SIGNATURE 0x00
#define QEMU_CFG_ID 0x01
#define QEMU_CFG_UUID 0x02
#define PCI_ADDRESS_SPACE_MEM 0x00
#define PCI_ADDRESS_SPACE_IO 0x01
#define PCI_ADDRESS_SPACE_MEM_PREFETCH 0x08
#define PCI_ROM_SLOT 6
#define PCI_NUM_REGIONS 7
#define PCI_DEVICES_MAX 64
#define PCI_VENDOR_ID 0x00 /* 16 bits */
#define PCI_DEVICE_ID 0x02 /* 16 bits */
#define PCI_COMMAND 0x04 /* 16 bits */
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
#define PCI_CLASS_DEVICE 0x0a /* Device class */
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */
#define PCI_MIN_GNT 0x3e /* 8 bits */
#define PCI_MAX_LAT 0x3f /* 8 bits */
#define PCI_VENDOR_ID_INTEL 0x8086
#define PCI_DEVICE_ID_INTEL_82441 0x1237
#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110
#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
#define PCI_VENDOR_ID_IBM 0x1014
#define PCI_VENDOR_ID_APPLE 0x106b

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start);
SECTIONS
{
. = 0x000e0000;
.text : { *(.text) }
.rodata : { *(.rodata*) }
_end = . ;
.data 0x700 : AT (_end) { __data_start = .; *(.data); __data_end = .;}
.bss : { __bss_start = .; *(.bss) *(COMMON); __bss_end = .;}
/DISCARD/ : { *(.stab)
*(.stabstr)
*(.comment)
*(.note)
}
}

View File

@ -0,0 +1,119 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// 32 bit Bochs BIOS init code
// Copyright (C) 2006 Fabrice Bellard
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "rombios.h"
.globl _start
.globl smp_ap_boot_code_start
.globl smp_ap_boot_code_end
.global smm_relocation_start
.global smm_relocation_end
.global smm_code_start
.global smm_code_end
_start:
/* clear bss section */
xor %eax, %eax
mov $__bss_start, %edi
mov $__bss_end, %ecx
sub %edi, %ecx
rep stosb
/* copy data section */
mov $_end, %esi
mov $__data_start, %edi
mov $__data_end, %ecx
sub %edi, %ecx
rep movsb
jmp rombios32_init
.code16
smp_ap_boot_code_start:
cli
xor %ax, %ax
mov %ax, %ds
mov $SMP_MSR_ADDR, %ebx
11:
mov 0(%ebx), %ecx
test %ecx, %ecx
jz 12f
mov 4(%ebx), %eax
mov 8(%ebx), %edx
wrmsr
add $12, %ebx
jmp 11b
12:
lock incw smp_cpus
1:
hlt
jmp 1b
smp_ap_boot_code_end:
/* code to relocate SMBASE to 0xa0000 */
smm_relocation_start:
mov $0x38000 + 0x7efc, %ebx
addr32 mov (%ebx), %al /* revision ID to see if x86_64 or x86 */
cmp $0x64, %al
je 1f
mov $0x38000 + 0x7ef8, %ebx
jmp 2f
1:
mov $0x38000 + 0x7f00, %ebx
2:
movl $0xa0000, %eax
addr32 movl %eax, (%ebx)
/* indicate to the BIOS that the SMM code was executed */
mov $0x00, %al
movw $0xb3, %dx
outb %al, %dx
rsm
smm_relocation_end:
/* minimal SMM code to enable or disable ACPI */
smm_code_start:
movw $0xb2, %dx
inb %dx, %al
cmp $0xf0, %al
jne 1f
/* ACPI disable */
mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
inw %dx, %ax
andw $~1, %ax
outw %ax, %dx
jmp 2f
1:
cmp $0xf1, %al
jne 2f
/* ACPI enable */
mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
inw %dx, %ax
orw $1, %ax
outw %ax, %dx
2:
rsm
smm_code_end:

View File

@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
// 75002 Paris - France
// http://www.linux-mandrake.com/
// http://www.mandrakesoft.com/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
unsigned char bios[65536];
int
main(int argc, char *argv[])
{
int bios_file;
FILE * org_file;
unsigned org, last_org, offset;
int retval;
unsigned int to_read, index;
double elements, ratio;
if (argc !=3 ) {
fprintf(stderr, "Usage: usage bios-file org-file\n");
exit(1);
}
bios_file = open(argv[1], O_RDONLY);
org_file = fopen(argv[2], "r");
if ( (bios_file<0) | (org_file==NULL) ) {
fprintf(stderr, "problems opening files.\n");
exit(1);
}
printf("files opened OK\n");
to_read = 65536;
index = 0;
while (to_read > 0) {
retval = read(bios_file, &bios[index], to_read);
if (retval <= 0) {
fprintf(stderr, "problem reading bios file\n");
exit(1);
}
to_read -= retval;
index += retval;
}
printf("bios file read in OK\n");
last_org = 0;
while (1) {
retval = fscanf(org_file, "0x%x\n", &org);
if (retval <= 0) break;
printf("%04x .. %04x ", last_org, org-1);
for (offset=org-1; offset>last_org; offset--) {
if (bios[offset] != 0) break;
}
if (offset > last_org) {
elements = (1.0 + double(offset) - double(last_org));
}
else {
if (bios[last_org] == 0)
elements = 0.0;
else
elements = 1.0;
}
ratio = elements / (double(org) - double(last_org));
ratio *= 100.0;
printf("%6.2lf\n", ratio);
last_org = org;
}
}