Index: HelenOS.config
===================================================================
--- HelenOS.config (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ HelenOS.config (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -520,5 +520,5 @@
@ "1920x1080"
@ "1920x1200"
-! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_VESA_MODE (choice)
+! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_MODE (choice)
% Default framebuffer depth
@@ -526,5 +526,5 @@
@ "16"
@ "24"
-! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_VESA_BPP (choice)
+! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_BPP (choice)
% Start AP processors by the loader
@@ -570,5 +570,5 @@
! CONFIG_PCC (n/y)
-% Build binutils binaries
+% Build binutils binaries
! CONFIG_BINUTILS (n/y)
@@ -576,5 +576,5 @@
! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)
-# USB settings
+# USB settings
% USB release build (less logging)
@@ -588,3 +588,8 @@
@ "ganged" Root hub ports are all powered or all off.
@ "per_port" Powered status of every root hub port is independent.
-![PLATFORM=ia32|PLATFORM=amd64] OHCI_POWER_SWITCH (choice)
+! [PLATFORM=ia32|PLATFORM=amd64] OHCI_POWER_SWITCH (choice)
+
+% GRUB boot loader architecture
+@ "pc" GRUB for PC
+@ "efi" GRUB for UEFI
+! [PLATFORM=ia32|PLATFORM=amd64] GRUB_ARCH (choice)
Index: boot/Makefile
===================================================================
--- boot/Makefile (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/Makefile (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -40,8 +40,5 @@
$(PACK) $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) arch/$(KARCH) $(COMPONENTS)
-$(INITRD).img: $(INITRD).fs
- $(MKHORD) $(PAGE_SIZE) $< $@
-
-$(INITRD).fs: build_dist
+$(INITRD).img: build_dist
ifeq ($(RDFMT),tmpfs)
$(MKTMPFS) $(DIST_PATH) $@
@@ -95,5 +92,5 @@
clean_dist:
- rm -f $(INITRD).fs $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) $(LINK).comp *.co
+ rm -f $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) $(LINK).comp *.co
rm -f $(USPACE_PATH)/dist/srv/*
rm -rf $(USPACE_PATH)/dist/drv/*
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/Makefile.common (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -53,5 +53,4 @@
SANDBOX = pack
PACK = $(TOOLS_PATH)/pack.py
-MKHORD = $(TOOLS_PATH)/mkhord.py
MKTMPFS = $(TOOLS_PATH)/mktmpfs.py
MKFAT = $(TOOLS_PATH)/mkfat.py
Index: boot/Makefile.grub
===================================================================
--- boot/Makefile.grub (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/Makefile.grub (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -31,38 +31,66 @@
include Makefile.common
-GRUB2 = grub
-STAGE2 = $(GRUB2)/i386-pc/eltorito.img
-STAGE2_IN = boot/$(STAGE2)
+GRUB = grub.$(GRUB_ARCH)
+BOOT = $(DISTROOT)/boot
+
+ELTORITO = boot/grub/$(GRUB_ARCH).img
+IMAGE = $(DISTROOT)/$(ELTORITO)
+
+ifeq ($(GRUB_ARCH),pc)
+ BOOT_CONFIG = $(BOOT)/grub/i386-pc/grub.cfg
+ MULTIBOOT_CMD = multiboot
+ MODULE_CMD = module
+endif
+ifeq ($(GRUB_ARCH),efi)
+ BOOT_CONFIG = $(BOOT)/grub/grub.cfg
+ MULTIBOOT_CMD = multiboot2
+ MODULE_CMD = module2
+endif
all: $(BOOT_OUTPUT)
$(BOOT_OUTPUT): build_dist
- mkisofs -J -r -input-charset utf-8 -b $(STAGE2_IN) -no-emul-boot -boot-load-size 64 -boot-info-table -o $@ $(DISTROOT)/
+ifeq ($(GRUB_ARCH),pc)
+ mkisofs -J -r -input-charset utf-8 -V "HelenOS boot ISO" -eltorito-boot $(ELTORITO) -no-emul-boot -boot-load-size 64 -boot-info-table -o $@ $(DISTROOT)/
+endif
+ifeq ($(GRUB_ARCH),efi)
+ mkisofs -J -r -input-charset utf-8 -V "HelenOS boot ISO" -efi-boot $(ELTORITO) -o $@ $(DISTROOT)/
+endif
build_dist: clean
- mkdir -p $(DISTROOT)/boot
- cp -r $(GRUB2) $(DISTROOT)/boot
+ mkdir -p $(BOOT)
+ cp -r $(GRUB) $(BOOT)/grub
+ifeq ($(GRUB_ARCH),efi)
+ gunzip $(IMAGE)
+endif
+
for module in $(COMPONENTS) ; do \
- cp "$$module" $(DISTROOT)/boot/ ; \
+ cp "$$module" $(BOOT)/ ; \
done
- echo "set default=0" > $(DISTROOT)/boot/grub/i386-pc/grub.cfg
- echo "set timeout=10" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg
- echo "" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg
+ echo "set default=0" > $(BOOT_CONFIG)
+ echo "set timeout=10" >> $(BOOT_CONFIG)
+ echo "" >> $(BOOT_CONFIG)
- echo "menuentry 'HelenOS $(RELEASE)' --class helenos --class os {" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg
- echo " set root='(cd)'" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg
+ifeq ($(GRUB_ARCH),pc)
+ echo "insmod vbe" >> $(BOOT_CONFIG)
+ echo "insmod vga" >> $(BOOT_CONFIG)
+endif
+ifeq ($(GRUB_ARCH),efi)
+ echo "insmod efi_gop" >> $(BOOT_CONFIG)
+ echo "insmod efi_uga" >> $(BOOT_CONFIG)
+endif
+ echo "" >> $(BOOT_CONFIG)
+ echo "menuentry 'HelenOS $(RELEASE)' --class helenos --class os {" >> $(BOOT_CONFIG)
for module in $(MODULES) ; do \
- echo "" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg ; \
- echo " echo 'Loading $$module'" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg ; \
+ echo " echo 'Loading $$module'" >> $(BOOT_CONFIG) ; \
if [ "$$module" = "kernel.bin" ] ; then \
- echo " multiboot /boot/$$module" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg ; \
+ echo " $(MULTIBOOT_CMD) /boot/$$module" >> $(BOOT_CONFIG) ; \
else \
- echo " module /boot/$$module" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg ; \
+ echo " $(MODULE_CMD) /boot/$$module" >> $(BOOT_CONFIG) ; \
fi \
done
-
- echo "}" >> $(DISTROOT)/boot/grub/i386-pc/grub.cfg
+ echo "}" >> $(BOOT_CONFIG)
clean:
Index: boot/arch/amd64/Makefile.inc
===================================================================
--- boot/arch/amd64/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/amd64/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -26,6 +26,4 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-
-PAGE_SIZE = 4096
RD_SRVS_ESSENTIAL += \
Index: boot/arch/arm32/Makefile.inc
===================================================================
--- boot/arch/arm32/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/arm32/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -39,5 +39,4 @@
BITS = 32
ENDIANESS = LE
-PAGE_SIZE = 4096
RD_SRVS_ESSENTIAL += \
Index: boot/arch/ia64/Makefile.inc
===================================================================
--- boot/arch/ia64/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/ia64/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -33,5 +33,4 @@
BITS = 64
ENDIANESS = LE
-PAGE_SIZE = 16384
EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -mno-sdata
Index: boot/arch/mips32/Makefile.inc
===================================================================
--- boot/arch/mips32/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/mips32/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -29,5 +29,4 @@
BFD_ARCH = mips
BITS = 32
-PAGE_SIZE = 16384
EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32
Index: boot/arch/mips64/Makefile.inc
===================================================================
--- boot/arch/mips64/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/mips64/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -29,5 +29,4 @@
BFD_ARCH = mips:4000
BITS = 64
-PAGE_SIZE = 16384
EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=64
Index: boot/arch/ppc32/Makefile.inc
===================================================================
--- boot/arch/ppc32/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/ppc32/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -37,5 +37,4 @@
BITS = 32
ENDIANESS = BE
-PAGE_SIZE = 4096
EXTRA_CFLAGS = -mcpu=powerpc -msoft-float -m32
Index: boot/arch/sparc64/Makefile.inc
===================================================================
--- boot/arch/sparc64/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ boot/arch/sparc64/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -37,5 +37,4 @@
BITS = 64
ENDIANESS = BE
-PAGE_SIZE = 16384
EXTRA_CFLAGS = -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow
Index: boot/grub.efi/COPYING
===================================================================
--- boot/grub.efi/COPYING (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/COPYING (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,674 @@
+ 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
+.
Index: boot/grub.efi/README
===================================================================
--- boot/grub.efi/README (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/README (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,12 @@
+The binary files of GRUB boot loader in this directory have been created
+by compiling GRUB for the 'i386-efi' and 'x86_64-efi' targets. The combined
+32bit and 64bit EFI boot floppy image was created by modifying the
+i386-grub-mkrescue and x86_64-grub-mkrescue scripts to create EFI payloads
+which search for the bootable ISO image with the volume label
+'HelenOS boot ISO'.
+
+For licensing terms of GRUB boot loader see the file COPYING contained
+in this directory. Full version of GRUB, including its source code,
+can be downloaded from GRUB's project page:
+
+http://www.gnu.org/software/grub/
Index: boot/grub.efi/i386-efi/command.lst
===================================================================
--- boot/grub.efi/i386-efi/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,134 @@
+*acpi: acpi
+*background_image: gfxterm
+*cat: cat
+*cpuid: cpuid
+*crc: hashsum
+*echo: echo
+*functional_test: functional_test
+*gettext: gettext
+*hashsum: hashsum
+*hdparm: hdparm
+*hello: hello
+*help: help
+*hexdump: hexdump
+*inb: iorw
+*inl: iorw
+*inw: iorw
+*keystatus: keystatus
+*kfreebsd: bsd
+*knetbsd: bsd
+*kopenbsd: bsd
+*list_env: loadenv
+*load_env: loadenv
+*loopback: loopback
+*ls: ls
+*lsacpi: lsacpi
+*lspci: lspci
+*md5sum: hashsum
+*menuentry: normal
+*probe: probe
+*read_byte: memrw
+*read_dword: memrw
+*read_word: memrw
+*regexp: regexp
+*save_env: loadenv
+*search: search
+*serial: serial
+*setpci: setpci
+*sha1sum: hashsum
+*sha256sum: hashsum
+*sha512sum: hashsum
+*sleep: sleep
+*submenu: normal
+*terminfo: terminfo
+*test_blockarg: test_blockarg
+*xnu_splash: xnu
+.: configfile
+[: test
+appleloader: appleldr
+authenticate: normal
+badram: mmap
+blocklist: blocklist
+boot: boot
+break: normal
+cat: minicmd
+chainloader: chain
+clear: normal
+cmp: cmp
+configfile: configfile
+continue: normal
+cutmem: mmap
+date: date
+dump: minicmd
+exit: minicmd
+export: normal
+extract_entries_configfile: configfile
+extract_entries_source: configfile
+fakebios: loadbios
+false: true
+fix_video: fixvideo
+gptsync: gptsync
+halt: halt
+help: minicmd
+initrd: linux
+keymap: keylayouts
+kfreebsd_loadenv: bsd
+kfreebsd_module: bsd
+kfreebsd_module_elf: bsd
+knetbsd_module: bsd
+knetbsd_module_elf: bsd
+kopenbsd_ramdisk: bsd
+linux: linux
+loadbios: loadbios
+loadfont: font
+lsefimmap: lsefimmap
+lsefisystab: lsefisystab
+lsfonts: font
+lsmmap: lsmmap
+lsmod: minicmd
+lssal: lssal
+module2: multiboot2
+module: multiboot
+multiboot2: multiboot2
+multiboot: multiboot
+normal: normal
+normal_exit: normal
+outb: iorw
+outl: iorw
+outw: iorw
+parttool: parttool
+password: password
+password_pbkdf2: password_pbkdf2
+play: play
+read: read
+reboot: reboot
+return: normal
+rmmod: minicmd
+search.file: search_fs_file
+search.fs_label: search_label
+search.fs_uuid: search_fs_uuid
+setparams: normal
+shift: normal
+source: configfile
+terminal_input: terminal
+terminal_output: terminal
+test: test
+testload: testload
+true: true
+usb: usbtest
+videoinfo: videoinfo
+videotest: videotest
+write_byte: memrw
+write_dword: memrw
+write_word: memrw
+xnu_devprop_load: xnu
+xnu_kernel64: xnu
+xnu_kernel: xnu
+xnu_kext: xnu
+xnu_kextdir: xnu
+xnu_mkext: xnu
+xnu_ramdisk: xnu
+xnu_resume: xnu
+xnu_uuid: xnu_uuid
+zfs-bootfs: zfsinfo
+zfsinfo: zfsinfo
Index: boot/grub.efi/i386-efi/crypto.lst
===================================================================
--- boot/grub.efi/i386-efi/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,38 @@
+RIJNDAEL: gcry_rijndael
+RIJNDAEL192: gcry_rijndael
+RIJNDAEL256: gcry_rijndael
+AES128: gcry_rijndael
+AES-128: gcry_rijndael
+AES-192: gcry_rijndael
+AES-256: gcry_rijndael
+ARCFOUR: gcry_arcfour
+BLOWFISH: gcry_blowfish
+CAMELLIA128: gcry_camellia
+CAMELLIA192: gcry_camellia
+CAMELLIA256: gcry_camellia
+CAST5: gcry_cast5
+CRC32: gcry_crc
+CRC32RFC1510: gcry_crc
+CRC24RFC2440: gcry_crc
+DES: gcry_des
+3DES: gcry_des
+MD4: gcry_md4
+MD5: gcry_md5
+RFC2268_40: gcry_rfc2268
+AES: gcry_rijndael
+AES192: gcry_rijndael
+AES256: gcry_rijndael
+RIPEMD160: gcry_rmd160
+SEED: gcry_seed
+SERPENT128: gcry_serpent
+SERPENT192: gcry_serpent
+SERPENT256: gcry_serpent
+SHA1: gcry_sha1
+SHA224: gcry_sha256
+SHA256: gcry_sha256
+SHA512: gcry_sha512
+SHA384: gcry_sha512
+TIGER192: gcry_tiger
+TWOFISH: gcry_twofish
+TWOFISH128: gcry_twofish
+WHIRLPOOL: gcry_whirlpool
Index: boot/grub.efi/i386-efi/fs.lst
===================================================================
--- boot/grub.efi/i386-efi/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,25 @@
+affs
+afs
+afs_be
+befs
+befs_be
+btrfs
+cpio
+ext2
+fat
+hfs
+hfsplus
+iso9660
+jfs
+minix
+minix2
+nilfs2
+ntfs
+reiserfs
+sfs
+tar
+udf
+ufs1
+ufs2
+xfs
+zfs
Index: boot/grub.efi/i386-efi/moddep.lst
===================================================================
--- boot/grub.efi/i386-efi/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,175 @@
+videotest: font video gfxmenu
+loopback: extcmd
+gcry_des: crypto
+memrw: extcmd
+terminfo: extcmd
+part_gpt:
+read:
+lsefimmap:
+gcry_arcfour: crypto
+aout:
+elf:
+password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
+gcry_seed: crypto
+bsd: elf serial extcmd video aout boot cpuid relocator mmap
+sfs: fshelp
+reiserfs: fshelp
+part_sunpc:
+gfxmenu: trig bitmap_scale gfxterm font normal bitmap video
+jfs:
+help: extcmd normal
+configfile: normal
+ohci: cs5536 usb boot pci
+afs: fshelp
+xzio: gcry_crc
+usb_keyboard: keylayouts usb
+search_fs_file:
+usbms: scsi usb
+test_blockarg: extcmd normal
+true:
+affs: fshelp
+iso9660: fshelp
+gfxterm: bitmap_scale font extcmd bitmap video
+appleldr: boot
+xfs: fshelp
+functional_test: extcmd
+sleep: extcmd normal
+memdisk:
+gcry_rijndael: crypto
+gettext:
+gcry_sha1: crypto
+cmp:
+befs_be: fshelp
+usb: pci
+hashsum: crypto extcmd normal
+halt: acpi
+search_fs_uuid:
+linux: video boot relocator mmap
+keystatus: extcmd
+part_sun:
+video_bochs: video pci video_fb
+bufio:
+usbserial_ftdi: serial usb usbserial_common
+cpuid: extcmd
+hdparm: extcmd
+gcry_blowfish: crypto
+test:
+nilfs2: fshelp
+minicmd:
+ata: scsi pci
+udf: fshelp
+gzio:
+xnu_uuid: gcry_md5
+uhci: usb pci
+terminal:
+raid:
+crypto:
+part_bsd: part_msdos
+cs5536: pci
+gcry_sha512: crypto
+password: crypto normal
+fshelp:
+xnu: bitmap_scale extcmd normal video boot bitmap relocator
+mmap:
+iorw: extcmd
+zfsinfo: zfs
+lssal:
+blocklist:
+ext2: fshelp
+part_acorn:
+videoinfo: video
+btrfs: gzio
+lsmmap: mmap
+bitmap:
+ntfs: fshelp
+multiboot: video boot relocator mmap
+gcry_crc: crypto
+png: bufio bitmap
+jpeg: bufio bitmap
+regexp: extcmd normal
+parttool: normal
+usbserial_pl2303: serial usb usbserial_common
+cpio:
+gcry_rmd160: crypto
+fat:
+zfs:
+raid6rec: raid
+lsefisystab:
+minix2:
+lsacpi: extcmd acpi
+loadenv: extcmd
+bitmap_scale: bitmap
+datehook: datetime normal
+probe: extcmd
+tar:
+loadbios: pci
+hfs:
+boot:
+keylayouts:
+kernel:
+usbtest: usb
+relocator: mmap
+acpi: extcmd mmap
+tga: bufio bitmap
+reboot:
+serial: extcmd terminfo
+befs: fshelp
+efi_uga: video pci video_fb
+dm_nv: raid
+font: bufio video
+raid5rec: raid
+datetime:
+video:
+example_functional_test: functional_test
+pci:
+hfsplus: fshelp
+gcry_cast5: crypto
+extcmd:
+gcry_whirlpool: crypto
+gcry_tiger: crypto
+fixvideo: pci
+video_fb: video
+search: search_fs_uuid search_fs_file extcmd search_label
+lspci: extcmd pci
+trig:
+afs_be: fshelp
+msdospart: parttool
+gcry_twofish: crypto
+testload:
+part_apple:
+hexdump: extcmd
+ata_pthru: ata
+pbkdf2: crypto
+gcry_sha256: crypto
+date: datetime normal
+usbserial_common: serial usb
+ls: extcmd normal
+ntfscomp: ntfs
+video_cirrus: video pci video_fb
+scsi:
+hello: extcmd
+normal: terminal gfxterm crypto extcmd boot
+cat: extcmd
+ufs1:
+mdraid09: raid
+lvm:
+chain: boot
+ufs2:
+setpci: extcmd pci
+search_label:
+gptsync:
+setjmp:
+multiboot2: video boot relocator mmap acpi
+gcry_rfc2268: crypto
+mdraid1x: raid
+play:
+part_amiga:
+efi_gop: video video_fb
+minix:
+echo: extcmd
+gcry_serpent: crypto
+gcry_md4: crypto
+gcry_md5: crypto
+part_msdos:
+gcry_camellia: crypto
+at_keyboard: keylayouts boot
Index: boot/grub.efi/i386-efi/partmap.lst
===================================================================
--- boot/grub.efi/i386-efi/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,8 @@
+part_acorn
+part_amiga
+part_apple
+part_bsd
+part_gpt
+part_msdos
+part_sun
+part_sunpc
Index: boot/grub.efi/i386-efi/parttool.lst
===================================================================
--- boot/grub.efi/i386-efi/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,1 @@
+msdos: msdospart
Index: boot/grub.efi/i386-efi/terminal.lst
===================================================================
--- boot/grub.efi/i386-efi/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,6 @@
+iat_keyboard: at_keyboard
+iserial: serial
+iserial_*: serial
+ogfxterm: gfxterm
+oserial: serial
+oserial_*: serial
Index: boot/grub.efi/i386-efi/video.lst
===================================================================
--- boot/grub.efi/i386-efi/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/i386-efi/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,4 @@
+efi_gop
+efi_uga
+video_bochs
+video_cirrus
Index: boot/grub.efi/x86_64-efi/command.lst
===================================================================
--- boot/grub.efi/x86_64-efi/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,134 @@
+*acpi: acpi
+*background_image: gfxterm
+*cat: cat
+*cpuid: cpuid
+*crc: hashsum
+*echo: echo
+*functional_test: functional_test
+*gettext: gettext
+*hashsum: hashsum
+*hdparm: hdparm
+*hello: hello
+*help: help
+*hexdump: hexdump
+*inb: iorw
+*inl: iorw
+*inw: iorw
+*keystatus: keystatus
+*kfreebsd: bsd
+*knetbsd: bsd
+*kopenbsd: bsd
+*list_env: loadenv
+*load_env: loadenv
+*loopback: loopback
+*ls: ls
+*lsacpi: lsacpi
+*lspci: lspci
+*md5sum: hashsum
+*menuentry: normal
+*probe: probe
+*read_byte: memrw
+*read_dword: memrw
+*read_word: memrw
+*regexp: regexp
+*save_env: loadenv
+*search: search
+*serial: serial
+*setpci: setpci
+*sha1sum: hashsum
+*sha256sum: hashsum
+*sha512sum: hashsum
+*sleep: sleep
+*submenu: normal
+*terminfo: terminfo
+*test_blockarg: test_blockarg
+*xnu_splash: xnu
+.: configfile
+[: test
+appleloader: appleldr
+authenticate: normal
+badram: mmap
+blocklist: blocklist
+boot: boot
+break: normal
+cat: minicmd
+chainloader: chain
+clear: normal
+cmp: cmp
+configfile: configfile
+continue: normal
+cutmem: mmap
+date: date
+dump: minicmd
+exit: minicmd
+export: normal
+extract_entries_configfile: configfile
+extract_entries_source: configfile
+fakebios: loadbios
+false: true
+fix_video: fixvideo
+gptsync: gptsync
+halt: halt
+help: minicmd
+initrd: linux
+keymap: keylayouts
+kfreebsd_loadenv: bsd
+kfreebsd_module: bsd
+kfreebsd_module_elf: bsd
+knetbsd_module: bsd
+knetbsd_module_elf: bsd
+kopenbsd_ramdisk: bsd
+linux: linux
+loadbios: loadbios
+loadfont: font
+lsefimmap: lsefimmap
+lsefisystab: lsefisystab
+lsfonts: font
+lsmmap: lsmmap
+lsmod: minicmd
+lssal: lssal
+module2: multiboot2
+module: multiboot
+multiboot2: multiboot2
+multiboot: multiboot
+normal: normal
+normal_exit: normal
+outb: iorw
+outl: iorw
+outw: iorw
+parttool: parttool
+password: password
+password_pbkdf2: password_pbkdf2
+play: play
+read: read
+reboot: reboot
+return: normal
+rmmod: minicmd
+search.file: search_fs_file
+search.fs_label: search_label
+search.fs_uuid: search_fs_uuid
+setparams: normal
+shift: normal
+source: configfile
+terminal_input: terminal
+terminal_output: terminal
+test: test
+testload: testload
+true: true
+usb: usbtest
+videoinfo: videoinfo
+videotest: videotest
+write_byte: memrw
+write_dword: memrw
+write_word: memrw
+xnu_devprop_load: xnu
+xnu_kernel64: xnu
+xnu_kernel: xnu
+xnu_kext: xnu
+xnu_kextdir: xnu
+xnu_mkext: xnu
+xnu_ramdisk: xnu
+xnu_resume: xnu
+xnu_uuid: xnu_uuid
+zfs-bootfs: zfsinfo
+zfsinfo: zfsinfo
Index: boot/grub.efi/x86_64-efi/crypto.lst
===================================================================
--- boot/grub.efi/x86_64-efi/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,38 @@
+RIJNDAEL: gcry_rijndael
+RIJNDAEL192: gcry_rijndael
+RIJNDAEL256: gcry_rijndael
+AES128: gcry_rijndael
+AES-128: gcry_rijndael
+AES-192: gcry_rijndael
+AES-256: gcry_rijndael
+ARCFOUR: gcry_arcfour
+BLOWFISH: gcry_blowfish
+CAMELLIA128: gcry_camellia
+CAMELLIA192: gcry_camellia
+CAMELLIA256: gcry_camellia
+CAST5: gcry_cast5
+CRC32: gcry_crc
+CRC32RFC1510: gcry_crc
+CRC24RFC2440: gcry_crc
+DES: gcry_des
+3DES: gcry_des
+MD4: gcry_md4
+MD5: gcry_md5
+RFC2268_40: gcry_rfc2268
+AES: gcry_rijndael
+AES192: gcry_rijndael
+AES256: gcry_rijndael
+RIPEMD160: gcry_rmd160
+SEED: gcry_seed
+SERPENT128: gcry_serpent
+SERPENT192: gcry_serpent
+SERPENT256: gcry_serpent
+SHA1: gcry_sha1
+SHA224: gcry_sha256
+SHA256: gcry_sha256
+SHA512: gcry_sha512
+SHA384: gcry_sha512
+TIGER192: gcry_tiger
+TWOFISH: gcry_twofish
+TWOFISH128: gcry_twofish
+WHIRLPOOL: gcry_whirlpool
Index: boot/grub.efi/x86_64-efi/fs.lst
===================================================================
--- boot/grub.efi/x86_64-efi/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,25 @@
+affs
+afs
+afs_be
+befs
+befs_be
+btrfs
+cpio
+ext2
+fat
+hfs
+hfsplus
+iso9660
+jfs
+minix
+minix2
+nilfs2
+ntfs
+reiserfs
+sfs
+tar
+udf
+ufs1
+ufs2
+xfs
+zfs
Index: boot/grub.efi/x86_64-efi/moddep.lst
===================================================================
--- boot/grub.efi/x86_64-efi/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,175 @@
+videotest: font video gfxmenu
+loopback: extcmd
+gcry_des: crypto
+memrw: extcmd
+terminfo: extcmd
+part_gpt:
+read:
+lsefimmap:
+gcry_arcfour: crypto
+aout:
+elf:
+password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
+gcry_seed: crypto
+bsd: elf serial extcmd video aout boot cpuid relocator mmap
+sfs: fshelp
+reiserfs: fshelp
+part_sunpc:
+gfxmenu: trig bitmap_scale gfxterm font normal bitmap video
+jfs:
+help: extcmd normal
+configfile: normal
+ohci: cs5536 usb boot pci
+afs: fshelp
+xzio: gcry_crc
+usb_keyboard: keylayouts usb
+search_fs_file:
+usbms: scsi usb
+test_blockarg: extcmd normal
+true:
+affs: fshelp
+iso9660: fshelp
+gfxterm: bitmap_scale font extcmd bitmap video
+appleldr: boot
+xfs: fshelp
+functional_test: extcmd
+sleep: extcmd normal
+memdisk:
+gcry_rijndael: crypto
+gettext:
+gcry_sha1: crypto
+cmp:
+befs_be: fshelp
+usb: pci
+hashsum: crypto extcmd normal
+halt: acpi
+search_fs_uuid:
+linux: video boot relocator mmap
+keystatus: extcmd
+part_sun:
+video_bochs: video pci video_fb
+bufio:
+usbserial_ftdi: serial usb usbserial_common
+cpuid: extcmd
+hdparm: extcmd
+gcry_blowfish: crypto
+test:
+nilfs2: fshelp
+minicmd:
+ata: scsi pci
+udf: fshelp
+gzio:
+xnu_uuid: gcry_md5
+uhci: usb pci
+terminal:
+raid:
+crypto:
+part_bsd: part_msdos
+cs5536: pci
+gcry_sha512: crypto
+password: crypto normal
+fshelp:
+xnu: bitmap_scale extcmd normal video boot bitmap relocator
+mmap:
+iorw: extcmd
+zfsinfo: zfs
+lssal:
+blocklist:
+ext2: fshelp
+part_acorn:
+videoinfo: video
+btrfs: gzio
+lsmmap: mmap
+bitmap:
+ntfs: fshelp
+multiboot: video boot relocator mmap
+gcry_crc: crypto
+png: bufio bitmap
+jpeg: bufio bitmap
+regexp: extcmd normal
+parttool: normal
+usbserial_pl2303: serial usb usbserial_common
+cpio:
+gcry_rmd160: crypto
+fat:
+zfs:
+raid6rec: raid
+lsefisystab:
+minix2:
+lsacpi: extcmd acpi
+loadenv: extcmd
+bitmap_scale: bitmap
+datehook: datetime normal
+probe: extcmd
+tar:
+loadbios: pci
+hfs:
+boot:
+keylayouts:
+kernel:
+usbtest: usb
+relocator: mmap
+acpi: extcmd mmap
+tga: bufio bitmap
+reboot:
+serial: extcmd terminfo
+befs: fshelp
+efi_uga: video pci video_fb
+dm_nv: raid
+font: bufio video
+raid5rec: raid
+datetime:
+video:
+example_functional_test: functional_test
+pci:
+hfsplus: fshelp
+gcry_cast5: crypto
+extcmd:
+gcry_whirlpool: crypto
+gcry_tiger: crypto
+fixvideo: pci
+video_fb: video
+search: search_fs_uuid search_fs_file extcmd search_label
+lspci: extcmd pci
+trig:
+afs_be: fshelp
+msdospart: parttool
+gcry_twofish: crypto
+testload:
+part_apple:
+hexdump: extcmd
+ata_pthru: ata
+pbkdf2: crypto
+gcry_sha256: crypto
+date: datetime normal
+usbserial_common: serial usb
+ls: extcmd normal
+ntfscomp: ntfs
+video_cirrus: video pci video_fb
+scsi:
+hello: extcmd
+normal: terminal gfxterm crypto extcmd boot
+cat: extcmd
+ufs1:
+mdraid09: raid
+lvm:
+chain: boot
+ufs2:
+setpci: extcmd pci
+search_label:
+gptsync:
+setjmp:
+multiboot2: video boot relocator mmap acpi
+gcry_rfc2268: crypto
+mdraid1x: raid
+play:
+part_amiga:
+efi_gop: video video_fb
+minix:
+echo: extcmd
+gcry_serpent: crypto
+gcry_md4: crypto
+gcry_md5: crypto
+part_msdos:
+gcry_camellia: crypto
+at_keyboard: keylayouts boot
Index: boot/grub.efi/x86_64-efi/partmap.lst
===================================================================
--- boot/grub.efi/x86_64-efi/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,8 @@
+part_acorn
+part_amiga
+part_apple
+part_bsd
+part_gpt
+part_msdos
+part_sun
+part_sunpc
Index: boot/grub.efi/x86_64-efi/parttool.lst
===================================================================
--- boot/grub.efi/x86_64-efi/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,1 @@
+msdos: msdospart
Index: boot/grub.efi/x86_64-efi/terminal.lst
===================================================================
--- boot/grub.efi/x86_64-efi/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,6 @@
+iat_keyboard: at_keyboard
+iserial: serial
+iserial_*: serial
+ogfxterm: gfxterm
+oserial: serial
+oserial_*: serial
Index: boot/grub.efi/x86_64-efi/video.lst
===================================================================
--- boot/grub.efi/x86_64-efi/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.efi/x86_64-efi/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,4 @@
+efi_gop
+efi_uga
+video_bochs
+video_cirrus
Index: boot/grub.pc/COPYING
===================================================================
--- boot/grub.pc/COPYING (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/COPYING (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,674 @@
+ 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
+.
Index: boot/grub.pc/README
===================================================================
--- boot/grub.pc/README (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/README (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,9 @@
+The binary files of GRUB boot loader in this directory have been created
+by compiling GRUB for the 'i386-pc' target and then using the grub-mkrescue
+script to create the El Torito boot image.
+
+For licensing terms of GRUB boot loader see the file COPYING contained
+in this directory. Full version of GRUB, including its source code,
+can be downloaded from GRUB's project page:
+
+http://www.gnu.org/software/grub/
Index: boot/grub.pc/i386-pc/command.lst
===================================================================
--- boot/grub.pc/i386-pc/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/command.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,150 @@
+*acpi: acpi
+*background_image: gfxterm
+*cat: cat
+*cpuid: cpuid
+*crc: hashsum
+*drivemap: drivemap
+*echo: echo
+*functional_test: functional_test
+*gettext: gettext
+*halt: halt
+*hashsum: hashsum
+*hdparm: hdparm
+*hello: hello
+*help: help
+*hexdump: hexdump
+*inb: iorw
+*inl: iorw
+*inw: iorw
+*keystatus: keystatus
+*kfreebsd: bsd
+*knetbsd: bsd
+*kopenbsd: bsd
+*list_env: loadenv
+*load_env: loadenv
+*loopback: loopback
+*ls: ls
+*lsacpi: lsacpi
+*lspci: lspci
+*md5sum: hashsum
+*menuentry: normal
+*probe: probe
+*read_byte: memrw
+*read_dword: memrw
+*read_word: memrw
+*regexp: regexp
+*save_env: loadenv
+*search: search
+*sendkey: sendkey
+*serial: serial
+*setpci: setpci
+*sha1sum: hashsum
+*sha256sum: hashsum
+*sha512sum: hashsum
+*sleep: sleep
+*submenu: normal
+*terminfo: terminfo
+*test_blockarg: test_blockarg
+*xnu_splash: xnu
+.: configfile
+[: test
+authenticate: normal
+badram: mmap
+blocklist: blocklist
+boot: boot
+break: normal
+cat: minicmd
+chainloader: chain
+clear: normal
+cmosclean: cmostest
+cmostest: cmostest
+cmp: cmp
+configfile: configfile
+continue: normal
+cutmem: mmap
+date: date
+dump: minicmd
+efiemu_loadcore: efiemu
+efiemu_prepare: efiemu
+efiemu_unload: efiemu
+exit: minicmd
+export: normal
+extract_entries_configfile: configfile
+extract_entries_source: configfile
+extract_legacy_entries_configfile: legacycfg
+extract_legacy_entries_source: legacycfg
+false: true
+gptsync: gptsync
+help: minicmd
+initrd16: linux16
+initrd: linux
+keymap: keylayouts
+kfreebsd_loadenv: bsd
+kfreebsd_module: bsd
+kfreebsd_module_elf: bsd
+knetbsd_module: bsd
+knetbsd_module_elf: bsd
+kopenbsd_ramdisk: bsd
+legacy_check_password: legacycfg
+legacy_configfile: legacycfg
+legacy_initrd: legacycfg
+legacy_initrd_nounzip: legacycfg
+legacy_kernel: legacycfg
+legacy_password: legacycfg
+legacy_source: legacycfg
+linux16: linux16
+linux: linux
+loadfont: font
+lsapm: lsapm
+lsfonts: font
+lsmmap: lsmmap
+lsmod: minicmd
+module2: multiboot2
+module: multiboot
+multiboot2: multiboot2
+multiboot: multiboot
+normal: normal
+normal_exit: normal
+ntldr: ntldr
+outb: iorw
+outl: iorw
+outw: iorw
+parttool: parttool
+password: password
+password_pbkdf2: password_pbkdf2
+play: play
+pxe_unload: pxecmd
+read: read
+reboot: reboot
+return: normal
+rmmod: minicmd
+search.file: search_fs_file
+search.fs_label: search_label
+search.fs_uuid: search_fs_uuid
+setparams: normal
+shift: normal
+source: configfile
+terminal_input: terminal
+terminal_output: terminal
+test: test
+testload: testload
+true: true
+usb: usbtest
+vbeinfo: videoinfo
+vbetest: videotest
+videoinfo: videoinfo
+videotest: videotest
+write_byte: memrw
+write_dword: memrw
+write_word: memrw
+xnu_devprop_load: xnu
+xnu_kernel64: xnu
+xnu_kernel: xnu
+xnu_kext: xnu
+xnu_kextdir: xnu
+xnu_mkext: xnu
+xnu_ramdisk: xnu
+xnu_resume: xnu
+xnu_uuid: xnu_uuid
+zfs-bootfs: zfsinfo
+zfsinfo: zfsinfo
Index: boot/grub.pc/i386-pc/crypto.lst
===================================================================
--- boot/grub.pc/i386-pc/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/crypto.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,38 @@
+RIJNDAEL: gcry_rijndael
+RIJNDAEL192: gcry_rijndael
+RIJNDAEL256: gcry_rijndael
+AES128: gcry_rijndael
+AES-128: gcry_rijndael
+AES-192: gcry_rijndael
+AES-256: gcry_rijndael
+ARCFOUR: gcry_arcfour
+BLOWFISH: gcry_blowfish
+CAMELLIA128: gcry_camellia
+CAMELLIA192: gcry_camellia
+CAMELLIA256: gcry_camellia
+CAST5: gcry_cast5
+CRC32: gcry_crc
+CRC32RFC1510: gcry_crc
+CRC24RFC2440: gcry_crc
+DES: gcry_des
+3DES: gcry_des
+MD4: gcry_md4
+MD5: gcry_md5
+RFC2268_40: gcry_rfc2268
+AES: gcry_rijndael
+AES192: gcry_rijndael
+AES256: gcry_rijndael
+RIPEMD160: gcry_rmd160
+SEED: gcry_seed
+SERPENT128: gcry_serpent
+SERPENT192: gcry_serpent
+SERPENT256: gcry_serpent
+SHA1: gcry_sha1
+SHA224: gcry_sha256
+SHA256: gcry_sha256
+SHA512: gcry_sha512
+SHA384: gcry_sha512
+TIGER192: gcry_tiger
+TWOFISH: gcry_twofish
+TWOFISH128: gcry_twofish
+WHIRLPOOL: gcry_whirlpool
Index: boot/grub.pc/i386-pc/fs.lst
===================================================================
--- boot/grub.pc/i386-pc/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/fs.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,26 @@
+affs
+afs
+afs_be
+befs
+befs_be
+btrfs
+cpio
+ext2
+fat
+hfs
+hfsplus
+iso9660
+jfs
+minix
+minix2
+nilfs2
+ntfs
+pxe
+reiserfs
+sfs
+tar
+udf
+ufs1
+ufs2
+xfs
+zfs
Index: boot/grub.pc/i386-pc/moddep.lst
===================================================================
--- boot/grub.pc/i386-pc/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/moddep.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,181 @@
+videotest: font video gfxmenu
+loopback: extcmd
+gcry_des: crypto
+memrw: extcmd
+terminfo: extcmd
+part_gpt:
+read:
+gcry_arcfour: crypto
+aout:
+vga_text:
+elf:
+password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
+gcry_seed: crypto
+bsd: elf serial extcmd vbe video aout boot cpuid relocator mmap
+sfs: fshelp
+reiserfs: fshelp
+part_sunpc:
+gfxmenu: trig bitmap_scale gfxterm font normal bitmap video
+jfs:
+help: extcmd normal
+configfile: normal
+ohci: cs5536 usb boot pci
+afs: fshelp
+xzio: gcry_crc
+usb_keyboard: keylayouts usb
+search_fs_file:
+vga: video video_fb
+usbms: scsi usb
+test_blockarg: extcmd normal
+true:
+affs: fshelp
+iso9660: fshelp
+gfxterm: bitmap_scale font extcmd bitmap video
+xfs: fshelp
+functional_test: extcmd
+sleep: extcmd normal
+pxecmd: pxe
+memdisk:
+gcry_rijndael: crypto
+gettext:
+gcry_sha1: crypto
+cmp:
+befs_be: fshelp
+usb: pci
+hashsum: crypto extcmd normal
+halt: extcmd acpi
+search_fs_uuid:
+linux: normal vbe video boot relocator mmap
+keystatus: extcmd
+part_sun:
+sendkey: extcmd boot
+video_bochs: video pci video_fb
+bufio:
+usbserial_ftdi: serial usb usbserial_common
+cpuid: extcmd
+hdparm: extcmd
+gcry_blowfish: crypto
+test:
+nilfs2: fshelp
+minicmd:
+ata: scsi pci
+udf: fshelp
+gzio:
+xnu_uuid: gcry_md5
+uhci: usb pci
+terminal:
+raid:
+crypto:
+part_bsd: part_msdos
+cs5536: pci
+lsapm:
+gcry_sha512: crypto
+biosdisk:
+password: crypto normal
+fshelp:
+efiemu: gcry_crc normal acpi
+xnu: bitmap_scale extcmd normal video bitmap boot relocator efiemu
+mmap: boot
+iorw: extcmd
+zfsinfo: zfs
+cmostest:
+blocklist:
+ext2: fshelp
+drivemap: extcmd boot mmap
+part_acorn:
+videoinfo: video
+btrfs: gzio
+lsmmap:
+bitmap:
+vbe: video video_fb
+ntfs: fshelp
+multiboot: vbe video boot relocator mmap lsapm
+gcry_crc: crypto
+png: bufio bitmap
+jpeg: bufio bitmap
+regexp: extcmd normal
+parttool: normal
+usbserial_pl2303: serial usb usbserial_common
+cpio:
+gcry_rmd160: crypto
+fat:
+zfs:
+raid6rec: raid
+ntldr: boot video relocator
+minix2:
+lsacpi: extcmd acpi
+loadenv: extcmd
+bitmap_scale: bitmap
+datehook: datetime normal
+probe: extcmd
+tar:
+hfs:
+boot:
+keylayouts:
+kernel:
+usbtest: usb
+relocator:
+acpi: extcmd mmap
+tga: bufio bitmap
+reboot:
+serial: extcmd terminfo
+befs: fshelp
+dm_nv: raid
+font: bufio video
+raid5rec: raid
+datetime:
+video:
+example_functional_test: functional_test
+pci:
+hfsplus: fshelp
+gcry_cast5: crypto
+extcmd:
+gcry_whirlpool: crypto
+pxe: bufio
+gcry_tiger: crypto
+video_fb: video
+search: search_fs_uuid search_fs_file extcmd search_label
+lspci: extcmd pci
+trig:
+afs_be: fshelp
+msdospart: parttool
+gcry_twofish: crypto
+testload:
+part_apple:
+hexdump: extcmd
+ata_pthru: ata
+pbkdf2: crypto
+gcry_sha256: crypto
+date: datetime normal
+usbserial_common: serial usb
+ls: extcmd normal
+ntfscomp: ntfs
+video_cirrus: video pci video_fb
+scsi:
+hello: extcmd
+normal: terminal gfxterm crypto extcmd boot
+linux16: boot video relocator mmap
+cat: extcmd
+ufs1:
+mdraid09: raid
+lvm:
+chain: boot video
+ufs2:
+setpci: extcmd pci
+search_label:
+gptsync:
+setjmp:
+multiboot2: vbe boot video relocator mmap lsapm acpi
+gcry_rfc2268: crypto
+mdraid1x: raid
+legacycfg: linux crypto password gcry_md5 normal
+play:
+part_amiga:
+minix:
+echo: extcmd
+gcry_serpent: crypto
+gcry_md4: crypto
+gcry_md5: crypto
+part_msdos:
+gcry_camellia: crypto
+at_keyboard: keylayouts boot
Index: boot/grub.pc/i386-pc/partmap.lst
===================================================================
--- boot/grub.pc/i386-pc/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/partmap.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,8 @@
+part_acorn
+part_amiga
+part_apple
+part_bsd
+part_gpt
+part_msdos
+part_sun
+part_sunpc
Index: boot/grub.pc/i386-pc/parttool.lst
===================================================================
--- boot/grub.pc/i386-pc/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/parttool.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,1 @@
+msdos: msdospart
Index: boot/grub.pc/i386-pc/terminal.lst
===================================================================
--- boot/grub.pc/i386-pc/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/terminal.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,7 @@
+iat_keyboard: at_keyboard
+iserial: serial
+iserial_*: serial
+ogfxterm: gfxterm
+oserial: serial
+oserial_*: serial
+ovga_text: vga_text
Index: boot/grub.pc/i386-pc/video.lst
===================================================================
--- boot/grub.pc/i386-pc/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ boot/grub.pc/i386-pc/video.lst (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,4 @@
+vbe
+vga
+video_bochs
+video_cirrus
Index: ot/grub/COPYING
===================================================================
--- boot/grub/COPYING (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,674 +1,0 @@
- 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
-.
Index: ot/grub/README
===================================================================
--- boot/grub/README (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,5 +1,0 @@
-For licensing terms of GRUB boot loader see the file COPYING contained
-in this directory. Full version of GRUB, including its source code,
-can be downloaded from GRUB's project page:
-
-http://www.gnu.org/software/grub/
Index: ot/grub/i386-pc/command.lst
===================================================================
--- boot/grub/i386-pc/command.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,150 +1,0 @@
-*acpi: acpi
-*background_image: gfxterm
-*cat: cat
-*cpuid: cpuid
-*crc: hashsum
-*drivemap: drivemap
-*echo: echo
-*functional_test: functional_test
-*gettext: gettext
-*halt: halt
-*hashsum: hashsum
-*hdparm: hdparm
-*hello: hello
-*help: help
-*hexdump: hexdump
-*inb: iorw
-*inl: iorw
-*inw: iorw
-*keystatus: keystatus
-*kfreebsd: bsd
-*knetbsd: bsd
-*kopenbsd: bsd
-*list_env: loadenv
-*load_env: loadenv
-*loopback: loopback
-*ls: ls
-*lsacpi: lsacpi
-*lspci: lspci
-*md5sum: hashsum
-*menuentry: normal
-*probe: probe
-*read_byte: memrw
-*read_dword: memrw
-*read_word: memrw
-*regexp: regexp
-*save_env: loadenv
-*search: search
-*sendkey: sendkey
-*serial: serial
-*setpci: setpci
-*sha1sum: hashsum
-*sha256sum: hashsum
-*sha512sum: hashsum
-*sleep: sleep
-*submenu: normal
-*terminfo: terminfo
-*test_blockarg: test_blockarg
-*xnu_splash: xnu
-.: configfile
-[: test
-authenticate: normal
-badram: mmap
-blocklist: blocklist
-boot: boot
-break: normal
-cat: minicmd
-chainloader: chain
-clear: normal
-cmosclean: cmostest
-cmostest: cmostest
-cmp: cmp
-configfile: configfile
-continue: normal
-cutmem: mmap
-date: date
-dump: minicmd
-efiemu_loadcore: efiemu
-efiemu_prepare: efiemu
-efiemu_unload: efiemu
-exit: minicmd
-export: normal
-extract_entries_configfile: configfile
-extract_entries_source: configfile
-extract_legacy_entries_configfile: legacycfg
-extract_legacy_entries_source: legacycfg
-false: true
-gptsync: gptsync
-help: minicmd
-initrd16: linux16
-initrd: linux
-keymap: keylayouts
-kfreebsd_loadenv: bsd
-kfreebsd_module: bsd
-kfreebsd_module_elf: bsd
-knetbsd_module: bsd
-knetbsd_module_elf: bsd
-kopenbsd_ramdisk: bsd
-legacy_check_password: legacycfg
-legacy_configfile: legacycfg
-legacy_initrd: legacycfg
-legacy_initrd_nounzip: legacycfg
-legacy_kernel: legacycfg
-legacy_password: legacycfg
-legacy_source: legacycfg
-linux16: linux16
-linux: linux
-loadfont: font
-lsapm: lsapm
-lsfonts: font
-lsmmap: lsmmap
-lsmod: minicmd
-module2: multiboot2
-module: multiboot
-multiboot2: multiboot2
-multiboot: multiboot
-normal: normal
-normal_exit: normal
-ntldr: ntldr
-outb: iorw
-outl: iorw
-outw: iorw
-parttool: parttool
-password: password
-password_pbkdf2: password_pbkdf2
-play: play
-pxe_unload: pxecmd
-read: read
-reboot: reboot
-return: normal
-rmmod: minicmd
-search.file: search_fs_file
-search.fs_label: search_label
-search.fs_uuid: search_fs_uuid
-setparams: normal
-shift: normal
-source: configfile
-terminal_input: terminal
-terminal_output: terminal
-test: test
-testload: testload
-true: true
-usb: usbtest
-vbeinfo: videoinfo
-vbetest: videotest
-videoinfo: videoinfo
-videotest: videotest
-write_byte: memrw
-write_dword: memrw
-write_word: memrw
-xnu_devprop_load: xnu
-xnu_kernel64: xnu
-xnu_kernel: xnu
-xnu_kext: xnu
-xnu_kextdir: xnu
-xnu_mkext: xnu
-xnu_ramdisk: xnu
-xnu_resume: xnu
-xnu_uuid: xnu_uuid
-zfs-bootfs: zfsinfo
-zfsinfo: zfsinfo
Index: ot/grub/i386-pc/crypto.lst
===================================================================
--- boot/grub/i386-pc/crypto.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,38 +1,0 @@
-RIJNDAEL: gcry_rijndael
-RIJNDAEL192: gcry_rijndael
-RIJNDAEL256: gcry_rijndael
-AES128: gcry_rijndael
-AES-128: gcry_rijndael
-AES-192: gcry_rijndael
-AES-256: gcry_rijndael
-ARCFOUR: gcry_arcfour
-BLOWFISH: gcry_blowfish
-CAMELLIA128: gcry_camellia
-CAMELLIA192: gcry_camellia
-CAMELLIA256: gcry_camellia
-CAST5: gcry_cast5
-CRC32: gcry_crc
-CRC32RFC1510: gcry_crc
-CRC24RFC2440: gcry_crc
-DES: gcry_des
-3DES: gcry_des
-MD4: gcry_md4
-MD5: gcry_md5
-RFC2268_40: gcry_rfc2268
-AES: gcry_rijndael
-AES192: gcry_rijndael
-AES256: gcry_rijndael
-RIPEMD160: gcry_rmd160
-SEED: gcry_seed
-SERPENT128: gcry_serpent
-SERPENT192: gcry_serpent
-SERPENT256: gcry_serpent
-SHA1: gcry_sha1
-SHA224: gcry_sha256
-SHA256: gcry_sha256
-SHA512: gcry_sha512
-SHA384: gcry_sha512
-TIGER192: gcry_tiger
-TWOFISH: gcry_twofish
-TWOFISH128: gcry_twofish
-WHIRLPOOL: gcry_whirlpool
Index: ot/grub/i386-pc/fs.lst
===================================================================
--- boot/grub/i386-pc/fs.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,26 +1,0 @@
-affs
-afs
-afs_be
-befs
-befs_be
-btrfs
-cpio
-ext2
-fat
-hfs
-hfsplus
-iso9660
-jfs
-minix
-minix2
-nilfs2
-ntfs
-pxe
-reiserfs
-sfs
-tar
-udf
-ufs1
-ufs2
-xfs
-zfs
Index: ot/grub/i386-pc/moddep.lst
===================================================================
--- boot/grub/i386-pc/moddep.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,181 +1,0 @@
-videotest: font video gfxmenu
-loopback: extcmd
-gcry_des: crypto
-memrw: extcmd
-terminfo: extcmd
-part_gpt:
-read:
-gcry_arcfour: crypto
-aout:
-vga_text:
-elf:
-password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
-gcry_seed: crypto
-bsd: elf serial extcmd vbe video aout boot cpuid relocator mmap
-sfs: fshelp
-reiserfs: fshelp
-part_sunpc:
-gfxmenu: trig bitmap_scale gfxterm font normal bitmap video
-jfs:
-help: extcmd normal
-configfile: normal
-ohci: cs5536 usb boot pci
-afs: fshelp
-xzio: gcry_crc
-usb_keyboard: keylayouts usb
-search_fs_file:
-vga: video video_fb
-usbms: scsi usb
-test_blockarg: extcmd normal
-true:
-affs: fshelp
-iso9660: fshelp
-gfxterm: bitmap_scale font extcmd bitmap video
-xfs: fshelp
-functional_test: extcmd
-sleep: extcmd normal
-pxecmd: pxe
-memdisk:
-gcry_rijndael: crypto
-gettext:
-gcry_sha1: crypto
-cmp:
-befs_be: fshelp
-usb: pci
-hashsum: crypto extcmd normal
-halt: extcmd acpi
-search_fs_uuid:
-linux: normal vbe video boot relocator mmap
-keystatus: extcmd
-part_sun:
-sendkey: extcmd boot
-video_bochs: video pci video_fb
-bufio:
-usbserial_ftdi: serial usb usbserial_common
-cpuid: extcmd
-hdparm: extcmd
-gcry_blowfish: crypto
-test:
-nilfs2: fshelp
-minicmd:
-ata: scsi pci
-udf: fshelp
-gzio:
-xnu_uuid: gcry_md5
-uhci: usb pci
-terminal:
-raid:
-crypto:
-part_bsd: part_msdos
-cs5536: pci
-lsapm:
-gcry_sha512: crypto
-biosdisk:
-password: crypto normal
-fshelp:
-efiemu: gcry_crc normal acpi
-xnu: bitmap_scale extcmd normal video bitmap boot relocator efiemu
-mmap: boot
-iorw: extcmd
-zfsinfo: zfs
-cmostest:
-blocklist:
-ext2: fshelp
-drivemap: extcmd boot mmap
-part_acorn:
-videoinfo: video
-btrfs: gzio
-lsmmap:
-bitmap:
-vbe: video video_fb
-ntfs: fshelp
-multiboot: vbe video boot relocator mmap lsapm
-gcry_crc: crypto
-png: bufio bitmap
-jpeg: bufio bitmap
-regexp: extcmd normal
-parttool: normal
-usbserial_pl2303: serial usb usbserial_common
-cpio:
-gcry_rmd160: crypto
-fat:
-zfs:
-raid6rec: raid
-ntldr: boot video relocator
-minix2:
-lsacpi: extcmd acpi
-loadenv: extcmd
-bitmap_scale: bitmap
-datehook: datetime normal
-probe: extcmd
-tar:
-hfs:
-boot:
-keylayouts:
-kernel:
-usbtest: usb
-relocator:
-acpi: extcmd mmap
-tga: bufio bitmap
-reboot:
-serial: extcmd terminfo
-befs: fshelp
-dm_nv: raid
-font: bufio video
-raid5rec: raid
-datetime:
-video:
-example_functional_test: functional_test
-pci:
-hfsplus: fshelp
-gcry_cast5: crypto
-extcmd:
-gcry_whirlpool: crypto
-pxe: bufio
-gcry_tiger: crypto
-video_fb: video
-search: search_fs_uuid search_fs_file extcmd search_label
-lspci: extcmd pci
-trig:
-afs_be: fshelp
-msdospart: parttool
-gcry_twofish: crypto
-testload:
-part_apple:
-hexdump: extcmd
-ata_pthru: ata
-pbkdf2: crypto
-gcry_sha256: crypto
-date: datetime normal
-usbserial_common: serial usb
-ls: extcmd normal
-ntfscomp: ntfs
-video_cirrus: video pci video_fb
-scsi:
-hello: extcmd
-normal: terminal gfxterm crypto extcmd boot
-linux16: boot video relocator mmap
-cat: extcmd
-ufs1:
-mdraid09: raid
-lvm:
-chain: boot video
-ufs2:
-setpci: extcmd pci
-search_label:
-gptsync:
-setjmp:
-multiboot2: vbe boot video relocator mmap lsapm acpi
-gcry_rfc2268: crypto
-mdraid1x: raid
-legacycfg: linux crypto password gcry_md5 normal
-play:
-part_amiga:
-minix:
-echo: extcmd
-gcry_serpent: crypto
-gcry_md4: crypto
-gcry_md5: crypto
-part_msdos:
-gcry_camellia: crypto
-at_keyboard: keylayouts boot
Index: ot/grub/i386-pc/partmap.lst
===================================================================
--- boot/grub/i386-pc/partmap.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,8 +1,0 @@
-part_acorn
-part_amiga
-part_apple
-part_bsd
-part_gpt
-part_msdos
-part_sun
-part_sunpc
Index: ot/grub/i386-pc/parttool.lst
===================================================================
--- boot/grub/i386-pc/parttool.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,1 +1,0 @@
-msdos: msdospart
Index: ot/grub/i386-pc/terminal.lst
===================================================================
--- boot/grub/i386-pc/terminal.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,7 +1,0 @@
-iat_keyboard: at_keyboard
-iserial: serial
-iserial_*: serial
-ogfxterm: gfxterm
-oserial: serial
-oserial_*: serial
-ovga_text: vga_text
Index: ot/grub/i386-pc/video.lst
===================================================================
--- boot/grub/i386-pc/video.lst (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,4 +1,0 @@
-vbe
-vga
-video_bochs
-video_cirrus
Index: defaults/amd64/Makefile.config
===================================================================
--- defaults/amd64/Makefile.config (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ defaults/amd64/Makefile.config (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -54,8 +54,8 @@
# Default framebuffer mode
-CONFIG_VESA_MODE = 800x600
+CONFIG_BFB_MODE = 800x600
# Default framebuffer depth
-CONFIG_VESA_BPP = 16
+CONFIG_BFB_BPP = 16
# Load disk drivers on startup
@@ -67,2 +67,5 @@
# OHCI root hub power switch, ganged is enough
OHCI_POWER_SWITCH = ganged
+
+# GRUB boot loader architecture
+GRUB_ARCH = pc
Index: defaults/ia32/Makefile.config
===================================================================
--- defaults/ia32/Makefile.config (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ defaults/ia32/Makefile.config (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -60,8 +60,8 @@
# Default framebuffer mode
-CONFIG_VESA_MODE = 800x600
+CONFIG_BFB_MODE = 800x600
# Default framebuffer depth
-CONFIG_VESA_BPP = 16
+CONFIG_BFB_BPP = 16
# Load disk drivers on startup
@@ -73,2 +73,5 @@
# OHCI root hub power switch, ganged is enough
OHCI_POWER_SWITCH = ganged
+
+# GRUB boot loader architecture
+GRUB_ARCH = pc
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/amd64/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -72,5 +72,6 @@
ARCH_SOURCES = \
arch/$(KARCH)/src/fpu_context.c \
- arch/$(KARCH)/src/boot/boot.S \
+ arch/$(KARCH)/src/boot/multiboot.S \
+ arch/$(KARCH)/src/boot/multiboot2.S \
arch/$(KARCH)/src/boot/memmap.c \
arch/$(KARCH)/src/debug/stacktrace.c \
@@ -79,5 +80,4 @@
arch/$(KARCH)/src/context.S \
arch/$(KARCH)/src/ddi/ddi.c \
- arch/$(KARCH)/src/drivers/vesa.c \
arch/$(KARCH)/src/drivers/i8254.c \
arch/$(KARCH)/src/drivers/i8259.c \
Index: kernel/arch/amd64/include/arch.h
===================================================================
--- kernel/arch/amd64/include/arch.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/amd64/include/arch.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -38,5 +38,5 @@
#include
-extern void arch_pre_main(uint32_t, const multiboot_info_t *);
+extern void arch_pre_main(uint32_t, void *);
#endif
Index: kernel/arch/amd64/include/boot/boot.h
===================================================================
--- kernel/arch/amd64/include/boot/boot.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/amd64/include/boot/boot.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -40,7 +40,4 @@
#define BOOT_STACK_SIZE 0x000400
-#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-#define MULTIBOOT_HEADER_FLAGS 0x00010003
-
#ifndef __ASM__
Index: kernel/arch/amd64/src/amd64.c
===================================================================
--- kernel/arch/amd64/src/amd64.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/amd64/src/amd64.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -41,7 +41,8 @@
#include
#include
+#include
#include
#include
-#include
+#include
#include
#include
@@ -101,11 +102,13 @@
/** Perform amd64-specific initialization before main_bsp() is called.
*
- * @param signature Should contain the multiboot signature.
- * @param mi Pointer to the multiboot information structure.
- */
-void arch_pre_main(uint32_t signature, const multiboot_info_t *mi)
+ * @param signature Multiboot signature.
+ * @param info Multiboot information structure.
+ *
+ */
+void arch_pre_main(uint32_t signature, void *info)
{
/* Parse multiboot information obtained from the bootloader. */
- multiboot_info_parse(signature, mi);
+ multiboot_info_parse(signature, (multiboot_info_t *) info);
+ multiboot2_info_parse(signature, (multiboot2_info_t *) info);
#ifdef CONFIG_SMP
@@ -153,13 +156,13 @@
#if (defined(CONFIG_FB) || defined(CONFIG_EGA))
- bool vesa = false;
+ bool bfb = false;
#endif
#ifdef CONFIG_FB
- vesa = vesa_init();
+ bfb = bfb_init();
#endif
#ifdef CONFIG_EGA
- if (!vesa) {
+ if (!bfb) {
outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
if (egadev)
Index: rnel/arch/amd64/src/boot/boot.S
===================================================================
--- kernel/arch/amd64/src/boot/boot.S (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,681 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.macro pm_error msg
- movl \msg, %esi
- jmp pm_error_halt
-.endm
-
-.macro pm_status msg
-#ifdef CONFIG_EGA
- pushl %esi
- movl \msg, %esi
- call pm_early_puts
- popl %esi
-#endif
-.endm
-
-.macro pm2_status msg
-#ifndef CONFIG_FB
- pm_status \msg
-#endif
-.endm
-
-.align 4
-.global multiboot_image_start
-multiboot_header:
- .long MULTIBOOT_HEADER_MAGIC
- .long MULTIBOOT_HEADER_FLAGS
- .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) /* checksum */
- .long multiboot_header
- .long unmapped_ktext_start
- .long 0
- .long 0
- .long multiboot_image_start
-
-multiboot_image_start:
- cld
-
- /* Initialize stack pointer */
- movl $START_STACK, %esp
-
- /* Initialize Global Descriptor Table register */
- lgdtl bootstrap_gdtr
-
- /* Kernel data + stack */
- movw $GDT_SELECTOR(KDATA_DES), %cx
- movw %cx, %es
- movw %cx, %ds
- movw %cx, %ss
-
- /*
- * Simics seems to remove hidden part of GS on entering user mode
- * when _visible_ part of GS does not point to user-mode segment.
- */
- movw $GDT_SELECTOR(UDATA_DES), %cx
- movw %cx, %fs
- movw %cx, %gs
-
- jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot_meeting_point
- multiboot_meeting_point:
-
- /* Save GRUB arguments */
- movl %eax, grub_eax
- movl %ebx, grub_ebx
-
- pm_status $status_prot
-
- movl $(INTEL_CPUID_EXTENDED), %eax
- cpuid
- cmp $(INTEL_CPUID_EXTENDED), %eax
- ja extended_cpuid_supported
-
- pm_error $err_extended_cpuid
-
- extended_cpuid_supported:
-
- movl $(AMD_CPUID_EXTENDED), %eax
- cpuid
- bt $(AMD_EXT_LONG_MODE), %edx
- jc long_mode_supported
-
- pm_error $err_long_mode
-
- long_mode_supported:
-
- bt $(AMD_EXT_NOEXECUTE), %edx
- jc noexecute_supported
-
- pm_error $err_noexecute
-
- noexecute_supported:
-
- movl $(INTEL_CPUID_STANDARD), %eax
- cpuid
- bt $(INTEL_FXSAVE), %edx
- jc fx_supported
-
- pm_error $err_fx
-
- fx_supported:
-
- bt $(INTEL_SSE2), %edx
- jc sse2_supported
-
- pm_error $err_sse2
-
- sse2_supported:
-
-#include "vesa_prot.inc"
-
- /*
- * Protected 32-bit. We want to reuse the code-seg descriptor,
- * the Default operand size must not be 1 when entering long mode.
- */
-
- pm2_status $status_prot2
-
- /*
- * Enable 64-bit page translation entries - CR4.PAE = 1.
- * Paging is not enabled until after long mode is enabled.
- */
-
- movl %cr4, %eax
- btsl $5, %eax
- movl %eax, %cr4
-
- /* Set up paging tables */
- leal ptl_0, %eax
- movl %eax, %cr3
-
- /* Enable long mode */
- movl $EFER_MSR_NUM, %ecx
- rdmsr /* read EFER */
- btsl $AMD_LME_FLAG, %eax /* set LME = 1 */
- wrmsr
-
- /* Enable paging to activate long mode (set CR0.PG = 1) */
- movl %cr0, %eax
- btsl $31, %eax
- movl %eax, %cr0
-
- /* At this point we are in compatibility mode */
- jmpl $GDT_SELECTOR(KTEXT_DES), $start64
-
-/** Print string to EGA display (in light red) and halt.
- *
- * Should be executed from 32 bit protected mode with paging
- * turned off. Stack is not required. This routine is used even
- * if CONFIG_EGA is not enabled. Since we are going to halt the
- * CPU anyway, it is always better to at least try to print
- * some hints.
- *
- * @param %esi Pointer to the NULL-terminated string
- * to be print.
- *
- */
-pm_error_halt:
- movl $0xb8000, %edi /* base of EGA text mode memory */
- xorl %eax, %eax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb err_cursor_ok
-
- movw $1998, %ax
-
- err_cursor_ok:
-
- movw %ax, %bx
- shl $1, %eax
- addl %eax, %edi
-
- err_ploop:
- lodsb
-
- cmp $0, %al
- je err_ploop_end
-
- movb $0x0c, %ah /* black background, light red foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb err_ploop
-
- /* Scroll the screen (24 rows) */
- movl %esi, %edx
- movl $0xb80a0, %esi
- movl $0xb8000, %edi
- movl $960, %ecx
- rep movsl
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $40, %ecx
- rep stosl
-
- /* Go to row 24 */
- movl %edx, %esi
- movl $0xb8f00, %edi
- movw $1920, %bx
-
- jmp err_ploop
- err_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- cli
- hlt1:
- hlt
- jmp hlt1
-
-/** Print string to EGA display (in light green).
- *
- * Should be called from 32 bit protected mode with paging
- * turned off. A stack space of at least 24 bytes is required,
- * but the function does not establish a stack frame.
- *
- * Macros such as pm_status and pm2_status take care that
- * this function is used only when CONFIG_EGA is enabled
- * and CONFIG_FB is disabled.
- *
- * @param %esi Pointer to the NULL-terminated string
- * to be print.
- *
- */
-pm_early_puts:
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushl %edi
-
- movl $0xb8000, %edi /* base of EGA text mode memory */
- xorl %eax, %eax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb pm_puts_cursor_ok
-
- movw $1998, %ax
-
- pm_puts_cursor_ok:
-
- movw %ax, %bx
- shl $1, %eax
- addl %eax, %edi
-
- pm_puts_ploop:
- lodsb
-
- cmp $0, %al
- je pm_puts_ploop_end
-
- movb $0x0a, %ah /* black background, light green foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb pm_puts_ploop
-
- /* Scroll the screen (24 rows) */
- movl %esi, %edx
- movl $0xb80a0, %esi
- movl $0xb8000, %edi
- movl $960, %ecx
- rep movsl
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $40, %ecx
- rep stosl
-
- /* Go to row 24 */
- movl %edx, %esi
- movl $0xb8f00, %edi
- movw $1920, %bx
-
- jmp pm_puts_ploop
- pm_puts_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- popl %edi
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
-
- ret
-
-.code64
-
-.macro long_status msg
- pushq %rdi
- movq \msg, %rdi
- call early_puts
- popq %rdi
-.endm
-
-start64:
-
- /*
- * Long mode.
- */
-
- movq $(PA2KA(START_STACK)), %rsp
-
- /* Create the first stack frame */
- pushq $0
- movq %rsp, %rbp
-
- long_status $status_long
-
- /* Call arch_pre_main(grub_eax, grub_ebx) */
- xorq %rdi, %rdi
- movl grub_eax, %edi
- xorq %rsi, %rsi
- movl grub_ebx, %esi
-
- movabsq $arch_pre_main, %rax
- callq *%rax
-
- long_status $status_main
-
- /* Call main_bsp() */
- movabsq $main_bsp, %rax
- call *%rax
-
- /* Not reached */
- cli
- hlt0:
- hlt
- jmp hlt0
-
-/** Print string to EGA display.
- *
- * Should be called from long mode (with paging enabled
- * and stack established). This function is ABI compliant
- * (without red-zone).
- *
- * If CONFIG_EGA is undefined or CONFIG_FB is defined
- * then this function does nothing.
- *
- * @param %rdi Pointer to the NULL-terminated string
- * to be printed.
- *
- */
-early_puts:
-
-#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
- /* Prologue, save preserved registers */
- pushq %rbp
- movq %rsp, %rbp
- pushq %rbx
-
- movq %rdi, %rsi
- movq $(PA2KA(0xb8000)), %rdi /* base of EGA text mode memory */
- xorq %rax, %rax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb early_puts_cursor_ok
-
- movw $1998, %ax
-
- early_puts_cursor_ok:
-
- movw %ax, %bx
- shl $1, %rax
- addq %rax, %rdi
-
- early_puts_ploop:
- lodsb
-
- cmp $0, %al
- je early_puts_ploop_end
-
- movb $0x0e, %ah /* black background, yellow foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb early_puts_ploop
-
- /* Scroll the screen (24 rows) */
- movq %rsi, %rdx
- movq $(PA2KA(0xb80a0)), %rsi
- movq $(PA2KA(0xb8000)), %rdi
- movl $480, %ecx
- rep movsq
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $20, %ecx
- rep stosq
-
- /* Go to row 24 */
- movq %rdx, %rsi
- movq $(PA2KA(0xb8f00)), %rdi
- movw $1920, %bx
-
- jmp early_puts_ploop
- early_puts_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- /* Epilogue, restore preserved registers */
- popq %rbx
- leave
-
-#endif
-
- ret
-
-#include "vesa_real.inc"
-
-.section K_INI_PTLS, "aw", @progbits
-
-/** Generate initial page table contents.
- *
- * @param cnt Number of entries to generate. Must be multiple of 8.
- * @param g Number of GB that will be added to the mapping.
- *
- */
-.macro ptl2gen cnt g
- .if \cnt
- ptl2gen "\cnt - 8" \g
- .quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
- .endif
-.endm
-
-/* Page table for pages in the 1st gigabyte. */
-.align 4096
-ptl_2_0g:
- ptl2gen 512 0
-
-/* Page table for pages in the 2nd gigabyte. */
-.align 4096
-ptl_2_1g:
- ptl2gen 512 1
-
-/* Page table for pages in the 3rd gigabyte. */
-.align 4096
-ptl_2_2g:
- ptl2gen 512 2
-
-/* Page table for pages in the 4th gigabyte. */
-.align 4096
-ptl_2_3g:
- ptl2gen 512 3
-
-/* Page table for pages in the 5th gigabyte. */
-.align 4096
-ptl_2_4g:
- ptl2gen 512 4
-
-/* Page table for pages in the 6th gigabyte. */
-.align 4096
-ptl_2_5g:
- ptl2gen 512 5
-
-/* Page table for pages in the 7th gigabyte. */
-.align 4096
-ptl_2_6g:
- ptl2gen 512 6
-
-/* Page table for pages in the 8th gigabyte. */
-.align 4096
-ptl_2_7g:
- ptl2gen 512 7
-
-.align 4096
-ptl_1:
- /* Identity mapping for [0; 8G) */
- .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
- .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
- .fill 504, 8, 0
-
-.align 4096
-.global ptl_0
-ptl_0:
- .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
- .fill 255, 8, 0
- .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
- .fill 255, 8, 0
-
-.section K_DATA_START, "aw", @progbits
-
-bootstrap_gdtr:
- .word GDT_SELECTOR(GDT_ITEMS)
- .long KA2PA(gdt)
-
-grub_eax:
- .long 0
-
-grub_ebx:
- .long 0
-
-err_extended_cpuid:
- .asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted."
-err_long_mode:
- .asciz "Error: 64-bit long mode not supported. System halted."
-err_noexecute:
- .asciz "Error: No-execute pages not supported. System halted."
-err_fx:
- .asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted."
-err_sse2:
- .asciz "Error: SSE2 instructions not supported. System halted."
-
-status_prot:
- .asciz "[prot] "
-status_vesa_copy:
- .asciz "[vesa_copy] "
-status_grub_cmdline:
- .asciz "[grub_cmdline] "
-status_vesa_real:
- .asciz "[vesa_real] "
-status_prot2:
- .asciz "[prot2] "
-status_long:
- .asciz "[long] "
-status_main:
- .asciz "[main] "
Index: kernel/arch/amd64/src/boot/memmap.c
===================================================================
--- kernel/arch/amd64/src/boot/memmap.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/amd64/src/boot/memmap.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -35,5 +35,5 @@
#include
-uint8_t e820counter = 0xffU;
+uint8_t e820counter = 0;
e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
Index: kernel/arch/amd64/src/boot/multiboot.S
===================================================================
--- kernel/arch/amd64/src/boot/multiboot.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/arch/amd64/src/boot/multiboot.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,684 @@
+/*
+ * Copyright (c) 2005 Ondrej Palkovsky
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2008 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
+
+.section K_TEXT_START, "ax"
+
+.code32
+
+.macro pm_error msg
+ movl \msg, %esi
+ jmp pm_error_halt
+.endm
+
+.macro pm_status msg
+#ifdef CONFIG_EGA
+ pushl %esi
+ movl \msg, %esi
+ call pm_early_puts
+ popl %esi
+#endif
+.endm
+
+.macro pm2_status msg
+#ifndef CONFIG_FB
+ pm_status \msg
+#endif
+.endm
+
+.align 4
+.global multiboot_image_start
+multiboot_header:
+ .long MULTIBOOT_HEADER_MAGIC
+ .long MULTIBOOT_HEADER_FLAGS
+ .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) /* checksum */
+ .long multiboot_header
+ .long unmapped_ktext_start
+ .long 0
+ .long 0
+ .long multiboot_image_start
+
+multiboot_image_start:
+ cld
+
+ /* Initialize stack pointer */
+ movl $START_STACK, %esp
+
+ /* Initialize Global Descriptor Table register */
+ lgdtl bootstrap_gdtr
+
+ /* Kernel data + stack */
+ movw $GDT_SELECTOR(KDATA_DES), %cx
+ movw %cx, %es
+ movw %cx, %ds
+ movw %cx, %ss
+
+ /*
+ * Simics seems to remove hidden part of GS on entering user mode
+ * when _visible_ part of GS does not point to user-mode segment.
+ */
+ movw $GDT_SELECTOR(UDATA_DES), %cx
+ movw %cx, %fs
+ movw %cx, %gs
+
+ jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot_meeting_point
+ multiboot_meeting_point:
+
+ /*
+ * Protected 32-bit. We want to reuse the code-seg descriptor,
+ * the Default operand size must not be 1 when entering long mode.
+ */
+
+ /* Save multiboot arguments */
+ movl %eax, multiboot_eax
+ movl %ebx, multiboot_ebx
+
+ pm_status $status_prot
+
+ movl $(INTEL_CPUID_EXTENDED), %eax
+ cpuid
+ cmp $(INTEL_CPUID_EXTENDED), %eax
+ ja extended_cpuid_supported
+
+ pm_error $err_extended_cpuid
+
+ extended_cpuid_supported:
+
+ movl $(AMD_CPUID_EXTENDED), %eax
+ cpuid
+ bt $(AMD_EXT_LONG_MODE), %edx
+ jc long_mode_supported
+
+ pm_error $err_long_mode
+
+ long_mode_supported:
+
+ bt $(AMD_EXT_NOEXECUTE), %edx
+ jc noexecute_supported
+
+ pm_error $err_noexecute
+
+ noexecute_supported:
+
+ movl $(INTEL_CPUID_STANDARD), %eax
+ cpuid
+ bt $(INTEL_FXSAVE), %edx
+ jc fx_supported
+
+ pm_error $err_fx
+
+ fx_supported:
+
+ bt $(INTEL_SSE2), %edx
+ jc sse2_supported
+
+ pm_error $err_sse2
+
+ sse2_supported:
+
+#include "vesa_prot.inc"
+
+ pm2_status $status_prot2
+
+ /*
+ * Enable 64-bit page translation entries - CR4.PAE = 1.
+ * Paging is not enabled until after long mode is enabled.
+ */
+
+ movl %cr4, %eax
+ btsl $5, %eax
+ movl %eax, %cr4
+
+ /* Set up paging tables */
+ leal ptl_0, %eax
+ movl %eax, %cr3
+
+ /* Enable long mode */
+ movl $EFER_MSR_NUM, %ecx
+ rdmsr /* read EFER */
+ btsl $AMD_LME_FLAG, %eax /* set LME = 1 */
+ wrmsr
+
+ /* Enable paging to activate long mode (set CR0.PG = 1) */
+ movl %cr0, %eax
+ btsl $31, %eax
+ movl %eax, %cr0
+
+ /* At this point we are in compatibility mode */
+ jmpl $GDT_SELECTOR(KTEXT_DES), $start64
+
+/** Print string to EGA display (in light red) and halt.
+ *
+ * Should be executed from 32 bit protected mode with paging
+ * turned off. Stack is not required. This routine is used even
+ * if CONFIG_EGA is not enabled. Since we are going to halt the
+ * CPU anyway, it is always better to at least try to print
+ * some hints.
+ *
+ * @param %esi Pointer to the NULL-terminated string
+ * to be print.
+ *
+ */
+pm_error_halt:
+ movl $0xb8000, %edi /* base of EGA text mode memory */
+ xorl %eax, %eax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb err_cursor_ok
+
+ movw $1998, %ax
+
+ err_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %eax
+ addl %eax, %edi
+
+ err_ploop:
+ lodsb
+
+ cmp $0, %al
+ je err_ploop_end
+
+ movb $0x0c, %ah /* black background, light red foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb err_ploop
+
+ /* Scroll the screen (24 rows) */
+ movl %esi, %edx
+ movl $0xb80a0, %esi
+ movl $0xb8000, %edi
+ movl $960, %ecx
+ rep movsl
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $40, %ecx
+ rep stosl
+
+ /* Go to row 24 */
+ movl %edx, %esi
+ movl $0xb8f00, %edi
+ movw $1920, %bx
+
+ jmp err_ploop
+ err_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ cli
+ hlt1:
+ hlt
+ jmp hlt1
+
+/** Print string to EGA display (in light green).
+ *
+ * Should be called from 32 bit protected mode with paging
+ * turned off. A stack space of at least 24 bytes is required,
+ * but the function does not establish a stack frame.
+ *
+ * Macros such as pm_status and pm2_status take care that
+ * this function is used only when CONFIG_EGA is enabled
+ * and CONFIG_FB is disabled.
+ *
+ * @param %esi Pointer to the NULL-terminated string
+ * to be print.
+ *
+ */
+pm_early_puts:
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ pushl %edi
+
+ movl $0xb8000, %edi /* base of EGA text mode memory */
+ xorl %eax, %eax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb pm_puts_cursor_ok
+
+ movw $1998, %ax
+
+ pm_puts_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %eax
+ addl %eax, %edi
+
+ pm_puts_ploop:
+ lodsb
+
+ cmp $0, %al
+ je pm_puts_ploop_end
+
+ movb $0x0a, %ah /* black background, light green foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb pm_puts_ploop
+
+ /* Scroll the screen (24 rows) */
+ movl %esi, %edx
+ movl $0xb80a0, %esi
+ movl $0xb8000, %edi
+ movl $960, %ecx
+ rep movsl
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $40, %ecx
+ rep stosl
+
+ /* Go to row 24 */
+ movl %edx, %esi
+ movl $0xb8f00, %edi
+ movw $1920, %bx
+
+ jmp pm_puts_ploop
+ pm_puts_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ popl %edi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ popl %eax
+
+ ret
+
+.code64
+
+.macro long_status msg
+ pushq %rdi
+ movq \msg, %rdi
+ call early_puts
+ popq %rdi
+.endm
+
+start64:
+
+ /*
+ * Long mode.
+ */
+
+ movq $(PA2KA(START_STACK)), %rsp
+
+ /* Create the first stack frame */
+ pushq $0
+ movq %rsp, %rbp
+
+ long_status $status_long
+
+ /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
+ xorq %rdi, %rdi
+ movl multiboot_eax, %edi
+ xorq %rsi, %rsi
+ movl multiboot_ebx, %esi
+
+ movabsq $arch_pre_main, %rax
+ callq *%rax
+
+ long_status $status_main
+
+ /* Call main_bsp() */
+ movabsq $main_bsp, %rax
+ call *%rax
+
+ /* Not reached */
+ cli
+ hlt0:
+ hlt
+ jmp hlt0
+
+/** Print string to EGA display.
+ *
+ * Should be called from long mode (with paging enabled
+ * and stack established). This function is ABI compliant
+ * (without red-zone).
+ *
+ * If CONFIG_EGA is undefined or CONFIG_FB is defined
+ * then this function does nothing.
+ *
+ * @param %rdi Pointer to the NULL-terminated string
+ * to be printed.
+ *
+ */
+early_puts:
+
+#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
+
+ /* Prologue, save preserved registers */
+ pushq %rbp
+ movq %rsp, %rbp
+ pushq %rbx
+
+ movq %rdi, %rsi
+ movq $(PA2KA(0xb8000)), %rdi /* base of EGA text mode memory */
+ xorq %rax, %rax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb early_puts_cursor_ok
+
+ movw $1998, %ax
+
+ early_puts_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %rax
+ addq %rax, %rdi
+
+ early_puts_ploop:
+ lodsb
+
+ cmp $0, %al
+ je early_puts_ploop_end
+
+ movb $0x0e, %ah /* black background, yellow foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb early_puts_ploop
+
+ /* Scroll the screen (24 rows) */
+ movq %rsi, %rdx
+ movq $(PA2KA(0xb80a0)), %rsi
+ movq $(PA2KA(0xb8000)), %rdi
+ movl $480, %ecx
+ rep movsq
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $20, %ecx
+ rep stosq
+
+ /* Go to row 24 */
+ movq %rdx, %rsi
+ movq $(PA2KA(0xb8f00)), %rdi
+ movw $1920, %bx
+
+ jmp early_puts_ploop
+ early_puts_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ /* Epilogue, restore preserved registers */
+ popq %rbx
+ leave
+
+#endif
+
+ ret
+
+#include "vesa_real.inc"
+
+.section K_INI_PTLS, "aw", @progbits
+
+/** Generate initial page table contents.
+ *
+ * @param cnt Number of entries to generate. Must be multiple of 8.
+ * @param g Number of GB that will be added to the mapping.
+ *
+ */
+.macro ptl2gen cnt g
+ .if \cnt
+ ptl2gen "\cnt - 8" \g
+ .quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
+ .endif
+.endm
+
+/* Page table for pages in the 1st gigabyte. */
+.align 4096
+ptl_2_0g:
+ ptl2gen 512 0
+
+/* Page table for pages in the 2nd gigabyte. */
+.align 4096
+ptl_2_1g:
+ ptl2gen 512 1
+
+/* Page table for pages in the 3rd gigabyte. */
+.align 4096
+ptl_2_2g:
+ ptl2gen 512 2
+
+/* Page table for pages in the 4th gigabyte. */
+.align 4096
+ptl_2_3g:
+ ptl2gen 512 3
+
+/* Page table for pages in the 5th gigabyte. */
+.align 4096
+ptl_2_4g:
+ ptl2gen 512 4
+
+/* Page table for pages in the 6th gigabyte. */
+.align 4096
+ptl_2_5g:
+ ptl2gen 512 5
+
+/* Page table for pages in the 7th gigabyte. */
+.align 4096
+ptl_2_6g:
+ ptl2gen 512 6
+
+/* Page table for pages in the 8th gigabyte. */
+.align 4096
+ptl_2_7g:
+ ptl2gen 512 7
+
+.align 4096
+ptl_1:
+ /* Identity mapping for [0; 8G) */
+ .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
+ .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
+ .fill 504, 8, 0
+
+.align 4096
+.global ptl_0
+ptl_0:
+ .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
+ .fill 255, 8, 0
+ .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
+ .fill 255, 8, 0
+
+.section K_DATA_START, "aw", @progbits
+
+.global bootstrap_gdtr
+bootstrap_gdtr:
+ .word GDT_SELECTOR(GDT_ITEMS)
+ .long KA2PA(gdt)
+
+.global multiboot_eax
+multiboot_eax:
+ .long 0
+
+.global multiboot_ebx
+multiboot_ebx:
+ .long 0
+
+err_extended_cpuid:
+ .asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted."
+err_long_mode:
+ .asciz "Error: 64-bit long mode not supported. System halted."
+err_noexecute:
+ .asciz "Error: No-execute pages not supported. System halted."
+err_fx:
+ .asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted."
+err_sse2:
+ .asciz "Error: SSE2 instructions not supported. System halted."
+
+status_prot:
+ .asciz "[prot] "
+status_vesa_copy:
+ .asciz "[vesa_copy] "
+status_multiboot_cmdline:
+ .asciz "[multiboot_cmdline] "
+status_vesa_real:
+ .asciz "[vesa_real] "
+status_prot2:
+ .asciz "[prot2] "
+status_long:
+ .asciz "[long] "
+status_main:
+ .asciz "[main] "
Index: kernel/arch/amd64/src/boot/multiboot2.S
===================================================================
--- kernel/arch/amd64/src/boot/multiboot2.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/arch/amd64/src/boot/multiboot2.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
+
+.section K_TEXT_START, "ax"
+
+.code32
+
+.align 8
+.global multiboot2_image_start
+multiboot2_header_start:
+ .long MULTIBOOT2_HEADER_MAGIC
+ .long MULTIBOOT2_HEADER_ARCH_I386
+ .long multiboot2_header_end - multiboot2_header_start
+ .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
+
+ /* Information request tag */
+ tag_info_req_start:
+ .word MULTIBOOT2_TAG_INFO_REQ
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_info_req_end - tag_info_req_start
+ .long MULTIBOOT2_TAG_MODULE
+ .long MULTIBOOT2_TAG_MEMMAP
+ .long MULTIBOOT2_TAG_FBINFO
+ tag_info_req_end:
+
+ /* Address tag */
+ tag_address_start:
+ .word MULTIBOOT2_TAG_ADDRESS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_address_end - tag_address_start
+ .long multiboot2_header_start
+ .long unmapped_ktext_start
+ .long 0
+ .long 0
+ tag_address_end:
+
+ /* Entry address tag */
+ tag_entry_address_start:
+ .word MULTIBOOT2_TAG_ENTRY_ADDRESS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_entry_address_end - tag_entry_address_start
+ .long multiboot2_image_start
+ tag_entry_address_end:
+
+ /* Flags tag */
+ tag_flags_start:
+ .word MULTIBOOT2_TAG_FLAGS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_flags_end - tag_flags_start
+ .long MULTIBOOT2_FLAGS_CONSOLE
+ tag_flags_end:
+
+ /* Framebuffer tag */
+ tag_framebuffer_start:
+ .word MULTIBOOT2_TAG_FRAMEBUFFER
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_framebuffer_end - tag_framebuffer_start
+ .long CONFIG_BFB_WIDTH
+ .long CONFIG_BFB_HEIGHT
+ .long CONFIG_BFB_BPP
+ tag_framebuffer_end:
+
+ /* Module alignment tag */
+ tag_module_align_start:
+ .word MULTIBOOT2_TAG_MODULE_ALIGN
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_module_align_end - tag_module_align_start
+ .long 0
+ tag_module_align_end:
+
+ /* Tag terminator */
+ tag_terminator_start:
+ .word MULTIBOOT2_TAG_TERMINATOR
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_terminator_end - tag_terminator_start
+ tag_terminator_end:
+multiboot2_header_end:
+
+multiboot2_image_start:
+ cld
+
+ /* Initialize stack pointer */
+ movl $START_STACK, %esp
+
+ /* Initialize Global Descriptor Table register */
+ lgdtl bootstrap_gdtr
+
+ /* Kernel data + stack */
+ movw $GDT_SELECTOR(KDATA_DES), %cx
+ movw %cx, %es
+ movw %cx, %ds
+ movw %cx, %ss
+
+ /*
+ * Simics seems to remove hidden part of GS on entering user mode
+ * when _visible_ part of GS does not point to user-mode segment.
+ */
+ movw $GDT_SELECTOR(UDATA_DES), %cx
+ movw %cx, %fs
+ movw %cx, %gs
+
+ jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot2_meeting_point
+ multiboot2_meeting_point:
+
+ /*
+ * Protected 32-bit. We want to reuse the code-seg descriptor,
+ * the Default operand size must not be 1 when entering long mode.
+ */
+
+ /* Save multiboot arguments */
+ movl %eax, multiboot_eax
+ movl %ebx, multiboot_ebx
+
+ movl $(INTEL_CPUID_EXTENDED), %eax
+ cpuid
+ cmp $(INTEL_CPUID_EXTENDED), %eax
+ ja extended_cpuid_supported
+
+ jmp pm_error_halt
+
+ extended_cpuid_supported:
+
+ movl $(AMD_CPUID_EXTENDED), %eax
+ cpuid
+ bt $(AMD_EXT_LONG_MODE), %edx
+ jc long_mode_supported
+
+ jmp pm_error_halt
+
+ long_mode_supported:
+
+ bt $(AMD_EXT_NOEXECUTE), %edx
+ jc noexecute_supported
+
+ jmp pm_error_halt
+
+ noexecute_supported:
+
+ movl $(INTEL_CPUID_STANDARD), %eax
+ cpuid
+ bt $(INTEL_FXSAVE), %edx
+ jc fx_supported
+
+ jmp pm_error_halt
+
+ fx_supported:
+
+ bt $(INTEL_SSE2), %edx
+ jc sse2_supported
+
+ jmp pm_error_halt
+
+ sse2_supported:
+
+ /*
+ * Enable 64-bit page translation entries - CR4.PAE = 1.
+ * Paging is not enabled until after long mode is enabled.
+ */
+
+ movl %cr4, %eax
+ btsl $5, %eax
+ movl %eax, %cr4
+
+ /* Set up paging tables */
+ leal ptl_0, %eax
+ movl %eax, %cr3
+
+ /* Enable long mode */
+ movl $EFER_MSR_NUM, %ecx
+ rdmsr /* read EFER */
+ btsl $AMD_LME_FLAG, %eax /* set LME = 1 */
+ wrmsr
+
+ /* Enable paging to activate long mode (set CR0.PG = 1) */
+ movl %cr0, %eax
+ btsl $31, %eax
+ movl %eax, %cr0
+
+ /* At this point we are in compatibility mode */
+ jmpl $GDT_SELECTOR(KTEXT_DES), $start64
+
+pm_error_halt:
+ cli
+ hlt1:
+ hlt
+ jmp hlt1
+
+.code64
+
+start64:
+
+ /*
+ * Long mode.
+ */
+
+ movq $(PA2KA(START_STACK)), %rsp
+
+ /* Create the first stack frame */
+ pushq $0
+ movq %rsp, %rbp
+
+ /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
+ xorq %rdi, %rdi
+ movl multiboot_eax, %edi
+ xorq %rsi, %rsi
+ movl multiboot_ebx, %esi
+
+ movabsq $arch_pre_main, %rax
+ callq *%rax
+
+ /* Call main_bsp() */
+ movabsq $main_bsp, %rax
+ call *%rax
+
+ /* Not reached */
+ cli
+ hlt0:
+ hlt
+ jmp hlt0
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -106,6 +106,6 @@
arch/$(KARCH)/src/drivers/i8254.c \
arch/$(KARCH)/src/drivers/i8259.c \
- arch/$(KARCH)/src/drivers/vesa.c \
- arch/$(KARCH)/src/boot/boot.S \
+ arch/$(KARCH)/src/boot/multiboot.S \
+ arch/$(KARCH)/src/boot/multiboot2.S \
arch/$(KARCH)/src/boot/memmap.c \
arch/$(KARCH)/src/fpu_context.c \
Index: kernel/arch/ia32/include/arch.h
===================================================================
--- kernel/arch/ia32/include/arch.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/include/arch.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -36,7 +36,7 @@
#define KERN_ia32_ARCH_H_
-#include
+#include
-extern void arch_pre_main(uint32_t, const multiboot_info_t *);
+extern void arch_pre_main(uint32_t, void *);
#endif
Index: kernel/arch/ia32/include/boot/boot.h
===================================================================
--- kernel/arch/ia32/include/boot/boot.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/include/boot/boot.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -40,9 +40,4 @@
#define BOOT_STACK_SIZE 0x0400
-#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-#define MULTIBOOT_HEADER_FLAGS 0x00010003
-
-#define MULTIBOOT_LOADER_MAGIC 0x2BADB002
-
#ifndef __ASM__
Index: rnel/arch/ia32/include/drivers/vesa.h
===================================================================
--- kernel/arch/ia32/include/drivers/vesa.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_VESA_H_
-#define KERN_ia32_VESA_H_
-
-#include
-
-extern bool vesa_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/src/boot/boot.S
===================================================================
--- kernel/arch/ia32/src/boot/boot.S (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,736 +1,0 @@
-/*
- * Copyright (c) 2001 Jakub Jermar
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.macro pm_error msg
- movl \msg, %esi
- jmp pm_error_halt
-.endm
-
-.macro pm_status msg
-#ifdef CONFIG_EGA
- pushl %esi
- movl \msg, %esi
- call pm_early_puts
- popl %esi
-#endif
-.endm
-
-.macro pm2_status msg
- pushl \msg
- call early_puts
-.endm
-
-.align 4
-.global multiboot_image_start
-multiboot_header:
- .long MULTIBOOT_HEADER_MAGIC
- .long MULTIBOOT_HEADER_FLAGS
- .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) /* checksum */
- .long multiboot_header
- .long unmapped_ktext_start
- .long 0
- .long 0
- .long multiboot_image_start
-
-multiboot_image_start:
- cld
-
- /* Initialize stack pointer */
- movl $START_STACK, %esp
-
- /* Initialize Global Descriptor Table register */
- lgdtl bootstrap_gdtr
-
- /* Kernel data + stack */
- movw $GDT_SELECTOR(KDATA_DES), %cx
- movw %cx, %es
- movw %cx, %fs
- movw %cx, %gs
- movw %cx, %ds
- movw %cx, %ss
-
- jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot_meeting_point
- multiboot_meeting_point:
-
- /* Save GRUB arguments */
- movl %eax, grub_eax
- movl %ebx, grub_ebx
-
- pm_status $status_prot
-
-#include "vesa_prot.inc"
-
-#ifndef PROCESSOR_i486
-
- pm_status $status_prot2
-
- movl $(INTEL_CPUID_LEVEL), %eax
- cpuid
- cmp $0x0, %eax /* any function > 0? */
- jbe pse_unsupported
-
- movl $(INTEL_CPUID_STANDARD), %eax
- cpuid
- bt $(INTEL_PSE), %edx
- jnc pse_unsupported
-
- /* Map kernel and turn paging on */
- pm_status $status_pse
- call map_kernel_pse
- jmp stack_init
-
-#endif /* PROCESSOR_i486 */
-
- pse_unsupported:
-
- /* Map kernel and turn paging on */
- pm_status $status_non_pse
- call map_kernel_non_pse
-
- stack_init:
-
- /* Create the first stack frame */
- pushl $0
- movl %esp, %ebp
-
- pm2_status $status_prot3
-
- /* Call arch_pre_main(grub_eax, grub_ebx) */
- pushl grub_ebx
- pushl grub_eax
- call arch_pre_main
-
- pm2_status $status_main
-
- /* Call main_bsp() */
- call main_bsp
-
- /* Not reached */
- cli
- hlt0:
- hlt
- jmp hlt0
-
-/** Setup mapping for the kernel (PSE variant)
- *
- * Setup mapping for both the unmapped and mapped sections
- * of the kernel. For simplicity, we map the entire 4G space.
- *
- */
-.global map_kernel_pse
-map_kernel_pse:
- /* Paging features */
- movl %cr4, %ecx
- orl $(1 << 4), %ecx /* PSE on */
- andl $(~(1 << 5)), %ecx /* PAE off */
- movl %ecx, %cr4
-
- movl $(page_directory + 0), %esi
- movl $(page_directory + 2048), %edi
- xorl %ecx, %ecx
- xorl %ebx, %ebx
-
- floop_pse:
- movl $((1 << 7) | (1 << 1) | (1 << 0)), %eax
- orl %ebx, %eax
- /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
- movl %eax, (%esi, %ecx, 4)
- /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
- movl %eax, (%edi, %ecx, 4)
- addl $(4 * 1024 * 1024), %ebx
-
- incl %ecx
- cmpl $512, %ecx
- jl floop_pse
-
- movl %esi, %cr3
-
- movl %cr0, %ebx
- orl $(1 << 31), %ebx /* paging on */
- movl %ebx, %cr0
- ret
-
-/** Setup mapping for the kernel (non-PSE variant).
- *
- * Setup mapping for both the unmapped and mapped sections
- * of the kernel. For simplicity, we map the entire 4G space.
- *
- */
-map_kernel_non_pse:
- /* Paging features */
- movl %cr4, %ecx
- andl $(~(1 << 5)), %ecx /* PAE off */
- movl %ecx, %cr4
-
- call calc_kernel_end
- call find_mem_for_pt
-
- mov kernel_end, %esi
- mov free_area, %ecx
-
- cmpl %esi, %ecx
- jbe use_kernel_end
-
- mov %ecx, %esi
-
- /* Align address down to 4k */
- andl $(~4095), %esi
-
- use_kernel_end:
-
- /* Align address to 4k */
- addl $4095, %esi
- andl $(~4095), %esi
-
- /* Allocate space for page tables */
- movl %esi, pt_loc
- movl $ballocs, %edi
- andl $0x7fffffff, %edi
-
- movl %esi, (%edi)
- addl $4, %edi
- movl $(2 * 1024 * 1024), (%edi)
-
- /* Fill page tables */
- xorl %ecx, %ecx
- xorl %ebx, %ebx
-
- floop_pt:
- movl $((1 << 1) | (1 << 0)), %eax
- orl %ebx, %eax
- movl %eax, (%esi, %ecx, 4)
- addl $(4 * 1024), %ebx
-
- incl %ecx
- cmpl $(512 * 1024), %ecx
-
- jl floop_pt
-
- /* Fill page directory */
- movl $(page_directory + 0), %esi
- movl $(page_directory + 2048), %edi
- xorl %ecx, %ecx
- movl pt_loc, %ebx
-
- floop:
- movl $((1 << 1) | (1 << 0)), %eax
- orl %ebx, %eax
-
- /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
- movl %eax, (%esi, %ecx, 4)
-
- /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
- movl %eax, (%edi, %ecx, 4)
- addl $(4 * 1024), %ebx
-
- incl %ecx
- cmpl $512, %ecx
-
- jl floop
-
- movl %esi, %cr3
-
- movl %cr0, %ebx
- orl $(1 << 31), %ebx /* paging on */
- movl %ebx, %cr0
-
- ret
-
-/** Calculate unmapped address of the end of the kernel. */
-calc_kernel_end:
- movl $hardcoded_load_address, %edi
- andl $0x7fffffff, %edi
- movl (%edi), %esi
- andl $0x7fffffff, %esi
-
- movl $hardcoded_ktext_size, %edi
- andl $0x7fffffff, %edi
- addl (%edi), %esi
- andl $0x7fffffff, %esi
-
- movl $hardcoded_kdata_size, %edi
- andl $0x7fffffff, %edi
- addl (%edi), %esi
- andl $0x7fffffff, %esi
- movl %esi, kernel_end
-
- ret
-
-/** Find free 2M (+4k for alignment) region where to store page tables */
-find_mem_for_pt:
- /* Check if multiboot info is present */
- cmpl $MULTIBOOT_LOADER_MAGIC, grub_eax
- je check_multiboot_map
-
- ret
-
- check_multiboot_map:
-
- /* Copy address of the multiboot info to ebx */
- movl grub_ebx, %ebx
-
- /* Check if memory map flag is present */
- movl (%ebx), %edx
- andl $(1 << 6), %edx
- jnz use_multiboot_map
-
- ret
-
- use_multiboot_map:
-
- /* Copy address of the memory map to edx */
- movl 48(%ebx), %edx
- movl %edx, %ecx
-
- addl 44(%ebx), %ecx
-
- /* Find a free region at least 2M in size */
- check_memmap_loop:
-
- /* Is this a free region? */
- cmp $1, 20(%edx)
- jnz next_region
-
- /* Check size */
- cmp $0, 16(%edx)
- jnz next_region
-
- cmpl $(2 * 1024 * 1024 + 4 * 1024), 12(%edx)
- jbe next_region
-
- cmp $0, 8(%edx)
- jz found_region
-
- next_region:
-
- cmp %ecx, %edx
- jbe next_region_do
-
- ret
-
- next_region_do:
-
- addl (%edx), %edx
- addl $4, %edx
- jmp check_memmap_loop
-
- found_region:
-
- /* Use end of the found region */
- mov 4(%edx), %ecx
- add 12(%edx), %ecx
- sub $(2 * 1024 * 1024), %ecx
- mov %ecx, free_area
-
- ret
-
-/** Print string to EGA display (in light red) and halt.
- *
- * Should be executed from 32 bit protected mode with paging
- * turned off. Stack is not required. This routine is used even
- * if CONFIG_EGA is not enabled. Since we are going to halt the
- * CPU anyway, it is always better to at least try to print
- * some hints.
- *
- * @param %esi NULL-terminated string to print.
- *
- */
-pm_error_halt:
- movl $0xb8000, %edi /* base of EGA text mode memory */
- xorl %eax, %eax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb err_cursor_ok
-
- movw $1998, %ax
-
- err_cursor_ok:
-
- movw %ax, %bx
- shl $1, %eax
- addl %eax, %edi
-
- err_ploop:
- lodsb
-
- cmp $0, %al
- je err_ploop_end
-
- movb $0x0c, %ah /* black background, light red foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb err_ploop
-
- /* Scroll the screen (24 rows) */
- movl %esi, %edx
- movl $0xb80a0, %esi
- movl $0xb8000, %edi
- movl $960, %ecx
- rep movsl
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $40, %ecx
- rep stosl
-
- /* Go to row 24 */
- movl %edx, %esi
- movl $0xb8f00, %edi
- movw $1920, %bx
-
- jmp err_ploop
- err_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- cli
- hlt1:
- hlt
- jmp hlt1
-
-/** Print string to EGA display (in light green).
- *
- * Should be called from 32 bit protected mode with paging
- * turned off. A stack space of at least 24 bytes is required,
- * but the function does not establish a stack frame.
- *
- * Macros such as pm_status take care that this function
- * is used only when CONFIG_EGA is enabled.
- *
- * @param %esi NULL-terminated string to print.
- *
- */
-pm_early_puts:
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushl %edi
-
- movl $0xb8000, %edi /* base of EGA text mode memory */
- xorl %eax, %eax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb pm_puts_cursor_ok
-
- movw $1998, %ax
-
- pm_puts_cursor_ok:
-
- movw %ax, %bx
- shl $1, %eax
- addl %eax, %edi
-
- pm_puts_ploop:
- lodsb
-
- cmp $0, %al
- je pm_puts_ploop_end
-
- movb $0x0a, %ah /* black background, light green foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb pm_puts_ploop
-
- /* Scroll the screen (24 rows) */
- movl %esi, %edx
- movl $0xb80a0, %esi
- movl $0xb8000, %edi
- movl $960, %ecx
- rep movsl
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $40, %ecx
- rep stosl
-
- /* Go to row 24 */
- movl %edx, %esi
- movl $0xb8f00, %edi
- movw $1920, %bx
-
- jmp pm_puts_ploop
- pm_puts_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- popl %edi
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
-
- ret
-
-/** Print string to EGA display.
- *
- * Should be called from 32 bit protected mode (with paging
- * enabled and stack established). This function is ABI compliant.
- *
- * If CONFIG_EGA is undefined or CONFIG_FB is defined
- * then this function does nothing.
- *
- * @param %ebp+0x08 NULL-terminated string to print.
- *
- */
-early_puts:
-
-#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
- /* Prologue, save preserved registers */
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
-
- movl 0x08(%ebp), %esi
- movl $(PA2KA(0xb8000)), %edi /* base of EGA text mode memory */
- xorl %eax, %eax
-
- /* Read bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
- shl $8, %ax
-
- /* Read bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- inb %dx, %al
-
- /* Sanity check for the cursor on screen */
- cmp $2000, %ax
- jb early_puts_cursor_ok
-
- movw $1998, %ax
-
- early_puts_cursor_ok:
-
- movw %ax, %bx
- shl $1, %eax
- addl %eax, %edi
-
- early_puts_ploop:
- lodsb
-
- cmp $0, %al
- je early_puts_ploop_end
-
- movb $0x0e, %ah /* black background, yellow foreground */
- stosw
-
- /* Sanity check for the cursor on the last line */
- inc %bx
- cmp $2000, %bx
- jb early_puts_ploop
-
- /* Scroll the screen (24 rows) */
- movl %esi, %edx
- movl $(PA2KA(0xb80a0)), %esi
- movl $(PA2KA(0xb8000)), %edi
- movl $960, %ecx
- rep movsl
-
- /* Clear the 24th row */
- xorl %eax, %eax
- movl $40, %ecx
- rep stosl
-
- /* Go to row 24 */
- movl %edx, %esi
- movl $(PA2KA(0xb8f00)), %edi
- movw $1920, %bx
-
- jmp early_puts_ploop
- early_puts_ploop_end:
-
- /* Write bits 8 - 15 of the cursor address */
- movw $0x3d4, %dx
- movb $0xe, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bh, %al
- outb %al, %dx
-
- /* Write bits 0 - 7 of the cursor address */
- movw $0x3d4, %dx
- movb $0xf, %al
- outb %al, %dx
-
- movw $0x3d5, %dx
- movb %bl, %al
- outb %al, %dx
-
- /* Epilogue, restore preserved registers */
- popl %edi
- popl %esi
- popl %ebx
- leave
-
-#endif
-
- ret
-
-#include "vesa_real.inc"
-
-.section K_DATA_START, "aw", @progbits
-
-.align 4096
-page_directory:
- .space 4096, 0
-
-bootstrap_gdtr:
- .word GDT_SELECTOR(GDT_ITEMS)
- .long KA2PA(gdt)
-
-grub_eax:
- .long 0
-grub_ebx:
- .long 0
-
-pt_loc:
- .long 0
-kernel_end:
- .long 0
-free_area:
- .long 0
-
-status_prot:
- .asciz "[prot] "
-status_pse:
- .asciz "[pse] "
-status_non_pse:
- .asciz "[non_pse] "
-status_vesa_copy:
- .asciz "[vesa_copy] "
-status_grub_cmdline:
- .asciz "[grub_cmdline] "
-status_vesa_real:
- .asciz "[vesa_real] "
-status_prot2:
- .asciz "[prot2] "
-status_prot3:
- .asciz "[prot3] "
-status_main:
- .asciz "[main] "
Index: kernel/arch/ia32/src/boot/memmap.c
===================================================================
--- kernel/arch/ia32/src/boot/memmap.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/src/boot/memmap.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -35,5 +35,5 @@
#include
-uint8_t e820counter = 0xffU;
+uint8_t e820counter = 0;
e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
Index: kernel/arch/ia32/src/boot/multiboot.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/arch/ia32/src/boot/multiboot.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,741 @@
+/*
+ * Copyright (c) 2001 Jakub Jermar
+ * Copyright (c) 2005 Martin Decky
+ * Copyright (c) 2011 Martin Sucha
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
+
+.section K_TEXT_START, "ax"
+
+.code32
+
+.macro pm_error msg
+ movl \msg, %esi
+ jmp pm_error_halt
+.endm
+
+.macro pm_status msg
+#ifdef CONFIG_EGA
+ pushl %esi
+ movl \msg, %esi
+ call pm_early_puts
+ popl %esi
+#endif
+.endm
+
+.macro pm2_status msg
+ pushl \msg
+ call early_puts
+.endm
+
+.align 4
+.global multiboot_image_start
+multiboot_header:
+ .long MULTIBOOT_HEADER_MAGIC
+ .long MULTIBOOT_HEADER_FLAGS
+ .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) /* checksum */
+ .long multiboot_header
+ .long unmapped_ktext_start
+ .long 0
+ .long 0
+ .long multiboot_image_start
+
+multiboot_image_start:
+ cld
+
+ /* Initialize stack pointer */
+ movl $START_STACK, %esp
+
+ /* Initialize Global Descriptor Table register */
+ lgdtl bootstrap_gdtr
+
+ /* Kernel data + stack */
+ movw $GDT_SELECTOR(KDATA_DES), %cx
+ movw %cx, %es
+ movw %cx, %fs
+ movw %cx, %gs
+ movw %cx, %ds
+ movw %cx, %ss
+
+ jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot_meeting_point
+ multiboot_meeting_point:
+
+ /* Save multiboot arguments */
+ movl %eax, multiboot_eax
+ movl %ebx, multiboot_ebx
+
+ pm_status $status_prot
+
+#include "vesa_prot.inc"
+
+#ifndef PROCESSOR_i486
+
+ pm_status $status_prot2
+
+ movl $(INTEL_CPUID_LEVEL), %eax
+ cpuid
+ cmp $0x0, %eax /* any function > 0? */
+ jbe pse_unsupported
+
+ movl $(INTEL_CPUID_STANDARD), %eax
+ cpuid
+ bt $(INTEL_PSE), %edx
+ jnc pse_unsupported
+
+ /* Map kernel and turn paging on */
+ pm_status $status_pse
+ call map_kernel_pse
+ jmp stack_init
+
+#endif /* PROCESSOR_i486 */
+
+ pse_unsupported:
+
+ /* Map kernel and turn paging on */
+ pm_status $status_non_pse
+ call map_kernel_non_pse
+
+ stack_init:
+
+ /* Create the first stack frame */
+ pushl $0
+ movl %esp, %ebp
+
+ pm2_status $status_prot3
+
+ /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
+ pushl multiboot_ebx
+ pushl multiboot_eax
+ call arch_pre_main
+
+ pm2_status $status_main
+
+ /* Call main_bsp() */
+ call main_bsp
+
+ /* Not reached */
+ cli
+ hlt0:
+ hlt
+ jmp hlt0
+
+/** Setup mapping for the kernel (PSE variant)
+ *
+ * Setup mapping for both the unmapped and mapped sections
+ * of the kernel. For simplicity, we map the entire 4G space.
+ *
+ */
+.global map_kernel_pse
+map_kernel_pse:
+ /* Paging features */
+ movl %cr4, %ecx
+ orl $(1 << 4), %ecx /* PSE on */
+ andl $(~(1 << 5)), %ecx /* PAE off */
+ movl %ecx, %cr4
+
+ movl $(page_directory + 0), %esi
+ movl $(page_directory + 2048), %edi
+ xorl %ecx, %ecx
+ xorl %ebx, %ebx
+
+ floop_pse:
+ movl $((1 << 7) | (1 << 1) | (1 << 0)), %eax
+ orl %ebx, %eax
+ /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
+ movl %eax, (%esi, %ecx, 4)
+ /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
+ movl %eax, (%edi, %ecx, 4)
+ addl $(4 * 1024 * 1024), %ebx
+
+ incl %ecx
+ cmpl $512, %ecx
+ jl floop_pse
+
+ movl %esi, %cr3
+
+ movl %cr0, %ebx
+ orl $(1 << 31), %ebx /* paging on */
+ movl %ebx, %cr0
+ ret
+
+/** Setup mapping for the kernel (non-PSE variant).
+ *
+ * Setup mapping for both the unmapped and mapped sections
+ * of the kernel. For simplicity, we map the entire 4G space.
+ *
+ */
+.global map_kernel_non_pse
+map_kernel_non_pse:
+ /* Paging features */
+ movl %cr4, %ecx
+ andl $(~(1 << 5)), %ecx /* PAE off */
+ movl %ecx, %cr4
+
+ call calc_kernel_end
+ call find_mem_for_pt
+
+ mov kernel_end, %esi
+ mov free_area, %ecx
+
+ cmpl %esi, %ecx
+ jbe use_kernel_end
+
+ mov %ecx, %esi
+
+ /* Align address down to 4k */
+ andl $(~4095), %esi
+
+ use_kernel_end:
+
+ /* Align address to 4k */
+ addl $4095, %esi
+ andl $(~4095), %esi
+
+ /* Allocate space for page tables */
+ movl %esi, pt_loc
+ movl $ballocs, %edi
+ andl $0x7fffffff, %edi
+
+ movl %esi, (%edi)
+ addl $4, %edi
+ movl $(2 * 1024 * 1024), (%edi)
+
+ /* Fill page tables */
+ xorl %ecx, %ecx
+ xorl %ebx, %ebx
+
+ floop_pt:
+ movl $((1 << 1) | (1 << 0)), %eax
+ orl %ebx, %eax
+ movl %eax, (%esi, %ecx, 4)
+ addl $(4 * 1024), %ebx
+
+ incl %ecx
+ cmpl $(512 * 1024), %ecx
+
+ jl floop_pt
+
+ /* Fill page directory */
+ movl $(page_directory + 0), %esi
+ movl $(page_directory + 2048), %edi
+ xorl %ecx, %ecx
+ movl pt_loc, %ebx
+
+ floop:
+ movl $((1 << 1) | (1 << 0)), %eax
+ orl %ebx, %eax
+
+ /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
+ movl %eax, (%esi, %ecx, 4)
+
+ /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
+ movl %eax, (%edi, %ecx, 4)
+ addl $(4 * 1024), %ebx
+
+ incl %ecx
+ cmpl $512, %ecx
+
+ jl floop
+
+ movl %esi, %cr3
+
+ movl %cr0, %ebx
+ orl $(1 << 31), %ebx /* paging on */
+ movl %ebx, %cr0
+
+ ret
+
+/** Calculate unmapped address of the end of the kernel. */
+calc_kernel_end:
+ movl $hardcoded_load_address, %edi
+ andl $0x7fffffff, %edi
+ movl (%edi), %esi
+ andl $0x7fffffff, %esi
+
+ movl $hardcoded_ktext_size, %edi
+ andl $0x7fffffff, %edi
+ addl (%edi), %esi
+ andl $0x7fffffff, %esi
+
+ movl $hardcoded_kdata_size, %edi
+ andl $0x7fffffff, %edi
+ addl (%edi), %esi
+ andl $0x7fffffff, %esi
+ movl %esi, kernel_end
+
+ ret
+
+/** Find free 2M (+4k for alignment) region where to store page tables */
+find_mem_for_pt:
+ /* Check if multiboot info is present */
+ cmpl $MULTIBOOT_LOADER_MAGIC, multiboot_eax
+ je check_multiboot_map
+
+ ret
+
+ check_multiboot_map:
+
+ /* Copy address of the multiboot info to ebx */
+ movl multiboot_ebx, %ebx
+
+ /* Check if memory map flag is present */
+ movl (%ebx), %edx
+ andl $(1 << 6), %edx
+ jnz use_multiboot_map
+
+ ret
+
+ use_multiboot_map:
+
+ /* Copy address of the memory map to edx */
+ movl 48(%ebx), %edx
+ movl %edx, %ecx
+
+ addl 44(%ebx), %ecx
+
+ /* Find a free region at least 2M in size */
+ check_memmap_loop:
+
+ /* Is this a free region? */
+ cmp $1, 20(%edx)
+ jnz next_region
+
+ /* Check size */
+ cmp $0, 16(%edx)
+ jnz next_region
+
+ cmpl $(2 * 1024 * 1024 + 4 * 1024), 12(%edx)
+ jbe next_region
+
+ cmp $0, 8(%edx)
+ jz found_region
+
+ next_region:
+
+ cmp %ecx, %edx
+ jbe next_region_do
+
+ ret
+
+ next_region_do:
+
+ addl (%edx), %edx
+ addl $4, %edx
+ jmp check_memmap_loop
+
+ found_region:
+
+ /* Use end of the found region */
+ mov 4(%edx), %ecx
+ add 12(%edx), %ecx
+ sub $(2 * 1024 * 1024), %ecx
+ mov %ecx, free_area
+
+ ret
+
+/** Print string to EGA display (in light red) and halt.
+ *
+ * Should be executed from 32 bit protected mode with paging
+ * turned off. Stack is not required. This routine is used even
+ * if CONFIG_EGA is not enabled. Since we are going to halt the
+ * CPU anyway, it is always better to at least try to print
+ * some hints.
+ *
+ * @param %esi NULL-terminated string to print.
+ *
+ */
+pm_error_halt:
+ movl $0xb8000, %edi /* base of EGA text mode memory */
+ xorl %eax, %eax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb err_cursor_ok
+
+ movw $1998, %ax
+
+ err_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %eax
+ addl %eax, %edi
+
+ err_ploop:
+ lodsb
+
+ cmp $0, %al
+ je err_ploop_end
+
+ movb $0x0c, %ah /* black background, light red foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb err_ploop
+
+ /* Scroll the screen (24 rows) */
+ movl %esi, %edx
+ movl $0xb80a0, %esi
+ movl $0xb8000, %edi
+ movl $960, %ecx
+ rep movsl
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $40, %ecx
+ rep stosl
+
+ /* Go to row 24 */
+ movl %edx, %esi
+ movl $0xb8f00, %edi
+ movw $1920, %bx
+
+ jmp err_ploop
+ err_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ cli
+ hlt1:
+ hlt
+ jmp hlt1
+
+/** Print string to EGA display (in light green).
+ *
+ * Should be called from 32 bit protected mode with paging
+ * turned off. A stack space of at least 24 bytes is required,
+ * but the function does not establish a stack frame.
+ *
+ * Macros such as pm_status take care that this function
+ * is used only when CONFIG_EGA is enabled.
+ *
+ * @param %esi NULL-terminated string to print.
+ *
+ */
+pm_early_puts:
+ pushl %eax
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ pushl %edi
+
+ movl $0xb8000, %edi /* base of EGA text mode memory */
+ xorl %eax, %eax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb pm_puts_cursor_ok
+
+ movw $1998, %ax
+
+ pm_puts_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %eax
+ addl %eax, %edi
+
+ pm_puts_ploop:
+ lodsb
+
+ cmp $0, %al
+ je pm_puts_ploop_end
+
+ movb $0x0a, %ah /* black background, light green foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb pm_puts_ploop
+
+ /* Scroll the screen (24 rows) */
+ movl %esi, %edx
+ movl $0xb80a0, %esi
+ movl $0xb8000, %edi
+ movl $960, %ecx
+ rep movsl
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $40, %ecx
+ rep stosl
+
+ /* Go to row 24 */
+ movl %edx, %esi
+ movl $0xb8f00, %edi
+ movw $1920, %bx
+
+ jmp pm_puts_ploop
+ pm_puts_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ popl %edi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ popl %eax
+
+ ret
+
+/** Print string to EGA display.
+ *
+ * Should be called from 32 bit protected mode (with paging
+ * enabled and stack established). This function is ABI compliant.
+ *
+ * If CONFIG_EGA is undefined or CONFIG_FB is defined
+ * then this function does nothing.
+ *
+ * @param %ebp+0x08 NULL-terminated string to print.
+ *
+ */
+early_puts:
+
+#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
+
+ /* Prologue, save preserved registers */
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+
+ movl 0x08(%ebp), %esi
+ movl $(PA2KA(0xb8000)), %edi /* base of EGA text mode memory */
+ xorl %eax, %eax
+
+ /* Read bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+ shl $8, %ax
+
+ /* Read bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ inb %dx, %al
+
+ /* Sanity check for the cursor on screen */
+ cmp $2000, %ax
+ jb early_puts_cursor_ok
+
+ movw $1998, %ax
+
+ early_puts_cursor_ok:
+
+ movw %ax, %bx
+ shl $1, %eax
+ addl %eax, %edi
+
+ early_puts_ploop:
+ lodsb
+
+ cmp $0, %al
+ je early_puts_ploop_end
+
+ movb $0x0e, %ah /* black background, yellow foreground */
+ stosw
+
+ /* Sanity check for the cursor on the last line */
+ inc %bx
+ cmp $2000, %bx
+ jb early_puts_ploop
+
+ /* Scroll the screen (24 rows) */
+ movl %esi, %edx
+ movl $(PA2KA(0xb80a0)), %esi
+ movl $(PA2KA(0xb8000)), %edi
+ movl $960, %ecx
+ rep movsl
+
+ /* Clear the 24th row */
+ xorl %eax, %eax
+ movl $40, %ecx
+ rep stosl
+
+ /* Go to row 24 */
+ movl %edx, %esi
+ movl $(PA2KA(0xb8f00)), %edi
+ movw $1920, %bx
+
+ jmp early_puts_ploop
+ early_puts_ploop_end:
+
+ /* Write bits 8 - 15 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xe, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bh, %al
+ outb %al, %dx
+
+ /* Write bits 0 - 7 of the cursor address */
+ movw $0x3d4, %dx
+ movb $0xf, %al
+ outb %al, %dx
+
+ movw $0x3d5, %dx
+ movb %bl, %al
+ outb %al, %dx
+
+ /* Epilogue, restore preserved registers */
+ popl %edi
+ popl %esi
+ popl %ebx
+ leave
+
+#endif
+
+ ret
+
+#include "vesa_real.inc"
+
+.section K_DATA_START, "aw", @progbits
+
+.align 4096
+page_directory:
+ .space 4096, 0
+
+.global bootstrap_gdtr
+bootstrap_gdtr:
+ .word GDT_SELECTOR(GDT_ITEMS)
+ .long KA2PA(gdt)
+
+.global multiboot_eax
+multiboot_eax:
+ .long 0
+
+.global multiboot_ebx
+multiboot_ebx:
+ .long 0
+
+pt_loc:
+ .long 0
+kernel_end:
+ .long 0
+free_area:
+ .long 0
+
+status_prot:
+ .asciz "[prot] "
+status_pse:
+ .asciz "[pse] "
+status_non_pse:
+ .asciz "[non_pse] "
+status_vesa_copy:
+ .asciz "[vesa_copy] "
+status_multiboot_cmdline:
+ .asciz "[multiboot_cmdline] "
+status_vesa_real:
+ .asciz "[vesa_real] "
+status_prot2:
+ .asciz "[prot2] "
+status_prot3:
+ .asciz "[prot3] "
+status_main:
+ .asciz "[main] "
Index: kernel/arch/ia32/src/boot/multiboot2.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot2.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/arch/ia32/src/boot/multiboot2.S (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
+
+.section K_TEXT_START, "ax"
+
+.code32
+
+.align 8
+.global multiboot2_image_start
+multiboot2_header_start:
+ .long MULTIBOOT2_HEADER_MAGIC
+ .long MULTIBOOT2_HEADER_ARCH_I386
+ .long multiboot2_header_end - multiboot2_header_start
+ .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
+
+ /* Information request tag */
+ tag_info_req_start:
+ .word MULTIBOOT2_TAG_INFO_REQ
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_info_req_end - tag_info_req_start
+ .long MULTIBOOT2_TAG_MODULE
+ .long MULTIBOOT2_TAG_MEMMAP
+ .long MULTIBOOT2_TAG_FBINFO
+ tag_info_req_end:
+
+ /* Address tag */
+ tag_address_start:
+ .word MULTIBOOT2_TAG_ADDRESS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_address_end - tag_address_start
+ .long multiboot2_header_start
+ .long unmapped_ktext_start
+ .long 0
+ .long 0
+ tag_address_end:
+
+ /* Entry address tag */
+ tag_entry_address_start:
+ .word MULTIBOOT2_TAG_ENTRY_ADDRESS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_entry_address_end - tag_entry_address_start
+ .long multiboot2_image_start
+ tag_entry_address_end:
+
+ /* Flags tag */
+ tag_flags_start:
+ .word MULTIBOOT2_TAG_FLAGS
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_flags_end - tag_flags_start
+ .long MULTIBOOT2_FLAGS_CONSOLE
+ tag_flags_end:
+
+ /* Framebuffer tag */
+ tag_framebuffer_start:
+ .word MULTIBOOT2_TAG_FRAMEBUFFER
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_framebuffer_end - tag_framebuffer_start
+ .long CONFIG_BFB_WIDTH
+ .long CONFIG_BFB_HEIGHT
+ .long CONFIG_BFB_BPP
+ tag_framebuffer_end:
+
+ /* Module alignment tag */
+ tag_module_align_start:
+ .word MULTIBOOT2_TAG_MODULE_ALIGN
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_module_align_end - tag_module_align_start
+ .long 0
+ tag_module_align_end:
+
+ /* Tag terminator */
+ tag_terminator_start:
+ .word MULTIBOOT2_TAG_TERMINATOR
+ .word MULTIBOOT2_FLAGS_REQUIRED
+ .long tag_terminator_end - tag_terminator_start
+ tag_terminator_end:
+multiboot2_header_end:
+
+multiboot2_image_start:
+ cld
+
+ /* Initialize stack pointer */
+ movl $START_STACK, %esp
+
+ /* Initialize Global Descriptor Table register */
+ lgdtl bootstrap_gdtr
+
+ /* Kernel data + stack */
+ movw $GDT_SELECTOR(KDATA_DES), %cx
+ movw %cx, %es
+ movw %cx, %fs
+ movw %cx, %gs
+ movw %cx, %ds
+ movw %cx, %ss
+
+ jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot2_meeting_point
+ multiboot2_meeting_point:
+
+ /* Save multiboot arguments */
+ movl %eax, multiboot_eax
+ movl %ebx, multiboot_ebx
+
+#ifndef PROCESSOR_i486
+
+ movl $(INTEL_CPUID_LEVEL), %eax
+ cpuid
+ cmp $0x0, %eax /* any function > 0? */
+ jbe pse_unsupported
+
+ movl $(INTEL_CPUID_STANDARD), %eax
+ cpuid
+ bt $(INTEL_PSE), %edx
+ jnc pse_unsupported
+
+ /* Map kernel and turn paging on */
+ call map_kernel_pse
+ jmp stack_init
+
+#endif /* PROCESSOR_i486 */
+
+ pse_unsupported:
+
+ /* Map kernel and turn paging on */
+ call map_kernel_non_pse
+
+ stack_init:
+
+ /* Create the first stack frame */
+ pushl $0
+ movl %esp, %ebp
+
+ /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
+ pushl multiboot_ebx
+ pushl multiboot_eax
+ call arch_pre_main
+
+ /* Call main_bsp() */
+ call main_bsp
+
+ /* Not reached */
+ cli
+ hlt0:
+ hlt
+ jmp hlt0
Index: kernel/arch/ia32/src/boot/vesa_prot.inc
===================================================================
--- kernel/arch/ia32/src/boot/vesa_prot.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/src/boot/vesa_prot.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -1,5 +1,4 @@
#ifdef CONFIG_FB
-#define MULTIBOOT_LOADER_MAGIC 0x2BADB002
#define MBINFO_BIT_CMDLINE 2
#define MBINFO_OFFSET_CMDLINE 16
@@ -14,13 +13,13 @@
rep movsb
- /* Check for GRUB command line */
+ /* Check for multiboot command line */
- pm_status $status_grub_cmdline
+ pm_status $status_multiboot_cmdline
- mov grub_eax, %eax
+ mov multiboot_eax, %eax
cmp $MULTIBOOT_LOADER_MAGIC, %eax
jne no_cmdline
- mov grub_ebx, %ebx
+ mov multiboot_ebx, %ebx
mov (%ebx), %eax
bt $MBINFO_BIT_CMDLINE, %eax
@@ -89,25 +88,33 @@
/* Returned back to protected mode */
- mov %ax, KA2PA(vesa_scanline)
+ movzx %ax, %ecx
+ mov %ecx, KA2PA(bfb_scanline)
+
shr $16, %eax
- mov %ax, KA2PA(vesa_bpp)
+ mov %ax, KA2PA(bfb_bpp)
- mov %bx, KA2PA(vesa_height)
+ movzx %bx, %ecx
+ mov %ecx, KA2PA(bfb_height)
+
shr $16, %ebx
- mov %bx, KA2PA(vesa_width)
+ mov %ebx, KA2PA(bfb_width)
- mov %dl, KA2PA(vesa_green_pos)
+ mov %dl, KA2PA(bfb_green_pos)
+
shr $8, %edx
- mov %dl, KA2PA(vesa_green_mask)
+ mov %dl, KA2PA(bfb_green_size)
+
shr $8, %edx
- mov %dl, KA2PA(vesa_red_pos)
+ mov %dl, KA2PA(bfb_red_pos)
+
shr $8, %edx
- mov %dl, KA2PA(vesa_red_mask)
+ mov %dl, KA2PA(bfb_red_size)
mov %esi, %edx
- mov %dl, KA2PA(vesa_blue_pos)
+ mov %dl, KA2PA(bfb_blue_pos)
+
shr $8, %edx
- mov %dl, KA2PA(vesa_blue_mask)
+ mov %dl, KA2PA(bfb_blue_size)
- mov %edi, KA2PA(vesa_ph_addr)
+ mov %edi, KA2PA(bfb_addr)
#endif
Index: kernel/arch/ia32/src/boot/vesa_real.inc
===================================================================
--- kernel/arch/ia32/src/boot/vesa_real.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/src/boot/vesa_real.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -304,5 +304,5 @@
/*
* Store mode parameters:
- * eax = bpp[8] scanline[16]
+ * eax = bpp[16] scanline[16]
* ebx = width[16] height[16]
* edx = red_mask[8] red_pos[8] green_mask[8] green_pos[8]
@@ -328,4 +328,5 @@
shl $8, %edx
mov VESA_MODE_RED_POS_OFFSET(%di), %dl
+
shl $8, %edx
mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl
@@ -369,6 +370,10 @@
mov $0x0003, %ax
int $0x10
+
+ xor %eax, %eax
+ xor %ebx, %ebx
+ xor %edx, %edx
mov $0xffffffff, %edi
- xor %ax, %ax
+
jz vesa_leave_real /* force relative jump */
@@ -386,7 +391,7 @@
default_mode:
- .ascii STRING(CONFIG_VESA_MODE)
+ .ascii STRING(CONFIG_BFB_MODE)
.ascii "-"
- .asciz STRING(CONFIG_VESA_BPP)
+ .asciz STRING(CONFIG_BFB_BPP)
.fill 24
Index: rnel/arch/ia32/src/drivers/vesa.c
===================================================================
--- kernel/arch/ia32/src/drivers/vesa.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ia32
- * @{
- */
-/**
- * @file
- * @brief VESA frame buffer driver.
- */
-
-#ifdef CONFIG_FB
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-uint32_t vesa_ph_addr;
-uint16_t vesa_width;
-uint16_t vesa_height;
-uint16_t vesa_bpp;
-uint16_t vesa_scanline;
-
-uint8_t vesa_red_mask;
-uint8_t vesa_red_pos;
-
-uint8_t vesa_green_mask;
-uint8_t vesa_green_pos;
-
-uint8_t vesa_blue_mask;
-uint8_t vesa_blue_pos;
-
-bool vesa_init(void)
-{
- if ((vesa_width == 0xffffU) || (vesa_height == 0xffffU))
- return false;
-
- visual_t visual;
-
- switch (vesa_bpp) {
- case 8:
- visual = VISUAL_INDIRECT_8;
- break;
- case 16:
- if ((vesa_red_mask == 5) && (vesa_red_pos == 10)
- && (vesa_green_mask == 5) && (vesa_green_pos == 5)
- && (vesa_blue_mask == 5) && (vesa_blue_pos == 0))
- visual = VISUAL_RGB_5_5_5_LE;
- else
- visual = VISUAL_RGB_5_6_5_LE;
- break;
- case 24:
- visual = VISUAL_BGR_8_8_8;
- break;
- case 32:
- visual = VISUAL_BGR_8_8_8_0;
- break;
- default:
- LOG("Unsupported bits per pixel.");
- return false;
- }
-
- fb_properties_t vesa_props = {
- .addr = vesa_ph_addr,
- .offset = 0,
- .x = vesa_width,
- .y = vesa_height,
- .scan = vesa_scanline,
- .visual = visual,
- };
-
- outdev_t *fbdev = fb_init(&vesa_props);
- if (!fbdev)
- return false;
-
- stdout_wire(fbdev);
- return true;
-}
-
-#endif
-
-/** @}
- */
Index: kernel/arch/ia32/src/ia32.c
===================================================================
--- kernel/arch/ia32/src/ia32.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/arch/ia32/src/ia32.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -42,7 +42,8 @@
#include
+#include
#include
#include
-#include
+#include
#include
#include
@@ -76,11 +77,13 @@
/** Perform ia32-specific initialization before main_bsp() is called.
*
- * @param signature Should contain the multiboot signature.
- * @param mi Pointer to the multiboot information structure.
- */
-void arch_pre_main(uint32_t signature, const multiboot_info_t *mi)
+ * @param signature Multiboot signature.
+ * @param info Multiboot information structure.
+ *
+ */
+void arch_pre_main(uint32_t signature, void *info)
{
/* Parse multiboot information obtained from the bootloader. */
- multiboot_info_parse(signature, mi);
+ multiboot_info_parse(signature, (multiboot_info_t *) info);
+ multiboot2_info_parse(signature, (multiboot2_info_t *) info);
#ifdef CONFIG_SMP
@@ -114,13 +117,13 @@
#if (defined(CONFIG_FB) || defined(CONFIG_EGA))
- bool vesa = false;
+ bool bfb = false;
#endif
#ifdef CONFIG_FB
- vesa = vesa_init();
+ bfb = bfb_init();
#endif
#ifdef CONFIG_EGA
- if (!vesa) {
+ if (!bfb) {
outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
if (egadev)
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/genarch/Makefile.inc (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -67,5 +67,6 @@
genarch/src/fb/font-8x16.c \
genarch/src/fb/logo-196x66.c \
- genarch/src/fb/fb.c
+ genarch/src/fb/fb.c \
+ genarch/src/fb/bfb.c
endif
@@ -143,5 +144,6 @@
ifeq ($(CONFIG_MULTIBOOT), y)
GENARCH_SOURCES += \
- genarch/src/multiboot/multiboot.c
+ genarch/src/multiboot/multiboot.c \
+ genarch/src/multiboot/multiboot2.c
endif
Index: kernel/genarch/include/fb/bfb.h
===================================================================
--- kernel/genarch/include/fb/bfb.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/genarch/include/fb/bfb.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006 Jakub Vana
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_BFB_H_
+#define KERN_BFB_H_
+
+#include
+
+extern uintptr_t bfb_addr;
+extern uint32_t bfb_width;
+extern uint32_t bfb_height;
+extern uint16_t bfb_bpp;
+extern uint32_t bfb_scanline;
+
+extern uint8_t bfb_red_pos;
+extern uint8_t bfb_red_size;
+
+extern uint8_t bfb_green_pos;
+extern uint8_t bfb_green_size;
+
+extern uint8_t bfb_blue_pos;
+extern uint8_t bfb_blue_size;
+
+extern bool bfb_init(void);
+
+#endif
+
+/** @}
+ */
Index: kernel/genarch/include/multiboot/multiboot.h
===================================================================
--- kernel/genarch/include/multiboot/multiboot.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/genarch/include/multiboot/multiboot.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -36,11 +36,21 @@
#define KERN_MULTIBOOT_H_
+#define MULTIBOOT_HEADER_MAGIC 0x1badb002
+#define MULTIBOOT_HEADER_FLAGS 0x00010003
+
+#define MULTIBOOT_LOADER_MAGIC 0x2badb002
+
+#ifndef __ASM__
+
#include
#include
+
+/** Convert 32-bit multiboot address to a pointer. */
+#define MULTIBOOT_PTR(mba) ((void *) (uintptr_t) (mba))
/** Multiboot 32-bit address. */
typedef uint32_t mbaddr_t;
-/** Multiboot mod structure */
+/** Multiboot module structure */
typedef struct {
mbaddr_t start;
@@ -48,5 +58,5 @@
mbaddr_t string;
uint32_t reserved;
-} __attribute__ ((packed)) multiboot_mod_t;
+} __attribute__((packed)) multiboot_module_t;
/** Multiboot mmap structure */
@@ -54,5 +64,5 @@
uint32_t size;
e820memmap_t mm_info;
-} __attribute__ ((packed)) multiboot_mmap_t;
+} __attribute__((packed)) multiboot_memmap_t;
/** Multiboot information structure */
@@ -74,24 +84,22 @@
/* ... */
-} __attribute__ ((packed)) multiboot_info_t;
+} __attribute__((packed)) multiboot_info_t;
enum multiboot_info_flags {
- MBINFO_FLAGS_MEM = 0x01,
- MBINFO_FLAGS_BOOT = 0x02,
- MBINFO_FLAGS_CMDLINE = 0x04,
- MBINFO_FLAGS_MODS = 0x08,
- MBINFO_FLAGS_SYMS1 = 0x10,
- MBINFO_FLAGS_SYMS2 = 0x20,
- MBINFO_FLAGS_MMAP = 0x40
+ MULTIBOOT_INFO_FLAGS_MEM = 0x01,
+ MULTIBOOT_INFO_FLAGS_BOOT = 0x02,
+ MULTIBOOT_INFO_FLAGS_CMDLINE = 0x04,
+ MULTIBOOT_INFO_FLAGS_MODS = 0x08,
+ MULTIBOOT_INFO_FLAGS_SYMS1 = 0x10,
+ MULTIBOOT_INFO_FLAGS_SYMS2 = 0x20,
+ MULTIBOOT_INFO_FLAGS_MMAP = 0x40
/* ... */
};
-#define MULTIBOOT_LOADER_MAGIC 0x2BADB002
+extern void multiboot_extract_command(char *, size_t, const char *);
+extern void multiboot_info_parse(uint32_t, const multiboot_info_t *);
-/** Convert 32-bit multiboot address to a pointer. */
-#define MULTIBOOT_PTR(mba) ((void *)(uintptr_t) (mba))
-
-extern void multiboot_info_parse(uint32_t, const multiboot_info_t *);
+#endif /* __ASM__ */
#endif
Index: kernel/genarch/include/multiboot/multiboot2.h
===================================================================
--- kernel/genarch/include/multiboot/multiboot2.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/genarch/include/multiboot/multiboot2.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_MULTIBOOT2_H_
+#define KERN_MULTIBOOT2_H_
+
+#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
+#define MULTIBOOT2_HEADER_ARCH_I386 0
+
+#define MULTIBOOT2_LOADER_MAGIC 0x36d76289
+
+#define MULTIBOOT2_FLAGS_REQUIRED 0
+#define MULTIBOOT2_FLAGS_CONSOLE 0x03
+
+#define MULTIBOOT2_TAG_TERMINATOR 0
+#define MULTIBOOT2_TAG_INFO_REQ 1
+#define MULTIBOOT2_TAG_ADDRESS 2
+#define MULTIBOOT2_TAG_ENTRY_ADDRESS 3
+#define MULTIBOOT2_TAG_FLAGS 4
+#define MULTIBOOT2_TAG_FRAMEBUFFER 5
+#define MULTIBOOT2_TAG_MODULE_ALIGN 6
+
+#define MULTIBOOT2_TAG_MODULE 3
+#define MULTIBOOT2_TAG_MEMMAP 6
+#define MULTIBOOT2_TAG_FBINFO 8
+
+#define MULTIBOOT2_VISUAL_INDEXED 0
+#define MULTIBOOT2_VISUAL_RGB 1
+#define MULTIBOOT2_VISUAL_EGA 2
+
+#ifndef __ASM__
+
+#include
+#include
+
+/** Multiboot2 32-bit address. */
+typedef uint32_t mb2addr_t;
+
+/** Multiboot2 information structure */
+typedef struct {
+ uint32_t size;
+ uint32_t reserved;
+} __attribute__((packed)) multiboot2_info_t;
+
+/** Multiboot2 modules structure */
+typedef struct {
+ mb2addr_t start;
+ mb2addr_t end;
+ char string[];
+} __attribute__((packed)) multiboot2_module_t;
+
+/** Multiboot2 memmap structure */
+typedef struct {
+ uint32_t entry_size;
+ uint32_t entry_version;
+} __attribute__ ((packed)) multiboot2_memmap_t;
+
+/** Multiboot2 memmap entry structure */
+typedef struct {
+ uint64_t base_address;
+ uint64_t size;
+ uint32_t type;
+ uint32_t reserved;
+} __attribute__((packed)) multiboot2_memmap_entry_t;
+
+/** Multiboot2 palette structure */
+typedef struct {
+ uint8_t red;
+ uint8_t green;
+ uint8_t blue;
+} __attribute__((packed)) multiboot2_colorinfo_palette_t;
+
+/** Multiboot2 indexed color information structure */
+typedef struct {
+ uint32_t colors;
+ multiboot2_colorinfo_palette_t palette[];
+} __attribute__((packed)) multiboot2_colorinfo_indexed_t;
+
+/** Multiboot2 RGB color information structure */
+typedef struct {
+ uint8_t red_pos;
+ uint8_t red_size;
+ uint8_t green_pos;
+ uint8_t green_size;
+ uint8_t blue_pos;
+ uint8_t blue_size;
+} __attribute__((packed)) multiboot2_colorinfo_rgb_t;
+
+/** Multiboot2 framebuffer information structure */
+typedef struct {
+ uint64_t addr;
+ uint32_t scanline;
+ uint32_t width;
+ uint32_t height;
+ uint8_t bpp;
+ uint8_t visual;
+ uint8_t reserved;
+ union {
+ multiboot2_colorinfo_indexed_t indexed;
+ multiboot2_colorinfo_rgb_t rgb;
+ };
+} __attribute__((packed)) multiboot2_fbinfo_t;
+
+/** Generic multiboot2 tag */
+typedef struct {
+ uint32_t type;
+ uint32_t size;
+ union {
+ multiboot2_module_t module;
+ multiboot2_memmap_t memmap;
+ multiboot2_fbinfo_t fbinfo;
+ };
+} __attribute__((packed)) multiboot2_tag_t;
+
+extern void multiboot2_info_parse(uint32_t, const multiboot2_info_t *);
+
+#endif /* __ASM__ */
+
+#endif
+
+/** @}
+ */
Index: kernel/genarch/src/fb/bfb.c
===================================================================
--- kernel/genarch/src/fb/bfb.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/genarch/src/fb/bfb.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2006 Jakub Vana
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/**
+ * @file
+ * @brief Boot framebuffer driver.
+ */
+
+#include
+#include
+#include
+#include
+
+uintptr_t bfb_addr = (uintptr_t) -1;
+uint32_t bfb_width = 0;
+uint32_t bfb_height = 0;
+uint16_t bfb_bpp = 0;
+uint32_t bfb_scanline = 0;
+
+uint8_t bfb_red_pos = 0;
+uint8_t bfb_red_size = 0;
+
+uint8_t bfb_green_pos = 0;
+uint8_t bfb_green_size = 0;
+
+uint8_t bfb_blue_pos = 0;
+uint8_t bfb_blue_size = 0;
+
+bool bfb_init(void)
+{
+ if ((bfb_width == 0) || (bfb_height == 0))
+ return false;
+
+ fb_properties_t bfb_props = {
+ .addr = bfb_addr,
+ .offset = 0,
+ .x = bfb_width,
+ .y = bfb_height,
+ .scan = bfb_scanline
+ };
+
+ switch (bfb_bpp) {
+ case 8:
+ bfb_props.visual = VISUAL_INDIRECT_8;
+ break;
+ case 16:
+ if ((bfb_red_pos == 10) && (bfb_red_size == 5) &&
+ (bfb_green_pos == 5) && (bfb_green_size == 5) &&
+ (bfb_blue_pos == 0) && (bfb_blue_size == 5))
+ bfb_props.visual = VISUAL_RGB_5_5_5_LE;
+ else
+ bfb_props.visual = VISUAL_RGB_5_6_5_LE;
+ break;
+ case 24:
+ bfb_props.visual = VISUAL_BGR_8_8_8;
+ break;
+ case 32:
+ bfb_props.visual = VISUAL_BGR_8_8_8_0;
+ break;
+ default:
+ LOG("Unsupported bits per pixel.");
+ return false;
+ }
+
+ outdev_t *fbdev = fb_init(&bfb_props);
+ if (!fbdev)
+ return false;
+
+ stdout_wire(fbdev);
+ return true;
+}
+
+/** @}
+ */
Index: kernel/genarch/src/multiboot/multiboot.c
===================================================================
--- kernel/genarch/src/multiboot/multiboot.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/genarch/src/multiboot/multiboot.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -33,18 +33,17 @@
*/
+#include
#include
-#include
#include
#include
-#include
/** Extract command name from the multiboot module command line.
*
- * @param buf Destination buffer (will always NULL-terminate).
- * @param sz Size of destination buffer (in bytes).
+ * @param buf Destination buffer (will be always NULL-terminated).
+ * @param size Size of destination buffer (in bytes).
* @param cmd_line Input string (the command line).
*
*/
-static void extract_command(char *buf, size_t sz, const char *cmd_line)
+void multiboot_extract_command(char *buf, size_t size, const char *cmd_line)
{
/* Find the first space. */
@@ -69,5 +68,41 @@
/* Copy the command. */
- str_ncpy(buf, sz, start, (size_t) (end - start));
+ str_ncpy(buf, size, start, (size_t) (end - start));
+}
+
+static void multiboot_modules(uint32_t count, multiboot_module_t *mods)
+{
+ for (uint32_t i = 0; i < count; i++) {
+ if (init.cnt >= CONFIG_INIT_TASKS)
+ break;
+
+ init.tasks[init.cnt].addr = PA2KA(mods[i].start);
+ init.tasks[init.cnt].size = mods[i].end - mods[i].start;
+
+ /* Copy command line, if available. */
+ if (mods[i].string) {
+ multiboot_extract_command(init.tasks[init.cnt].name,
+ CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string));
+ } else
+ init.tasks[init.cnt].name[0] = 0;
+
+ init.cnt++;
+ }
+}
+
+static void multiboot_memmap(uint32_t length, multiboot_memmap_t *memmap)
+{
+ uint32_t pos = 0;
+
+ while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
+ e820table[e820counter] = memmap->mm_info;
+
+ /* Compute address of next structure. */
+ uint32_t size = sizeof(memmap->size) + memmap->size;
+ memmap = (multiboot_memmap_t *) ((uintptr_t) memmap + size);
+ pos += size;
+
+ e820counter++;
+ }
}
@@ -78,59 +113,21 @@
*
* @param signature Should contain the multiboot signature.
- * @param mi Pointer to the multiboot information structure.
+ * @param info Multiboot information structure.
+ *
*/
-void multiboot_info_parse(uint32_t signature, const multiboot_info_t *mi)
+void multiboot_info_parse(uint32_t signature, const multiboot_info_t *info)
{
- uint32_t flags;
+ if (signature != MULTIBOOT_LOADER_MAGIC)
+ return;
- if (signature == MULTIBOOT_LOADER_MAGIC)
- flags = mi->flags;
- else {
- /* No multiboot info available. */
- flags = 0;
- }
-
- /* Copy module information. */
- uint32_t i;
- if ((flags & MBINFO_FLAGS_MODS) != 0) {
- init.cnt = min(mi->mods_count, CONFIG_INIT_TASKS);
- multiboot_mod_t *mods
- = (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr);
-
- for (i = 0; i < init.cnt; i++) {
- init.tasks[i].addr = PA2KA(mods[i].start);
- init.tasks[i].size = mods[i].end - mods[i].start;
-
- /* Copy command line, if available. */
- if (mods[i].string) {
- extract_command(init.tasks[i].name,
- CONFIG_TASK_NAME_BUFLEN,
- MULTIBOOT_PTR(mods[i].string));
- } else
- init.tasks[i].name[0] = 0;
- }
- } else
- init.cnt = 0;
+ /* Copy modules information. */
+ if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0)
+ multiboot_modules(info->mods_count,
+ (multiboot_module_t *) MULTIBOOT_PTR(info->mods_addr));
/* Copy memory map. */
-
- if ((flags & MBINFO_FLAGS_MMAP) != 0) {
- int32_t mmap_length = mi->mmap_length;
- multiboot_mmap_t *mme = MULTIBOOT_PTR(mi->mmap_addr);
- e820counter = 0;
-
- i = 0;
- while ((mmap_length > 0) && (i < MEMMAP_E820_MAX_RECORDS)) {
- e820table[i++] = mme->mm_info;
-
- /* Compute address of next structure. */
- uint32_t size = sizeof(mme->size) + mme->size;
- mme = ((void *) mme) + size;
- mmap_length -= size;
- }
-
- e820counter = i;
- } else
- e820counter = 0;
+ if ((info->flags & MULTIBOOT_INFO_FLAGS_MMAP) != 0)
+ multiboot_memmap(info->mmap_length,
+ (multiboot_memmap_t *) MULTIBOOT_PTR(info->mmap_addr));
}
Index: kernel/genarch/src/multiboot/multiboot2.c
===================================================================
--- kernel/genarch/src/multiboot/multiboot2.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
+++ kernel/genarch/src/multiboot/multiboot2.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/** @file
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define MULTIBOOT2_TAG_ALIGN 8
+
+static void multiboot2_module(const multiboot2_module_t *module)
+{
+ if (init.cnt < CONFIG_INIT_TASKS) {
+ init.tasks[init.cnt].addr = PA2KA(module->start);
+ init.tasks[init.cnt].size = module->end - module->start;
+ multiboot_extract_command(init.tasks[init.cnt].name,
+ CONFIG_TASK_NAME_BUFLEN, module->string);
+
+ init.cnt++;
+ }
+}
+
+static void multiboot2_memmap(uint32_t length, const multiboot2_memmap_t *memmap)
+{
+ multiboot2_memmap_entry_t *entry = (multiboot2_memmap_entry_t *)
+ ((uintptr_t) memmap + sizeof(*memmap));
+ uint32_t pos = sizeof(*memmap);
+
+ while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
+ e820table[e820counter].base_address = entry->base_address;
+ e820table[e820counter].size = entry->size;
+ e820table[e820counter].type = entry->type;
+
+ /* Compute address of next entry. */
+ entry = (multiboot2_memmap_entry_t *)
+ ((uintptr_t) entry + memmap->entry_size);
+ pos += memmap->entry_size;
+
+ e820counter++;
+ }
+}
+
+static void multiboot2_fbinfo(const multiboot2_fbinfo_t *fbinfo)
+{
+ if (fbinfo->visual == MULTIBOOT2_VISUAL_RGB) {
+ bfb_addr = fbinfo->addr;
+ bfb_width = fbinfo->width;
+ bfb_height = fbinfo->height;
+ bfb_bpp = fbinfo->bpp;
+ bfb_scanline = fbinfo->scanline;
+
+ bfb_red_pos = fbinfo->rgb.red_pos;
+ bfb_red_size = fbinfo->rgb.red_size;
+
+ bfb_green_pos = fbinfo->rgb.green_pos;
+ bfb_green_size = fbinfo->rgb.green_size;
+
+ bfb_blue_pos = fbinfo->rgb.blue_pos;
+ bfb_blue_size = fbinfo->rgb.blue_size;
+ }
+}
+
+/** Parse multiboot2 information structure.
+ *
+ * If @a signature does not contain a valid multiboot2 signature,
+ * assumes no multiboot2 information is available.
+ *
+ * @param signature Should contain the multiboot2 signature.
+ * @param info Multiboot2 information structure.
+ *
+ */
+void multiboot2_info_parse(uint32_t signature, const multiboot2_info_t *info)
+{
+ if (signature != MULTIBOOT2_LOADER_MAGIC)
+ return;
+
+ const multiboot2_tag_t *tag = (const multiboot2_tag_t *)
+ ALIGN_UP((uintptr_t) info + sizeof(*info), MULTIBOOT2_TAG_ALIGN);
+
+ while (tag->type != MULTIBOOT2_TAG_TERMINATOR) {
+ switch (tag->type) {
+ case MULTIBOOT2_TAG_MODULE:
+ multiboot2_module(&tag->module);
+ break;
+ case MULTIBOOT2_TAG_MEMMAP:
+ multiboot2_memmap(tag->size, &tag->memmap);
+ break;
+ case MULTIBOOT2_TAG_FBINFO:
+ multiboot2_fbinfo(&tag->fbinfo);
+ break;
+ }
+
+ tag = (const multiboot2_tag_t *)
+ ALIGN_UP((uintptr_t) tag + tag->size, MULTIBOOT2_TAG_ALIGN);
+ }
+}
+
+/** @}
+ */
Index: kernel/generic/include/lib/rd.h
===================================================================
--- kernel/generic/include/lib/rd.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/generic/include/lib/rd.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -38,44 +38,5 @@
#include
-/**
- * RAM disk version
- */
-#define RD_VERSION 1
-
-/**
- * RAM disk magic number
- */
-#define RD_MAGIC_SIZE 4
-#define RD_MAG0 'H'
-#define RD_MAG1 'O'
-#define RD_MAG2 'R'
-#define RD_MAG3 'D'
-
-/**
- * RAM disk data encoding types
- */
-#define RD_DATA_NONE 0
-#define RD_DATA_LSB 1 /* Least significant byte first (little endian) */
-#define RD_DATA_MSB 2 /* Most signigicant byte first (big endian) */
-
-/**
- * RAM disk error return codes
- */
-#define RE_OK 0 /* No error */
-#define RE_INVALID 1 /* Invalid RAM disk image */
-#define RE_UNSUPPORTED 2 /* Non-supported image (e.g. wrong version) */
-
-/** RAM disk header */
-struct rd_header {
- uint8_t magic[RD_MAGIC_SIZE];
- uint8_t version;
- uint8_t data_type;
- uint32_t header_size;
- uint64_t data_size;
-} __attribute__ ((packed));
-
-typedef struct rd_header rd_header_t;
-
-extern int init_rd(rd_header_t *addr, size_t size);
+extern void init_rd(void *, size_t);
#endif
Index: kernel/generic/src/lib/rd.c
===================================================================
--- kernel/generic/src/lib/rd.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/generic/src/lib/rd.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -33,5 +33,5 @@
/**
* @file
- * @brief RAM disk support.
+ * @brief RAM disk support.
*
* Support for RAM disk images.
@@ -39,66 +39,31 @@
#include
-#include
#include
#include
#include
-#include
-static parea_t rd_parea; /**< Physical memory area for rd. */
+/** Physical memory area for RAM disk. */
+static parea_t rd_parea;
-/**
- * RAM disk initialization routine. At this point, the RAM disk memory is shared
- * and information about the share is provided as sysinfo values to the
- * userspace tasks.
- */
-int init_rd(rd_header_t *header, size_t size)
+/** RAM disk initialization routine
+ *
+ * The information about the RAM disk is provided as sysinfo
+ * values to the uspace tasks.
+ *
+ */
+void init_rd(void *data, size_t size)
{
- /* Identify RAM disk */
- if ((header->magic[0] != RD_MAG0) || (header->magic[1] != RD_MAG1) ||
- (header->magic[2] != RD_MAG2) || (header->magic[3] != RD_MAG3))
- return RE_INVALID;
+ uintptr_t base = KA2PA((uintptr_t) data);
+ ASSERT((base % FRAME_SIZE) == 0);
- /* Identify version */
- if (header->version != RD_VERSION)
- return RE_UNSUPPORTED;
-
- uint32_t hsize;
- uint64_t dsize;
- switch (header->data_type) {
- case RD_DATA_LSB:
- hsize = uint32_t_le2host(header->header_size);
- dsize = uint64_t_le2host(header->data_size);
- break;
- case RD_DATA_MSB:
- hsize = uint32_t_be2host(header->header_size);
- dsize = uint64_t_be2host(header->data_size);
- break;
- default:
- return RE_UNSUPPORTED;
- }
-
- if ((hsize % FRAME_SIZE) || (dsize % FRAME_SIZE))
- return RE_UNSUPPORTED;
-
- if (hsize > size)
- return RE_INVALID;
-
- if ((uint64_t) hsize + dsize > size)
- dsize = size - hsize;
-
- rd_parea.pbase = ALIGN_DOWN((uintptr_t) KA2PA((void *) header + hsize),
- FRAME_SIZE);
- rd_parea.frames = SIZE2FRAMES(dsize);
+ rd_parea.pbase = base;
+ rd_parea.frames = SIZE2FRAMES(size);
rd_parea.unpriv = false;
rd_parea.mapped = false;
ddi_parea_register(&rd_parea);
-
+
sysinfo_set_item_val("rd", NULL, true);
- sysinfo_set_item_val("rd.header_size", NULL, hsize);
- sysinfo_set_item_val("rd.size", NULL, dsize);
- sysinfo_set_item_val("rd.address.physical", NULL,
- (sysarg_t) KA2PA((void *) header + hsize));
-
- return RE_OK;
+ sysinfo_set_item_val("rd.size", NULL, size);
+ sysinfo_set_item_val("rd.address.physical", NULL, (sysarg_t) base);
}
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ kernel/generic/src/main/kinit.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -179,5 +179,5 @@
for (i = 0; i < init.cnt; i++) {
if (init.tasks[i].addr % FRAME_SIZE) {
- printf("init[%zu].addr is not frame aligned\n", i);
+ printf("init[%zu]: Address is not frame aligned\n", i);
programs[i].task = NULL;
continue;
@@ -203,22 +203,28 @@
namebuf, &programs[i]);
- if ((rc == 0) && (programs[i].task != NULL)) {
+ if (rc == 0) {
+ if (programs[i].task != NULL) {
+ /*
+ * Set capabilities to init userspace tasks.
+ */
+ cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
+ CAP_IO_MANAGER | CAP_IRQ_REG);
+
+ if (!ipc_phone_0)
+ ipc_phone_0 = &programs[i].task->answerbox;
+ }
+
/*
- * Set capabilities to init userspace tasks.
+ * If programs[i].task == NULL then it is
+ * the program loader and it was registered
+ * successfully.
*/
- cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
- CAP_IO_MANAGER | CAP_IRQ_REG);
-
- if (!ipc_phone_0)
- ipc_phone_0 = &programs[i].task->answerbox;
- } else if (rc == 0) {
- /* It was the program loader and was registered */
- } else {
- /* RAM disk image */
- int rd = init_rd((rd_header_t *) init.tasks[i].addr, init.tasks[i].size);
-
- if (rd != RE_OK)
- printf("Init binary %zu not used (error %d)\n", i, rd);
- }
+ } else if (i == init.cnt - 1) {
+ /*
+ * Assume the last task is the RAM disk.
+ */
+ init_rd((void *) init.tasks[i].addr, init.tasks[i].size);
+ } else
+ printf("init[%zu]: Init binary load failed (error %d)\n", i, rc);
}
Index: tools/config.py
===================================================================
--- tools/config.py (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ tools/config.py (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -85,4 +85,5 @@
if ctype == 'cnf':
return True
+
return False
@@ -242,5 +243,5 @@
default = get_default_rule(rule)
-
+
#
# If we don't have a value but we do have
@@ -344,4 +345,20 @@
return True
+def preprocess_config(config, rules):
+ "Preprocess configuration"
+
+ varname_mode = 'CONFIG_BFB_MODE'
+ varname_width = 'CONFIG_BFB_WIDTH'
+ varname_height = 'CONFIG_BFB_HEIGHT'
+
+ if varname_mode in config:
+ mode = config[varname_mode].partition('x')
+
+ config[varname_width] = mode[0]
+ rules.append((varname_width, 'choice', 'Default framebuffer width', None, None))
+
+ config[varname_height] = mode[2]
+ rules.append((varname_height, 'choice', 'Default framebuffer height', None, None))
+
def create_output(mkname, mcname, config, rules):
"Create output configuration"
@@ -504,4 +521,5 @@
if (len(sys.argv) >= 3) and (sys.argv[2] == 'default'):
if (infer_verify_choices(config, rules)):
+ preprocess_config(config, rules)
create_output(MAKEFILE, MACROS, config, rules)
return 0
@@ -517,4 +535,5 @@
if (infer_verify_choices(config, rules)):
+ preprocess_config(config, rules)
create_output(MAKEFILE, MACROS, config, rules)
return 0
@@ -564,5 +583,5 @@
default = get_default_rule(rule)
-
+
#
# If we don't have a value but we do have
@@ -626,4 +645,5 @@
xtui.screen_done(screen)
+ preprocess_config(config, rules)
create_output(MAKEFILE, MACROS, config, rules)
return 0
Index: ols/mkhord.py
===================================================================
--- tools/mkhord.py (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,105 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2008 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-HORD encapsulator
-"""
-
-import sys
-import os
-import xstruct
-
-HEADER = """little:
- char tag[4] /* 'HORD' */
- uint8_t version /* version */
- uint8_t encoding /* encoding */
- uint32_t header_size /* header size */
- uint64_t payload_size /* payload size */
-"""
-
-HORD_LSB = 1
-
-def align_up(size, alignment):
- "Align upwards to a given alignment"
- return (((size) + ((alignment) - 1)) & ~((alignment) - 1))
-
-def usage(prname):
- "Print usage syntax"
- print(prname + " ")
-
-def main():
- if (len(sys.argv) < 4):
- usage(sys.argv[0])
- return
-
- if (not sys.argv[1].isdigit()):
- print(" must be a number")
- return
-
- align = int(sys.argv[1], 0)
- if (align <= 0):
- print(" must be positive")
- return
-
- fs_image = os.path.abspath(sys.argv[2])
- if (not os.path.isfile(fs_image)):
- print(" must be a file")
- return
-
- inf = open(fs_image, "rb")
- outf = open(sys.argv[3], "wb")
-
- header = xstruct.create(HEADER)
-
- header_size = header.size()
- payload_size = os.path.getsize(fs_image)
-
- header_size_aligned = align_up(header_size, align)
- payload_size_aligned = align_up(payload_size, align)
-
- header.tag = b"HORD"
- header.version = 1
- header.encoding = HORD_LSB
- header.header_size = header_size_aligned
- header.payload_size = payload_size_aligned
-
- outf.write(header.pack())
- outf.write(xstruct.create("little: padding[%d]" % (header_size_aligned - header_size)).pack())
-
- outf.write(inf.read())
-
- padding = payload_size_aligned - payload_size
- if (padding > 0):
- outf.write(xstruct.create("little: padding[%d]" % padding).pack())
-
- inf.close()
- outf.close()
-
-if __name__ == '__main__':
- main()
Index: uspace/drv/bus/usb/ehci/Makefile
===================================================================
--- uspace/drv/bus/usb/ehci/Makefile (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/drv/bus/usb/ehci/Makefile (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -42,5 +42,4 @@
SOURCES = \
- hc_iface.c \
main.c \
pci.c
Index: pace/drv/bus/usb/ehci/ehci.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * Common EHCI definitions.
- */
-#ifndef DRV_EHCI_EHCI_H
-#define DRV_EHCI_EHCI_H
-
-#include
-
-#define NAME "ehci"
-
-extern usbhc_iface_t ehci_hc_iface;
-
-#endif
-/**
- * @}
- */
-
Index: pace/drv/bus/usb/ehci/hc_iface.c
===================================================================
--- uspace/drv/bus/usb/ehci/hc_iface.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ (revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * USB-HC interface implementation.
- */
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "ehci.h"
-
-#define UNSUPPORTED(methodname) \
- usb_log_debug("Client called unsupported interface method " \
- "`%s()' in %s:%d.\n", \
- methodname, __FILE__, __LINE__)
-
-/** Found free USB address.
- *
- * @param[in] fun Device function the action was invoked on.
- * @param[in] speed Speed of the device that will get this address.
- * @param[out] address Non-null pointer where to store the free address.
- * @return Error code.
- */
-static int request_address(ddf_fun_t *fun, usb_address_t *address, bool strict,
- usb_speed_t speed)
-{
- UNSUPPORTED("request_address");
-
- return ENOTSUP;
-}
-
-/** Bind USB address with device devman handle.
- *
- * @param[in] fun Device function the action was invoked on.
- * @param[in] address USB address of the device.
- * @param[in] handle Devman handle of the device.
- * @return Error code.
- */
-static int bind_address(ddf_fun_t *fun,
- usb_address_t address, devman_handle_t handle)
-{
- UNSUPPORTED("bind_address");
-
- return ENOTSUP;
-}
-
-/** Find device handle by USB address.
- *
- * @param[in] fun DDF function that was called.
- * @param[in] address Address in question.
- * @param[out] handle Where to store device handle if found.
- * @return Error code.
- */
-static int find_by_address(ddf_fun_t *fun, usb_address_t address,
- devman_handle_t *handle)
-{
- UNSUPPORTED("find_by_address");
-
- return ENOTSUP;
-}
-
-/** Release previously requested address.
- *
- * @param[in] fun Device function the action was invoked on.
- * @param[in] address USB address to be released.
- * @return Error code.
- */
-static int release_address(ddf_fun_t *fun, usb_address_t address)
-{
- UNSUPPORTED("release_address");
-
- return ENOTSUP;
-}
-
-/** Register endpoint for bandwidth reservation.
- *
- * @param[in] fun Device function the action was invoked on.
- * @param[in] address USB address of the device.
- * @param[in] speed Endpoint speed (invalid means to use device one).
- * @param[in] endpoint Endpoint number.
- * @param[in] transfer_type USB transfer type.
- * @param[in] direction Endpoint data direction.
- * @param[in] max_packet_size Max packet size of the endpoint.
- * @param[in] interval Polling interval.
- * @return Error code.
- */
-static int register_endpoint(ddf_fun_t *fun,
- usb_address_t address, usb_endpoint_t endpoint,
- usb_transfer_type_t transfer_type, usb_direction_t direction,
- size_t max_packet_size, unsigned int interval)
-{
- UNSUPPORTED("register_endpoint");
-
- return ENOTSUP;
-}
-
-/** Unregister endpoint (free some bandwidth reservation).
- *
- * @param[in] fun Device function the action was invoked on.
- * @param[in] address USB address of the device.
- * @param[in] endpoint Endpoint number.
- * @param[in] direction Endpoint data direction.
- * @return Error code.
- */
-static int unregister_endpoint(ddf_fun_t *fun, usb_address_t address,
- usb_endpoint_t endpoint, usb_direction_t direction)
-{
- UNSUPPORTED("unregister_endpoint");
-
- return ENOTSUP;
-}
-
-/** Host controller interface implementation for EHCI. */
-usbhc_iface_t ehci_hc_iface = {
- .request_address = request_address,
- .bind_address = bind_address,
- .find_by_address = find_by_address,
- .release_address = release_address,
-
- .register_endpoint = register_endpoint,
- .unregister_endpoint = unregister_endpoint,
-};
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/ehci/main.c
===================================================================
--- uspace/drv/bus/usb/ehci/main.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/drv/bus/usb/ehci/main.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -42,7 +42,9 @@
#include
#include
+#include
#include "pci.h"
-#include "ehci.h"
+
+#define NAME "ehci"
static int ehci_dev_add(ddf_dev_t *device);
@@ -57,5 +59,5 @@
};
static ddf_dev_ops_t hc_ops = {
- .interfaces[USBHC_DEV_IFACE] = &ehci_hc_iface,
+ .interfaces[USBHC_DEV_IFACE] = &hcd_iface,
};
@@ -95,4 +97,11 @@
return ENOMEM;
}
+ hcd_t *ehci_hc = ddf_fun_data_alloc(hc_fun, sizeof(hcd_t));
+ if (ehci_hc == NULL) {
+ usb_log_error("Failed to alloc generic HC driver.\n");
+ return ENOMEM;
+ }
+ /* High Speed, no bandwidth */
+ hcd_init(ehci_hc, USB_SPEED_HIGH, 0, NULL);
hc_fun->ops = &hc_ops;
Index: uspace/drv/bus/usb/usbmid/explore.c
===================================================================
--- uspace/drv/bus/usb/usbmid/explore.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/drv/bus/usb/usbmid/explore.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -54,5 +54,5 @@
* @return Interface @p interface_no is already present in the list.
*/
-static bool interface_in_list(list_t *list, int interface_no)
+static bool interface_in_list(const list_t *list, int interface_no)
{
list_foreach(*list, l) {
Index: uspace/drv/bus/usb/usbmid/usbmid.c
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/drv/bus/usb/usbmid/usbmid.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -45,6 +45,5 @@
/** Callback for DDF USB interface. */
-static int usb_iface_get_interface_impl(ddf_fun_t *fun, devman_handle_t handle,
- int *iface_no)
+static int usb_iface_get_interface_impl(ddf_fun_t *fun, int *iface_no)
{
assert(fun);
@@ -64,5 +63,5 @@
.get_hc_handle = usb_iface_get_hc_handle_device_impl,
.get_my_address = usb_iface_get_my_address_forward_impl,
- .get_interface = usb_iface_get_interface_impl,
+ .get_my_interface = usb_iface_get_interface_impl,
};
Index: uspace/drv/bus/usb/vhc/connhost.c
===================================================================
--- uspace/drv/bus/usb/vhc/connhost.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/drv/bus/usb/vhc/connhost.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -508,5 +508,5 @@
.request_address = request_address,
.bind_address = bind_address,
- .find_by_address = find_by_address,
+ .get_handle = find_by_address,
.release_address = release_address,
Index: uspace/lib/drv/generic/remote_usb.c
===================================================================
--- uspace/lib/drv/generic/remote_usb.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/drv/generic/remote_usb.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2010 Vojtech Horky
+ * Copyright (c) 2011 Jan Vesely
* All rights reserved.
*
@@ -39,14 +40,74 @@
#include "ddf/driver.h"
+typedef enum {
+ IPC_M_USB_GET_MY_ADDRESS,
+ IPC_M_USB_GET_MY_INTERFACE,
+ IPC_M_USB_GET_HOST_CONTROLLER_HANDLE,
+} usb_iface_funcs_t;
+
+/** Tell USB address assigned to device.
+ * @param exch Vaid IPC exchange
+ * @param address Pointer to address storage place.
+ * @return Error code.
+ *
+ * Exch param is an open communication to device implementing usb_iface.
+ */
+int usb_get_my_address(async_exch_t *exch, usb_address_t *address)
+{
+ if (!exch)
+ return EINVAL;
+ sysarg_t addr;
+ const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+ IPC_M_USB_GET_MY_ADDRESS, &addr);
+
+ if (ret == EOK && address != NULL)
+ *address = (usb_address_t) addr;
+ return ret;
+}
+/*----------------------------------------------------------------------------*/
+/** Tell interface number given device can use.
+ * @param[in] exch IPC communication exchange
+ * @param[in] handle Id of the device
+ * @param[out] usb_iface Assigned USB interface
+ * @return Error code.
+ */
+int usb_get_my_interface(async_exch_t *exch, int *usb_iface)
+{
+ if (!exch)
+ return EINVAL;
+ sysarg_t iface_no;
+ const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+ IPC_M_USB_GET_MY_INTERFACE, &iface_no);
+ if (ret == EOK && usb_iface)
+ *usb_iface = (int)iface_no;
+ return ret;
+}
+/*----------------------------------------------------------------------------*/
+/** Tell devman handle of device host controller.
+ * @param[in] exch IPC communication exchange
+ * @param[out] hc_handle devman handle of the HC used by the target device.
+ * @return Error code.
+ */
+int usb_get_hc_handle(async_exch_t *exch, devman_handle_t *hc_handle)
+{
+ if (!exch)
+ return EINVAL;
+ devman_handle_t h;
+ const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+ IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
+ if (ret == EOK && hc_handle)
+ *hc_handle = (devman_handle_t)h;
+ return ret;
+}
+
static void remote_usb_get_my_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-static void remote_usb_get_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
+static void remote_usb_get_my_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-//static void remote_usb(device_t *, void *, ipc_callid_t, ipc_call_t *);
/** Remote USB interface operations. */
static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
[IPC_M_USB_GET_MY_ADDRESS] = remote_usb_get_my_address,
- [IPC_M_USB_GET_INTERFACE] = remote_usb_get_interface,
+ [IPC_M_USB_GET_MY_INTERFACE] = remote_usb_get_my_interface,
[IPC_M_USB_GET_HOST_CONTROLLER_HANDLE] = remote_usb_get_hc_handle,
};
@@ -60,9 +121,9 @@
};
-
+/*----------------------------------------------------------------------------*/
void remote_usb_get_my_address(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usb_iface_t *usb_iface = (usb_iface_t *) iface;
+ const usb_iface_t *usb_iface = (usb_iface_t *) iface;
if (usb_iface->get_my_address == NULL) {
@@ -72,37 +133,35 @@
usb_address_t address;
- int rc = usb_iface->get_my_address(fun, &address);
- if (rc != EOK) {
- async_answer_0(callid, rc);
+ const int ret = usb_iface->get_my_address(fun, &address);
+ if (ret != EOK) {
+ async_answer_0(callid, ret);
} else {
async_answer_1(callid, EOK, address);
}
}
-
-void remote_usb_get_interface(ddf_fun_t *fun, void *iface,
+/*----------------------------------------------------------------------------*/
+void remote_usb_get_my_interface(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usb_iface_t *usb_iface = (usb_iface_t *) iface;
+ const usb_iface_t *usb_iface = (usb_iface_t *) iface;
- if (usb_iface->get_interface == NULL) {
+ if (usb_iface->get_my_interface == NULL) {
async_answer_0(callid, ENOTSUP);
return;
}
- devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
-
int iface_no;
- int rc = usb_iface->get_interface(fun, handle, &iface_no);
- if (rc != EOK) {
- async_answer_0(callid, rc);
+ const int ret = usb_iface->get_my_interface(fun, &iface_no);
+ if (ret != EOK) {
+ async_answer_0(callid, ret);
} else {
async_answer_1(callid, EOK, iface_no);
}
}
-
+/*----------------------------------------------------------------------------*/
void remote_usb_get_hc_handle(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usb_iface_t *usb_iface = (usb_iface_t *) iface;
+ const usb_iface_t *usb_iface = (usb_iface_t *) iface;
if (usb_iface->get_hc_handle == NULL) {
@@ -112,14 +171,11 @@
devman_handle_t handle;
- int rc = usb_iface->get_hc_handle(fun, &handle);
- if (rc != EOK) {
- async_answer_0(callid, rc);
+ const int ret = usb_iface->get_hc_handle(fun, &handle);
+ if (ret != EOK) {
+ async_answer_0(callid, ret);
}
async_answer_1(callid, EOK, (sysarg_t) handle);
}
-
-
-
/**
* @}
Index: uspace/lib/drv/generic/remote_usbhc.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhc.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/drv/generic/remote_usbhc.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2010-2011 Vojtech Horky
+ * Copyright (c) 2011 Jan Vesely
* All rights reserved.
*
@@ -42,7 +43,285 @@
#define USB_MAX_PAYLOAD_SIZE 1020
+/** IPC methods for communication with HC through DDF interface.
+ *
+ * Notes for async methods:
+ *
+ * Methods for sending data to device (OUT transactions)
+ * - e.g. IPC_M_USBHC_INTERRUPT_OUT -
+ * always use the same semantics:
+ * - first, IPC call with given method is made
+ * - argument #1 is target address
+ * - argument #2 is target endpoint
+ * - argument #3 is max packet size of the endpoint
+ * - this call is immediately followed by IPC data write (from caller)
+ * - the initial call (and the whole transaction) is answer after the
+ * transaction is scheduled by the HC and acknowledged by the device
+ * or immediately after error is detected
+ * - the answer carries only the error code
+ *
+ * Methods for retrieving data from device (IN transactions)
+ * - e.g. IPC_M_USBHC_INTERRUPT_IN -
+ * also use the same semantics:
+ * - first, IPC call with given method is made
+ * - argument #1 is target address
+ * - argument #2 is target endpoint
+ * - this call is immediately followed by IPC data read (async version)
+ * - the call is not answered until the device returns some data (or until
+ * error occurs)
+ *
+ * Some special methods (NO-DATA transactions) do not send any data. These
+ * might behave as both OUT or IN transactions because communication parts
+ * where actual buffers are exchanged are omitted.
+ **
+ * For all these methods, wrap functions exists. Important rule: functions
+ * for IN transactions have (as parameters) buffers where retrieved data
+ * will be stored. These buffers must be already allocated and shall not be
+ * touch until the transaction is completed
+ * (e.g. not before calling usb_wait_for() with appropriate handle).
+ * OUT transactions buffers can be freed immediately after call is dispatched
+ * (i.e. after return from wrapping function).
+ *
+ */
+typedef enum {
+ /** Asks for address assignment by host controller.
+ * Answer:
+ * - ELIMIT - host controller run out of address
+ * - EOK - address assigned
+ * Answer arguments:
+ * - assigned address
+ *
+ * The address must be released by via IPC_M_USBHC_RELEASE_ADDRESS.
+ */
+ IPC_M_USBHC_REQUEST_ADDRESS,
+
+ /** Bind USB address with devman handle.
+ * Parameters:
+ * - USB address
+ * - devman handle
+ * Answer:
+ * - EOK - address binded
+ * - ENOENT - address is not in use
+ */
+ IPC_M_USBHC_BIND_ADDRESS,
+
+ /** Get handle binded with given USB address.
+ * Parameters
+ * - USB address
+ * Answer:
+ * - EOK - address binded, first parameter is the devman handle
+ * - ENOENT - address is not in use at the moment
+ */
+ IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
+
+ /** Release address in use.
+ * Arguments:
+ * - address to be released
+ * Answer:
+ * - ENOENT - address not in use
+ * - EPERM - trying to release default USB address
+ */
+ IPC_M_USBHC_RELEASE_ADDRESS,
+
+ /** Register endpoint attributes at host controller.
+ * This is used to reserve portion of USB bandwidth.
+ * When speed is invalid, speed of the device is used.
+ * Parameters:
+ * - USB address + endpoint number
+ * - packed as ADDR << 16 + EP
+ * - speed + transfer type + direction
+ * - packed as ( SPEED << 8 + TYPE ) << 8 + DIR
+ * - maximum packet size + interval (in milliseconds)
+ * - packed as MPS << 16 + INT
+ * Answer:
+ * - EOK - reservation successful
+ * - ELIMIT - not enough bandwidth to satisfy the request
+ */
+ IPC_M_USBHC_REGISTER_ENDPOINT,
+
+ /** Revert endpoint registration.
+ * Parameters:
+ * - USB address
+ * - endpoint number
+ * - data direction
+ * Answer:
+ * - EOK - endpoint unregistered
+ * - ENOENT - unknown endpoint
+ */
+ IPC_M_USBHC_UNREGISTER_ENDPOINT,
+
+ /** Get data from device.
+ * See explanation at usb_iface_funcs_t (IN transaction).
+ */
+ IPC_M_USBHC_READ,
+
+ /** Send data to device.
+ * See explanation at usb_iface_funcs_t (OUT transaction).
+ */
+ IPC_M_USBHC_WRITE,
+} usbhc_iface_funcs_t;
+
+int usbhc_request_address(async_exch_t *exch, usb_address_t *address,
+ bool strict, usb_speed_t speed)
+{
+ if (!exch || !address)
+ return EINVAL;
+ sysarg_t new_address;
+ const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_REQUEST_ADDRESS, *address, strict, speed, &new_address);
+ if (ret == EOK)
+ *address = (usb_address_t)new_address;
+ return ret;
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_bind_address(async_exch_t *exch, usb_address_t address,
+ devman_handle_t handle)
+{
+ if (!exch)
+ return EINVAL;
+ return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_BIND_ADDRESS, address, handle);
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_get_handle(async_exch_t *exch, usb_address_t address,
+ devman_handle_t *handle)
+{
+ if (!exch)
+ return EINVAL;
+ sysarg_t h;
+ const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, address, &h);
+ if (ret == EOK && handle)
+ *handle = (devman_handle_t)h;
+ return ret;
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_release_address(async_exch_t *exch, usb_address_t address)
+{
+ if (!exch)
+ return EINVAL;
+ return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_RELEASE_ADDRESS, address);
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_register_endpoint(async_exch_t *exch, usb_address_t address,
+ usb_endpoint_t endpoint, usb_transfer_type_t type,
+ usb_direction_t direction, size_t mps, unsigned interval)
+{
+ if (!exch)
+ return EINVAL;
+ const usb_target_t target =
+ {{ .address = address, .endpoint = endpoint }};
+#define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff))
+
+ return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_REGISTER_ENDPOINT, target.packed,
+ _PACK2(type, direction), _PACK2(mps, interval));
+
+#undef _PACK2
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_unregister_endpoint(async_exch_t *exch, usb_address_t address,
+ usb_endpoint_t endpoint, usb_direction_t direction)
+{
+ if (!exch)
+ return EINVAL;
+ return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction);
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_read(async_exch_t *exch, usb_address_t address,
+ usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
+ size_t *rec_size)
+{
+ if (size == 0 && setup == 0)
+ return EOK;
+
+ if (!exch)
+ return EINVAL;
+ const usb_target_t target =
+ {{ .address = address, .endpoint = endpoint }};
+
+ /* Make call identifying target USB device and type of transfer. */
+ aid_t opening_request = async_send_4(exch,
+ DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_READ, target.packed,
+ (setup & UINT32_MAX), (setup >> 32), NULL);
+
+ if (opening_request == 0) {
+ return ENOMEM;
+ }
+
+ /* Retrieve the data. */
+ ipc_call_t data_request_call;
+ aid_t data_request =
+ async_data_read(exch, data, size, &data_request_call);
+
+ if (data_request == 0) {
+ // FIXME: How to let the other side know that we want to abort?
+ async_wait_for(opening_request, NULL);
+ return ENOMEM;
+ }
+
+ /* Wait for the answer. */
+ sysarg_t data_request_rc;
+ sysarg_t opening_request_rc;
+ async_wait_for(data_request, &data_request_rc);
+ async_wait_for(opening_request, &opening_request_rc);
+
+ if (data_request_rc != EOK) {
+ /* Prefer the return code of the opening request. */
+ if (opening_request_rc != EOK) {
+ return (int) opening_request_rc;
+ } else {
+ return (int) data_request_rc;
+ }
+ }
+ if (opening_request_rc != EOK) {
+ return (int) opening_request_rc;
+ }
+
+ *rec_size = IPC_GET_ARG2(data_request_call);
+ return EOK;
+}
+/*----------------------------------------------------------------------------*/
+int usbhc_write(async_exch_t *exch, usb_address_t address,
+ usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
+{
+ if (size == 0 && setup == 0)
+ return EOK;
+
+ if (!exch)
+ return EINVAL;
+ const usb_target_t target =
+ {{ .address = address, .endpoint = endpoint }};
+
+ aid_t opening_request = async_send_5(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
+ IPC_M_USBHC_WRITE, target.packed, size,
+ (setup & UINT32_MAX), (setup >> 32), NULL);
+
+ if (opening_request == 0) {
+ return ENOMEM;
+ }
+
+ /* Send the data if any. */
+ if (size > 0) {
+ const int ret = async_data_write_start(exch, data, size);
+ if (ret != EOK) {
+ async_wait_for(opening_request, NULL);
+ return ret;
+ }
+ }
+
+ /* Wait for the answer. */
+ sysarg_t opening_request_rc;
+ async_wait_for(opening_request, &opening_request_rc);
+
+ return (int) opening_request_rc;
+}
+/*----------------------------------------------------------------------------*/
+
static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-static void remote_usbhc_find_by_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
+static void remote_usbhc_get_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
@@ -57,5 +336,5 @@
[IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,
[IPC_M_USBHC_BIND_ADDRESS] = remote_usbhc_bind_address,
- [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_find_by_address,
+ [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_get_handle,
[IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
@@ -78,5 +357,4 @@
ipc_callid_t data_caller;
void *buffer;
- size_t size;
} async_transaction_t;
@@ -103,13 +381,12 @@
trans->data_caller = 0;
trans->buffer = NULL;
- trans->size = 0;
return trans;
}
-
+/*----------------------------------------------------------------------------*/
void remote_usbhc_request_address(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
+ const usbhc_iface_t *usb_iface = iface;
if (!usb_iface->request_address) {
@@ -129,9 +406,9 @@
}
}
-
+/*----------------------------------------------------------------------------*/
void remote_usbhc_bind_address(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
+ const usbhc_iface_t *usb_iface = iface;
if (!usb_iface->bind_address) {
@@ -140,37 +417,36 @@
}
- usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
- devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call);
-
- int rc = usb_iface->bind_address(fun, address, handle);
-
- async_answer_0(callid, rc);
-}
-
-void remote_usbhc_find_by_address(ddf_fun_t *fun, void *iface,
+ const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
+ const devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call);
+
+ const int ret = usb_iface->bind_address(fun, address, handle);
+ async_answer_0(callid, ret);
+}
+/*----------------------------------------------------------------------------*/
+void remote_usbhc_get_handle(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
-
- if (!usb_iface->find_by_address) {
- async_answer_0(callid, ENOTSUP);
- return;
- }
-
- usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
+ const usbhc_iface_t *usb_iface = iface;
+
+ if (!usb_iface->get_handle) {
+ async_answer_0(callid, ENOTSUP);
+ return;
+ }
+
+ const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
devman_handle_t handle;
- int rc = usb_iface->find_by_address(fun, address, &handle);
-
- if (rc == EOK) {
- async_answer_1(callid, EOK, handle);
+ const int ret = usb_iface->get_handle(fun, address, &handle);
+
+ if (ret == EOK) {
+ async_answer_1(callid, ret, handle);
} else {
- async_answer_0(callid, rc);
- }
-}
-
+ async_answer_0(callid, ret);
+ }
+}
+/*----------------------------------------------------------------------------*/
void remote_usbhc_release_address(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
- usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
+ const usbhc_iface_t *usb_iface = iface;
if (!usb_iface->release_address) {
@@ -179,16 +455,14 @@
}
- usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
-
- int rc = usb_iface->release_address(fun, address);
-
- async_answer_0(callid, rc);
-}
-
-
+ const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
+
+ const int ret = usb_iface->release_address(fun, address);
+ async_answer_0(callid, ret);
+}
+/*----------------------------------------------------------------------------*/
static void callback_out(ddf_fun_t *fun,
int outcome, void *arg)
{
- async_transaction_t *trans = (async_transaction_t *)arg;
+ async_transaction_t *trans = arg;
async_answer_0(trans->caller, outcome);
@@ -196,5 +470,5 @@
async_transaction_destroy(trans);
}
-
+/*----------------------------------------------------------------------------*/
static void callback_in(ddf_fun_t *fun,
int outcome, size_t actual_size, void *arg)
@@ -211,6 +485,4 @@
}
- trans->size = actual_size;
-
if (trans->data_caller) {
async_data_read_finalize(trans->data_caller,
@@ -222,5 +494,5 @@
async_transaction_destroy(trans);
}
-
+/*----------------------------------------------------------------------------*/
void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
@@ -300,10 +572,11 @@
}
- if (!async_data_read_receive(&trans->data_caller, &trans->size)) {
+ size_t size = 0;
+ if (!async_data_read_receive(&trans->data_caller, &size)) {
async_answer_0(callid, EPARTY);
return;
}
- trans->buffer = malloc(trans->size);
+ trans->buffer = malloc(size);
if (trans->buffer == NULL) {
async_answer_0(trans->data_caller, ENOMEM);
@@ -313,5 +586,5 @@
const int rc = hc_iface->read(
- fun, target, setup, trans->buffer, trans->size, callback_in, trans);
+ fun, target, setup, trans->buffer, size, callback_in, trans);
if (rc != EOK) {
@@ -321,5 +594,5 @@
}
}
-
+/*----------------------------------------------------------------------------*/
void remote_usbhc_write(
ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
@@ -348,8 +621,9 @@
}
+ size_t size = 0;
if (data_buffer_len > 0) {
- int rc = async_data_write_accept(&trans->buffer, false,
+ const int rc = async_data_write_accept(&trans->buffer, false,
1, USB_MAX_PAYLOAD_SIZE,
- 0, &trans->size);
+ 0, &size);
if (rc != EOK) {
@@ -360,6 +634,6 @@
}
- int rc = hc_iface->write(
- fun, target, setup, trans->buffer, trans->size, callback_out, trans);
+ const int rc = hc_iface->write(
+ fun, target, setup, trans->buffer, size, callback_out, trans);
if (rc != EOK) {
@@ -368,6 +642,4 @@
}
}
-
-
/**
* @}
Index: uspace/lib/drv/include/usb_iface.h
===================================================================
--- uspace/lib/drv/include/usb_iface.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/drv/include/usb_iface.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -39,60 +39,17 @@
#include "ddf/driver.h"
+#include
#include
-typedef enum {
- /** Tell USB address assigned to device.
- * Parameters:
- * - devman handle id
- * Answer:
- * - EINVAL - unknown handle or handle not managed by this driver
- * - ENOTSUP - operation not supported (shall not happen)
- * - arbitrary error code if returned by remote implementation
- * - EOK - handle found, first parameter contains the USB address
- *
- * The handle must be the one used for binding USB address with
- * it (IPC_M_USBHC_BIND_ADDRESS), otherwise the host controller
- * (that this request would eventually reach) would not be able
- * to find it.
- * The problem is that this handle is actually assigned to the
- * function inside driver of the parent device (usually hub driver).
- * To bypass this problem, the initial caller specify handle as
- * zero and the first parent assigns the actual value.
- * See usb_iface_get_address_hub_child_impl() implementation
- * that could be assigned to device ops of a child device of in a
- * hub driver.
- * For example, the USB multi interface device driver (MID)
- * passes this initial zero without any modification because the
- * handle must be resolved by its parent.
- */
- IPC_M_USB_GET_MY_ADDRESS,
- /** Tell interface number given device can use.
- * Parameters
- * - devman handle id of the device
- * Answer:
- * - ENOTSUP - operation not supported (can also mean any interface)
- * - EOK - operation okay, first parameter contains interface number
- */
- IPC_M_USB_GET_INTERFACE,
-
- /** Tell devman handle of device host controller.
- * Parameters:
- * - none
- * Answer:
- * - EOK - request processed without errors
- * - ENOTSUP - this indicates invalid USB driver
- * Parameters of the answer:
- * - devman handle of HC caller is physically connected to
- */
- IPC_M_USB_GET_HOST_CONTROLLER_HANDLE
-} usb_iface_funcs_t;
+int usb_get_my_address(async_exch_t *, usb_address_t *);
+int usb_get_my_interface(async_exch_t *, int *);
+int usb_get_hc_handle(async_exch_t *, devman_handle_t *);
/** USB device communication interface. */
typedef struct {
int (*get_my_address)(ddf_fun_t *, usb_address_t *);
- int (*get_interface)(ddf_fun_t *, devman_handle_t, int *);
+ int (*get_my_interface)(ddf_fun_t *, int *);
int (*get_hc_handle)(ddf_fun_t *, devman_handle_t *);
} usb_iface_t;
-
#endif
Index: uspace/lib/drv/include/usbhc_iface.h
===================================================================
--- uspace/lib/drv/include/usbhc_iface.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/drv/include/usbhc_iface.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -42,122 +42,16 @@
#include
-
-/** IPC methods for communication with HC through DDF interface.
- *
- * Notes for async methods:
- *
- * Methods for sending data to device (OUT transactions)
- * - e.g. IPC_M_USBHC_INTERRUPT_OUT -
- * always use the same semantics:
- * - first, IPC call with given method is made
- * - argument #1 is target address
- * - argument #2 is target endpoint
- * - argument #3 is max packet size of the endpoint
- * - this call is immediately followed by IPC data write (from caller)
- * - the initial call (and the whole transaction) is answer after the
- * transaction is scheduled by the HC and acknowledged by the device
- * or immediately after error is detected
- * - the answer carries only the error code
- *
- * Methods for retrieving data from device (IN transactions)
- * - e.g. IPC_M_USBHC_INTERRUPT_IN -
- * also use the same semantics:
- * - first, IPC call with given method is made
- * - argument #1 is target address
- * - argument #2 is target endpoint
- * - this call is immediately followed by IPC data read (async version)
- * - the call is not answered until the device returns some data (or until
- * error occurs)
- *
- * Some special methods (NO-DATA transactions) do not send any data. These
- * might behave as both OUT or IN transactions because communication parts
- * where actual buffers are exchanged are omitted.
- **
- * For all these methods, wrap functions exists. Important rule: functions
- * for IN transactions have (as parameters) buffers where retrieved data
- * will be stored. These buffers must be already allocated and shall not be
- * touch until the transaction is completed
- * (e.g. not before calling usb_wait_for() with appropriate handle).
- * OUT transactions buffers can be freed immediately after call is dispatched
- * (i.e. after return from wrapping function).
- *
- */
-typedef enum {
- /** Asks for address assignment by host controller.
- * Answer:
- * - ELIMIT - host controller run out of address
- * - EOK - address assigned
- * Answer arguments:
- * - assigned address
- *
- * The address must be released by via IPC_M_USBHC_RELEASE_ADDRESS.
- */
- IPC_M_USBHC_REQUEST_ADDRESS,
-
- /** Bind USB address with devman handle.
- * Parameters:
- * - USB address
- * - devman handle
- * Answer:
- * - EOK - address binded
- * - ENOENT - address is not in use
- */
- IPC_M_USBHC_BIND_ADDRESS,
-
- /** Get handle binded with given USB address.
- * Parameters
- * - USB address
- * Answer:
- * - EOK - address binded, first parameter is the devman handle
- * - ENOENT - address is not in use at the moment
- */
- IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
-
- /** Release address in use.
- * Arguments:
- * - address to be released
- * Answer:
- * - ENOENT - address not in use
- * - EPERM - trying to release default USB address
- */
- IPC_M_USBHC_RELEASE_ADDRESS,
-
- /** Register endpoint attributes at host controller.
- * This is used to reserve portion of USB bandwidth.
- * When speed is invalid, speed of the device is used.
- * Parameters:
- * - USB address + endpoint number
- * - packed as ADDR << 16 + EP
- * - speed + transfer type + direction
- * - packed as ( SPEED << 8 + TYPE ) << 8 + DIR
- * - maximum packet size + interval (in milliseconds)
- * - packed as MPS << 16 + INT
- * Answer:
- * - EOK - reservation successful
- * - ELIMIT - not enough bandwidth to satisfy the request
- */
- IPC_M_USBHC_REGISTER_ENDPOINT,
-
- /** Revert endpoint registration.
- * Parameters:
- * - USB address
- * - endpoint number
- * - data direction
- * Answer:
- * - EOK - endpoint unregistered
- * - ENOENT - unknown endpoint
- */
- IPC_M_USBHC_UNREGISTER_ENDPOINT,
-
- /** Get data from device.
- * See explanation at usb_iface_funcs_t (IN transaction).
- */
- IPC_M_USBHC_READ,
-
- /** Send data to device.
- * See explanation at usb_iface_funcs_t (OUT transaction).
- */
- IPC_M_USBHC_WRITE,
-} usbhc_iface_funcs_t;
+int usbhc_request_address(async_exch_t *, usb_address_t *, bool, usb_speed_t);
+int usbhc_bind_address(async_exch_t *, usb_address_t, devman_handle_t);
+int usbhc_get_handle(async_exch_t *, usb_address_t, devman_handle_t *);
+int usbhc_release_address(async_exch_t *, usb_address_t);
+int usbhc_register_endpoint(async_exch_t *, usb_address_t, usb_endpoint_t,
+ usb_transfer_type_t, usb_direction_t, size_t, unsigned int);
+int usbhc_unregister_endpoint(async_exch_t *, usb_address_t, usb_endpoint_t,
+ usb_direction_t);
+int usbhc_read(async_exch_t *, usb_address_t, usb_endpoint_t,
+ uint64_t, void *, size_t, size_t *);
+int usbhc_write(async_exch_t *, usb_address_t, usb_endpoint_t,
+ uint64_t, const void *, size_t);
/** Callback for outgoing transfer. */
@@ -172,5 +66,6 @@
int (*request_address)(ddf_fun_t *, usb_address_t *, bool, usb_speed_t);
int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t);
- int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *);
+ int (*get_handle)(ddf_fun_t *, usb_address_t,
+ devman_handle_t *);
int (*release_address)(ddf_fun_t *, usb_address_t);
Index: uspace/lib/usb/src/ddfiface.c
===================================================================
--- uspace/lib/usb/src/ddfiface.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usb/src/ddfiface.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -36,4 +36,5 @@
#include
#include
+#include
#include
#include
@@ -104,19 +105,15 @@
async_exch_t *exch = async_exchange_begin(parent_sess);
+ if (!exch) {
+ async_hangup(parent_sess);
+ return ENOMEM;
+ }
- sysarg_t addr;
- int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
- IPC_M_USB_GET_MY_ADDRESS, &addr);
+ const int ret = usb_get_my_address(exch, address);
async_exchange_end(exch);
async_hangup(parent_sess);
- if (rc != EOK)
- return rc;
-
- if (address != NULL)
- *address = (usb_address_t) addr;
-
- return EOK;
+ return ret;
}
Index: uspace/lib/usb/src/hc.c
===================================================================
--- uspace/lib/usb/src/hc.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usb/src/hc.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -153,18 +153,11 @@
if (!usb_hc_connection_is_opened(connection))
return ENOENT;
-
+
async_exch_t *exch = async_exchange_begin(connection->hc_sess);
-
- sysarg_t tmp;
- int rc = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
- address, &tmp);
-
+ if (!exch)
+ return ENOMEM;
+ const int ret = usbhc_get_handle(exch, address, handle);
async_exchange_end(exch);
-
- if ((rc == EOK) && (handle != NULL))
- *handle = tmp;
-
- return rc;
+ return ret;
}
@@ -181,18 +174,20 @@
if (!parent_sess)
return ENOMEM;
-
+
async_exch_t *exch = async_exchange_begin(parent_sess);
-
- sysarg_t address;
- int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
- IPC_M_USB_GET_MY_ADDRESS, &address);
-
+ if (!exch) {
+ async_hangup(parent_sess);
+ return ENOMEM;
+ }
+ usb_address_t address;
+ const int ret = usb_get_my_address(exch, &address);
+
async_exchange_end(exch);
async_hangup(parent_sess);
-
- if (rc != EOK)
- return rc;
-
- return (usb_address_t) address;
+
+ if (ret != EOK)
+ return ret;
+
+ return address;
}
@@ -231,21 +226,16 @@
if (!parent_sess)
return ENOMEM;
-
+
async_exch_t *exch = async_exchange_begin(parent_sess);
-
- devman_handle_t h;
- int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
- IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
-
+ if (!exch) {
+ async_hangup(parent_sess);
+ return ENOMEM;
+ }
+ const int ret = usb_get_hc_handle(exch, hc_handle);
+
async_exchange_end(exch);
async_hangup(parent_sess);
-
- if (rc != EOK)
- return rc;
-
- if (hc_handle != NULL)
- *hc_handle = h;
-
- return EOK;
+
+ return ret;
}
Index: uspace/lib/usbdev/include/usb/dev/pipes.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/pipes.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/include/usb/dev/pipes.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -179,5 +179,5 @@
int usb_pipe_read(usb_pipe_t *, void *, size_t, size_t *);
-int usb_pipe_write(usb_pipe_t *, void *, size_t);
+int usb_pipe_write(usb_pipe_t *, const void *, size_t);
int usb_pipe_control_read(usb_pipe_t *, const void *, size_t,
Index: uspace/lib/usbdev/include/usb/dev/request.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/request.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/include/usb/dev/request.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -82,4 +82,6 @@
*/
uint8_t request_type;
+#define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
+
/** Request identification. */
uint8_t request;
Index: uspace/lib/usbdev/src/altiface.c
===================================================================
--- uspace/lib/usbdev/src/altiface.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/altiface.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -65,13 +65,11 @@
size_t alternate_count = 0;
- const uint8_t *iface_ptr = usb_dp_get_nested_descriptor(&dp_parser,
- &dp_data, config_descr);
+ const void *iface_ptr =
+ usb_dp_get_nested_descriptor(&dp_parser, &dp_data, config_descr);
while (iface_ptr != NULL) {
- usb_standard_interface_descriptor_t *iface
- = (usb_standard_interface_descriptor_t *) iface_ptr;
- if (iface->descriptor_type == USB_DESCTYPE_INTERFACE) {
- if (iface->interface_number == interface_no) {
- alternate_count++;
- }
+ const usb_standard_interface_descriptor_t *iface = iface_ptr;
+ if (iface->descriptor_type == USB_DESCTYPE_INTERFACE
+ && iface->interface_number == interface_no) {
+ ++alternate_count;
}
iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
@@ -82,10 +80,10 @@
}
-/** Create alternate interface representation structure.
+/** Initialize alternate interface representation structure.
*
+ * @param[in] alternates Pointer to allocated structure.
* @param[in] config_descr Configuration descriptor.
* @param[in] config_descr_size Size of configuration descriptor.
* @param[in] interface_number Interface number.
- * @param[out] alternates_ptr Where to store pointer to allocated structure.
* @return Error code.
*/
@@ -101,4 +99,5 @@
alternates->current = 0;
+ /* No interfaces. */
if (interface_number < 0) {
return EOK;
@@ -107,5 +106,5 @@
alternates->alternative_count
= usb_interface_count_alternates(config_descr, config_descr_size,
- interface_number);
+ interface_number);
if (alternates->alternative_count == 0) {
@@ -128,14 +127,20 @@
};
- usb_alternate_interface_descriptors_t *cur_alt_iface
+ usb_alternate_interface_descriptors_t *iterator
= &alternates->alternatives[0];
- const uint8_t *iface_ptr = usb_dp_get_nested_descriptor(&dp_parser,
- &dp_data, dp_data.data);
- while (iface_ptr != NULL) {
- usb_standard_interface_descriptor_t *iface
- = (usb_standard_interface_descriptor_t *) iface_ptr;
+ const usb_alternate_interface_descriptors_t *end
+ = &alternates->alternatives[alternates->alternative_count];
+
+ const void *iface_ptr =
+ usb_dp_get_nested_descriptor(&dp_parser, &dp_data, dp_data.data);
+
+ while (iface_ptr != NULL && iterator < end) {
+ const usb_standard_interface_descriptor_t *iface = iface_ptr;
+
if ((iface->descriptor_type != USB_DESCTYPE_INTERFACE)
|| (iface->interface_number != interface_number)) {
+ /* This is not a valid alternate interface descriptor
+ * for interface with number == interface_number. */
iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser,
&dp_data, dp_data.data, iface_ptr);
@@ -143,20 +148,18 @@
}
- cur_alt_iface->interface = iface;
- cur_alt_iface->nested_descriptors = iface_ptr + sizeof(*iface);
+ iterator->interface = iface;
+ iterator->nested_descriptors = iface_ptr + sizeof(*iface);
/* Find next interface to count size of nested descriptors. */
iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
dp_data.data, iface_ptr);
- if (iface_ptr == NULL) {
- const uint8_t *next = dp_data.data + dp_data.size;
- cur_alt_iface->nested_descriptors_size
- = next - cur_alt_iface->nested_descriptors;
- } else {
- cur_alt_iface->nested_descriptors_size
- = iface_ptr - cur_alt_iface->nested_descriptors;
- }
- cur_alt_iface++;
+ const uint8_t *next = (iface_ptr == NULL) ?
+ dp_data.data + dp_data.size : iface_ptr;
+
+ iterator->nested_descriptors_size
+ = next - iterator->nested_descriptors;
+
+ ++iterator;
}
Index: uspace/lib/usbdev/src/devpoll.c
===================================================================
--- uspace/lib/usbdev/src/devpoll.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/devpoll.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -46,11 +46,5 @@
/** Data needed for polling. */
typedef struct {
- int debug;
- size_t max_failures;
- useconds_t delay;
- bool auto_clear_halt;
- bool (*on_data)(usb_device_t *, uint8_t *, size_t, void *);
- void (*on_polling_end)(usb_device_t *, bool, void *);
- bool (*on_error)(usb_device_t *, int, void *);
+ usb_device_auto_polling_t auto_polling;
usb_device_t *dev;
@@ -69,38 +63,38 @@
static int polling_fibril(void *arg)
{
- polling_data_t *polling_data = (polling_data_t *) arg;
- assert(polling_data);
+ assert(arg);
+ const polling_data_t *data = arg;
+ /* Helper to reduce typing. */
+ const usb_device_auto_polling_t *params = &data->auto_polling;
usb_pipe_t *pipe
- = &polling_data->dev->pipes[polling_data->pipe_index].pipe;
-
- if (polling_data->debug > 0) {
- usb_endpoint_mapping_t *mapping
- = &polling_data->dev->pipes[polling_data->pipe_index];
+ = &data->dev->pipes[data->pipe_index].pipe;
+
+ if (params->debug > 0) {
+ const usb_endpoint_mapping_t *mapping
+ = &data->dev->pipes[data->pipe_index];
usb_log_debug("Poll%p: started polling of `%s' - " \
"interface %d (%s,%d,%d), %zuB/%zu.\n",
- polling_data,
- polling_data->dev->ddf_dev->name,
+ data, data->dev->ddf_dev->name,
(int) mapping->interface->interface_number,
usb_str_class(mapping->interface->interface_class),
(int) mapping->interface->interface_subclass,
(int) mapping->interface->interface_protocol,
- polling_data->request_size, pipe->max_packet_size);
- }
-
+ data->request_size, pipe->max_packet_size);
+ }
+
+ usb_pipe_start_long_transfer(pipe);
size_t failed_attempts = 0;
- while (failed_attempts <= polling_data->max_failures) {
- int rc;
-
+ while (failed_attempts <= params->max_failures) {
size_t actual_size;
- rc = usb_pipe_read(pipe, polling_data->buffer,
- polling_data->request_size, &actual_size);
-
- if (polling_data->debug > 1) {
+ const int rc = usb_pipe_read(pipe, data->buffer,
+ data->request_size, &actual_size);
+
+ if (params->debug > 1) {
if (rc == EOK) {
usb_log_debug(
"Poll%p: received: '%s' (%zuB).\n",
- polling_data,
- usb_debug_str_buffer(polling_data->buffer,
+ data,
+ usb_debug_str_buffer(data->buffer,
actual_size, 16),
actual_size);
@@ -108,10 +102,10 @@
usb_log_debug(
"Poll%p: polling failed: %s.\n",
- polling_data, str_error(rc));
+ data, str_error(rc));
}
}
/* If the pipe stalled, we can try to reset the stall. */
- if ((rc == ESTALL) && (polling_data->auto_clear_halt)) {
+ if ((rc == ESTALL) && (params->auto_clear_halt)) {
/*
* We ignore error here as this is usually a futile
@@ -119,28 +113,24 @@
*/
usb_request_clear_endpoint_halt(
- &polling_data->dev->ctrl_pipe,
- pipe->endpoint_no);
+ &data->dev->ctrl_pipe, pipe->endpoint_no);
}
if (rc != EOK) {
- if (polling_data->on_error != NULL) {
- bool cont = polling_data->on_error(
- polling_data->dev, rc,
- polling_data->custom_arg);
- if (!cont) {
- failed_attempts
- = polling_data->max_failures;
- }
+ ++failed_attempts;
+ const bool cont = (params->on_error == NULL) ? true :
+ params->on_error(data->dev, rc, data->custom_arg);
+ if (!cont) {
+ failed_attempts = params->max_failures;
}
- failed_attempts++;
continue;
}
/* We have the data, execute the callback now. */
- bool carry_on = polling_data->on_data(polling_data->dev,
- polling_data->buffer, actual_size,
- polling_data->custom_arg);
+ assert(params->on_data);
+ const bool carry_on = params->on_data(
+ data->dev, data->buffer, actual_size, data->custom_arg);
if (!carry_on) {
+ /* This is user requested abort, erases failures. */
failed_attempts = 0;
break;
@@ -151,29 +141,28 @@
/* Take a rest before next request. */
- async_usleep(polling_data->delay);
- }
-
- if (polling_data->on_polling_end != NULL) {
- polling_data->on_polling_end(polling_data->dev,
- failed_attempts > 0, polling_data->custom_arg);
- }
-
- if (polling_data->debug > 0) {
- if (failed_attempts > 0) {
- usb_log_error(
- "Polling of device `%s' terminated: %s.\n",
- polling_data->dev->ddf_dev->name,
- "recurring failures");
+ async_usleep(params->delay);
+ }
+
+ usb_pipe_end_long_transfer(pipe);
+
+ const bool failed = failed_attempts > 0;
+
+ if (params->on_polling_end != NULL) {
+ params->on_polling_end(data->dev, failed, data->custom_arg);
+ }
+
+ if (params->debug > 0) {
+ if (failed) {
+ usb_log_error("Polling of device `%s' terminated: "
+ "recurring failures.\n", data->dev->ddf_dev->name);
} else {
- usb_log_debug(
- "Polling of device `%s' terminated by user.\n",
- polling_data->dev->ddf_dev->name
- );
+ usb_log_debug("Polling of device `%s' terminated: "
+ "driver request.\n", data->dev->ddf_dev->name);
}
}
/* Free the allocated memory. */
- free(polling_data->buffer);
- free(polling_data);
+ free(data->buffer);
+ free(data);
return EOK;
@@ -202,15 +191,4 @@
usb_polling_terminted_callback_t terminated_callback, void *arg)
{
- if ((dev == NULL) || (callback == NULL)) {
- return EBADMEM;
- }
- if (request_size == 0) {
- return EINVAL;
- }
- if ((dev->pipes[pipe_index].pipe.transfer_type != USB_TRANSFER_INTERRUPT)
- || (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) {
- return EINVAL;
- }
-
const usb_device_auto_polling_t auto_polling = {
.debug = 1,
@@ -248,8 +226,9 @@
size_t request_size, void *arg)
{
- if (dev == NULL) {
+ if ((dev == NULL) || (polling == NULL) || (polling->on_data == NULL)) {
return EBADMEM;
}
- if (pipe_index >= dev->pipes_count) {
+
+ if (pipe_index >= dev->pipes_count || request_size == 0) {
return EINVAL;
}
@@ -257,7 +236,4 @@
|| (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) {
return EINVAL;
- }
- if ((polling == NULL) || (polling->on_data == NULL)) {
- return EBADMEM;
}
@@ -278,17 +254,12 @@
polling_data->custom_arg = arg;
- polling_data->debug = polling->debug;
- polling_data->max_failures = polling->max_failures;
- if (polling->delay >= 0) {
- polling_data->delay = (useconds_t) polling->delay;
- } else {
- polling_data->delay = (useconds_t) dev->pipes[pipe_index]
- .descriptor->poll_interval;
- }
- polling_data->auto_clear_halt = polling->auto_clear_halt;
-
- polling_data->on_data = polling->on_data;
- polling_data->on_polling_end = polling->on_polling_end;
- polling_data->on_error = polling->on_error;
+ /* Copy provided settings. */
+ polling_data->auto_polling = *polling;
+
+ /* Negative value means use descriptor provided value. */
+ if (polling->delay < 0) {
+ polling_data->auto_polling.delay =
+ (int) dev->pipes[pipe_index].descriptor->poll_interval;
+ }
fid_t fibril = fibril_create(polling_fibril, polling_data);
Index: uspace/lib/usbdev/src/hub.c
===================================================================
--- uspace/lib/usbdev/src/hub.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/hub.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -76,17 +76,14 @@
{
CHECK_CONNECTION(connection);
-
+
async_exch_t *exch = async_exchange_begin(connection->hc_sess);
-
- sysarg_t address;
- int rc = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_REQUEST_ADDRESS, preferred, strict, speed, &address);
-
+ if (!exch)
+ return (usb_address_t)ENOMEM;
+
+ usb_address_t address = preferred;
+ const int ret = usbhc_request_address(exch, &address, strict, speed);
+
async_exchange_end(exch);
-
- if (rc != EOK)
- return (usb_address_t) rc;
-
- return (usb_address_t) address;
+ return ret == EOK ? address : ret;
}
@@ -97,19 +94,19 @@
* @return Error code.
*/
-int usb_hc_register_device(usb_hc_connection_t * connection,
+int usb_hc_register_device(usb_hc_connection_t *connection,
const usb_hub_attached_device_t *attached_device)
{
CHECK_CONNECTION(connection);
-
- if (attached_device == NULL)
- return EBADMEM;
-
+ if (attached_device == NULL || attached_device->fun == NULL)
+ return EINVAL;
+
async_exch_t *exch = async_exchange_begin(connection->hc_sess);
- int rc = async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_BIND_ADDRESS,
+ if (!exch)
+ return ENOMEM;
+ const int ret = usbhc_bind_address(exch,
attached_device->address, attached_device->fun->handle);
async_exchange_end(exch);
-
- return rc;
+
+ return ret;
}
@@ -124,11 +121,12 @@
{
CHECK_CONNECTION(connection);
-
+
async_exch_t *exch = async_exchange_begin(connection->hc_sess);
- int rc = async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_RELEASE_ADDRESS, address);
+ if (!exch)
+ return ENOMEM;
+ const int ret = usbhc_release_address(exch, address);
async_exchange_end(exch);
-
- return rc;
+
+ return ret;
}
@@ -221,6 +219,6 @@
* request or requests for descriptors when creating match ids).
*/
-int usb_hc_new_device_wrapper(ddf_dev_t *parent, usb_hc_connection_t *connection,
- usb_speed_t dev_speed,
+int usb_hc_new_device_wrapper(ddf_dev_t *parent,
+ usb_hc_connection_t *connection, usb_speed_t dev_speed,
int (*enable_port)(void *arg), void *arg, usb_address_t *assigned_address,
ddf_dev_ops_t *dev_ops, void *new_dev_data, ddf_fun_t **new_fun)
@@ -229,10 +227,7 @@
return EINVAL;
- // FIXME: this is awful, we are accessing directly the structure.
// TODO: Why not use provided connection?
- usb_hc_connection_t hc_conn = {
- .hc_handle = connection->hc_handle,
- .hc_sess = NULL
- };
+ usb_hc_connection_t hc_conn;
+ usb_hc_connection_initialize(&hc_conn, connection->hc_handle);
int rc;
Index: uspace/lib/usbdev/src/pipepriv.c
===================================================================
--- uspace/lib/usbdev/src/pipepriv.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/pipepriv.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -87,4 +87,5 @@
if (pipe->refcount == 0) {
+ assert(pipe->hc_sess == NULL);
/* Need to open the phone by ourselves. */
async_sess_t *sess =
Index: uspace/lib/usbdev/src/pipes.c
===================================================================
--- uspace/lib/usbdev/src/pipes.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/pipes.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -54,16 +54,15 @@
static usb_address_t get_my_address(async_sess_t *sess, const ddf_dev_t *dev)
{
+ assert(sess);
async_exch_t *exch = async_exchange_begin(sess);
-
- sysarg_t address;
- int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
- IPC_M_USB_GET_MY_ADDRESS, &address);
-
+ if (!exch)
+ return ENOMEM;
+
+ usb_address_t address;
+ const int ret = usb_get_my_address(exch, &address);
+
async_exchange_end(exch);
-
- if (rc != EOK)
- return rc;
-
- return (usb_address_t) address;
+
+ return (ret == EOK) ? address : ret;
}
@@ -71,5 +70,5 @@
*
* @param device Device in question.
- * @return Interface number (negative code means any).
+ * @return Error code (ENOTSUP means any).
*/
int usb_device_get_assigned_interface(const ddf_dev_t *device)
@@ -80,19 +79,16 @@
IPC_FLAG_BLOCKING);
if (!parent_sess)
- return -1;
-
+ return ENOMEM;
+
async_exch_t *exch = async_exchange_begin(parent_sess);
-
- sysarg_t iface_no;
- int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
- IPC_M_USB_GET_INTERFACE, device->handle, &iface_no);
-
- async_exchange_end(exch);
- async_hangup(parent_sess);
-
- if (rc != EOK)
- return -1;
-
- return (int) iface_no;
+ if (!exch) {
+ async_hangup(parent_sess);
+ return ENOMEM;
+ }
+
+ int iface_no;
+ const int ret = usb_get_my_interface(exch, &iface_no);
+
+ return ret == EOK ? iface_no : ret;
}
Index: uspace/lib/usbdev/src/pipesinit.c
===================================================================
--- uspace/lib/usbdev/src/pipesinit.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/pipesinit.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -54,5 +54,5 @@
/** Nesting pairs of standard descriptors. */
-static usb_dp_descriptor_nesting_t descriptor_nesting[] = {
+static const usb_dp_descriptor_nesting_t descriptor_nesting[] = {
NESTING(CONFIGURATION, INTERFACE),
NESTING(INTERFACE, ENDPOINT),
@@ -405,9 +405,4 @@
}
-#define TRY_LOOP(attempt_var) \
- for (attempt_var = 0; attempt_var < 3; attempt_var++)
-
- size_t failed_attempts;
- int rc;
usb_pipe_start_long_transfer(pipe);
@@ -415,5 +410,6 @@
uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE];
size_t transferred_size;
- TRY_LOOP(failed_attempts) {
+ int rc;
+ for (size_t attempt_var = 0; attempt_var < 3; ++attempt_var) {
rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD,
USB_REQUEST_RECIPIENT_DEVICE, USB_DESCTYPE_DEVICE,
@@ -450,22 +446,18 @@
{
assert(pipe);
+ assert(pipe->wire);
assert(hc_connection);
if (!usb_hc_connection_is_opened(hc_connection))
return EBADF;
-
- const usb_target_t target =
- {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
-#define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff))
-
async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess);
- int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_REGISTER_ENDPOINT, target.packed,
- _PACK2(pipe->transfer_type, pipe->direction),
- _PACK2(pipe->max_packet_size, interval));
+ if (!exch)
+ return ENOMEM;
+ const int ret = usbhc_register_endpoint(exch,
+ pipe->wire->address, pipe->endpoint_no, pipe->transfer_type,
+ pipe->direction, pipe->max_packet_size, interval);
+
async_exchange_end(exch);
-
-#undef _PACK2
- return rc;
+ return ret;
}
@@ -482,15 +474,16 @@
assert(pipe->wire);
assert(hc_connection);
-
+
if (!usb_hc_connection_is_opened(hc_connection))
return EBADF;
-
+
async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess);
- int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_UNREGISTER_ENDPOINT,
+ if (!exch)
+ return ENOMEM;
+ const int ret = usbhc_unregister_endpoint(exch,
pipe->wire->address, pipe->endpoint_no, pipe->direction);
async_exchange_end(exch);
-
- return rc;
+
+ return ret;
}
Index: uspace/lib/usbdev/src/pipesio.c
===================================================================
--- uspace/lib/usbdev/src/pipesio.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/pipesio.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -62,135 +62,34 @@
* @return Error code.
*/
-static int usb_pipe_read_no_checks(usb_pipe_t *pipe,
+static int usb_pipe_read_no_check(usb_pipe_t *pipe, uint64_t setup,
void *buffer, size_t size, size_t *size_transfered)
{
- /* Only interrupt and bulk transfers are supported */
+ /* Isochronous transfer are not supported (yet) */
if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
- pipe->transfer_type != USB_TRANSFER_BULK)
+ pipe->transfer_type != USB_TRANSFER_BULK &&
+ pipe->transfer_type != USB_TRANSFER_CONTROL)
return ENOTSUP;
- const usb_target_t target =
- {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
-
+ int ret = pipe_add_ref(pipe, false);
+ if (ret != EOK) {
+ return ret;
+ }
+
/* Ensure serialization over the phone. */
pipe_start_transaction(pipe);
async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
-
- /*
- * Make call identifying target USB device and type of transfer.
- */
- aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_READ, target.packed, NULL);
-
- if (opening_request == 0) {
- async_exchange_end(exch);
+ if (!exch) {
pipe_end_transaction(pipe);
+ pipe_drop_ref(pipe);
return ENOMEM;
}
-
- /*
- * Retrieve the data.
- */
- ipc_call_t data_request_call;
- aid_t data_request = async_data_read(exch, buffer, size,
- &data_request_call);
-
- /*
- * Since now on, someone else might access the backing phone
- * without breaking the transfer IPC protocol.
- */
+
+ ret = usbhc_read(exch, pipe->wire->address, pipe->endpoint_no,
+ setup, buffer, size, size_transfered);
async_exchange_end(exch);
pipe_end_transaction(pipe);
-
- if (data_request == 0) {
- /*
- * FIXME:
- * How to let the other side know that we want to abort?
- */
- async_wait_for(opening_request, NULL);
- return ENOMEM;
- }
-
- /*
- * Wait for the answer.
- */
- sysarg_t data_request_rc;
- sysarg_t opening_request_rc;
- async_wait_for(data_request, &data_request_rc);
- async_wait_for(opening_request, &opening_request_rc);
-
- if (data_request_rc != EOK) {
- /* Prefer the return code of the opening request. */
- if (opening_request_rc != EOK) {
- return (int) opening_request_rc;
- } else {
- return (int) data_request_rc;
- }
- }
- if (opening_request_rc != EOK) {
- return (int) opening_request_rc;
- }
-
- *size_transfered = IPC_GET_ARG2(data_request_call);
-
- return EOK;
-}
-
-
-/** Request a read (in) transfer on an endpoint pipe.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[out] buffer Buffer where to store the data.
- * @param[in] size Size of the buffer (in bytes).
- * @param[out] size_transfered Number of bytes that were actually transfered.
- * @return Error code.
- */
-int usb_pipe_read(usb_pipe_t *pipe,
- void *buffer, size_t size, size_t *size_transfered)
-{
- assert(pipe);
-
- if (buffer == NULL) {
- return EINVAL;
- }
-
- if (size == 0) {
- return EINVAL;
- }
-
- if (pipe->direction != USB_DIRECTION_IN) {
- return EBADF;
- }
-
- if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
- return EBADF;
- }
-
- int rc;
- rc = pipe_add_ref(pipe, false);
- if (rc != EOK) {
- return rc;
- }
-
-
- size_t act_size = 0;
-
- rc = usb_pipe_read_no_checks(pipe, buffer, size, &act_size);
-
pipe_drop_ref(pipe);
-
- if (rc != EOK) {
- return rc;
- }
-
- if (size_transfered != NULL) {
- *size_transfered = act_size;
- }
-
- return EOK;
-}
-
-
-
+ return ret;
+}
/** Request an out transfer, no checking of input parameters.
@@ -201,97 +100,32 @@
* @return Error code.
*/
-static int usb_pipe_write_no_check(usb_pipe_t *pipe,
- void *buffer, size_t size)
+static int usb_pipe_write_no_check(usb_pipe_t *pipe, uint64_t setup,
+ const void *buffer, size_t size)
{
/* Only interrupt and bulk transfers are supported */
if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
- pipe->transfer_type != USB_TRANSFER_BULK)
+ pipe->transfer_type != USB_TRANSFER_BULK &&
+ pipe->transfer_type != USB_TRANSFER_CONTROL)
return ENOTSUP;
- const usb_target_t target =
- {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
+ int ret = pipe_add_ref(pipe, false);
+ if (ret != EOK) {
+ return ret;
+ }
/* Ensure serialization over the phone. */
pipe_start_transaction(pipe);
async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
-
- /*
- * Make call identifying target USB device and type of transfer.
- */
- aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_WRITE, target.packed, size, NULL);
-
- if (opening_request == 0) {
- async_exchange_end(exch);
+ if (!exch) {
pipe_end_transaction(pipe);
+ pipe_drop_ref(pipe);
return ENOMEM;
}
-
- /*
- * Send the data.
- */
- int rc = async_data_write_start(exch, buffer, size);
-
- /*
- * Since now on, someone else might access the backing phone
- * without breaking the transfer IPC protocol.
- */
+ ret = usbhc_write(exch, pipe->wire->address, pipe->endpoint_no,
+ setup, buffer, size);
async_exchange_end(exch);
pipe_end_transaction(pipe);
-
- if (rc != EOK) {
- async_wait_for(opening_request, NULL);
- return rc;
- }
-
- /*
- * Wait for the answer.
- */
- sysarg_t opening_request_rc;
- async_wait_for(opening_request, &opening_request_rc);
-
- return (int) opening_request_rc;
-}
-
-/** Request a write (out) transfer on an endpoint pipe.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] buffer Buffer with data to transfer.
- * @param[in] size Size of the buffer (in bytes).
- * @return Error code.
- */
-int usb_pipe_write(usb_pipe_t *pipe,
- void *buffer, size_t size)
-{
- assert(pipe);
-
- if (buffer == NULL) {
- return EINVAL;
- }
-
- if (size == 0) {
- return EINVAL;
- }
-
- if (pipe->direction != USB_DIRECTION_OUT) {
- return EBADF;
- }
-
- if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
- return EBADF;
- }
-
- int rc;
-
- rc = pipe_add_ref(pipe, false);
- if (rc != EOK) {
- return rc;
- }
-
- rc = usb_pipe_write_no_check(pipe, buffer, size);
-
pipe_drop_ref(pipe);
-
- return rc;
+ return ret;
}
@@ -309,5 +143,5 @@
- /* Prevent indefinite recursion. */
+ /* Prevent infinite recursion. */
pipe->auto_reset_halt = false;
usb_request_clear_endpoint_halt(pipe, 0);
@@ -315,6 +149,7 @@
}
-
-/** Request a control read transfer, no checking of input parameters.
+/** Request a control read transfer on an endpoint pipe.
+ *
+ * This function encapsulates all three stages of a control transfer.
*
* @param[in] pipe Pipe used for the transfer.
@@ -327,87 +162,4 @@
* @return Error code.
*/
-static int usb_pipe_control_read_no_check(usb_pipe_t *pipe,
- const void *setup_buffer, size_t setup_buffer_size,
- void *data_buffer, size_t data_buffer_size, size_t *data_transfered_size)
-{
- /* Ensure serialization over the phone. */
- pipe_start_transaction(pipe);
-
- const usb_target_t target =
- {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
-
- assert(setup_buffer_size == 8);
- uint64_t setup_packet;
- memcpy(&setup_packet, setup_buffer, 8);
- /*
- * Make call identifying target USB device and control transfer type.
- */
- async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
- aid_t opening_request = async_send_4(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_READ, target.packed,
- (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL);
-
- if (opening_request == 0) {
- async_exchange_end(exch);
- return ENOMEM;
- }
-
- /*
- * Retrieve the data.
- */
- ipc_call_t data_request_call;
- aid_t data_request = async_data_read(exch, data_buffer,
- data_buffer_size, &data_request_call);
-
- /*
- * Since now on, someone else might access the backing phone
- * without breaking the transfer IPC protocol.
- */
- async_exchange_end(exch);
- pipe_end_transaction(pipe);
-
- if (data_request == 0) {
- async_wait_for(opening_request, NULL);
- return ENOMEM;
- }
-
- /*
- * Wait for the answer.
- */
- sysarg_t data_request_rc;
- sysarg_t opening_request_rc;
- async_wait_for(data_request, &data_request_rc);
- async_wait_for(opening_request, &opening_request_rc);
-
- if (data_request_rc != EOK) {
- /* Prefer the return code of the opening request. */
- if (opening_request_rc != EOK) {
- return (int) opening_request_rc;
- } else {
- return (int) data_request_rc;
- }
- }
- if (opening_request_rc != EOK) {
- return (int) opening_request_rc;
- }
-
- *data_transfered_size = IPC_GET_ARG2(data_request_call);
-
- return EOK;
-}
-
-/** Request a control read transfer on an endpoint pipe.
- *
- * This function encapsulates all three stages of a control transfer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] setup_buffer Buffer with the setup packet.
- * @param[in] setup_buffer_size Size of the setup packet (in bytes).
- * @param[out] data_buffer Buffer for incoming data.
- * @param[in] data_buffer_size Size of the buffer for incoming data (in bytes).
- * @param[out] data_transfered_size Number of bytes that were actually
- * transfered during the DATA stage.
- * @return Error code.
- */
int usb_pipe_control_read(usb_pipe_t *pipe,
const void *setup_buffer, size_t setup_buffer_size,
@@ -416,5 +168,5 @@
assert(pipe);
- if ((setup_buffer == NULL) || (setup_buffer_size == 0)) {
+ if ((setup_buffer == NULL) || (setup_buffer_size != 8)) {
return EINVAL;
}
@@ -429,14 +181,9 @@
}
- int rc;
-
- rc = pipe_add_ref(pipe, false);
- if (rc != EOK) {
- return rc;
- }
+ uint64_t setup_packet;
+ memcpy(&setup_packet, setup_buffer, 8);
size_t act_size = 0;
- rc = usb_pipe_control_read_no_check(pipe,
- setup_buffer, setup_buffer_size,
+ const int rc = usb_pipe_read_no_check(pipe, setup_packet,
data_buffer, data_buffer_size, &act_size);
@@ -445,19 +192,14 @@
}
- pipe_drop_ref(pipe);
-
- if (rc != EOK) {
- return rc;
- }
-
- if (data_transfered_size != NULL) {
+ if (rc == EOK && data_transfered_size != NULL) {
*data_transfered_size = act_size;
}
- return EOK;
-}
-
-
-/** Request a control write transfer, no checking of input parameters.
+ return rc;
+}
+
+/** Request a control write transfer on an endpoint pipe.
+ *
+ * This function encapsulates all three stages of a control transfer.
*
* @param[in] pipe Pipe used for the transfer.
@@ -468,71 +210,4 @@
* @return Error code.
*/
-static int usb_pipe_control_write_no_check(usb_pipe_t *pipe,
- const void *setup_buffer, size_t setup_buffer_size,
- const void *data_buffer, size_t data_buffer_size)
-{
- /* Ensure serialization over the phone. */
- pipe_start_transaction(pipe);
-
- const usb_target_t target =
- {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
- assert(setup_buffer_size == 8);
- uint64_t setup_packet;
- memcpy(&setup_packet, setup_buffer, 8);
-
- /*
- * Make call identifying target USB device and control transfer type.
- */
- async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
- aid_t opening_request = async_send_5(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
- IPC_M_USBHC_WRITE, target.packed, data_buffer_size,
- (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL);
-
- if (opening_request == 0) {
- async_exchange_end(exch);
- pipe_end_transaction(pipe);
- return ENOMEM;
- }
-
- /*
- * Send the data (if any).
- */
- if (data_buffer_size > 0) {
- int rc = async_data_write_start(exch, data_buffer, data_buffer_size);
-
- /* All data sent, pipe can be released. */
- async_exchange_end(exch);
- pipe_end_transaction(pipe);
-
- if (rc != EOK) {
- async_wait_for(opening_request, NULL);
- return rc;
- }
- } else {
- /* No data to send, we can release the pipe for others. */
- async_exchange_end(exch);
- pipe_end_transaction(pipe);
- }
-
- /*
- * Wait for the answer.
- */
- sysarg_t opening_request_rc;
- async_wait_for(opening_request, &opening_request_rc);
-
- return (int) opening_request_rc;
-}
-
-/** Request a control write transfer on an endpoint pipe.
- *
- * This function encapsulates all three stages of a control transfer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] setup_buffer Buffer with the setup packet.
- * @param[in] setup_buffer_size Size of the setup packet (in bytes).
- * @param[in] data_buffer Buffer with data to be sent.
- * @param[in] data_buffer_size Size of the buffer with outgoing data (in bytes).
- * @return Error code.
- */
int usb_pipe_control_write(usb_pipe_t *pipe,
const void *setup_buffer, size_t setup_buffer_size,
@@ -541,5 +216,5 @@
assert(pipe);
- if ((setup_buffer == NULL) || (setup_buffer_size == 0)) {
+ if ((setup_buffer == NULL) || (setup_buffer_size != 8)) {
return EINVAL;
}
@@ -558,13 +233,9 @@
}
- int rc;
-
- rc = pipe_add_ref(pipe, false);
- if (rc != EOK) {
- return rc;
- }
-
- rc = usb_pipe_control_write_no_check(pipe,
- setup_buffer, setup_buffer_size, data_buffer, data_buffer_size);
+ uint64_t setup_packet;
+ memcpy(&setup_packet, setup_buffer, 8);
+
+ const int rc = usb_pipe_write_no_check(pipe, setup_packet,
+ data_buffer, data_buffer_size);
if (rc == ESTALL) {
@@ -572,9 +243,72 @@
}
- pipe_drop_ref(pipe);
-
return rc;
}
+/** Request a read (in) transfer on an endpoint pipe.
+ *
+ * @param[in] pipe Pipe used for the transfer.
+ * @param[out] buffer Buffer where to store the data.
+ * @param[in] size Size of the buffer (in bytes).
+ * @param[out] size_transfered Number of bytes that were actually transfered.
+ * @return Error code.
+ */
+int usb_pipe_read(usb_pipe_t *pipe,
+ void *buffer, size_t size, size_t *size_transfered)
+{
+ assert(pipe);
+
+ if (buffer == NULL) {
+ return EINVAL;
+ }
+
+ if (size == 0) {
+ return EINVAL;
+ }
+
+ if (pipe->direction != USB_DIRECTION_IN) {
+ return EBADF;
+ }
+
+ if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
+ return EBADF;
+ }
+
+ size_t act_size = 0;
+ const int rc = usb_pipe_read_no_check(pipe, 0, buffer, size, &act_size);
+
+
+ if (rc == EOK && size_transfered != NULL) {
+ *size_transfered = act_size;
+ }
+
+ return rc;
+}
+
+/** Request a write (out) transfer on an endpoint pipe.
+ *
+ * @param[in] pipe Pipe used for the transfer.
+ * @param[in] buffer Buffer with data to transfer.
+ * @param[in] size Size of the buffer (in bytes).
+ * @return Error code.
+ */
+int usb_pipe_write(usb_pipe_t *pipe, const void *buffer, size_t size)
+{
+ assert(pipe);
+
+ if (buffer == NULL || size == 0) {
+ return EINVAL;
+ }
+
+ if (pipe->direction != USB_DIRECTION_OUT) {
+ return EBADF;
+ }
+
+ if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
+ return EBADF;
+ }
+
+ return usb_pipe_write_no_check(pipe, 0, buffer, size);
+}
/**
Index: uspace/lib/usbdev/src/request.c
===================================================================
--- uspace/lib/usbdev/src/request.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbdev/src/request.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -143,16 +143,15 @@
*/
- usb_device_request_setup_packet_t setup_packet;
- setup_packet.request_type = 128 | (request_type << 5) | recipient;
- setup_packet.request = request;
- setup_packet.value = value;
- setup_packet.index = index;
- setup_packet.length = (uint16_t) data_size;
-
- int rc = usb_pipe_control_read(pipe,
- &setup_packet, sizeof(setup_packet),
+ const usb_device_request_setup_packet_t setup_packet = {
+ .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST
+ | (request_type << 5) | recipient,
+ .request = request,
+ .value = value,
+ .index = index,
+ .length = (uint16_t) data_size,
+ };
+
+ return usb_pipe_control_read(pipe, &setup_packet, sizeof(setup_packet),
data, data_size, actual_data_size);
-
- return rc;
}
@@ -276,5 +275,5 @@
}
- uint16_t wValue = descriptor_index | (descriptor_type << 8);
+ const uint16_t wValue = descriptor_index | (descriptor_type << 8);
return usb_control_request_get(pipe,
Index: uspace/lib/usbhost/include/usb/host/hcd.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/hcd.h (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbhost/include/usb/host/hcd.h (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -63,5 +63,5 @@
/*----------------------------------------------------------------------------*/
/** Initialize hcd_t structure.
- * Initializes device and endpoint managers. Sets data nd hook pointer to NULL.
+ * Initializes device and endpoint managers. Sets data and hook pointer to NULL.
* @param hcd hcd_t structure to initialize, non-null.
* @param bandwidth Available bandwidth, passed to endpoint manager.
Index: uspace/lib/usbhost/src/iface.c
===================================================================
--- uspace/lib/usbhost/src/iface.c (revision 07fd4cd12c13e7fea58e90f7cd905868c715f57c)
+++ uspace/lib/usbhost/src/iface.c (revision b8b1e6316d7aaa2e058c2099df2fd5541df4abaa)
@@ -252,5 +252,5 @@
.request_address = request_address,
.bind_address = bind_address,
- .find_by_address = find_by_address,
+ .get_handle = find_by_address,
.release_address = release_address,