pax_global_header 0000666 0000000 0000000 00000000064 12537753636 0014533 g ustar 00root root 0000000 0000000 52 comment=33fbe13a3e2a01e0ba1087a8feed801a0451db21
seabios-1.8.2/ 0000775 0000000 0000000 00000000000 12537753636 0013170 5 ustar 00root root 0000000 0000000 seabios-1.8.2/.gitignore 0000664 0000000 0000000 00000000036 12537753636 0015157 0 ustar 00root root 0000000 0000000 out
*.pyc
.config
.config.old
seabios-1.8.2/COPYING 0000664 0000000 0000000 00000104513 12537753636 0014227 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
seabios-1.8.2/COPYING.LESSER 0000664 0000000 0000000 00000016727 12537753636 0015234 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
seabios-1.8.2/Makefile 0000664 0000000 0000000 00000024523 12537753636 0014636 0 ustar 00root root 0000000 0000000 # SeaBIOS build system
#
# Copyright (C) 2008-2012 Kevin O'Connor
#
# This file may be distributed under the terms of the GNU LGPLv3 license.
# Output directory
OUT=out/
# Common command definitions
export HOSTCC := $(CC)
export CONFIG_SHELL := sh
export KCONFIG_AUTOHEADER := autoconf.h
export KCONFIG_CONFIG := $(CURDIR)/.config
export LC_ALL := C
CROSS_PREFIX=
ifneq ($(CROSS_PREFIX),)
CC=$(CROSS_PREFIX)gcc
endif
AS=$(CROSS_PREFIX)as
LD=$(CROSS_PREFIX)ld
OBJCOPY=$(CROSS_PREFIX)objcopy
OBJDUMP=$(CROSS_PREFIX)objdump
STRIP=$(CROSS_PREFIX)strip
PYTHON=python
CPP=cpp
IASL:=iasl
LD32BIT_FLAG:=-melf_i386
# Source files
SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c mouse.c kbd.c \
system.c serial.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c apm.c \
hw/pci.c hw/timer.c hw/rtc.c hw/dma.c hw/pic.c hw/ps2port.c hw/serialio.c \
hw/usb.c hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c \
hw/usb-hid.c hw/usb-msc.c hw/usb-uas.c \
hw/blockcmd.c hw/floppy.c hw/ata.c hw/ramdisk.c \
hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c \
hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c
SRC16=$(SRCBOTH)
SRC32FLAT=$(SRCBOTH) post.c memmap.c malloc.c romfile.c x86.c optionroms.c \
pmm.c font.c boot.c bootsplash.c jpeg.c bmp.c \
hw/ahci.c hw/pvscsi.c hw/usb-xhci.c hw/usb-hub.c hw/sdcard.c \
fw/coreboot.c fw/lzmadecode.c fw/csm.c fw/biostables.c \
fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c fw/mtrr.c fw/xen.c \
fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c
SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio.c
DIRS=src src/hw src/fw vgasrc
# Default compiler flags
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
; then echo "$(2)"; else echo "$(3)"; fi ;)
CPPFLAGS = -P -MD -MT $@
COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
-Wall -Wno-strict-aliasing -Wold-style-definition \
$(call cc-option,$(CC),-Wtype-limits,) \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
-minline-all-stringops -fomit-frame-pointer \
-freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \
-ffunction-sections -fdata-sections -fno-common -fno-merge-constants
COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
COMMA := ,
CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0
CFLAGSSEG := $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
$(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
$(call cc-option,$(CC),-fno-tree-switch-conversion,)
CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0
CFLAGS16 := $(CFLAGSSEG) -DMODE16=1 \
$(call cc-option,$(CC),-m16,-Wa$(COMMA)src/code16gcc.s) \
$(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline)
# Run with "make V=1" to see the actual compile commands
ifdef V
Q=
else
Q=@
MAKEFLAGS += --no-print-directory
endif
# Default targets
-include $(KCONFIG_CONFIG)
target-y :=
target-$(CONFIG_QEMU) += $(OUT)bios.bin
target-$(CONFIG_CSM) += $(OUT)Csm16.bin
target-$(CONFIG_COREBOOT) += $(OUT)bios.bin.elf
target-$(CONFIG_BUILD_VGABIOS) += $(OUT)vgabios.bin
all: $(target-y)
# Make definitions
.PHONY : all clean distclean FORCE
.DELETE_ON_ERROR:
################ Common build rules
# Verify the build environment works.
TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" IASL="$(IASL)" scripts/test-build.sh)
ifeq "$(TESTGCC)" "-1"
$(error "Please upgrade the build environment")
endif
ifeq "$(TESTGCC)" "0"
# Use -fwhole-program
CFLAGSWHOLE=-fwhole-program -DWHOLE_PROGRAM
endif
# Do a whole file compile by textually including all C code.
define whole-compile
@echo " Compiling whole program $3"
$(Q)printf '$(foreach i,$2,#include "$i"\n)' > $3.tmp.c
$(Q)$(CC) -I. $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
endef
%.strip.o: %.o
@echo " Stripping $@"
$(Q)$(STRIP) $< -o $@
$(OUT)%.s: %.c
@echo " Compiling to assembler $@"
$(Q)$(CC) $(CFLAGS16) -S -c $< -o $@
$(OUT)%.o: %.c $(OUT)autoconf.h
@echo " Compile checking $@"
$(Q)$(CC) $(CFLAGS32FLAT) -c $< -o $@
$(OUT)%.lds: %.lds.S
@echo " Precompiling $@"
$(Q)$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@
################ Main BIOS build rules
$(OUT)asm-offsets.s: $(OUT)autoconf.h
$(OUT)asm-offsets.h: $(OUT)src/asm-offsets.s
@echo " Generating offset file $@"
$(Q)./scripts/gen-offsets.sh $< $@
$(OUT)ccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)src/%.o,$(SRC16)) ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
$(OUT)code32seg.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)src/%.o,$(SRC32SEG)) ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
$(OUT)ccode32flat.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)src/%.o,$(SRC32FLAT)) ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
$(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h
@echo " Compiling (16bit) $@"
$(Q)$(CC) $(CFLAGS16) -c -D__ASSEMBLY__ $< -o $@
$(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o scripts/layoutrom.py scripts/buildversion.sh
@echo " Building ld scripts"
$(Q)BUILD_VERSION="$(VERSION)" ./scripts/buildversion.sh $(OUT)version.c
$(Q)$(CC) $(CFLAGS32FLAT) -c $(OUT)version.c -o $(OUT)version.o
$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o
$(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump
$(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump
$(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump
$(Q)$(PYTHON) ./scripts/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)$(KCONFIG_AUTOHEADER) $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds
# These are actually built by scripts/layoutrom.py above, but by pulling them
# into an extra rule we prevent make -j from spawning layoutrom.py 4 times.
$(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds $(OUT)code32flat.o $(OUT)code16.o: $(OUT)romlayout16.lds
$(OUT)rom16.o: $(OUT)code16.o $(OUT)romlayout16.lds
@echo " Linking $@"
$(Q)$(LD) -T $(OUT)romlayout16.lds $< -o $@
$(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)romlayout32seg.lds
@echo " Linking $@"
$(Q)$(LD) -T $(OUT)romlayout32seg.lds $< -o $@
$(OUT)rom.o: $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds
@echo " Linking $@"
$(Q)$(LD) -T $(OUT)romlayout32flat.lds $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o -o $@
$(OUT)bios.bin.prep: $(OUT)rom.o scripts/checkrom.py
@echo " Prepping $@"
$(Q)rm -f $(OUT)bios.bin $(OUT)Csm16.bin $(OUT)bios.bin.elf
$(Q)$(OBJDUMP) -thr $< > $<.objdump
$(Q)$(OBJCOPY) -O binary $< $(OUT)bios.bin.raw
$(Q)$(PYTHON) ./scripts/checkrom.py $<.objdump $(CONFIG_ROM_SIZE) $(OUT)bios.bin.raw $(OUT)bios.bin.prep
$(OUT)bios.bin: $(OUT)bios.bin.prep
@echo " Creating $@"
$(Q)cp $< $@
$(OUT)Csm16.bin: $(OUT)bios.bin.prep
@echo " Creating $@"
$(Q)cp $< $@
$(OUT)bios.bin.elf: $(OUT)rom.o $(OUT)bios.bin.prep
@echo " Creating $@"
$(Q)$(STRIP) -R .comment $< -o $(OUT)bios.bin.elf
################ VGA build rules
# VGA src files
SRCVGA=src/output.c src/string.c src/hw/pci.c src/hw/serialio.c \
vgasrc/vgainit.c vgasrc/vgabios.c vgasrc/vgafb.c \
vgasrc/vgafonts.c vgasrc/vbe.c \
vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c \
src/fw/coreboot.c vgasrc/cbvga.c
ifeq "$(CONFIG_VGA_FIXUP_ASM)" "y"
$(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(filter-out -fomit-frame-pointer,$(CFLAGS16)) -fno-omit-frame-pointer -S -Isrc, $(SRCVGA),$@)
$(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py
@echo " Fixup VGA rom assembler"
$(Q)$(PYTHON) ./scripts/vgafixup.py $< $(OUT)vgaccode16.s
$(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@
else
$(OUT)vgaccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16) -Isrc, $(SRCVGA),$@)
endif
$(OUT)vgaentry.o: vgasrc/vgaentry.S $(OUT)autoconf.h $(OUT)asm-offsets.h
@echo " Compiling (16bit) $@"
$(Q)$(CC) $(CFLAGS16) -c -D__ASSEMBLY__ $< -o $@
$(OUT)vgarom.o: $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgasrc/vgalayout.lds scripts/buildversion.sh
@echo " Linking $@"
$(Q)BUILD_VERSION="$(VERSION)" ./scripts/buildversion.sh $(OUT)vgaversion.c VAR16
$(Q)$(CC) $(CFLAGS16) -c $(OUT)vgaversion.c -o $(OUT)vgaversion.o
$(Q)$(LD) --gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@
$(OUT)vgabios.bin.raw: $(OUT)vgarom.o
@echo " Extracting binary $@"
$(Q)$(OBJCOPY) -O binary $< $@
$(OUT)vgabios.bin: $(OUT)vgabios.bin.raw scripts/buildrom.py
@echo " Finalizing rom $@"
$(Q)$(PYTHON) ./scripts/buildrom.py $< $@
################ DSDT build rules
iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
; then echo "$(2)"; else echo "$(3)"; fi ;)
$(OUT)%.hex: %.dsl ./scripts/acpi_extract_preprocess.py ./scripts/acpi_extract.py
@echo " Compiling IASL $@"
$(Q)$(CPP) $(CPPFLAGS) $< -o $(OUT)$*.dsl.i.orig
$(Q)$(PYTHON) ./scripts/acpi_extract_preprocess.py $(OUT)$*.dsl.i.orig > $(OUT)$*.dsl.i
$(Q)$(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $(OUT)$* $(OUT)$*.dsl.i
$(Q)$(PYTHON) ./scripts/acpi_extract.py $(OUT)$*.lst > $(OUT)$*.off
$(Q)cat $(OUT)$*.off > $@
$(OUT)src/fw/acpi.o: $(OUT)src/fw/acpi-dsdt.hex $(OUT)src/fw/ssdt-proc.hex $(OUT)src/fw/ssdt-pcihp.hex $(OUT)src/fw/ssdt-misc.hex $(OUT)src/fw/q35-acpi-dsdt.hex
################ Kconfig rules
define do-kconfig
$(Q)mkdir -p $(OUT)/scripts/kconfig/lxdialog
$(Q)mkdir -p $(OUT)/include/config
$(Q)mkdir -p $(addprefix $(OUT), $(DIRS))
$(Q)$(MAKE) -C $(OUT) -f $(CURDIR)/scripts/kconfig/Makefile srctree=$(CURDIR) src=scripts/kconfig obj=scripts/kconfig Q=$(Q) Kconfig=$(CURDIR)/src/Kconfig $1
endef
$(OUT)autoconf.h : $(KCONFIG_CONFIG) ; $(call do-kconfig, silentoldconfig)
$(KCONFIG_CONFIG): src/Kconfig vgasrc/Kconfig ; $(call do-kconfig, olddefconfig)
%onfig: ; $(call do-kconfig, $@)
help: ; $(call do-kconfig, $@)
################ Generic rules
clean:
$(Q)rm -rf $(OUT)
distclean: clean
$(Q)rm -f .config .config.old
-include $(patsubst %,$(OUT)%/*.d,$(DIRS))
seabios-1.8.2/README 0000664 0000000 0000000 00000001074 12537753636 0014052 0 ustar 00root root 0000000 0000000 Welcome to the SeaBIOS project! This project implements an X86 legacy
bios that is built with standard GNU tools.
Please see build and developer information at:
http://seabios.org/Developer_Documentation
For the impatient, SeaBIOS is built for QEMU and tested on QEMU with:
make
qemu -bios out/bios.bin
SeaBIOS can be configured with kconfig. To change the default
configuration one can run "make menuconfig" prior to running "make".
For other types of builds, and for more detailed developer
documentation, please see the online documentation listed above.
seabios-1.8.2/docs/ 0000775 0000000 0000000 00000000000 12537753636 0014120 5 ustar 00root root 0000000 0000000 seabios-1.8.2/docs/Build_overview.md 0000664 0000000 0000000 00000006305 12537753636 0017433 0 ustar 00root root 0000000 0000000 The SeaBIOS code can be built using standard GNU tools. A recent Linux
distribution should be able to build SeaBIOS using the standard
compiler tools.
Building SeaBIOS
================
First, [obtain the code](Download). SeaBIOS can be compiled for
several different build targets. It is also possible to configure
additional compile time options - run **make menuconfig** to do this.
Build for QEMU (along with KVM, Xen, and Bochs)
-----------------------------------------------
To build for QEMU (and similar), one should be able to run "make" in
the main directory. The resulting file "out/bios.bin" contains the
processed bios image.
One can use the resulting binary with QEMU by using QEMU's "-bios"
option. For example:
`qemu -bios out/bios.bin -fda myfdimage.img`
One can also use the resulting binary with Bochs. For example:
`bochs -q 'floppya: 1_44=myfdimage.img' 'romimage: file=out/bios.bin'`
Build for coreboot
------------------
To build for coreboot please see the coreboot build instructions at:
Build as a UEFI Compatibility Support Module (CSM)
--------------------------------------------------
To build as a CSM, first run kconfig (make menuconfig) and enable
CONFIG_CSM. Then build SeaBIOS (make) - the resulting binary will be
in "out/Csm16.bin".
This binary may be used with the OMVF/EDK-II UEFI firmware. It will
provide "legacy" BIOS services for booting non-EFI operating systems
and will also allow OVMF to display on otherwise unsupported video
hardware by using the traditional VGA BIOS. (Windows 2008r2 is known
to use INT 10h BIOS calls even when booted via EFI, and the presence
of a CSM makes this work as expected too.)
Having built SeaBIOS with CONFIG_CSM, one should be able to drop the
result (out/Csm16.bin) into an OVMF build tree at
OvmfPkg/Csm/Csm16/Csm16.bin and then build OVMF with 'build -D
CSM_ENABLE'. The SeaBIOS binary will be included as a discrete file
within the 'Flash Volume' which is created, and there are tools which
will extract it and allow it to be replaced.
Overview of files in the repository
===================================
The **src/** directory contains the main bios source code. The
**src/hw/** directory contains source code specific to hardware
drivers. The **src/fw/** directory contains source code for platform
firmware initialization. The **src/std/** directory contains header
files describing standard bios, firmware, and hardware interfaces.
The **vgasrc/** directory contains code for VGA BIOS implementations.
This code is separate from the main BIOS code in the src/ directory.
When the build is configured to produce a VGA BIOS the resulting
binary is found in out/vgabios.bin. The VGA BIOS code is always
compiled in 16bit mode.
The **scripts/** directory contains helper utilities for manipulating
and building the final roms.
The **out/** directory is created by the build process - it contains
all intermediate and final files.
When reading the C code be aware that code that runs in 16bit mode can
not arbitrarily access non-stack memory - see [Memory Model](Memory
Model) for more details. For information on the major C code functions
and where code execution starts see [Execution and code
flow](Execution and code flow).
seabios-1.8.2/docs/Debugging.md 0000664 0000000 0000000 00000010160 12537753636 0016333 0 ustar 00root root 0000000 0000000 This page describes the process of obtaining diagnostic information
from SeaBIOS and for reporting problems.
Diagnostic information
======================
SeaBIOS has the ability to output diagnostic messages. This is
implemented in the code via calls to the "dprintf()" C function.
On QEMU these messages are written to a special debug port. One can
view these messages by adding '-chardev stdio,id=seabios -device
isa-debugcon,iobase=0x402,chardev=seabios' to the QEMU command line.
Once this is done, one should see status messages on the console.
On coreboot these messages are generally written to the "cbmem"
console (CONFIG_DEBUG_COREBOOT). If SeaBIOS launches a Linux operating
system, one can obtain the cbmem tool from the coreboot repository and
run "cbmem -c" to view the SeaBIOS diagnostic messages.
Additionally, if a serial port is available, one may compile SeaBIOS
to send the diagnostic messages to the serial port. See the SeaBIOS
CONFIG_DEBUG_SERIAL option.
Trouble reporting
=================
If you are experiencing problems with SeaBIOS, it's useful to increase
the debugging level. This is done by running "make menuconfig" and
setting CONFIG_DEBUG_LEVEL to a higher value. A debug level of 8 will
show a lot of diagnostic information without flooding the serial port
(levels above 8 will frequently cause too much data).
To report an issue, please collect the serial boot log with SeaBIOS
set to a debug level of 8 and forward the full log along with a
description of the problem to the SeaBIOS [mailing list](Mailinglist).
Timing debug messages
=====================
The SeaBIOS repository has a tool (**scripts/readserial.py**) that can
timestamp each diagnostic message produced. The timestamps can provide
some additional information on how long internal processes take. It
also provides a simple profiling mechanism.
The tool can be used on coreboot builds that have diagnostic messages
sent to a serial port. Make sure SeaBIOS is configured with
CONFIG_DEBUG_SERIAL and run the following on the host receiving serial
output:
`/path/to/seabios/scripts/readserial.py /dev/ttyS0 115200`
Update the above command with the appropriate serial device and baud
rate.
The tool can also timestamp the messages from the QEMU debug port. To
use with QEMU run the following:
`mkfifo qemudebugpipe`\
`qemu -chardev pipe,path=qemudebugpipe,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios ...`
and then in another session:
`/path/to/seabios/scripts/readserial.py -nf qemudebugpipe`
The mkfifo command only needs to be run once to create the pipe file.
When readserial.py is running, it shows a timestamp with millisecond
precision of the amount of time since the start of the log. If one
presses the "enter" key in the readserial.py session it will add a
blank line to the screen and also reset the time back to zero. The
readserial.py program also keeps a log of all output in files that
look like "seriallog-YYYYMMDD_HHMMSS.log".
Debugging with gdb on QEMU
==========================
One can use gdb with QEMU to debug system images. To do this, add '-s
-S' to the qemu command line. For example:
`qemu -bios out/bios.bin -fda myfdimage.img -s -S`
Then, in another session, run gdb with either out/rom16.o (to debug
bios 16bit code) or out/rom.o (to debug bios 32bit code). For example:
`gdb out/rom16.o`
Once in gdb, use the command "target remote localhost:1234" to have
gdb connect to QEMU. See the QEMU documentation for more information
on using gdb and QEMU in this mode.
When debugging 16bit code, also run the following commands in gdb:
`set architecture i8086`\
`add-symbol-file out/rom16.o 0xf0000`
The second command loads the 16bit symbols a second time at an offset
of 0xf0000, which helps gdb set and catch breakpoints correctly.
To debug a VGA BIOS image, run "gdb out/vgarom.o" add use the gdb
command "add-symbol-file out/vgarom.o 0xc0000" to load the 16bit VGA
BIOS symbols twice.
If debugging the 32bit SeaBIOS initialization code with gdb, note that
SeaBIOS does self relocation by default. This relocation will alter
the location of initialization code symbols. Disable
CONFIG_RELOCATE_INIT to prevent SeaBIOS from doing this.
seabios-1.8.2/docs/Developer_Documentation.md 0000664 0000000 0000000 00000001510 12537753636 0021255 0 ustar 00root root 0000000 0000000 This page is intended for developers interested in understanding and
enhancing SeaBIOS. Please also consider joining the [mailing
list](Mailinglist).
The SeaBIOS code can be obtained via the [download](Download)
page. For specific information on building SeaBIOS for coreboot,
please see the [coreboot SeaBIOS](http://www.coreboot.org/SeaBIOS)
page.
See details on [building SeaBIOS](Build overview).
There is also information on the SeaBIOS [Memory Model](Memory Model).
Along with information on SeaBIOS [Execution and code flow](Execution
and code flow).
A description of the process of linking the final SeaBIOS binary is
available at [Linking overview](Linking overview).
To debug SeaBIOS and report problems see SeaBIOS
[debugging](Debugging).
Useful links to specifications is available at [Developer
links](Developer links).
seabios-1.8.2/docs/Developer_links.md 0000664 0000000 0000000 00000003061 12537753636 0017567 0 ustar 00root root 0000000 0000000 Links to pages with more information.
BIOS interfaces
===============
Ralf Brown's interrupt list
*
Memory layout info
*
Old PNP BIOS spec
*
T13 BIOS Enhanced Disk Drive (drafts):
*
Exported BIOS tables
====================
ACPI spec
*
PCI IRQ Routing Table Specification
*
MP configuration table
*
SM BIOS (aka DMI):
*
Hardware information
====================
info on PIC
*
info on kbd
*
info on vga
*
info on lpt
*
info on floppy
*
info on ata
*
*
info on serial
*
General information
===================
Bochs tech document list
*
Phoenix documents
*
Dosemu information
*
seabios-1.8.2/docs/Download.md 0000664 0000000 0000000 00000001323 12537753636 0016210 0 ustar 00root root 0000000 0000000 SeaBIOS may be distributed under the terms of the [GNU
LGPLv3](http://www.gnu.org/licenses/lgpl-3.0-standalone.html) license.
Both source code and binaries are available.
Latest source code
==================
The SeaBIOS project uses the [git](http://git-scm.com/) revision
control system. To download the latest source from revision control,
run:
`$ git clone git://git.seabios.org/seabios.git seabios`\
`$ cd seabios`
There's also a [website](http://git.seabios.org/) to browse the latest
source code online.
Released versions
=================
Released versions of the source code are available at:
Please see [releases](Releases) for information on each release.
seabios-1.8.2/docs/Execution_and_code_flow.md 0000664 0000000 0000000 00000017751 12537753636 0021263 0 ustar 00root root 0000000 0000000 This page provides a high-level description of some of the major code
phases that SeaBIOS transitions through and general information on
overall code flow.
SeaBIOS code phases
===================
The SeaBIOS code goes through a few distinct code phases during its
execution lifecycle. Understanding these code phases can help when
reading and enhancing the code.
POST phase
----------
The Power On Self Test (POST) phase is the initialization phase of the
BIOS. This phase is entered when SeaBIOS first starts execution. The
goal of the phase is to initialize internal state, initialize external
interfaces, detect and setup hardware, and to then start the boot
phase.
On emulators, this phase starts when the CPU starts execution in 16bit
mode at 0xFFFF0000:FFF0. The emulators map the SeaBIOS binary to this
address, and SeaBIOS arranges for romlayout.S:reset_vector() to be
present there. This code calls romlayout.S:entry_post() which then
calls post.c:handle_post() in 32bit mode.
On coreboot, the build arranges for romlayout.S:entry_elf() to be
called in 32bit mode. This then calls post.c:handle_post().
On CSM, the build arranges for romlayout.S:entry_csm() to be called
(in 16bit mode). This then calls csm.c:handle_csm() in 32bit mode.
Unlike on the emulators and coreboot, the SeaBIOS CSM POST phase is
orchastrated with UEFI and there are several calls back and forth
between SeaBIOS and UEFI via handle_csm() throughout the POST
process.
The POST phase itself has several sub-phases.
* The "preinit" sub-phase: code run prior to code relocation.
* The "init" sub-phase: code to initialize internal variables and
interfaces.
* The "setup" sub-phase: code to setup hardware and drivers.
* The "prepboot" sub-phase: code to finalize interfaces and prepare
for the boot phase.
At completion of the POST phase, SeaBIOS invokes an "int 0x19"
software interrupt in 16bit mode which begins the boot phase.
Boot phase
----------
The goal of the boot phase is to load the first portion of the
operating system's boot loader into memory and start execution of that
boot loader. This phase starts when a software interrupt ("int 0x19"
or "int 0x18") is invoked. The code flow starts in 16bit mode in
romlayout.S:entry_19() or romlayout.S:entry_18() which then
transition to 32bit mode and call boot.c:handle_19() or
boot.c:handle_18().
The boot phase is technically also part of the "runtime" phase of
SeaBIOS. It is typically invoked immiediately after the POST phase,
but it can also be invoked by an operating system or be invoked
multiple times in an attempt to find a valid boot media. Although the
boot phase C code runs in 32bit mode it does not have write access to
the 0x0f0000-0x100000 memory region and can not call the various
malloc_X() calls. See [Memory Model](Memory Model) for
more information.
Main runtime phase
------------------
The main runtime phase occurs after the boot phase starts the
operating system. Once in this phase, the SeaBIOS code may be invoked
by the operating system using various 16bit and 32bit calls. The goal
of this phase is to support these legacy calling interfaces and to
provide compatibility with BIOS standards. There are multiple entry
points for the BIOS - see the entry_XXX() assembler functions in
romlayout.S.
Callers use most of these legacy entry points by setting up a
particular CPU register state, invoking the BIOS, and then inspecting
the returned CPU register state. To handle this, SeaBIOS will backup
the current register state into a "struct bregs" (see romlayout.S,
entryfuncs.S, and bregs.h) on call entry and then pass this struct to
the C code. The C code can then inspect the register state and modify
it. The assembler entry functions will then restore the (possibly
modified) register state from the "struct bregs" on return to the
caller.
Resume and reboot
-----------------
As noted above, on emulators SeaBIOS handles the 0xFFFF0000:FFF0
machine startup execution vector. This vector is also called on
machine faults and on some machine "resume" events. It can also be
called (as 0xF0000:FFF0) by software as a request to reboot the
machine (on emulators, coreboot, and CSM).
The SeaBIOS "resume and reboot" code handles these calls and attempts
to determine the desired action of the caller. Code flow starts in
16bit mode in romlayout.S:reset_vector() which calls
romlayout.S:entry_post() which calls romlayout.S:entry_resume() which
calls resume.c:handle_resume(). Depending on the request the
handle_resume() code may transition to 32bit mode.
Technically this code is part of the "runtime" phase, so even though
parts of it run in 32bit mode it still has the same limitations of the
runtime phase.
Threads
=======
Internally SeaBIOS implements a simple cooperative multi-tasking
system. The system works by giving each "thread" its own stack, and
the system round-robins between these stacks whenever a thread issues
a yield() call. This "threading" system may be more appropriately
described as [coroutines](http://en.wikipedia.org/wiki/Coroutine).
These "threads" do not run on multiple CPUs and are not preempted, so
atomic memory accesses and complex locking is not required.
The goal of these threads is to reduce overall boot time by
parallelizing hardware delays. (For example, by allowing the wait for
an ATA harddrive to spinup and respond to commands to occur in
parallel with the wait for a PS/2 keyboard to respond to a setup
command.) These hardware setup threads are only available during the
"setup" sub-phase of the [POST phase](#POST_phase).
The code that implements threads is in stacks.c.
Hardware interrupts
===================
The SeaBIOS C code always runs with hardware interrupts disabled. All
of the C code entry points (see romlayout.S) are careful to explicitly
disable hardware interrupts (via "cli"). Because running with
interrupts disabled increases interrupt latency, any C code that could
loop for a significant amount of time (more than about 1 ms) should
periodically call yield(). The yield() call will briefly enable
hardware interrupts to occur, then disable interrupts, and then resume
execution of the C code.
There are two main reasons why SeaBIOS always runs C code with
interrupts disabled. The first reason is that external software may
override the default SeaBIOS handlers that are called on a hardware
interrupt event. Indeed, it is common for DOS based applications to do
this. These legacy third party interrupt handlers may have
undocumented expections (such as stack location and stack size) and
may attempt to call back into the various SeaBIOS software services.
Greater compatibility and more reproducible results can be achieved by
only permitting hardware interrupts at specific points (via yield()
calls). The second reason is that much of SeaBIOS runs in 32bit mode.
Attempting to handle interrupts in both 16bit mode and 32bit mode and
switching between modes to delegate those interrupts is an unneeded
complexity. Although disabling interrupts can increase interrupt
latency, this only impacts legacy systems where the small increase in
interrupt latency is unlikely to be noticeable.
Extra 16bit stack
=================
SeaBIOS implements 16bit real mode handlers for both hardware
interrupts and software request "interrupts". In a traditional BIOS,
these requests would use the caller's stack space. However, the
minimum amount of space the caller must provide has not been
standardized and very old DOS programs have been observed to allocate
very small amounts of stack space (100 bytes or less).
By default, SeaBIOS now switches to its own stack on most 16bit real
mode entry points. This extra stack space is allocated in ["low
memory"](Memory Model). It ensures SeaBIOS uses a minimal amount of a
callers stack (typically no more than 16 bytes) for these legacy
calls. (More recently defined BIOS interfaces such as those that
support 16bit protected and 32bit protected mode calls standardize a
minimum stack size with adequete space, and SeaBIOS generally will not
use its extra stack in these cases.)
The code to implement this stack "hopping" is in romlayout.S and in
stacks.c.
seabios-1.8.2/docs/Linking_overview.md 0000664 0000000 0000000 00000017275 12537753636 0017777 0 ustar 00root root 0000000 0000000 This page describes the process that the SeaBIOS build uses to link
the compiled code into the final binary objects.
Unfortunately, the SeaBIOS linking phase is complex. This complexity
is due to several unusual requirements:
* Some BIOS entry points must reside at specific hardcoded memory
locations. The build must support positioning code and variables at
specific locations.
* In order to support multiple [memory models](Memory Model) the same
C code can be complied in three modes (16bit mode, 32bit segmented
mode, and 32bit "flat" mode). Binary code from these three modes
must be able to co-exist and on occasion reference each other.
* There is a finite amount of memory available to the BIOS. The build
will attempt to weed out unused code and variables from the final
binary. It also supports self-relocation of one-time initialization
code.
Code layout
===========
To support the unusual build requirements, several
[gcc](http://en.wikipedia.org/wiki/GNU_Compiler_Collection) compiler
options are used. The "-ffunction-sections" and "-fdata-sections"
flags instruct the compiler to place each variable and function into
its own
[ELF](http://en.wikipedia.org/wiki/Executable_and_Linkable_Format)
section.
The C code is compiled three times into three separate objects for
each of the major supported [memory models](Memory Model):
**code16.o**, **code32seg.o**, and **code32flat.o**. Information on
the sections and symbols of these three objects are extracted (using
**objdump**) and passed in to the **scripts/layoutrom.py** python
script. This script analyzes this information and produces gnu
[ld](http://en.wikipedia.org/wiki/GNU_linker) "linker scripts" which
provide precise location information to the linker. These linker
scripts are then used during the link phase which produces a **rom.o**
object containing all the code.
Fixed location entry points
---------------------------
The build supports placing code entry points and variables at fixed
memory locations. This support is required in order to support the
legacy BIOS standards. For example, a program might execute an "int
0x15" to request system information from the BIOS, but another old
program might use "ljmpw $0xf000, $0xf859" instead. Both must provide
the same results and so the build must position the 0x15 interrupt
entry point in physical memory at 0xff859.
This support is accomplished by placing the given code/variables into
ELF sections that have a name containing the substring
".fixedaddr.0x1234" (where 0x1234 is the desired address). For
variables in C code this is accomplished by marking the variables with
the VARFSEGFIXED(0x1234) macro. For assembler entry points the ORG
macro is used (see **romlayout.S**).
During the build, the **layoutrom.py** script will detect sections
that contain the ".fixedaddr." substring and will arrange for the
final linker scripts to specify the desired address for the given
section.
Due to the sparse nature of these fixed address sections, the
layoutrom.py script will also arrange to pack in other unrelated 16bit
code into the free space between fixed address sections (see
layoutrom.py:fitSections()). This maximizes the space available and
reduces the overall size of the final binary.
C code in three modes
---------------------
SeaBIOS must support multiple [memory models](Memory Model). This is
accomplished by compiling the C code three separate times into three
separate objects.
The C code within a mode must not accidentally call a C function in
another mode, but multiple modes must all access the same single copy
of global variables. Further, it is occasionally necessary for the C
code in one mode to obtain the address of C code in another mode.
In order to use the same global variables between all modes, the
layoutrom.py script will detect references to global variables and
emit specific symbol definitions for those global variables in the
linker scripts so that all references use the same physical memory
address (see layoutrom.py:outXRefs()).
To ensure C code does not accidentally call C code compiled in a
different mode, the build will ensure the symbols for C code in each
mode are isolated from each other during the linking stage. To support
those situations where an address of a C function in another mode is
required the build supports symbols with a special "\_cfuncX_"
prefix. The layoutrom.py script detects these references and will emit
a corresponding symbol definitions in the linker script that points to
the C code of the specified mode. This is typically seen with code
like:
`extern void _cfunc32flat_process_op(void);`\
`return call32(_cfunc32flat_process_op, 0, 0);`
In the above example, when the build finds the symbol
"\_cfunc32flat_process_op" it will emit that symbol with the physical
address of the 32bit "flat" version of the process_op() C function.
Build garbage collection
------------------------
To reduce the overall size of the final SeaBIOS binary the build
supports automatically weeding out of unused code and variables. This
is done with two separate processes: when supported the gcc
"-fwhole-program" compilation flag is used, and the layoutrom.py
script checks for unreferenced ELF sections. The layoutrom.py script
builds the final linker scripts with only referenced ELF sections, and
thus unreferenced sections are weeded out from the final objects.
When writing C code, it is necessary to mark C functions with the
VISIBLE16, VISIBLE32SEG, or VISIBLE32FLAT macros if the functions are
ever referenced from assembler code. These macros ensure the
corresponding C function is emitted by the C compiler when compiling
for the given memory mode. These macros, however, do not affect the
layoutrom.py reference check, so even a function decorated with one of
the above macros can be weeded out from the final object if it is
never referenced.
Code relocation
---------------
To further reduce the runtime memory size of the BIOS, the build
supports runtime self-relocation. Normally SeaBIOS is loaded into
memory in the memory region at 0xC0000-0x100000. This is convenient
for initial binary deployment, but the space competes with memory
requirements for Option ROMs, BIOS tables, and runtime storage. By
default, SeaBIOS will self-relocate its one-time initialization code
to free up space in this region.
To support this feature, the build attempts to automatically detect
which C code is exclusively initialization phase code (see
layoutrom.py:checkRuntime()). It does this by finding all functions
decorated with the VISIBLE32INIT macro and all functions only
reachable via functions with that macro. These "init only" functions
are then grouped together and their location and size is stored in the
binary for the runtime code to relocate (see post.c:reloc_preinit()).
The build also locates all cross section code references along with
all absolute memory addresses in the "init only" code. These addresses
need to be modified with the new run-time address in order for the
code to successfully run at a new address. The build finds the
location of the addresses (see layoutrom.py:getRelocs()) and stores
the information in the final binary.
Final binary checks
===================
At the conclusion of the main linking stage, the code is contained in
the file **rom.o**. This object file contains all of the assembler
code, variables, and the C code from all three memory model modes.
At this point the **scripts/checkrom.py** script is run to perform
final checks on the code. The script performs some sanity checks, it
may update some tables in the binary, and it reports some size
information.
After the checkrom.py script is run the final user visible binary is
produced. The name of the final binary is either **bios.bin**,
**Csm16.bin**, or **bios.bin.elf** depending on the SeaBIOS build
requested.
seabios-1.8.2/docs/Mailinglist.md 0000664 0000000 0000000 00000000520 12537753636 0016713 0 ustar 00root root 0000000 0000000 For questions and general information about SeaBIOS, please subscribe
to the [SeaBIOS mailing
list](http://www.seabios.org/mailman/listinfo/seabios). If you're not
subscribed, your post will be held temporarily for moderator approval
(to combat spam).
A mailing list archive is available at
seabios-1.8.2/docs/Memory_Model.md 0000664 0000000 0000000 00000026750 12537753636 0017044 0 ustar 00root root 0000000 0000000 The SeaBIOS code is required to support multiple x86 CPU memory
models. This requirement impacts the code layout and internal storage
of SeaBIOS.
x86 Memory Models
=================
The x86 line of CPUs has evolved over many years. The original 8086
chip used 16bit pointers and could only address 1 megabyte of memory.
The 80286 CPU still used 16bit pointers, but could address up to 16
megabytes of memory. The 80386 chips could process 32bit instructions
and could access up to 4 gigabyte of memory. The most recent x86 chips
can process 64bit instructions and access 16 exabytes of ram.
During the evolution of the x86 CPUs from the 8086 to the 80386 the
BIOS was extended to handle calls in the various modes that the CPU
implemented.
This section outlines the five different x86 CPU execution and memory
access models that SeaBIOS supports.
16bit real mode
---------------
This mode is a
[segmented](http://en.wikipedia.org/wiki/Memory_segmentation) memory
mode invoked by callers. The CPU defaults to executing 16bit
instructions. Callers typically invoke the BIOS by issuing an "int x"
instruction which causes a software
[interrupt](http://en.wikipedia.org/wiki/Interrupt) that is handled by
the BIOS. The SeaBIOS code also handles hardware interrupts in this
mode. SeaBIOS can only access the first 1 megabyte of memory in this
mode, but it can access any part of that first megabyte.
16bit bigreal mode
------------------
This mode is a segmented memory mode that is used for [option
roms](http://en.wikipedia.org/wiki/Option_ROM). The CPU defaults to
executing 16bit instructions and segmented memory accesses are still
used. However, the segment limits are increased so that the entire
first 4 gigabytes of memory is fully accessible. Callers can invoke
all the [16bit real mode](#16bit_real_mode) functions while in this
mode and can also invoke the Post Memory Manager (PMM) functions that
are available during option rom execution.
16bit protected mode
--------------------
CPU execution in this mode is similar to [16bit real
mode](#16bit_real_mode). The CPU defaults to executing 16bit
instructions. However, each segment register indexes a "descriptor
table", and it is difficult or impossible to know what the physical
address of each segment is. Generally speaking, the BIOS can only
access code and data in the f-segment. The PCIBIOS, APM BIOS, and PNP
BIOS all have documented 16bit protected mode entry points.
Some old code may attempt to invoke the standard [16bit real
mode](#16bit_real_mode) entry points while in 16bit protected
mode. The PCI BIOS specification explicitly requires that the legacy
"int 1a" real mode entry point support 16bit protected mode calls if
they are for the PCI BIOS. Callers of other legacy entry points in
protected mode have not been observed and SeaBIOS does not support
them.
32bit segmented mode
--------------------
In this mode the processor runs in 32bit mode, but the segment
registers may have a limit and may have a non-zero offset. In effect,
this mode has all of the limitations of [16bit protected
mode](#16bit_protected_mode) - the main difference between the modes
is that the processor defaults to executing 32bit instructions. In
addition to these limitations, callers may also run the SeaBIOS code
at varying virtual addresses and so the code must support code
relocation. The PCI BIOS specification and APM BIOS specification
define 32bit segmented mode interfaces.
32bit flat mode
---------------
In this mode the processor defaults to executing 32bit instructions,
and all segment registers have an offset of zero and allow access to
the entire first 4 gigabytes of memory. This is the only "sane" mode
for 32bit code - modern compilers and modern operating systems will
generally only support this mode (when running 32bit code).
Ironically, it's the only mode that is not strictly required for a
BIOS to support. SeaBIOS uses this mode internally to support the POST
and BOOT [phases of execution](Execution and code flow).
code16gcc
=========
In order to produce code that can run when the processor is in a 16bit
mode, SeaBIOS uses the
[binutils](http://en.wikipedia.org/wiki/GNU_Binutils) ".code16gcc"
assembler flag. This instructs the assembler to emit extra prefix
opcodes so that the 32bit code produced by
[gcc](http://en.wikipedia.org/wiki/GNU_Compiler_Collection) will run
even when the processor is in 16bit mode. Note that gcc always
produces 32bit code - it does not know about the ".code16gcc" flag and
does not know that the code will run in a 16bit mode.
SeaBIOS uses the same code for all of the 16bit modes ([16bit real
mode](#16bit_real_mode), [16bit bigreal mode](#16bit_bigreal_mode),
and [16bit protected mode](#16bit_protected_mode)) and that code is
assembled using ".code16gcc". SeaBIOS is careful to use segment
registers properly so that the same code can run in the different
16bit modes that it needs to support.
C code mode flags
=================
Two compile time flags are available to determine the memory model the
code is intended for: MODE16 and MODESEGMENT. When compiling for the
16 bit modes, MODE16 is true and MODESEGMENT is true. In 32bit
segmented mode, MODE16 is false and MODESEGMENT is true. In 32bit flat
mode both MODE16 and MODESEGMENT are false.
Common memory used at run-time
==============================
There are several memory areas that the SeaBIOS "runtime"
[phase](Execution and code flow) makes use of:
* 0x000000-0x000400: Interrupt descriptor table (IDT). This area
defines 256 interrupt vectors as defined by the Intel CPU
specification for 16bit irq handlers. This area is read/writable at
runtime and can be accessed from 16bit real mode and 16bit bigreal
mode calls. SeaBIOS only uses this area to maintain compatibility
with legacy systems.
* 0x000400-0x000500: BIOS Data Area (BDA). This area contains various
legacy flags and attributes. The area is read/writable at runtime
and can be accessed from 16bit real mode and 16bit bigreal mode
calls. SeaBIOS only uses this area to maintain compatibility with
legacy systems.
* 0x09FC00-0x0A0000 (typical): Extended BIOS Data Area (EBDA). This
area contains a few legacy flags and attributes. The area is
typically located at 0x9FC00, but it can be moved by option roms, by
legacy operating systems, and by SeaBIOS if
CONFIG_MALLOC_UPPERMEMORY is not set. Its actual location is
determined by a pointer in the BDA. The area is read/writable at
runtime and can be accessed from 16bit real mode and 16bit bigreal
mode calls. SeaBIOS only uses this area to maintain compatibility
with legacy systems.
* 0x0E0000-0x0F0000 (typical): "low" memory. This area is used for
custom read/writable storage internal to SeaBIOS. The area is
read/writable at runtime and can be accessed from 16bit real mode
and 16bit bigreal mode calls. The area is typically located at the
end of the e-segment, but the build may position it anywhere in the
0x0C0000-0x0F0000 region. However, if CONFIG_MALLOC_UPPERMEMORY is
not set, then this region is between 0x090000-0x0A0000. Space is
allocated in this region by either marking a global variable with
the "VARLOW" flag or by calling malloc_low() during
initialization. The area can be grown dynamically (via malloc_low),
but it will never exceed 64K.
* 0x0F0000-0x100000: The BIOS segment. This area is used for both
runtime code and static variables. Space is allocated in this region
by either marking a global variable with VAR16, one of the VARFSEG
flags, or by calling malloc_fseg() during initialization. The area
is read-only at runtime and can be accessed from 16bit real mode,
16bit bigreal mode, 16bit protected mode, and 32bit segmented mode
calls.
All of the above areas are also read/writable during the SeaBIOS
initialization phase and are accessible when in 32bit flat mode.
Segmented mode memory access
============================
The assembler entry functions for segmented mode calls (all modes
except [32bit flat mode](#32bit_flat_mode)) will arrange
to set the data segment (%ds) to be the same as the stack segment
(%ss) before calling any C code. This permits all C variables located
on the stack and C pointers to data located on the stack to work as
normal.
However, all code running in segmented mode must wrap non-stack memory
accesses in special macros. These macros ensure the correct segment
register is used. Failure to use the correct macro will result in an
incorrect memory access that will likely cause hard to find errors.
There are three low-level memory access macros:
* GET_VAR / SET_VAR : Accesses a variable using the specified segment
register. This isn't typically used directly by C code.
* GET_FARVAR / SET_FARVAR : Assigns the extra segment (%es) to the
given segment id and then performs the given memory access via %es.
* GET_FLATVAR / SET_FLATVAR : These macros take a 32bit pointer,
construct a segment/offset pair valid in real mode, and then perform
the given access. These macros must not be used in 16bit protected
mode or 32bit segmented mode.
Since most memory accesses are to [common memory used at
run-time](#Common_memory_used_at_run-time), several helper
macros are also available.
* GET_IDT / SET_IDT : Access the interrupt descriptor table (IDT).
* GET_BDA / SET_BDA : Access the BIOS Data Area (BDA).
* GET_EBDA / SET_EBDA : Access the Extended BIOS Data Area (EBDA).
* GET_LOW / SET_LOW : Access internal variables marked with
VARLOW. (There are also related macros GET_LOWFLAT / SET_LOWFLAT for
accessing storage allocated with malloc_low).
* GET_GLOBAL : Access internal variables marked with the VAR16 or
VARFSEG flags. (There is also the related macro GET_GLOBALFLAT for
accessing storage allocated with malloc_fseg).
Memory available during initialization
======================================
During the POST [phase](Execution and code flow) the code
can fully access the first 4 gigabytes of memory. However, memory
accesses are generally limited to the [common memory used at
run-time](#Common_memory_used_at_run-time) and areas
allocated at runtime via one of the malloc calls:
* malloc_high : Permanent high-memory zone. This area is used for
custom read/writable storage internal to SeaBIOS. The area is
located at the top of the first 4 gigabytes of ram. It is commonly
used for storing standard tables accessed by the operating system at
runtime (ACPI, SMBIOS, and MPTable) and for DMA buffers used by
hardware drivers. The area is read/writable at runtime and an entry
in the e820 memory map is used to reserve it. When running on an
emulator that has only 1 megabyte of ram this zone will be empty.
* malloc_tmphigh : Temporary high-memory zone. This area is used for
custom read/writable storage during the SeaBIOS initialization
phase. The area generally starts after the first 1 megabyte of ram
(0x100000) and ends prior to the Permanent high-memory zone. When
running on an emulator that has only 1 megabyte of ram this zone
will be empty. The area is not reserved from the operating system,
so it must not be accessed after the SeaBIOS initialization phase.
* malloc_tmplow : Temporary low-memory zone. This area is used for
custom read/writable storage during the SeaBIOS initialization
phase. The area resides between 0x07000-0x90000. The area is not
reserved from the operating system and by specification it is
required to be zero'd at the end of the initialization phase.
The "tmplow" and "tmphigh" regions are only available during the
initialization phase. Any access (either read or write) after
completion of the initialization phase can result in difficult to find
errors.
seabios-1.8.2/docs/README 0000664 0000000 0000000 00000000346 12537753636 0015003 0 ustar 00root root 0000000 0000000 This directory contains SeaBIOS documentation as found on the SeaBIOS
wiki. All the files in this directory (with the exclusion of this
README file) correspond to a page on the wiki.
The documentation files use markdown syntax.
seabios-1.8.2/docs/Releases.md 0000664 0000000 0000000 00000027222 12537753636 0016212 0 ustar 00root root 0000000 0000000 History of SeaBIOS releases. Please see [download](Download) for
information on obtaining these releases.
SeaBIOS 1.8.0
=============
Available on 20150218. Major changes in this release:
* Several USB timing fixes for USB controllers on real hardware
* Initial support for USB3 hubs
* Initial support for SD cards (on QEMU only)
* Initial support for transitioning to 32bit mode using SMIs (on QEMU
TCG only)
* SeaVGABIOS improvements
* Added cursor emulation to coreboot native init vgabios (cbvga)
* Added support for read character calls when in graphics mode
* Developer documentation added to "docs/" directory in the code
repository and several documentation updates
* Several bug fixes and code cleanups
As of the 1.8.0 release, new feature releases will modify the first
two release numbers (eg, 1.8) and stable releases will use three
numbers (eg, 1.8.1). The prior behavior of using a forth number
(eg, 1.7.5.1) for stable releases will no longer be used.
SeaBIOS 1.7.5
=============
Available on 20140528. Major changes in this release:
* Support for obtaining SMBIOS tables directly from QEMU.
* XHCI USB controller fixes for real hardware (now tested on several
boards)
* SeaVGABIOS improvements
* New driver for "coreboot native vga" support
* Improved detection of older x86emu versions with incorrect
emulation.
* Several bug fixes and code cleanups
SeaBIOS 1.7.5.1
---------------
Available on 20141113. Stable release containing only bug fixes.
SeaBIOS 1.7.5.2
---------------
Available on 20150112. Stable release containing only bug fixes.
SeaBIOS 1.7.4
=============
Available on 20131223. Major changes in this release:
* Support for obtaining ACPI tables directly from QEMU.
* Initial support for XHCI USB controllers (initially for QEMU only).
* Support for booting from "pvscsi" devices on QEMU.
* Enhanced floppy driver - improved support for real hardware.
* coreboot cbmem console support.
* Optional support for using the 9-segment instead of the e-segment
for local variables.
* Improved internal timer code and accuracy.
* SeaVGABIOS improvements
* Better support for legacy X.org releases with incomplete x86emu
emulation.
* Support for using an internal stack to reduce caller's stack
usage.
* Back port of new "bochs dispi" interface video modes.
* Several bug fixes and code cleanups
* Source code separated out into additional hardware and firmware
directories.
* Update to latest version of Kconfig
SeaBIOS 1.7.3
=============
Available on 20130707. Major changes in this release:
* Initial support for using SeaBIOS as a UEFI Compatibility Support
Module (CSM)
* Support for detecting and using ACPI reboot ports.
* By default, all 16bit entry points now use an internal stack to
reduce stack footprint.
* Floppy controller code has been rewritten to improve
compatibility. Non-standard floppy sizes now work again with recent
QEMU versions.
* Several bug fixes and code cleanups
SeaBIOS 1.7.2
=============
Available on 20130118. Major changes in this release:
* Support for ICH9 host chipset ("q35") on emulators
* Support for booting from LSI MegaRAID SAS controllers
* Support for using the ACPI PM timer on emulators
* Improved Geode VGA BIOS support.
* Several bug fixes
SeaBIOS 1.7.2.1
---------------
Available on 20130227. Stable release containing only bug fixes.
SeaBIOS 1.7.2.2
---------------
Available on 20130527. Stable release containing only bug fixes.
SeaBIOS 1.7.1
=============
Available on 20120831. Major changes in this release:
* Initial support for booting from USB attached scsi (USB UAS) drives
* USB EHCI 64bit controller support
* USB MSC multi-LUN device support
* Support for booting from LSI SCSI controllers on emulators
* Support for booting from AMD PCscsi controllers on emulators
* New PCI allocation code on emulators. Support 64bit PCI bars and
mapping them above 4G.
* Support for non-linear APIC ids on emulators.
* Stack switching for 16bit real mode irq handlers to reduce stack
footprint.
* Support for custom storage in the memory at 0xc0000-0xf0000. No
longer reserve memory for custom storage in first 640k.
* Improved code generation for 16bit segment register loads
* Boot code will now (by default) reboot after 60 seconds if no boot
device found
* CBFS and FWCFG "files" are now only scanned one time
* Several bug fixes
SeaBIOS 1.7.0
=============
Available on 20120414. Major changes in this release:
* Many enhancements to VGA BIOS code - it should now be feature
complete with LGPL vgabios.
* Support for virtio-scsi.
* Improved USB drive (usb-msc) support.
* Several USB controller bug fixes and improvements.
* Runtime ACPI AML PCI hotplug construction.
* Support for running on i386 and i486 CPUs.
* Enhancements to PCI init when running on emulators.
* Several bug fixes
SeaBIOS 1.6.3
=============
Available on 20111004. Major changes in this release:
* Initial support for Xen
* PCI init (on emulators) uses a two-phase initialization
* Fixes for AHCI so it can work on real hardware. AHCI is now enabled
by default.
* Bootsplash support for BMP files
* Several configuration options can now be configured at runtime via
CBFS files (eg, "etc/boot-menu-wait")
* PCI device scan is cached during POST phase
* Several bug fixes
The SeaBIOS 1.6.3 release was an incremental feature release. The
first release number (1) was incremented as the project was no longer
in a beta stage, and the third release number (3) was also incremented
to indicate the release was a regular feature release.
SeaBIOS 1.6.3.1
---------------
Available on 20111124. Stable release containing only bug fixes.
SeaBIOS 1.6.3.2
---------------
Available on 20120311. Stable release containing only bug fixes.
SeaBIOS 0.6.2
=============
Available on 20110228. Major changes in this release:
* Setup code can relocate to high-memory to save space in c-f segments
* Build now configured via Kconfig
* Experimental support for AHCI controllers
* Support for run-time configuration of the boot order (via
CBFS/fw_cfg "bootorder" file)
* Support T13 EDD3.0 spec
* Improved bounds checking on PCI memory allocation
* Several bug fixes
SeaBIOS 0.6.1
=============
Available on 20100913. Major changes in this release:
* Support for virtio drives
* Add ACPI definitions for cpu hotplug support
* Support for a graphical bootsplash screen
* USB mouse support
* The PCI support for emulators is less dependent on i440 chipset
* New malloc implementation which improves memalign and free
* The build system no longer double links objects
* Several bug fixes
SeaBIOS 0.6.1.1
---------------
Available on 20101031. Stable release containing only bug fixes.
SeaBIOS 0.6.1.2
---------------
Available on 20101113. Stable release containing only bug fixes.
SeaBIOS 0.6.1.3
---------------
Available on 20101226. Stable release containing only bug fixes.
SeaBIOS 0.6.0
=============
Available on 20100326. Major changes in this release:
* USB hub support
* USB drive booting support
* USB keyboard auto-repeat support
* USB EHCI controller support
* Several improvements to compatibility of PS2 port handlers for old
code
* Support for qemu e820 interface
* Several bug fixes and code cleanups
SeaBIOS 0.5.1
=============
Available on 20100108. Major changes in this release:
* Support for 32bit PCI BIOS calls
* Support for int1589 calls
* MPTable fixes for OpenBSD
* ATA DMA and bus-mastering support
* Several bug fixes and code cleanups
SeaBIOS 0.5.0
=============
Available on 20091218. Major changes in this release:
* Several enhancements ported from the Bochs BIOS derived code in qemu
and kvm
* Support for parallel hardware initialization to reduce bootup times
* Enable PCI option rom support by default (Bochs users must now
enable CONFIG_OPTIONROMS_DEPLOYED in src/config.h). Support added
for extracting option roms from qemu "fw_cfg".
* Support USB UHCI and OHCI controllers
* Initial support for USB keyboards
* SeaBIOS can now be greater than 64K
* Support for permanent low memory allocations
* APIC "local interrupts" now enabled in SeaBIOS (on emulators)
* Several bug fixes and code cleanups
SeaBIOS 0.4.2
=============
Available on 20090909. Major changes in this release:
* Implement Post Memory Manager (PMM) support. Use equivalent "malloc"
functions for internal allocations as well.
* Refactor disk "block" interface for greater expandability
* Support CBFS based floppy images
* Allow boot menu to select either floppy to boot from
* Increase ebda size to store a CDROM harddrive/floppy emulation
buffer
* Support systems with multiple vga cards (only the card with the
legacy IO ranges mapped will have its option rom executed)
* Make option rom memory be writable during option rom execution (on
emulators)
* Compile version number into code and report on each boot
* Several bug fixes and code cleanups
SeaBIOS 0.4.1
=============
Available on 20090714. Major changes in this release:
* Support older versions of gcc that predate "-fwhole-program" (eg,
v3.x)
* Add initial port of "LGPL vga bios" code into tree in "vgasrc/"
directory
* Handle ATA drives still "spinning up" during SeaBIOS drive detect
* Add support for option rom Boot Connection Vectors (BCV)
* Enhance boot menu to support booting from any drive or any cdrom
* Support flash based Coreboot File System (CBFS)
* Support booting from a CBFS "payload"
* Support coreboot table forwarder
* Support compile time definitions for multiple root PCI buses
* New tools/readserial.py tool
* Several bug fixes and code cleanups
SeaBIOS 0.4.0
=============
Available on 20090206. Major changes in this release:
* Add Bios Boot Specification (BBS) calls; add PnP call stubs
* Support option roms stored in PCI rom BAR
* Support rebooting on ctrl+alt+delete key press
* Scan PCI devices for ATA adapters (don't assume legacy ISA ATA ports
are valid)
* Attempt to automatically determine gcc capabilities/bugs during
build
* Add script to layout 16bit sections at fixed offsets and in
compacted space
* Introduce timestamp counter based delays
* Support POST calls that are really a resume
* Use new stack in EBDA for int13 disk calls to reduce stack usage
* Support the EBDA being relocated by option roms
* Move many variables from EBDA to global variables (stored in
f-segment)
* Support for PCI bridges when iterating through PCI device list
* Initial port of several KVM specific features from their Bochs BIOS
derived code
* Access BDA using segment 0x40 and IVT using segment 0x00 (which
could be important for 16bit protected mode callers)
* Several bug fixes and code cleanups
SeaBIOS 0.3.0
=============
Available on 20080817. Major changes in this release:
* Run boot code (int18/19) in 32bit mode
* Rewrite of PS2 port handling - new code is more compatible with real
hardware
* Initial support for int155f VGA option rom calls
* Several bug fixes and code cleanups
SeaBIOS 0.2.3
=============
Available on 20080702. Major changes in this release:
* Initial support for running on real hardware with coreboot
* Support parsing coreboot tables
* Support relocating bios tables from high memory when running under
coreboot
* Dynamic e820 map generation
* Serial debug support
* New tools/checkstack.py tool
* Several bug fixes and code cleanups
SeaBIOS 0.2.2
=============
Formerly known as "legacybios". Available on 20080501. Major changes
in this release:
* Several bug fixes and code cleanups
SeaBIOS 0.2.1
=============
Formerly known as "legacybios". Available on 20080406. Major changes
in this release:
* Port of boot menu code from Bochs BIOS
* Several bug fixes and code cleanups
SeaBIOS 0.2.0
=============
Formerly known as "legacybios". Available on 20080330. Major changes
in this release:
* Completion of initial port of Bochs BIOS code to gcc.
seabios-1.8.2/docs/SeaBIOS.md 0000664 0000000 0000000 00000001310 12537753636 0015622 0 ustar 00root root 0000000 0000000 SeaBIOS is an open source implementation of a 16bit X86 BIOS. SeaBIOS
can run in an emulator or it can run natively on X86 hardware with the
use of [coreboot](http://www.coreboot.org/).
SeaBIOS is the default BIOS for [qemu](http://www.qemu.org/) and
[kvm](http://www.linux-kvm.org/).
The [coreboot SeaBIOS](http://www.coreboot.org/SeaBIOS) page has
information on using SeaBIOS in coreboot. Please see the
[releases](Releases) page for information on recent releases. See the
[download](Download) page to obtain SeaBIOS.
Please join the [mailing list](Mailinglist) to contribute to
SeaBIOS. Information on the internals of SeaBIOS is available on the
[Developer Documentation](Developer Documentation) page.
seabios-1.8.2/scripts/ 0000775 0000000 0000000 00000000000 12537753636 0014657 5 ustar 00root root 0000000 0000000 seabios-1.8.2/scripts/acpi_extract.py 0000775 0000000 0000000 00000027763 12537753636 0017721 0 ustar 00root root 0000000 0000000 #!/usr/bin/python
# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin
#
# This file may be distributed under the terms of the GNU GPLv3 license.
# Process mixed ASL/AML listing (.lst file) produced by iasl -l
# Locate and execute ACPI_EXTRACT directives, output offset info
#
# Documentation of ACPI_EXTRACT_* directive tags:
#
# These directive tags output offset information from AML for BIOS runtime
# table generation.
# Each directive is of the form:
# ACPI_EXTRACT_ (...)
# and causes the extractor to create an array
# named with offset, in the generated AML,
# of an object of a given type in the following .
#
# A directive must fit on a single code line.
#
# Object type in AML is verified, a mismatch causes a build failure.
#
# Directives and operators currently supported are:
# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name()
# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name()
# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name()
# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method()
# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name()
# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block
# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor()
# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1
# ACPI_EXTRACT_DEVICE_START - start of Device() block
# ACPI_EXTRACT_DEVICE_STRING - extract a NameString from Device()
# ACPI_EXTRACT_DEVICE_END - offset at last byte of Device() + 1
# ACPI_EXTRACT_PKG_START - start of Package block
#
# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode
#
# ACPI_EXTRACT is not allowed anywhere else in code, except in comments.
import re
import sys
import fileinput
aml = []
asl = []
output = {}
debug = ""
class asl_line:
line = None
lineno = None
aml_offset = None
def die(diag):
sys.stderr.write("Error: %s; %s\n" % (diag, debug))
sys.exit(1)
#Store an ASL command, matching AML offset, and input line (for debugging)
def add_asl(lineno, line):
l = asl_line()
l.line = line
l.lineno = lineno
l.aml_offset = len(aml)
asl.append(l)
#Store an AML byte sequence
#Verify that offset output by iasl matches # of bytes so far
def add_aml(offset, line):
o = int(offset, 16)
# Sanity check: offset must match size of code so far
if (o != len(aml)):
die("Offset 0x%x != 0x%x" % (o, len(aml)))
# Strip any trailing dots and ASCII dump after "
line = re.sub(r'\s*\.*\s*".*$', "", line)
# Strip traling whitespace
line = re.sub(r'\s+$', "", line)
# Strip leading whitespace
line = re.sub(r'^\s+', "", line)
# Split on whitespace
code = re.split(r'\s+', line)
for c in code:
# Require a legal hex number, two digits
if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))):
die("Unexpected octet %s" % c)
aml.append(int(c, 16))
# Process aml bytecode array, decoding AML
def aml_pkglen_bytes(offset):
# PkgLength can be multibyte. Bits 8-7 give the # of extra bytes.
pkglenbytes = aml[offset] >> 6
return pkglenbytes + 1
def aml_pkglen(offset):
pkgstart = offset
pkglenbytes = aml_pkglen_bytes(offset)
pkglen = aml[offset] & 0x3F
# If multibyte, first nibble only uses bits 0-3
if ((pkglenbytes > 1) and (pkglen & 0x30)):
die("PkgLen bytes 0x%x but first nibble 0x%x expected 0x0X" %
(pkglen, pkglen))
offset += 1
pkglenbytes -= 1
for i in range(pkglenbytes):
pkglen |= aml[offset + i] << (i * 8 + 4)
if (len(aml) < pkgstart + pkglen):
die("PckgLen 0x%x at offset 0x%x exceeds AML size 0x%x" %
(pkglen, offset, len(aml)))
return pkglen
# Given method offset, find its NameString offset
def aml_method_string(offset):
#0x14 MethodOp PkgLength NameString MethodFlags TermList
if (aml[offset] != 0x14):
die( "Method offset 0x%x: expected 0x14 actual 0x%x" %
(offset, aml[offset]))
offset += 1
pkglenbytes = aml_pkglen_bytes(offset)
offset += pkglenbytes
return offset
# Given name offset, find its NameString offset
def aml_name_string(offset):
#0x08 NameOp NameString DataRef
if (aml[offset] != 0x08):
die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
(offset, aml[offset]))
offset += 1
# Block Name Modifier. Skip it.
if (aml[offset] == 0x5c or aml[offset] == 0x5e):
offset += 1
return offset
# Given data offset, find 8 byte buffer offset
def aml_data_buffer8(offset):
#0x08 NameOp NameString DataRef
expect = [0x11, 0x0B, 0x0A, 0x08]
if (aml[offset:offset+4] != expect):
die( "Name offset 0x%x: expected %s actual %s" %
(offset, aml[offset:offset+4], expect))
return offset + len(expect)
# Given data offset, find dword const offset
def aml_data_dword_const(offset):
#0x08 NameOp NameString DataRef
if (aml[offset] != 0x0C):
die( "Name offset 0x%x: expected 0x0C actual 0x%x" %
(offset, aml[offset]))
return offset + 1
# Given data offset, find word const offset
def aml_data_word_const(offset):
#0x08 NameOp NameString DataRef
if (aml[offset] != 0x0B):
die( "Name offset 0x%x: expected 0x0B actual 0x%x" %
(offset, aml[offset]))
return offset + 1
# Given data offset, find byte const offset
def aml_data_byte_const(offset):
#0x08 NameOp NameString DataRef
if (aml[offset] != 0x0A):
die( "Name offset 0x%x: expected 0x0A actual 0x%x" %
(offset, aml[offset]))
return offset + 1
# Find name'd buffer8
def aml_name_buffer8(offset):
return aml_data_buffer8(aml_name_string(offset) + 4)
# Given name offset, find dword const offset
def aml_name_dword_const(offset):
return aml_data_dword_const(aml_name_string(offset) + 4)
# Given name offset, find word const offset
def aml_name_word_const(offset):
return aml_data_word_const(aml_name_string(offset) + 4)
# Given name offset, find byte const offset
def aml_name_byte_const(offset):
return aml_data_byte_const(aml_name_string(offset) + 4)
def aml_device_start(offset):
#0x5B 0x82 DeviceOp PkgLength NameString
if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)):
die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" %
(offset, aml[offset], aml[offset + 1]))
return offset
def aml_device_string(offset):
#0x5B 0x82 DeviceOp PkgLength NameString
start = aml_device_start(offset)
offset += 2
pkglenbytes = aml_pkglen_bytes(offset)
offset += pkglenbytes
return offset
def aml_device_end(offset):
start = aml_device_start(offset)
offset += 2
pkglenbytes = aml_pkglen_bytes(offset)
pkglen = aml_pkglen(offset)
return offset + pkglen
def aml_processor_start(offset):
#0x5B 0x83 ProcessorOp PkgLength NameString ProcID
if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)):
die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" %
(offset, aml[offset], aml[offset + 1]))
return offset
def aml_processor_string(offset):
#0x5B 0x83 ProcessorOp PkgLength NameString ProcID
start = aml_processor_start(offset)
offset += 2
pkglenbytes = aml_pkglen_bytes(offset)
offset += pkglenbytes
return offset
def aml_processor_end(offset):
start = aml_processor_start(offset)
offset += 2
pkglenbytes = aml_pkglen_bytes(offset)
pkglen = aml_pkglen(offset)
return offset + pkglen
def aml_package_start(offset):
offset = aml_name_string(offset) + 4
# 0x12 PkgLength NumElements PackageElementList
if (aml[offset] != 0x12):
die( "Name offset 0x%x: expected 0x12 actual 0x%x" %
(offset, aml[offset]))
offset += 1
return offset + aml_pkglen_bytes(offset) + 1
lineno = 0
for line in fileinput.input():
# Strip trailing newline
line = line.rstrip()
# line number and debug string to output in case of errors
lineno = lineno + 1
debug = "input line %d: %s" % (lineno, line)
#ASL listing: space, then line#, then ...., then code
pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
m = pasl.search(line)
if (m):
add_asl(lineno, pasl.sub("", line))
# AML listing: offset in hex, then ...., then code
paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
m = paml.search(line)
if (m):
add_aml(m.group(1), paml.sub("", line))
# Now go over code
# Track AML offset of a previous non-empty ASL command
prev_aml_offset = -1
for i in range(len(asl)):
debug = "input line %d: %s" % (asl[i].lineno, asl[i].line)
l = asl[i].line
# skip if not an extract directive
a = len(re.findall(r'ACPI_EXTRACT', l))
if (not a):
# If not empty, store AML offset. Will be used for sanity checks
# IASL seems to put {}. at random places in the listing.
# Ignore any non-words for the purpose of this test.
m = re.search(r'\w+', l)
if (m):
prev_aml_offset = asl[i].aml_offset
continue
if (a > 1):
die("Expected at most one ACPI_EXTRACT per line, actual %d" % a)
mext = re.search(r'''
^\s* # leading whitespace
/\*\s* # start C comment
(ACPI_EXTRACT_\w+) # directive: group(1)
\s+ # whitspace separates directive from array name
(\w+) # array name: group(2)
\s*\*/ # end of C comment
\s*$ # trailing whitespace
''', l, re.VERBOSE)
if (not mext):
die("Stray ACPI_EXTRACT in input")
# previous command must have produced some AML,
# otherwise we are in a middle of a block
if (prev_aml_offset == asl[i].aml_offset):
die("ACPI_EXTRACT directive in the middle of a block")
directive = mext.group(1)
array = mext.group(2)
offset = asl[i].aml_offset
if (directive == "ACPI_EXTRACT_ALL_CODE"):
if array in output:
die("%s directive used more than once" % directive)
output[array] = aml
continue
if (directive == "ACPI_EXTRACT_NAME_BUFFER8"):
offset = aml_name_buffer8(offset)
elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"):
offset = aml_name_dword_const(offset)
elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"):
offset = aml_name_word_const(offset)
elif (directive == "ACPI_EXTRACT_NAME_BYTE_CONST"):
offset = aml_name_byte_const(offset)
elif (directive == "ACPI_EXTRACT_NAME_STRING"):
offset = aml_name_string(offset)
elif (directive == "ACPI_EXTRACT_METHOD_STRING"):
offset = aml_method_string(offset)
elif (directive == "ACPI_EXTRACT_DEVICE_START"):
offset = aml_device_start(offset)
elif (directive == "ACPI_EXTRACT_DEVICE_STRING"):
offset = aml_device_string(offset)
elif (directive == "ACPI_EXTRACT_DEVICE_END"):
offset = aml_device_end(offset)
elif (directive == "ACPI_EXTRACT_PROCESSOR_START"):
offset = aml_processor_start(offset)
elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"):
offset = aml_processor_string(offset)
elif (directive == "ACPI_EXTRACT_PROCESSOR_END"):
offset = aml_processor_end(offset)
elif (directive == "ACPI_EXTRACT_PKG_START"):
offset = aml_package_start(offset)
else:
die("Unsupported directive %s" % directive)
if array not in output:
output[array] = []
output[array].append(offset)
debug = "at end of file"
def get_value_type(maxvalue):
#Use type large enough to fit the table
if (maxvalue >= 0x10000):
return "int"
elif (maxvalue >= 0x100):
return "short"
else:
return "char"
# Pretty print output
for array in output.keys():
otype = get_value_type(max(output[array]))
odata = []
for value in output[array]:
odata.append("0x%x" % value)
sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array))
sys.stdout.write(",\n".join(odata))
sys.stdout.write('\n};\n')
seabios-1.8.2/scripts/acpi_extract_preprocess.py 0000775 0000000 0000000 00000002465 12537753636 0022156 0 ustar 00root root 0000000 0000000 #!/usr/bin/python
# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin
#
# This file may be distributed under the terms of the GNU GPLv3 license.
# Read a preprocessed ASL listing and put each ACPI_EXTRACT
# directive in a comment, to make iasl skip it.
# We also put each directive on a new line, the machinery
# in scripts/acpi_extract.py requires this.
import re
import sys
import fileinput
def die(diag):
sys.stderr.write("Error: %s\n" % (diag))
sys.exit(1)
# Note: () around pattern make split return matched string as part of list
psplit = re.compile(r''' (
\b # At word boundary
ACPI_EXTRACT_\w+ # directive
\s+ # some whitespace
\w+ # array name
)''', re.VERBOSE)
lineno = 0
for line in fileinput.input():
# line number and debug string to output in case of errors
lineno = lineno + 1
debug = "input line %d: %s" % (lineno, line.rstrip())
s = psplit.split(line)
# The way split works, each odd item is the matching ACPI_EXTRACT directive.
# Put each in a comment, and on a line by itself.
for i in range(len(s)):
if (i % 2):
sys.stdout.write("\n/* %s */\n" % s[i])
else:
sys.stdout.write(s[i])
seabios-1.8.2/scripts/buildrom.py 0000775 0000000 0000000 00000002623 12537753636 0017054 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
# Fill in checksum/size of an option rom, and pad it to proper length.
#
# Copyright (C) 2009 Kevin O'Connor
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import sys, struct
from python23compat import as_bytes
def alignpos(pos, alignbytes):
mask = alignbytes - 1
return (pos + mask) & ~mask
def checksum(data):
if (sys.version_info > (3, 0)):
cksum = sum(data)
else:
cksum = sum(map(ord, data))
return struct.pack('