|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] acpi: Move ACPI code to tools/libacpi
commit 73b72736e6cafdb040f97e29f36317622ffd64c5
Author: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Wed Sep 28 09:21:58 2016 -0400
Commit: Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Sep 28 14:32:05 2016 +0100
acpi: Move ACPI code to tools/libacpi
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
MAINTAINERS | 1 +
tools/firmware/hvmloader/Makefile | 14 +-
tools/firmware/hvmloader/acpi/COPYING | 480 -----------------
tools/firmware/hvmloader/acpi/Makefile | 91 ----
tools/firmware/hvmloader/acpi/README | 32 --
tools/firmware/hvmloader/acpi/acpi2_0.h | 461 ----------------
tools/firmware/hvmloader/acpi/build.c | 650 -----------------------
tools/firmware/hvmloader/acpi/dsdt.asl | 445 ----------------
tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl | 26 -
tools/firmware/hvmloader/acpi/gpl/COPYING | 22 -
tools/firmware/hvmloader/acpi/gpl/mk_dsdt_gpl.sh | 117 ----
tools/firmware/hvmloader/acpi/libacpi.h | 106 ----
tools/firmware/hvmloader/acpi/mk_dsdt.c | 435 ---------------
tools/firmware/hvmloader/acpi/ssdt_pm.asl | 418 ---------------
tools/firmware/hvmloader/acpi/ssdt_s3.asl | 28 -
tools/firmware/hvmloader/acpi/ssdt_s4.asl | 28 -
tools/firmware/hvmloader/acpi/ssdt_tpm.asl | 28 -
tools/firmware/hvmloader/acpi/static_tables.c | 168 ------
tools/firmware/hvmloader/ovmf.c | 2 +-
tools/firmware/rombios/32bit/Makefile | 2 +-
tools/firmware/rombios/32bit/tcgbios/Makefile | 2 +-
tools/libacpi/COPYING | 480 +++++++++++++++++
tools/libacpi/Makefile | 91 ++++
tools/libacpi/README | 32 ++
tools/libacpi/acpi2_0.h | 461 ++++++++++++++++
tools/libacpi/build.c | 650 +++++++++++++++++++++++
tools/libacpi/dsdt.asl | 445 ++++++++++++++++
tools/libacpi/dsdt_acpi_info.asl | 26 +
tools/libacpi/gpl/COPYING | 22 +
tools/libacpi/gpl/mk_dsdt_gpl.sh | 117 ++++
tools/libacpi/libacpi.h | 106 ++++
tools/libacpi/mk_dsdt.c | 435 +++++++++++++++
tools/libacpi/ssdt_pm.asl | 418 +++++++++++++++
tools/libacpi/ssdt_s3.asl | 28 +
tools/libacpi/ssdt_s4.asl | 28 +
tools/libacpi/ssdt_tpm.asl | 28 +
tools/libacpi/static_tables.c | 168 ++++++
37 files changed, 3547 insertions(+), 3544 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 8c5b756..377b695 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -138,6 +138,7 @@ S: Supported
F: xen/arch/x86/acpi/
F: xen/drivers/acpi/
F: xen/include/acpi/
+F: tools/libacpi/
AMD IOMMU
M: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
diff --git a/tools/firmware/hvmloader/Makefile
b/tools/firmware/hvmloader/Makefile
index 14ae341..77d7551 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -20,10 +20,7 @@
XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/firmware/Rules.mk
-export ACPI_BUILD_DIR=$(CURDIR)
-SUBDIRS := acpi
-# The HVM loader is started in 32-bit mode at the address below:
LOADADDR = 0x100000
# SMBIOS spec requires format mm/dd/yyyy
@@ -70,16 +67,20 @@ endif
export GPL := y
.PHONY: all
-all: subdirs-all
+all: acpi subdirs-all
$(MAKE) hvmloader
+.PHONY: acpi
+acpi:
+ $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR)
+
rombios.o: roms.inc
smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
-ACPI_PATH = acpi
+ACPI_PATH = ../../libacpi
ACPI_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
ACPI_OBJS = $(patsubst %.c,%.o,$(ACPI_FILES)) build.o static_tables.o
-$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"../util.h\"
+$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
CFLAGS += -I$(ACPI_PATH)
vpath build.c $(ACPI_PATH)
vpath static_tables.c $(ACPI_PATH)
@@ -121,6 +122,7 @@ endif
clean: subdirs-clean
rm -f roms.inc roms.inc.new acpi.h
rm -f hvmloader hvmloader.tmp *.o $(DEPS)
+ $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
.PHONY: distclean
distclean: clean
diff --git a/tools/firmware/hvmloader/acpi/COPYING
b/tools/firmware/hvmloader/acpi/COPYING
deleted file mode 100644
index 5f2f87e..0000000
--- a/tools/firmware/hvmloader/acpi/COPYING
+++ /dev/null
@@ -1,480 +0,0 @@
-This library is licensed under LGPL v2.1 to allow its usage in LGPL-2.1
-libraries such as libxl. Note that the only valid version of the LGPL as
-far as the files in this directory (and its subdirectories) are concerned
-is _this_ particular version of the license (i.e., *only* v2.1, not v2.2
-or v3.x, unless explicitly otherwise stated.
-
-Where clause 3 is invoked in order to relicense under the GPL then
-this shall be considered to be GPL v2 only for files which have
-specified LGPL v2.1 only.
-
-gpl sub-directory
-=================
-This directory contains a gpl sub-directory which contains code
-licensed under the GPL v2, because we have not yet been able to get
-the permission to relicense the relevant code to LGPL v2.1. See
-gpl/COPYING for more information.
-
-The makefile in this component allows to build a GPL and LGPL only
-variant of this library, the latter omits all GPL source code.
-
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-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 this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-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
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "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
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY 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
-LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
diff --git a/tools/firmware/hvmloader/acpi/Makefile
b/tools/firmware/hvmloader/acpi/Makefile
deleted file mode 100644
index 1340479..0000000
--- a/tools/firmware/hvmloader/acpi/Makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright (c) 2004, Intel Corporation.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published
-# by the Free Software Foundation; version 2.1 only. with the special
-# exception on linking described in file LICENSE.
-#
-# 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
-# NU Lesser General Public License for more details.
-#
-
-XEN_ROOT = $(CURDIR)/../../../..
-include $(XEN_ROOT)/tools/firmware/Rules.mk
-
-MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
-
-C_SRC-$(GPL) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
-C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, $(C_SRC-y))
-H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h
ssdt_tpm.h)
-
-# Suffix for temporary files.
-#
-# We will also use this suffix to workaround a bug in older iasl
-# versions where the tool will ignore everything after last '.' in the
-# path ('-p' argument). By adding ".<suffix>" we force iasl to use
-# complete $(ACPI_BUILD_DIR) as path, even if it has '.' symbols.
-TMP_SUFFIX = tmp
-
-vpath iasl $(PATH)
-all: $(C_SRC) $(H_SRC)
-
-$(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
- iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
- sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@
- rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
-
-$(MK_DSDT): mk_dsdt.c
- $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
-
-ifeq ($(GPL),y)
-$(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl
gpl/mk_dsdt_gpl.sh $(MK_DSDT)
- awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
- # Strip license comment
- sed -i '1,/\*\//{/\/\*/,/\*\//d}' $@.$(TMP_SUFFIX)
- $(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
- cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
- $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
- mv -f $@.$(TMP_SUFFIX) $@
-
-# NB. awk invocation is a portable alternative to 'head -n -1'
-$(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl
gpl/mk_dsdt_gpl.sh $(MK_DSDT)
- awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
- sed -i '1,/\*\//{/\/\*/,/\*\//d}' $@.$(TMP_SUFFIX)
- $(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
- cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
- $(MK_DSDT) --debug=$(debug) --maxcpu $* >> $@.$(TMP_SUFFIX)
- mv -f $@.$(TMP_SUFFIX) $@
-endif
-
-$(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl
- iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc
$(ACPI_BUILD_DIR)/$*.asl
- sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX)
- echo "int $*_len=sizeof($*);" >> $@.$(TMP_SUFFIX)
- mv -f $@.$(TMP_SUFFIX) $@
- rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
-
-iasl:
- @echo
- @echo "ACPI ASL compiler (iasl) is needed"
- @echo "Download and install Intel ACPI CA from"
- @echo "http://acpica.org/downloads/"
- @echo
- @exit 1
-
-build.o: ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h
-
-acpi.a: $(OBJS)
- $(AR) rc $@ $(OBJS)
-
-clean:
- rm -f $(C_SRC) $(H_SRC) $(MK_DSDT) $(C_SRC:=.$(TMP_SUFFIX))
- rm -f $(patsubst %.c,%.hex,$(C_SRC)) $(patsubst %.c,%.aml,$(C_SRC))
$(patsubst %.c,%.asl,$(C_SRC))
-
-distclean: clean
-
-install: all
-
--include $(DEPS)
diff --git a/tools/firmware/hvmloader/acpi/README
b/tools/firmware/hvmloader/acpi/README
deleted file mode 100644
index 2b9d6e1..0000000
--- a/tools/firmware/hvmloader/acpi/README
+++ /dev/null
@@ -1,32 +0,0 @@
-ACPI builder for domain firmware
-
-
-BUILDING ACPI
------------------
-Users of ACPI builder are expected to provide an include file that makes
available
-the following:
-* strncpy
-* printf
-* NULL
-* test_bit
-* offsetof
-
-When compiling build.c, the name of this include file should be given to
-compiler as -DLIBACPI_STDUTILS=\"<filename>\". See
tools/firmware/hvmloader/Makefile
-for an example.
-
-Note on DSDT Table
-------------------
-DSDT table source code is acpi_dsdt.asl
-It is already compiled and the output is acpi_dsdt.c
-Usually, user is not expected to change the acpi_dsdt.asl.
-In case that the acpi_dsdt.asl need to be updated, please
-Follow the instruction:
-
-# make acpi_dsdt.c
-
-Note:
-DSDT compiler "iasl" is needed. By default, it will be downloaded
-using wget in Makefile. if it failed, please download manually from
-http://developer.intel.com/technology/iapc/acpi/downloads.htm.
-then compile and install iasl
diff --git a/tools/firmware/hvmloader/acpi/acpi2_0.h
b/tools/firmware/hvmloader/acpi/acpi2_0.h
deleted file mode 100644
index 775eb7a..0000000
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * Copyright (c) 2004, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * 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 Lesser General Public License for more details.
- */
-#ifndef _ACPI_2_0_H_
-#define _ACPI_2_0_H_
-
-#include <stdint.h>
-#include <xen/xen.h>
-#include <xen/hvm/ioreq.h>
-
-#define ASCII32(a,b,c,d) \
- (((a) << 0) | ((b) << 8) | ((c) << 16) | ((d) << 24))
-#define ASCII64(a,b,c,d,e,f,g,h) \
- (((uint64_t)ASCII32(a,b,c,d)) | (((uint64_t)ASCII32(e,f,g,h)) << 32))
-
-#pragma pack (1)
-
-/*
- * Common ACPI header.
- */
-struct acpi_header {
- uint32_t signature;
- uint32_t length;
- uint8_t revision;
- uint8_t checksum;
- char oem_id[6];
- char oem_table_id[8];
- uint32_t oem_revision;
- uint32_t creator_id;
- uint32_t creator_revision;
-};
-
-#define ACPI_OEM_ID "Xen"
-#define ACPI_OEM_TABLE_ID "HVM"
-#define ACPI_OEM_REVISION 0
-
-#define ACPI_CREATOR_ID ASCII32('H','V','M','L') /* HVMLoader */
-#define ACPI_CREATOR_REVISION 0
-
-/*
- * ACPI 2.0 Generic Address Space definition.
- */
-struct acpi_20_generic_address {
- uint8_t address_space_id;
- uint8_t register_bit_width;
- uint8_t register_bit_offset;
- uint8_t reserved;
- uint64_t address;
-};
-
-/*
- * Generic Address Space Address IDs.
- */
-#define ACPI_SYSTEM_MEMORY 0
-#define ACPI_SYSTEM_IO 1
-#define ACPI_PCI_CONFIGURATION_SPACE 2
-#define ACPI_EMBEDDED_CONTROLLER 3
-#define ACPI_SMBUS 4
-#define ACPI_FUNCTIONAL_FIXED_HARDWARE 0x7F
-
-/*
- * Root System Description Pointer Structure in ACPI 1.0.
- */
-struct acpi_10_rsdp {
- uint64_t signature;
- uint8_t checksum;
- char oem_id[6];
- uint8_t reserved;
- uint32_t rsdt_address;
-};
-
-/*
- * Root System Description Pointer Structure.
- */
-struct acpi_20_rsdp {
- uint64_t signature;
- uint8_t checksum;
- char oem_id[6];
- uint8_t revision;
- uint32_t rsdt_address;
- uint32_t length;
- uint64_t xsdt_address;
- uint8_t extended_checksum;
- uint8_t reserved[3];
-};
-
-/*
- * Root System Description Table (RSDT).
- */
-struct acpi_20_rsdt {
- struct acpi_header header;
- uint32_t entry[1];
-};
-
-/*
- * Extended System Description Table (XSDT).
- */
-struct acpi_20_xsdt {
- struct acpi_header header;
- uint64_t entry[1];
-};
-
-/*
- * TCG Hardware Interface Table (TCPA)
- */
-struct acpi_20_tcpa {
- struct acpi_header header;
- uint16_t platform_class;
- uint32_t laml;
- uint64_t lasa;
-};
-#define ACPI_2_0_TCPA_LAML_SIZE (64*1024)
-
-/*
- * Fixed ACPI Description Table Structure (FADT) in ACPI 1.0.
- */
-struct acpi_10_fadt {
- struct acpi_header header;
- uint32_t firmware_ctrl;
- uint32_t dsdt;
- uint8_t reserved0;
- uint8_t preferred_pm_profile;
- uint16_t sci_int;
- uint32_t smi_cmd;
- uint8_t acpi_enable;
- uint8_t acpi_disable;
- uint8_t s4bios_req;
- uint8_t pstate_cnt;
- uint32_t pm1a_evt_blk;
- uint32_t pm1b_evt_blk;
- uint32_t pm1a_cnt_blk;
- uint32_t pm1b_cnt_blk;
- uint32_t pm2_cnt_blk;
- uint32_t pm_tmr_blk;
- uint32_t gpe0_blk;
- uint32_t gpe1_blk;
- uint8_t pm1_evt_len;
- uint8_t pm1_cnt_len;
- uint8_t pm2_cnt_len;
- uint8_t pm_tmr_len;
- uint8_t gpe0_blk_len;
- uint8_t gpe1_blk_len;
- uint8_t gpe1_base;
- uint8_t cst_cnt;
- uint16_t p_lvl2_lat;
- uint16_t p_lvl3_lat;
- uint16_t flush_size;
- uint16_t flush_stride;
- uint8_t duty_offset;
- uint8_t duty_width;
- uint8_t day_alrm;
- uint8_t mon_alrm;
- uint8_t century;
- uint16_t iapc_boot_arch;
- uint8_t reserved1;
- uint32_t flags;
-};
-
-/*
- * Fixed ACPI Description Table Structure (FADT).
- */
-struct acpi_20_fadt {
- struct acpi_header header;
- uint32_t firmware_ctrl;
- uint32_t dsdt;
- uint8_t reserved0;
- uint8_t preferred_pm_profile;
- uint16_t sci_int;
- uint32_t smi_cmd;
- uint8_t acpi_enable;
- uint8_t acpi_disable;
- uint8_t s4bios_req;
- uint8_t pstate_cnt;
- uint32_t pm1a_evt_blk;
- uint32_t pm1b_evt_blk;
- uint32_t pm1a_cnt_blk;
- uint32_t pm1b_cnt_blk;
- uint32_t pm2_cnt_blk;
- uint32_t pm_tmr_blk;
- uint32_t gpe0_blk;
- uint32_t gpe1_blk;
- uint8_t pm1_evt_len;
- uint8_t pm1_cnt_len;
- uint8_t pm2_cnt_len;
- uint8_t pm_tmr_len;
- uint8_t gpe0_blk_len;
- uint8_t gpe1_blk_len;
- uint8_t gpe1_base;
- uint8_t cst_cnt;
- uint16_t p_lvl2_lat;
- uint16_t p_lvl3_lat;
- uint16_t flush_size;
- uint16_t flush_stride;
- uint8_t duty_offset;
- uint8_t duty_width;
- uint8_t day_alrm;
- uint8_t mon_alrm;
- uint8_t century;
- uint16_t iapc_boot_arch;
- uint8_t reserved1;
- uint32_t flags;
- struct acpi_20_generic_address reset_reg;
- uint8_t reset_value;
- uint8_t reserved2[3];
- uint64_t x_firmware_ctrl;
- uint64_t x_dsdt;
- struct acpi_20_generic_address x_pm1a_evt_blk;
- struct acpi_20_generic_address x_pm1b_evt_blk;
- struct acpi_20_generic_address x_pm1a_cnt_blk;
- struct acpi_20_generic_address x_pm1b_cnt_blk;
- struct acpi_20_generic_address x_pm2_cnt_blk;
- struct acpi_20_generic_address x_pm_tmr_blk;
- struct acpi_20_generic_address x_gpe0_blk;
- struct acpi_20_generic_address x_gpe1_blk;
-};
-
-/*
- * FADT Boot Architecture Flags.
- */
-#define ACPI_LEGACY_DEVICES (1 << 0)
-#define ACPI_8042 (1 << 1)
-
-/*
- * FADT Fixed Feature Flags.
- */
-#define ACPI_WBINVD (1 << 0)
-#define ACPI_WBINVD_FLUSH (1 << 1)
-#define ACPI_PROC_C1 (1 << 2)
-#define ACPI_P_LVL2_UP (1 << 3)
-#define ACPI_PWR_BUTTON (1 << 4)
-#define ACPI_SLP_BUTTON (1 << 5)
-#define ACPI_FIX_RTC (1 << 6)
-#define ACPI_RTC_S4 (1 << 7)
-#define ACPI_TMR_VAL_EXT (1 << 8)
-#define ACPI_DCK_CAP (1 << 9)
-#define ACPI_RESET_REG_SUP (1 << 10)
-#define ACPI_SEALED_CASE (1 << 11)
-#define ACPI_HEADLESS (1 << 12)
-#define ACPI_CPU_SW_SLP (1 << 13)
-#define ACPI_USE_PLATFORM_CLOCK (1 << 15)
-
-/* PM1 Control Register Bits */
-#define ACPI_PM1C_SCI_EN (1 << 0)
-
-/*
- * Firmware ACPI Control Structure (FACS).
- */
-struct acpi_20_facs {
- uint32_t signature;
- uint32_t length;
- uint32_t hardware_signature;
- uint32_t firmware_waking_vector;
- uint32_t global_lock;
- uint32_t flags;
- uint64_t x_firmware_waking_vector;
- uint8_t version;
- uint8_t reserved[31];
-};
-
-#define ACPI_2_0_FACS_VERSION 0x01
-
-/*
- * Multiple APIC Description Table header definition (MADT).
- */
-struct acpi_20_madt {
- struct acpi_header header;
- uint32_t lapic_addr;
- uint32_t flags;
-};
-
-
-/*
- * HPET Description Table
- */
-struct acpi_20_hpet {
- struct acpi_header header;
- uint32_t timer_block_id;
- struct acpi_20_generic_address addr;
- uint8_t hpet_number;
- uint16_t min_tick;
- uint8_t page_protect;
-};
-#define ACPI_HPET_ADDRESS 0xFED00000UL
-
-/*
- * WAET Description Table
- */
-struct acpi_20_waet {
- struct acpi_header header;
- uint32_t flags;
-};
-
-/*
- * Multiple APIC Flags.
- */
-#define ACPI_PCAT_COMPAT (1 << 0)
-
-/*
- * Multiple APIC Description Table APIC structure types.
- */
-#define ACPI_PROCESSOR_LOCAL_APIC 0x00
-#define ACPI_IO_APIC 0x01
-#define ACPI_INTERRUPT_SOURCE_OVERRIDE 0x02
-#define ACPI_NON_MASKABLE_INTERRUPT_SOURCE 0x03
-#define ACPI_LOCAL_APIC_NMI 0x04
-#define ACPI_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
-#define ACPI_IO_SAPIC 0x06
-#define ACPI_PROCESSOR_LOCAL_SAPIC 0x07
-#define ACPI_PLATFORM_INTERRUPT_SOURCES 0x08
-
-/*
- * APIC Structure Definitions.
- */
-
-/*
- * Processor Local APIC Structure Definition.
- */
-struct acpi_20_madt_lapic {
- uint8_t type;
- uint8_t length;
- uint8_t acpi_processor_id;
- uint8_t apic_id;
- uint32_t flags;
-};
-
-/*
- * Local APIC Flags. All other bits are reserved and must be 0.
- */
-#define ACPI_LOCAL_APIC_ENABLED (1 << 0)
-
-/*
- * IO APIC Structure.
- */
-struct acpi_20_madt_ioapic {
- uint8_t type;
- uint8_t length;
- uint8_t ioapic_id;
- uint8_t reserved;
- uint32_t ioapic_addr;
- uint32_t gsi_base;
-};
-
-struct acpi_20_madt_intsrcovr {
- uint8_t type;
- uint8_t length;
- uint8_t bus;
- uint8_t source;
- uint32_t gsi;
- uint16_t flags;
-};
-
-/*
- * System Resource Affinity Table header definition (SRAT)
- */
-struct acpi_20_srat {
- struct acpi_header header;
- uint32_t table_revision;
- uint32_t reserved2[2];
-};
-
-#define ACPI_SRAT_TABLE_REVISION 1
-
-/*
- * System Resource Affinity Table structure types.
- */
-#define ACPI_PROCESSOR_AFFINITY 0x0
-#define ACPI_MEMORY_AFFINITY 0x1
-struct acpi_20_srat_processor {
- uint8_t type;
- uint8_t length;
- uint8_t domain;
- uint8_t apic_id;
- uint32_t flags;
- uint8_t sapic_id;
- uint8_t domain_hi[3];
- uint32_t reserved;
-};
-
-/*
- * Local APIC Affinity Flags. All other bits are reserved and must be 0.
- */
-#define ACPI_LOCAL_APIC_AFFIN_ENABLED (1 << 0)
-
-struct acpi_20_srat_memory {
- uint8_t type;
- uint8_t length;
- uint32_t domain;
- uint16_t reserved;
- uint64_t base_address;
- uint64_t mem_length;
- uint32_t reserved2;
- uint32_t flags;
- uint64_t reserved3;
-};
-
-/*
- * Memory Affinity Flags. All other bits are reserved and must be 0.
- */
-#define ACPI_MEM_AFFIN_ENABLED (1 << 0)
-#define ACPI_MEM_AFFIN_HOTPLUGGABLE (1 << 1)
-#define ACPI_MEM_AFFIN_NONVOLATILE (1 << 2)
-
-struct acpi_20_slit {
- struct acpi_header header;
- uint64_t localities;
- uint8_t entry[0];
-};
-
-/*
- * Table Signatures.
- */
-#define ACPI_2_0_RSDP_SIGNATURE ASCII64('R','S','D',' ','P','T','R',' ')
-#define ACPI_2_0_FACS_SIGNATURE ASCII32('F','A','C','S')
-#define ACPI_2_0_FADT_SIGNATURE ASCII32('F','A','C','P')
-#define ACPI_2_0_MADT_SIGNATURE ASCII32('A','P','I','C')
-#define ACPI_2_0_RSDT_SIGNATURE ASCII32('R','S','D','T')
-#define ACPI_2_0_XSDT_SIGNATURE ASCII32('X','S','D','T')
-#define ACPI_2_0_TCPA_SIGNATURE ASCII32('T','C','P','A')
-#define ACPI_2_0_HPET_SIGNATURE ASCII32('H','P','E','T')
-#define ACPI_2_0_WAET_SIGNATURE ASCII32('W','A','E','T')
-#define ACPI_2_0_SRAT_SIGNATURE ASCII32('S','R','A','T')
-#define ACPI_2_0_SLIT_SIGNATURE ASCII32('S','L','I','T')
-
-/*
- * Table revision numbers.
- */
-#define ACPI_2_0_RSDP_REVISION 0x02
-#define ACPI_2_0_FADT_REVISION 0x04
-#define ACPI_2_0_MADT_REVISION 0x02
-#define ACPI_2_0_RSDT_REVISION 0x01
-#define ACPI_2_0_XSDT_REVISION 0x01
-#define ACPI_2_0_TCPA_REVISION 0x02
-#define ACPI_2_0_HPET_REVISION 0x01
-#define ACPI_2_0_WAET_REVISION 0x01
-#define ACPI_1_0_FADT_REVISION 0x01
-#define ACPI_2_0_SRAT_REVISION 0x01
-#define ACPI_2_0_SLIT_REVISION 0x01
-
-#pragma pack ()
-
-#endif /* _ACPI_2_0_H_ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/tools/firmware/hvmloader/acpi/build.c
b/tools/firmware/hvmloader/acpi/build.c
deleted file mode 100644
index 6749c9b..0000000
--- a/tools/firmware/hvmloader/acpi/build.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Copyright (c) 2004, Intel Corporation.
- * Copyright (c) 2006, Keir Fraser, XenSource Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * 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 Lesser General Public License for more details.
- */
-
-#include LIBACPI_STDUTILS
-#include "acpi2_0.h"
-#include "libacpi.h"
-#include "ssdt_s3.h"
-#include "ssdt_s4.h"
-#include "ssdt_tpm.h"
-#include "ssdt_pm.h"
-#include <xen/hvm/hvm_info_table.h>
-#include <xen/hvm/hvm_xs_strings.h>
-#include <xen/hvm/params.h>
-#include <xen/memory.h>
-
-#define ACPI_MAX_SECONDARY_TABLES 16
-
-#define align16(sz) (((sz) + 15) & ~15)
-#define fixed_strcpy(d, s) strncpy((d), (s), sizeof(d))
-
-extern struct acpi_20_rsdp Rsdp;
-extern struct acpi_20_rsdt Rsdt;
-extern struct acpi_20_xsdt Xsdt;
-extern struct acpi_20_fadt Fadt;
-extern struct acpi_20_facs Facs;
-extern struct acpi_20_waet Waet;
-
-/*
- * Located at ACPI_INFO_PHYSICAL_ADDRESS.
- *
- * This must match the Field("BIOS"....) definition in the DSDT.
- */
-struct acpi_info {
- uint8_t com1_present:1; /* 0[0] - System has COM1? */
- uint8_t com2_present:1; /* 0[1] - System has COM2? */
- uint8_t lpt1_present:1; /* 0[2] - System has LPT1? */
- uint8_t hpet_present:1; /* 0[3] - System has HPET? */
- uint16_t nr_cpus; /* 2 - Number of CPUs */
- uint32_t pci_min, pci_len; /* 4, 8 - PCI I/O hole boundaries */
- uint32_t madt_csum_addr; /* 12 - Address of MADT checksum */
- uint32_t madt_lapic0_addr; /* 16 - Address of first MADT LAPIC struct */
- uint32_t vm_gid_addr; /* 20 - Address of VM generation id buffer */
- uint64_t pci_hi_min, pci_hi_len; /* 24, 32 - PCI I/O hole boundaries */
-};
-
-static void set_checksum(
- void *table, uint32_t checksum_offset, uint32_t length)
-{
- uint8_t *p, sum = 0;
-
- p = table;
- p[checksum_offset] = 0;
-
- while ( length-- )
- sum = sum + *p++;
-
- p = table;
- p[checksum_offset] = -sum;
-}
-
-static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt,
- const struct acpi_config *config,
- struct acpi_info *info)
-{
- struct acpi_20_madt *madt;
- struct acpi_20_madt_intsrcovr *intsrcovr;
- struct acpi_20_madt_ioapic *io_apic;
- struct acpi_20_madt_lapic *lapic;
- const struct hvm_info_table *hvminfo = config->hvminfo;
- int i, sz;
-
- if ( config->lapic_id == NULL )
- return NULL;
-
- sz = sizeof(struct acpi_20_madt);
- sz += sizeof(struct acpi_20_madt_intsrcovr) * 16;
- sz += sizeof(struct acpi_20_madt_ioapic);
- sz += sizeof(struct acpi_20_madt_lapic) * hvminfo->nr_vcpus;
-
- madt = ctxt->mem_ops.alloc(ctxt, sz, 16);
- if (!madt) return NULL;
-
- memset(madt, 0, sizeof(*madt));
- madt->header.signature = ACPI_2_0_MADT_SIGNATURE;
- madt->header.revision = ACPI_2_0_MADT_REVISION;
- fixed_strcpy(madt->header.oem_id, ACPI_OEM_ID);
- fixed_strcpy(madt->header.oem_table_id, ACPI_OEM_TABLE_ID);
- madt->header.oem_revision = ACPI_OEM_REVISION;
- madt->header.creator_id = ACPI_CREATOR_ID;
- madt->header.creator_revision = ACPI_CREATOR_REVISION;
- madt->lapic_addr = config->lapic_base_address;
- madt->flags = ACPI_PCAT_COMPAT;
-
- if ( config->table_flags & ACPI_HAS_IOAPIC )
- {
- intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1);
- for ( i = 0; i < 16; i++ )
- {
- memset(intsrcovr, 0, sizeof(*intsrcovr));
- intsrcovr->type = ACPI_INTERRUPT_SOURCE_OVERRIDE;
- intsrcovr->length = sizeof(*intsrcovr);
- intsrcovr->source = i;
-
- if ( i == 0 )
- {
- /* ISA IRQ0 routed to IOAPIC GSI 2. */
- intsrcovr->gsi = 2;
- intsrcovr->flags = 0x0;
- }
- else if ( config->pci_isa_irq_mask & (1U << i) )
- {
- /* PCI: active-low level-triggered. */
- intsrcovr->gsi = i;
- intsrcovr->flags = 0xf;
- }
- else
- {
- /* No need for a INT source override structure. */
- continue;
- }
-
- intsrcovr++;
- }
-
- io_apic = (struct acpi_20_madt_ioapic *)intsrcovr;
- memset(io_apic, 0, sizeof(*io_apic));
- io_apic->type = ACPI_IO_APIC;
- io_apic->length = sizeof(*io_apic);
- io_apic->ioapic_id = config->ioapic_id;
- io_apic->ioapic_addr = config->ioapic_base_address;
-
- lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
- }
- else
- lapic = (struct acpi_20_madt_lapic *)(madt + 1);
-
- info->nr_cpus = hvminfo->nr_vcpus;
- info->madt_lapic0_addr = ctxt->mem_ops.v2p(ctxt, lapic);
- for ( i = 0; i < hvminfo->nr_vcpus; i++ )
- {
- memset(lapic, 0, sizeof(*lapic));
- lapic->type = ACPI_PROCESSOR_LOCAL_APIC;
- lapic->length = sizeof(*lapic);
- /* Processor ID must match processor-object IDs in the DSDT. */
- lapic->acpi_processor_id = i;
- lapic->apic_id = config->lapic_id(i);
- lapic->flags = (test_bit(i, hvminfo->vcpu_online)
- ? ACPI_LOCAL_APIC_ENABLED : 0);
- lapic++;
- }
-
- madt->header.length = (unsigned char *)lapic - (unsigned char *)madt;
- set_checksum(madt, offsetof(struct acpi_header, checksum),
- madt->header.length);
- info->madt_csum_addr =
- ctxt->mem_ops.v2p(ctxt, &madt->header.checksum);
-
- return madt;
-}
-
-static struct acpi_20_hpet *construct_hpet(struct acpi_ctxt *ctxt,
- const struct acpi_config *config)
-{
- struct acpi_20_hpet *hpet;
-
- hpet = ctxt->mem_ops.alloc(ctxt, sizeof(*hpet), 16);
- if (!hpet) return NULL;
-
- memset(hpet, 0, sizeof(*hpet));
- hpet->header.signature = ACPI_2_0_HPET_SIGNATURE;
- hpet->header.revision = ACPI_2_0_HPET_REVISION;
- fixed_strcpy(hpet->header.oem_id, ACPI_OEM_ID);
- fixed_strcpy(hpet->header.oem_table_id, ACPI_OEM_TABLE_ID);
- hpet->header.oem_revision = ACPI_OEM_REVISION;
- hpet->header.creator_id = ACPI_CREATOR_ID;
- hpet->header.creator_revision = ACPI_CREATOR_REVISION;
- hpet->timer_block_id = 0x8086a201;
- hpet->addr.address = ACPI_HPET_ADDRESS;
-
- hpet->header.length = sizeof(*hpet);
- set_checksum(hpet, offsetof(struct acpi_header, checksum), sizeof(*hpet));
- return hpet;
-}
-
-static struct acpi_20_waet *construct_waet(struct acpi_ctxt *ctxt,
- const struct acpi_config *config)
-{
- struct acpi_20_waet *waet;
-
- waet = ctxt->mem_ops.alloc(ctxt, sizeof(*waet), 16);
- if (!waet) return NULL;
-
- memcpy(waet, &Waet, sizeof(*waet));
-
- waet->header.length = sizeof(*waet);
- set_checksum(waet, offsetof(struct acpi_header, checksum), sizeof(*waet));
-
- return waet;
-}
-
-static struct acpi_20_srat *construct_srat(struct acpi_ctxt *ctxt,
- const struct acpi_config *config)
-{
- struct acpi_20_srat *srat;
- struct acpi_20_srat_processor *processor;
- struct acpi_20_srat_memory *memory;
- unsigned int size;
- void *p;
- unsigned int i;
-
- size = sizeof(*srat) + sizeof(*processor) * config->hvminfo->nr_vcpus +
- sizeof(*memory) * config->numa.nr_vmemranges;
-
- p = ctxt->mem_ops.alloc(ctxt, size, 16);
- if ( !p )
- return NULL;
-
- srat = memset(p, 0, size);
- srat->header.signature = ACPI_2_0_SRAT_SIGNATURE;
- srat->header.revision = ACPI_2_0_SRAT_REVISION;
- fixed_strcpy(srat->header.oem_id, ACPI_OEM_ID);
- fixed_strcpy(srat->header.oem_table_id, ACPI_OEM_TABLE_ID);
- srat->header.oem_revision = ACPI_OEM_REVISION;
- srat->header.creator_id = ACPI_CREATOR_ID;
- srat->header.creator_revision = ACPI_CREATOR_REVISION;
- srat->table_revision = ACPI_SRAT_TABLE_REVISION;
-
- processor = (struct acpi_20_srat_processor *)(srat + 1);
- for ( i = 0; i < config->hvminfo->nr_vcpus; i++ )
- {
- processor->type = ACPI_PROCESSOR_AFFINITY;
- processor->length = sizeof(*processor);
- processor->domain = config->numa.vcpu_to_vnode[i];
- processor->apic_id = config->lapic_id(i);
- processor->flags = ACPI_LOCAL_APIC_AFFIN_ENABLED;
- processor++;
- }
-
- memory = (struct acpi_20_srat_memory *)processor;
- for ( i = 0; i < config->numa.nr_vmemranges; i++ )
- {
- memory->type = ACPI_MEMORY_AFFINITY;
- memory->length = sizeof(*memory);
- memory->domain = config->numa.vmemrange[i].nid;
- memory->flags = ACPI_MEM_AFFIN_ENABLED;
- memory->base_address = config->numa.vmemrange[i].start;
- memory->mem_length = config->numa.vmemrange[i].end -
- config->numa.vmemrange[i].start;
- memory++;
- }
-
- ASSERT(((unsigned long)memory) - ((unsigned long)p) == size);
-
- srat->header.length = size;
- set_checksum(srat, offsetof(struct acpi_header, checksum), size);
-
- return srat;
-}
-
-static struct acpi_20_slit *construct_slit(struct acpi_ctxt *ctxt,
- const struct acpi_config *config)
-{
- struct acpi_20_slit *slit;
- unsigned int i, num, size;
-
- num = config->numa.nr_vnodes * config->numa.nr_vnodes;
- size = sizeof(*slit) + num * sizeof(uint8_t);
-
- slit = ctxt->mem_ops.alloc(ctxt, size, 16);
- if ( !slit )
- return NULL;
-
- memset(slit, 0, size);
- slit->header.signature = ACPI_2_0_SLIT_SIGNATURE;
- slit->header.revision = ACPI_2_0_SLIT_REVISION;
- fixed_strcpy(slit->header.oem_id, ACPI_OEM_ID);
- fixed_strcpy(slit->header.oem_table_id, ACPI_OEM_TABLE_ID);
- slit->header.oem_revision = ACPI_OEM_REVISION;
- slit->header.creator_id = ACPI_CREATOR_ID;
- slit->header.creator_revision = ACPI_CREATOR_REVISION;
-
- for ( i = 0; i < num; i++ )
- slit->entry[i] = config->numa.vdistance[i];
-
- slit->localities = config->numa.nr_vnodes;
-
- slit->header.length = size;
- set_checksum(slit, offsetof(struct acpi_header, checksum), size);
-
- return slit;
-}
-
-static int construct_passthrough_tables(struct acpi_ctxt *ctxt,
- unsigned long *table_ptrs,
- int nr_tables,
- struct acpi_config *config)
-{
- unsigned long pt_addr;
- struct acpi_header *header;
- int nr_added;
- int nr_max = (ACPI_MAX_SECONDARY_TABLES - nr_tables - 1);
- uint32_t total = 0;
- uint8_t *buffer;
-
- if ( config->pt.addr == 0 )
- return 0;
-
- pt_addr = config->pt.addr;
-
- for ( nr_added = 0; nr_added < nr_max; nr_added++ )
- {
- if ( (config->pt.length - total) < sizeof(struct acpi_header) )
- break;
-
- header = (struct acpi_header*)pt_addr;
-
- buffer = ctxt->mem_ops.alloc(ctxt, header->length, 16);
- if ( buffer == NULL )
- break;
- memcpy(buffer, header, header->length);
-
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, buffer);
- total += header->length;
- pt_addr += header->length;
- }
-
- return nr_added;
-}
-
-static int construct_secondary_tables(struct acpi_ctxt *ctxt,
- unsigned long *table_ptrs,
- struct acpi_config *config,
- struct acpi_info *info)
-{
- int nr_tables = 0;
- struct acpi_20_madt *madt;
- struct acpi_20_hpet *hpet;
- struct acpi_20_waet *waet;
- struct acpi_20_tcpa *tcpa;
- unsigned char *ssdt;
- static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
- void *lasa;
-
- /* MADT. */
- if ( (config->hvminfo->nr_vcpus > 1) || config->hvminfo->apic_mode )
- {
- madt = construct_madt(ctxt, config, info);
- if (!madt) return -1;
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, madt);
- }
-
- /* HPET. */
- if ( info->hpet_present )
- {
- hpet = construct_hpet(ctxt, config);
- if (!hpet) return -1;
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, hpet);
- }
-
- /* WAET. */
- if ( config->table_flags & ACPI_HAS_WAET )
- {
- waet = construct_waet(ctxt, config);
- if ( !waet )
- return -1;
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, waet);
- }
-
- if ( config->table_flags & ACPI_HAS_SSDT_PM )
- {
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_pm), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_pm, sizeof(ssdt_pm));
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
- }
-
- if ( config->table_flags & ACPI_HAS_SSDT_S3 )
- {
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_s3), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_s3, sizeof(ssdt_s3));
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
- } else {
- printf("S3 disabled\n");
- }
-
- if ( config->table_flags & ACPI_HAS_SSDT_S4 )
- {
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_s4), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_s4, sizeof(ssdt_s4));
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
- } else {
- printf("S4 disabled\n");
- }
-
- /* TPM TCPA and SSDT. */
- if ( (config->table_flags & ACPI_HAS_TCPA) &&
- (config->tis_hdr[0] == tis_signature[0]) &&
- (config->tis_hdr[1] == tis_signature[1]) &&
- (config->tis_hdr[2] == tis_signature[2]) )
- {
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_tpm, sizeof(ssdt_tpm));
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
-
- tcpa = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_tcpa), 16);
- if (!tcpa) return -1;
- memset(tcpa, 0, sizeof(*tcpa));
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, tcpa);
-
- tcpa->header.signature = ACPI_2_0_TCPA_SIGNATURE;
- tcpa->header.length = sizeof(*tcpa);
- tcpa->header.revision = ACPI_2_0_TCPA_REVISION;
- fixed_strcpy(tcpa->header.oem_id, ACPI_OEM_ID);
- fixed_strcpy(tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID);
- tcpa->header.oem_revision = ACPI_OEM_REVISION;
- tcpa->header.creator_id = ACPI_CREATOR_ID;
- tcpa->header.creator_revision = ACPI_CREATOR_REVISION;
- if ( (lasa = ctxt->mem_ops.alloc(ctxt, ACPI_2_0_TCPA_LAML_SIZE, 16))
!= NULL )
- {
- tcpa->lasa = ctxt->mem_ops.v2p(ctxt, lasa);
- tcpa->laml = ACPI_2_0_TCPA_LAML_SIZE;
- memset(lasa, 0, tcpa->laml);
- set_checksum(tcpa,
- offsetof(struct acpi_header, checksum),
- tcpa->header.length);
- }
- }
-
- /* SRAT and SLIT */
- if ( config->numa.nr_vnodes > 0 )
- {
- struct acpi_20_srat *srat = construct_srat(ctxt, config);
- struct acpi_20_slit *slit = construct_slit(ctxt, config);
-
- if ( srat )
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, srat);
- else
- printf("Failed to build SRAT, skipping...\n");
- if ( slit )
- table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, slit);
- else
- printf("Failed to build SLIT, skipping...\n");
- }
-
- /* Load any additional tables passed through. */
- nr_tables += construct_passthrough_tables(ctxt, table_ptrs,
- nr_tables, config);
-
- table_ptrs[nr_tables] = 0;
- return nr_tables;
-}
-
-/**
- * Allocate and initialize Windows Generation ID
- * If value is not present in the XenStore or if all zeroes
- * the device will be not active
- *
- * Return 0 if memory failure, != 0 if success
- */
-static int new_vm_gid(struct acpi_ctxt *ctxt,
- struct acpi_config *config,
- struct acpi_info *info)
-{
- uint64_t *buf;
-
- info->vm_gid_addr = 0;
-
- /* check for 0 ID*/
- if ( !config->vm_gid[0] && !config->vm_gid[1] )
- return 1;
-
- /* copy to allocate BIOS memory */
- buf = ctxt->mem_ops.alloc(ctxt, sizeof(config->vm_gid), 8);
- if ( !buf )
- return 0;
- memcpy(buf, config->vm_gid, sizeof(config->vm_gid));
-
- /* set the address into ACPI table and also pass it back to the caller */
- info->vm_gid_addr = ctxt->mem_ops.v2p(ctxt, buf);
- config->vm_gid_addr = info->vm_gid_addr;
-
- return 1;
-}
-
-void acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config)
-{
- struct acpi_info *acpi_info;
- struct acpi_20_rsdp *rsdp;
- struct acpi_20_rsdt *rsdt;
- struct acpi_20_xsdt *xsdt;
- struct acpi_20_fadt *fadt;
- struct acpi_10_fadt *fadt_10;
- struct acpi_20_facs *facs;
- unsigned char *dsdt;
- unsigned long secondary_tables[ACPI_MAX_SECONDARY_TABLES];
- int nr_secondaries, i;
-
- acpi_info = (struct acpi_info *)config->infop;
- memset(acpi_info, 0, sizeof(*acpi_info));
- acpi_info->com1_present = !!(config->table_flags & ACPI_HAS_COM1);
- acpi_info->com2_present = !!(config->table_flags & ACPI_HAS_COM2);
- acpi_info->lpt1_present = !!(config->table_flags & ACPI_HAS_LPT1);
- acpi_info->hpet_present = !!(config->table_flags & ACPI_HAS_HPET);
- acpi_info->pci_min = config->pci_start;
- acpi_info->pci_len = config->pci_len;
- if ( config->pci_hi_len )
- {
- acpi_info->pci_hi_min = config->pci_hi_start;
- acpi_info->pci_hi_len = config->pci_hi_len;
- }
-
- /*
- * Fill in high-memory data structures, starting at @buf.
- */
-
- facs = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_facs), 16);
- if (!facs) goto oom;
- memcpy(facs, &Facs, sizeof(struct acpi_20_facs));
-
- /*
- * Alternative DSDTs we get linked against. A cover-all DSDT for up to the
- * implementation-defined maximum number of VCPUs, and an alternative for
use
- * when a guest can only have up to 15 VCPUs.
- *
- * The latter is required for Windows 2000, which experiences a BSOD of
- * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
- */
- if ( config->hvminfo->nr_vcpus <= 15 && config->dsdt_15cpu)
- {
- dsdt = ctxt->mem_ops.alloc(ctxt, config->dsdt_15cpu_len, 16);
- if (!dsdt) goto oom;
- memcpy(dsdt, config->dsdt_15cpu, config->dsdt_15cpu_len);
- }
- else
- {
- dsdt = ctxt->mem_ops.alloc(ctxt, config->dsdt_anycpu_len, 16);
- if (!dsdt) goto oom;
- memcpy(dsdt, config->dsdt_anycpu, config->dsdt_anycpu_len);
- }
-
- /*
- * N.B. ACPI 1.0 operating systems may not handle FADT with revision 2
- * or above properly, notably Windows 2000, which tries to copy FADT
- * into a 116 bytes buffer thus causing an overflow. The solution is to
- * link the higher revision FADT with the XSDT only and introduce a
- * compatible revision 1 FADT that is linked with the RSDT. Refer to:
- * http://www.acpi.info/presentations/S01USMOBS169_OS%20new.ppt
- */
- fadt_10 = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_10_fadt), 16);
- if (!fadt_10) goto oom;
- memcpy(fadt_10, &Fadt, sizeof(struct acpi_10_fadt));
- fadt_10->header.length = sizeof(struct acpi_10_fadt);
- fadt_10->header.revision = ACPI_1_0_FADT_REVISION;
- fadt_10->dsdt = ctxt->mem_ops.v2p(ctxt, dsdt);
- fadt_10->firmware_ctrl = ctxt->mem_ops.v2p(ctxt, facs);
- set_checksum(fadt_10,
- offsetof(struct acpi_header, checksum),
- sizeof(struct acpi_10_fadt));
-
- fadt = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_fadt), 16);
- if (!fadt) goto oom;
- memcpy(fadt, &Fadt, sizeof(struct acpi_20_fadt));
- fadt->dsdt = ctxt->mem_ops.v2p(ctxt, dsdt);
- fadt->x_dsdt = ctxt->mem_ops.v2p(ctxt, dsdt);
- fadt->firmware_ctrl = ctxt->mem_ops.v2p(ctxt, facs);
- fadt->x_firmware_ctrl = ctxt->mem_ops.v2p(ctxt, facs);
- set_checksum(fadt,
- offsetof(struct acpi_header, checksum),
- sizeof(struct acpi_20_fadt));
-
- nr_secondaries = construct_secondary_tables(ctxt, secondary_tables,
- config, acpi_info);
- if ( nr_secondaries < 0 )
- goto oom;
-
- xsdt = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_xsdt) +
- sizeof(uint64_t) * nr_secondaries,
- 16);
- if (!xsdt) goto oom;
- memcpy(xsdt, &Xsdt, sizeof(struct acpi_header));
- xsdt->entry[0] = ctxt->mem_ops.v2p(ctxt, fadt);
- for ( i = 0; secondary_tables[i]; i++ )
- xsdt->entry[i+1] = secondary_tables[i];
- xsdt->header.length = sizeof(struct acpi_header) + (i+1)*sizeof(uint64_t);
- set_checksum(xsdt,
- offsetof(struct acpi_header, checksum),
- xsdt->header.length);
-
- rsdt = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_rsdt) +
- sizeof(uint32_t) * nr_secondaries,
- 16);
- if (!rsdt) goto oom;
- memcpy(rsdt, &Rsdt, sizeof(struct acpi_header));
- rsdt->entry[0] = ctxt->mem_ops.v2p(ctxt, fadt_10);
- for ( i = 0; secondary_tables[i]; i++ )
- rsdt->entry[i+1] = secondary_tables[i];
- rsdt->header.length = sizeof(struct acpi_header) + (i+1)*sizeof(uint32_t);
- set_checksum(rsdt,
- offsetof(struct acpi_header, checksum),
- rsdt->header.length);
-
- /*
- * Fill in low-memory data structures: acpi_info and RSDP.
- */
- rsdp = (struct acpi_20_rsdp *)config->rsdp;
-
- memcpy(rsdp, &Rsdp, sizeof(struct acpi_20_rsdp));
- rsdp->rsdt_address = ctxt->mem_ops.v2p(ctxt, rsdt);
- rsdp->xsdt_address = ctxt->mem_ops.v2p(ctxt, xsdt);
- set_checksum(rsdp,
- offsetof(struct acpi_10_rsdp, checksum),
- sizeof(struct acpi_10_rsdp));
- set_checksum(rsdp,
- offsetof(struct acpi_20_rsdp, extended_checksum),
- sizeof(struct acpi_20_rsdp));
-
- if ( !new_vm_gid(ctxt, config, acpi_info) )
- goto oom;
-
- return;
-
-oom:
- printf("unable to build ACPI tables: out of memory\n");
-
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl
b/tools/firmware/hvmloader/acpi/dsdt.asl
deleted file mode 100644
index 2db40e4..0000000
--- a/tools/firmware/hvmloader/acpi/dsdt.asl
+++ /dev/null
@@ -1,445 +0,0 @@
-/******************************************************************************
- * DSDT for Xen with Qemu device model
- *
- * Copyright (c) 2004, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * 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 Lesser General Public License for more details.
- */
-
-DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
-{
- Name (\PMBS, 0x0C00)
- Name (\PMLN, 0x08)
- Name (\IOB1, 0x00)
- Name (\IOL1, 0x00)
- Name (\APCB, 0xFEC00000)
- Name (\APCL, 0x00010000)
- Name (\PUID, 0x00)
-
-
- Scope (\_SB)
- {
-
- /* Fix HCT test for 0x400 pci memory:
- * - need to report low 640 MB mem as motherboard resource
- */
- Device(MEM0)
- {
- Name(_HID, EISAID("PNP0C02"))
- Name(_CRS, ResourceTemplate() {
- QWordMemory(
- ResourceConsumer, PosDecode, MinFixed,
- MaxFixed, Cacheable, ReadWrite,
- 0x00000000,
- 0x00000000,
- 0x0009ffff,
- 0x00000000,
- 0x000a0000)
- })
- }
-
- Device (PCI0)
- {
- Name (_HID, EisaId ("PNP0A03"))
- Name (_UID, 0x00)
- Name (_ADR, 0x00)
- Name (_BBN, 0x00)
-
- /* Make cirrues VGA S3 suspend/resume work in Windows XP/2003 */
- Device (VGA)
- {
- Name (_ADR, 0x00020000)
-
- Method (_S1D, 0, NotSerialized)
- {
- Return (0x00)
- }
- Method (_S2D, 0, NotSerialized)
- {
- Return (0x00)
- }
- Method (_S3D, 0, NotSerialized)
- {
- Return (0x00)
- }
- }
-
- Method (_CRS, 0, NotSerialized)
- {
- Store (ResourceTemplate ()
- {
- /* bus number is from 0 - 255*/
- WordBusNumber(
- ResourceProducer, MinFixed, MaxFixed, SubDecode,
- 0x0000,
- 0x0000,
- 0x00FF,
- 0x0000,
- 0x0100)
- IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
- WordIO(
- ResourceProducer, MinFixed, MaxFixed, PosDecode,
- EntireRange,
- 0x0000,
- 0x0000,
- 0x0CF7,
- 0x0000,
- 0x0CF8)
- WordIO(
- ResourceProducer, MinFixed, MaxFixed, PosDecode,
- EntireRange,
- 0x0000,
- 0x0D00,
- 0xFFFF,
- 0x0000,
- 0xF300)
-
- /* reserve memory for pci devices */
- DWordMemory(
- ResourceProducer, PosDecode, MinFixed, MaxFixed,
- WriteCombining, ReadWrite,
- 0x00000000,
- 0x000A0000,
- 0x000BFFFF,
- 0x00000000,
- 0x00020000)
-
- DWordMemory(
- ResourceProducer, PosDecode, MinFixed, MaxFixed,
- NonCacheable, ReadWrite,
- 0x00000000,
- 0xF0000000,
- 0xF4FFFFFF,
- 0x00000000,
- 0x05000000,
- ,, _Y01)
-
- QWordMemory (
- ResourceProducer, PosDecode, MinFixed, MaxFixed,
- NonCacheable, ReadWrite,
- 0x0000000000000000,
- 0x0000000FFFFFFFF0,
- 0x0000000FFFFFFFFF,
- 0x0000000000000000,
- 0x0000000000000010,
- ,, _Y02)
-
- }, Local1)
-
- CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MIN, MMIN)
- CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MAX, MMAX)
- CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._LEN, MLEN)
-
- Store(\_SB.PMIN, MMIN)
- Store(\_SB.PLEN, MLEN)
- Add(MMIN, MLEN, MMAX)
- Subtract(MMAX, One, MMAX)
-
- /*
- * WinXP / Win2K3 blue-screen for operations on 64-bit values.
- * Therefore we need to split the 64-bit calculations needed
- * here, but different iasl versions evaluate name references
- * to integers differently:
- * Year (approximate) 2006 2008 2012
- * \_SB.PCI0._CRS._Y02 zero valid valid
- * \_SB.PCI0._CRS._Y02._MIN valid valid huge
- */
- If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) {
- Subtract(\_SB.PCI0._CRS._Y02._MIN, 14, Local0)
- } Else {
- Store(\_SB.PCI0._CRS._Y02, Local0)
- }
- CreateDWordField(Local1, Add(Local0, 14), MINL)
- CreateDWordField(Local1, Add(Local0, 18), MINH)
- CreateDWordField(Local1, Add(Local0, 22), MAXL)
- CreateDWordField(Local1, Add(Local0, 26), MAXH)
- CreateDWordField(Local1, Add(Local0, 38), LENL)
- CreateDWordField(Local1, Add(Local0, 42), LENH)
-
- Store(\_SB.LMIN, MINL)
- Store(\_SB.HMIN, MINH)
- Store(\_SB.LLEN, LENL)
- Store(\_SB.HLEN, LENH)
- Add(MINL, LENL, MAXL)
- Add(MINH, LENH, MAXH)
- If(LLess(MAXL, MINL)) {
- Add(MAXH, One, MAXH)
- }
- If(LOr(MINH, LENL)) {
- If(LEqual(MAXL, 0)) {
- Subtract(MAXH, One, MAXH)
- }
- Subtract(MAXL, One, MAXL)
- }
-
- Return (Local1)
- }
-
- Device(HPET) {
- Name(_HID, EISAID("PNP0103"))
- Name(_UID, 0)
- Method (_STA, 0, NotSerialized) {
- If(LEqual(\_SB.HPET, 0)) {
- Return(0x00)
- } Else {
- Return(0x0F)
- }
- }
- Name(_CRS, ResourceTemplate() {
- DWordMemory(
- ResourceConsumer, PosDecode, MinFixed, MaxFixed,
- NonCacheable, ReadWrite,
- 0x00000000,
- 0xFED00000,
- 0xFED003FF,
- 0x00000000,
- 0x00000400 /* 1K memory: FED00000 - FED003FF */
- )
- })
- }
-
- Device (ISA)
- {
- Name (_ADR, 0x00010000) /* device 1, fn 0 */
-
- OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
- Scope(\) {
- Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
- PIRA, 8,
- PIRB, 8,
- PIRC, 8,
- PIRD, 8
- }
- }
- Device (SYSR)
- {
- Name (_HID, EisaId ("PNP0C02"))
- Name (_UID, 0x01)
- Name (CRS, ResourceTemplate ()
- {
- /* TODO: list hidden resources */
- IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
- IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
- IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
- IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
- IO (Decode16, 0x0062, 0x0062, 0x00, 0x02)
- IO (Decode16, 0x0065, 0x0065, 0x00, 0x0B)
- IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
- IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
- IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
- IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
- IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
- IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
- IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1C)
- IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
- IO (Decode16, 0x08A0, 0x08A0, 0x00, 0x04)
- IO (Decode16, 0x0CC0, 0x0CC0, 0x00, 0x10)
- IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
- })
- Method (_CRS, 0, NotSerialized)
- {
- Return (CRS)
- }
- }
-
- Device (PIC)
- {
- Name (_HID, EisaId ("PNP0000"))
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x0020, 0x0020, 0x01, 0x02)
- IO (Decode16, 0x00A0, 0x00A0, 0x01, 0x02)
- IRQNoFlags () {2}
- })
- }
-
- Device (DMA0)
- {
- Name (_HID, EisaId ("PNP0200"))
- Name (_CRS, ResourceTemplate ()
- {
- DMA (Compatibility, BusMaster, Transfer8) {4}
- IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
- IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
- IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
- IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
- IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
- IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
- IO (Decode16, 0x0480, 0x0480, 0x00, 0x10)
- })
- }
-
- Device (TMR)
- {
- Name (_HID, EisaId ("PNP0100"))
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
- IRQNoFlags () {0}
- })
- }
-
- Device (RTC)
- {
- Name (_HID, EisaId ("PNP0B00"))
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
- IRQNoFlags () {8}
- })
- }
-
- Device (SPKR)
- {
- Name (_HID, EisaId ("PNP0800"))
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
- })
- }
-
- Device (PS2M)
- {
- Name (_HID, EisaId ("PNP0F13"))
- Name (_CID, 0x130FD041)
- Method (_STA, 0, NotSerialized)
- {
- Return (0x0F)
- }
-
- Name (_CRS, ResourceTemplate ()
- {
- IRQNoFlags () {12}
- })
- }
-
- Device (PS2K)
- {
- Name (_HID, EisaId ("PNP0303"))
- Name (_CID, 0x0B03D041)
- Method (_STA, 0, NotSerialized)
- {
- Return (0x0F)
- }
-
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
- IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
- IRQNoFlags () {1}
- })
- }
-
- Device (FDC0)
- {
- Name (_HID, EisaId ("PNP0700"))
- Method (_STA, 0, NotSerialized)
- {
- Return (0x0F)
- }
-
- Name (_CRS, ResourceTemplate ()
- {
- IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
- IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
- IRQNoFlags () {6}
- DMA (Compatibility, NotBusMaster, Transfer8) {2}
- })
- }
-
- Device (UAR1)
- {
- Name (_HID, EisaId ("PNP0501"))
- Name (_UID, 0x01)
- Method (_STA, 0, NotSerialized)
- {
- If(LEqual(\_SB.UAR1, 0)) {
- Return(0x00)
- } Else {
- Return(0x0F)
- }
- }
-
- Name (_CRS, ResourceTemplate()
- {
- IO (Decode16, 0x03F8, 0x03F8, 8, 8)
- IRQNoFlags () {4}
- })
- }
-
- Device (UAR2)
- {
- Name (_HID, EisaId ("PNP0501"))
- Name (_UID, 0x02)
- Method (_STA, 0, NotSerialized)
- {
- If(LEqual(\_SB.UAR2, 0)) {
- Return(0x00)
- } Else {
- Return(0x0F)
- }
- }
-
- Name (_CRS, ResourceTemplate()
- {
- IO (Decode16, 0x02F8, 0x02F8, 8, 8)
- IRQNoFlags () {3}
- })
- }
-
- Device (LTP1)
- {
- Name (_HID, EisaId ("PNP0400"))
- Name (_UID, 0x02)
- Method (_STA, 0, NotSerialized)
- {
- If(LEqual(\_SB.LTP1, 0)) {
- Return(0x00)
- } Else {
- Return(0x0F)
- }
- }
-
- Name (_CRS, ResourceTemplate()
- {
- IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
- IRQNoFlags () {7}
- })
- }
-
- Device(VGID) {
- Name(_HID, EisaId ("XEN0000"))
- Name(_UID, 0x00)
- Name(_CID, "VM_Gen_Counter")
- Name(_DDN, "VM_Gen_Counter")
- Method(_STA, 0, NotSerialized)
- {
- If(LEqual(\_SB.VGIA, 0x00000000)) {
- Return(0x00)
- } Else {
- Return(0x0F)
- }
- }
- Name(PKG, Package ()
- {
- 0x00000000,
- 0x00000000
- })
- Method(ADDR, 0, NotSerialized)
- {
- Store(\_SB.VGIA, Index(PKG, 0))
- Return(PKG)
- }
- }
- }
- }
- }
-}
diff --git a/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl
b/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl
deleted file mode 100644
index 0136dce..0000000
--- a/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl
+++ /dev/null
@@ -1,26 +0,0 @@
-
- Scope (\_SB)
- {
- /*
- * BIOS region must match struct acpi_info in build.c and
- * be located at ACPI_INFO_PHYSICAL_ADDRESS = 0xFC000000
- */
- OperationRegion(BIOS, SystemMemory, 0xFC000000, 40)
- Field(BIOS, ByteAcc, NoLock, Preserve) {
- UAR1, 1,
- UAR2, 1,
- LTP1, 1,
- HPET, 1,
- Offset(2),
- NCPU, 16,
- PMIN, 32,
- PLEN, 32,
- MSUA, 32, /* MADT checksum address */
- MAPA, 32, /* MADT LAPIC0 address */
- VGIA, 32, /* VM generation id address */
- LMIN, 32,
- HMIN, 32,
- LLEN, 32,
- HLEN, 32
- }
- }
diff --git a/tools/firmware/hvmloader/acpi/gpl/COPYING
b/tools/firmware/hvmloader/acpi/gpl/COPYING
deleted file mode 100644
index f995ef6..0000000
--- a/tools/firmware/hvmloader/acpi/gpl/COPYING
+++ /dev/null
@@ -1,22 +0,0 @@
-Unlike files in the directory above that are licensed under GNU Lesser
-General Public License version 2.1, files here are licensed under GNU
-General Public License version 2.
-
-A copy of this license can be obtained at <http://www.gnu.org/licenses/>
-
-
-INBOUND LICENSE
-
-Contributions to this directory are made under the LGPLv2.1 *only* as
-described in the COPYING file of the parent directory. As LGPLv2.1 is
-compatible with the GPLv2, the resulting file is GPLv2 when seen as a
-whole.
-
-The intention of this inbound license, is to avoid having to ask
-subsequent contributors to this directory for permission to change the
-license from GPLv2 to LGPLv2.1, once we get permission from the
-remaining copyright holders of this directory to change the license to
-LGPLv2.1.
-
-Note: The only outstanding permission required to re-license this
-directory to LGPLv2.1 is from Lenovo.
diff --git a/tools/firmware/hvmloader/acpi/gpl/mk_dsdt_gpl.sh
b/tools/firmware/hvmloader/acpi/gpl/mk_dsdt_gpl.sh
deleted file mode 100755
index 38fe01a..0000000
--- a/tools/firmware/hvmloader/acpi/gpl/mk_dsdt_gpl.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/bin/sh
-
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope 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 <http://www.gnu.org/licenses/>.
-#
-
-cat <<'EndOfASL'
- /* Beginning of GPL-only code */
-
- /* _S3 and _S4 are in separate SSDTs */
- Name (\_S5, Package (0x04) {
- 0x00, /* PM1a_CNT.SLP_TYP */
- 0x00, /* PM1b_CNT.SLP_TYP */
- 0x00, /* reserved */
- 0x00 /* reserved */
- })
- Name(PICD, 0)
- Method(_PIC, 1) {
- Store(Arg0, PICD)
- }
-EndOfASL
-
-# PCI-ISA link definitions
-# BUFA: List of ISA IRQs available for linking to PCI INTx.
-# BUFB: IRQ descriptor for returning from link-device _CRS methods.
-cat <<'EndOfASL'
- Scope ( \_SB.PCI0 ) {
- Name ( BUFA, ResourceTemplate() { IRQ(Level, ActiveLow, Shared) { 5,
10, 11 } } )
- Name ( BUFB, Buffer() { 0x23, 0x00, 0x00, 0x18, 0x79, 0 } )
- CreateWordField ( BUFB, 0x01, IRQV )
-EndOfASL
-
-for i in $(seq 1 4)
-do
- link=`echo "A B C D" | cut -d" " -f $i`
- cat <<EndOfASL
- Device ( LNK$link ) {
- Name ( _HID, EISAID("PNP0C0F") )
- Name ( _UID, $i)
- Method ( _STA, 0) {
- If ( And(PIR$link, 0x80) ) {
- Return ( 0x09 )
- } Else {
- Return ( 0x0B )
- }
- }
- Method ( _PRS ) {
- Return ( BUFA )
- }
- Method ( _DIS ) {
- Or ( PIR$link, 0x80, PIR$link )
- }
- Method ( _CRS ) {
- And ( PIR$link, 0x0f, Local0 )
- ShiftLeft ( 0x1, Local0, IRQV )
- Return ( BUFB )
- }
- Method ( _SRS, 1 ) {
- CreateWordField ( ARG0, 0x01, IRQ1 )
- FindSetRightBit ( IRQ1, Local0 )
- Decrement ( Local0 )
- Store ( Local0, PIR$link )
- }
- }
-EndOfASL
-done
-
-# PCI interrupt routing definitions
-# _PRT: Method to return routing table.
-cat <<'EndOfASL'
- Method ( _PRT, 0 ) {
- If ( PICD ) {
- Return ( PRTA )
- }
- Return ( PRTP )
- }
-EndOfASL
-
-# PRTP: PIC routing table (via ISA links).
-echo " Name(PRTP, Package() {"
-for dev in $(seq 1 31)
-do
- for intx in $(seq 0 3) # INTA-D
- do
- link_idx=$(( ((dev + intx) & 3) + 1 ))
- link=`echo "A B C D" | cut -d" " -f $link_idx`
- printf " Package(){0x%04xffff, %u, \\\\_SB.PCI0.LNK%c,
0},\n" \
- $dev $intx $link
- done
-done
-echo " })"
-
-# PRTA: APIC routing table (via non-legacy IOAPIC GSIs).
-echo " Name(PRTA, Package() {"
-for dev in $(seq 1 31)
-do
- for intx in $(seq 0 3) # INTA-D
- do
- idx=$(( ((dev * 4 + dev/8 + intx) & 31) + 16 ))
- printf " Package(){0x%04xffff, %u, 0, %u},\n" \
- $dev $intx $idx
- done
-done
-echo " })"
-
-echo " }"
-
-echo " /* End of GPL-only code */"
diff --git a/tools/firmware/hvmloader/acpi/libacpi.h
b/tools/firmware/hvmloader/acpi/libacpi.h
deleted file mode 100644
index e386362..0000000
--- a/tools/firmware/hvmloader/acpi/libacpi.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/******************************************************************************
- * libacpi.h
- *
- * libacpi interfaces
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * 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 Lesser General Public License for more details.
- *
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- */
-
-
-#ifndef __LIBACPI_H__
-#define __LIBACPI_H__
-
-#define ACPI_HAS_COM1 (1<<0)
-#define ACPI_HAS_COM2 (1<<1)
-#define ACPI_HAS_LPT1 (1<<2)
-#define ACPI_HAS_HPET (1<<3)
-#define ACPI_HAS_SSDT_PM (1<<4)
-#define ACPI_HAS_SSDT_S3 (1<<5)
-#define ACPI_HAS_SSDT_S4 (1<<6)
-#define ACPI_HAS_TCPA (1<<7)
-#define ACPI_HAS_IOAPIC (1<<8)
-#define ACPI_HAS_WAET (1<<9)
-
-struct xen_vmemrange;
-struct acpi_numa {
- uint32_t nr_vmemranges;
- uint32_t nr_vnodes;
- const unsigned int *vcpu_to_vnode;
- const unsigned int *vdistance;
- const struct xen_vmemrange *vmemrange;
-};
-
-struct acpi_ctxt {
- struct acpi_mem_ops {
- void *(*alloc)(struct acpi_ctxt *ctxt, uint32_t size, uint32_t align);
- void (*free)(struct acpi_ctxt *ctxt, void *v, uint32_t size);
- unsigned long (*v2p)(struct acpi_ctxt *ctxt, void *v);
- } mem_ops;
-};
-
-struct acpi_config {
- const unsigned char *dsdt_anycpu;
- unsigned int dsdt_anycpu_len;
- const unsigned char *dsdt_15cpu;
- unsigned int dsdt_15cpu_len;
-
- /* PCI I/O hole */
- uint32_t pci_start, pci_len;
- uint64_t pci_hi_start, pci_hi_len;
-
- uint32_t table_flags;
-
- uint64_t vm_gid[2];
- unsigned long vm_gid_addr; /* OUT parameter */
-
- struct {
- uint32_t addr;
- uint32_t length;
- } pt;
-
- struct acpi_numa numa;
- const struct hvm_info_table *hvminfo;
-
- const uint16_t *tis_hdr;
-
- /*
- * Address where acpi_info should be placed.
- * This must match the OperationRegion(BIOS, SystemMemory, ....)
- * definition in the DSDT
- */
- unsigned int infop;
-
- /* RSDP address */
- unsigned int rsdp;
-
- /* x86-specific parameters */
- uint8_t (*lapic_id)(unsigned cpu);
- uint32_t lapic_base_address;
- uint32_t ioapic_base_address;
- uint16_t pci_isa_irq_mask;
- uint8_t ioapic_id;
-};
-
-void acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config);
-
-#endif /* __LIBACPI_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/tools/firmware/hvmloader/acpi/mk_dsdt.c
b/tools/firmware/hvmloader/acpi/mk_dsdt.c
deleted file mode 100644
index e750820..0000000
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * 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 Lesser General Public License for more details.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <string.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <xen/hvm/hvm_info_table.h>
-
-static unsigned int indent_level;
-static bool debug = false;
-
-typedef enum dm_version {
- QEMU_XEN_TRADITIONAL,
- QEMU_XEN,
-} dm_version;
-
-static void indent(void)
-{
- unsigned int i;
- for ( i = 0; i < indent_level; i++ )
- printf(" ");
-}
-
-static __attribute__((format(printf, 2, 3)))
-void _stmt(const char *name, const char *fmt, ...)
-{
- va_list args;
-
- indent();
- printf("%s", name);
-
- if ( !fmt )
- return;
-
- printf(" ( ");
- va_start(args, fmt);
- vprintf(fmt, args);
- va_end(args);
- printf(" )");
-}
-
-#define stmt(n, f, a...) \
- do { \
- _stmt(n, f , ## a ); \
- printf("\n"); \
- } while (0)
-
-#define push_block(n, f, a...) \
- do { \
- _stmt(n, f , ## a ); \
- printf(" {\n"); \
- indent_level++; \
- } while (0)
-
-static void pop_block(void)
-{
- indent_level--;
- indent();
- printf("}\n");
-}
-
-static void pci_hotplug_notify(unsigned int slt)
-{
- stmt("Notify", "\\_SB.PCI0.S%02X, EVT", slt);
-}
-
-static void decision_tree(
- unsigned int s, unsigned int e, char *var, void (*leaf)(unsigned int))
-{
- if ( s == (e-1) )
- {
- (*leaf)(s);
- return;
- }
-
- push_block("If", "And(%s, 0x%02x)", var, (e-s)/2);
- decision_tree((s+e)/2, e, var, leaf);
- pop_block();
- push_block("Else", NULL);
- decision_tree(s, (s+e)/2, var, leaf);
- pop_block();
-}
-
-static struct option options[] = {
- { "maxcpu", 1, 0, 'c' },
- { "dm-version", 1, 0, 'q' },
- { "debug", 1, 0, 'd' },
- { 0, 0, 0, 0 }
-};
-
-int main(int argc, char **argv)
-{
- unsigned int slot, cpu, max_cpus = HVM_MAX_VCPUS;
- dm_version dm_version = QEMU_XEN_TRADITIONAL;
-
- for ( ; ; )
- {
- int opt = getopt_long(argc, argv, "", options, NULL);
- if ( opt == -1 )
- break;
-
- switch ( opt )
- {
- case 'c': {
- long i = 0;
- char *endptr;
-
- i = strtol(optarg, &endptr, 10);
- if ( (*optarg != '\0') && (*endptr == '\0') && (i >= 0) )
- {
- max_cpus = i;
- }
- else if ( !(strcmp(optarg, "any") == 0) )
- {
- fprintf(stderr, "`%s' is not a number or is < 0.\n", optarg);
- return -1;
- }
- break;
- }
- case 'q':
- if (strcmp(optarg, "qemu-xen") == 0) {
- dm_version = QEMU_XEN;
- } else if (strcmp(optarg, "qemu-xen-traditional") == 0) {
- dm_version = QEMU_XEN_TRADITIONAL;
- } else {
- fprintf(stderr, "Unknown device model version `%s'.\n",
optarg);
- return -1;
- }
- break;
- case 'd':
- if (*optarg == 'y')
- debug = true;
- break;
- default:
- return -1;
- }
- }
-
- /**** DSDT DefinitionBlock start ****/
- /* (we append to existing DSDT definition block) */
- indent_level++;
-
- /**** Processor start ****/
- push_block("Scope", "\\_SB");
-
- /* MADT checksum */
- stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
- push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
- indent(); printf("MSU, 8\n");
- pop_block();
-
- /* Processor object helpers. */
- push_block("Method", "PMAT, 2");
- push_block("If", "LLess(Arg0, NCPU)");
- stmt("Return", "ToBuffer(Arg1)");
- pop_block();
- stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
- pop_block();
-
- /* Define processor objects and control methods. */
- for ( cpu = 0; cpu < max_cpus; cpu++)
- {
- push_block("Processor", "PR%02X, %d, 0x0000b010, 0x06", cpu, cpu);
-
- stmt("Name", "_HID, \"ACPI0007\"");
-
- /* Name this processor's MADT LAPIC descriptor. */
- stmt("OperationRegion",
- "MATR, SystemMemory, Add(\\_SB.MAPA, %d), 8", cpu*8);
-
- push_block("Field", "MATR, ByteAcc, NoLock, Preserve");
- indent(); printf("MAT, 64\n");
- pop_block();
-
- push_block("Field", "MATR, ByteAcc, NoLock, Preserve");
- indent(); printf("Offset(4),\n");
- indent(); printf("FLG, 1\n");
- pop_block();
-
- push_block("Method", "_MAT, 0");
- if ( cpu )
- stmt("Return", "PMAT (%d, MAT)", cpu);
- else
- stmt("Return", "ToBuffer(MAT)");
- pop_block();
-
- push_block("Method", "_STA");
- if ( cpu )
- push_block("If", "LLess(%d, \\_SB.NCPU)", cpu);
- push_block("If", "FLG");
- stmt("Return", "0xF");
- pop_block();
- if ( cpu )
- pop_block();
- stmt("Return", "0x0");
- pop_block();
-
- push_block("Method", "_EJ0, 1, NotSerialized");
- stmt("Sleep", "0xC8");
- pop_block();
-
- pop_block();
- }
-
- /* Operation Region 'PRST': bitmask of online CPUs. */
- stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32");
- push_block("Field", "PRST, ByteAcc, NoLock, Preserve");
- indent(); printf("PRS, %u\n", max_cpus);
- pop_block();
-
- /* Control method 'PRSC': CPU hotplug GPE handler. */
- push_block("Method", "PRSC, 0");
- stmt("Store", "ToBuffer(PRS), Local0");
- for ( cpu = 0; cpu < max_cpus; cpu++ )
- {
- /* Read a byte at a time from the PRST online-CPU bitmask. */
- if ( (cpu & 7) == 0 )
- stmt("Store", "DerefOf(Index(Local0, %u)), Local1", cpu/8);
- else
- stmt("ShiftRight", "Local1, 1, Local1");
- /* Extract current CPU's status: 0=offline; 1=online. */
- stmt("And", "Local1, 1, Local2");
- /* Check if status is up-to-date in the relevant MADT LAPIC entry... */
- push_block("If", "LNotEqual(Local2, \\_SB.PR%02X.FLG)", cpu);
- /* ...If not, update it and the MADT checksum, and notify OSPM. */
- stmt("Store", "Local2, \\_SB.PR%02X.FLG", cpu);
- push_block("If", "LEqual(Local2, 1)");
- stmt("Notify", "PR%02X, 1", cpu); /* Notify: Device Check */
- stmt("Subtract", "\\_SB.MSU, 1, \\_SB.MSU"); /* Adjust MADT csum */
- pop_block();
- push_block("Else", NULL);
- stmt("Notify", "PR%02X, 3", cpu); /* Notify: Eject Request */
- stmt("Add", "\\_SB.MSU, 1, \\_SB.MSU"); /* Adjust MADT csum */
- pop_block();
- pop_block();
- }
- stmt("Return", "One");
- pop_block();
-
- pop_block();
-
- /* Define GPE control method. */
- push_block("Scope", "\\_GPE");
- push_block("Method",
- dm_version == QEMU_XEN_TRADITIONAL ? "_L02" : "_E02");
- stmt("\\_SB.PRSC ()", NULL);
- pop_block();
- pop_block();
- /**** Processor end ****/
-
-
- /**** PCI0 start ****/
- push_block("Scope", "\\_SB.PCI0");
-
- /*
- * Reserve the IO port ranges [0x10c0, 0x1101] and [0xb044, 0xb047].
- * Or else, for a hotplugged-in device, the port IO BAR assigned
- * by guest OS may conflict with the ranges here.
- */
- push_block("Device", "HP0"); {
- stmt("Name", "_HID, EISAID(\"PNP0C02\")");
- if (dm_version == QEMU_XEN_TRADITIONAL) {
- stmt("Name", "_CRS, ResourceTemplate() {"
- " IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x82)"
- " IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
- "}");
- } else {
- stmt("Name", "_CRS, ResourceTemplate() {"
- " IO (Decode16, 0xae00, 0xae00, 0x00, 0x10)"
- " IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
- "}");
- }
- } pop_block();
-
- /*
- * Each PCI hotplug slot needs at least two methods to handle
- * the ACPI event:
- * _EJ0: eject a device
- * _STA: return a device's status, e.g. enabled or removed
- *
- * Eject button would generate a general-purpose event, then the
- * control method for this event uses Notify() to inform OSPM which
- * action happened and on which device.
- *
- * Pls. refer "6.3 Device Insertion, Removal, and Status Objects"
- * in ACPI spec 3.0b for details.
- *
- * QEMU provides a simple hotplug controller with some I/O to handle
- * the hotplug action and status, which is beyond the ACPI scope.
- */
- if (dm_version == QEMU_XEN_TRADITIONAL) {
- for ( slot = 0; slot < 0x100; slot++ )
- {
- push_block("Device", "S%02X", slot);
- /* _ADR == dev:fn (16:16) */
- stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
- /* _SUN == dev */
- stmt("Name", "_SUN, 0x%08x", slot >> 3);
- push_block("Method", "_EJ0, 1");
- if (debug)
- {
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x88, \\_GPE.DPT2");
- }
- stmt("Store", "0x%02x, \\_GPE.PH%02X", /* eject */
- (slot & 1) ? 0x10 : 0x01, slot & ~1);
- pop_block();
- push_block("Method", "_STA, 0");
- if (debug)
- {
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x89, \\_GPE.DPT2");
- }
- if ( slot & 1 )
- stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
- else
- stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
- stmt("Return", "Local1"); /* IN status as the _STA */
- pop_block();
- pop_block();
- }
- } else {
- stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x04");
- push_block("Field", "SEJ, DWordAcc, NoLock, WriteAsZeros");
- indent(); printf("B0EJ, 32,\n");
- pop_block();
-
- /* hotplug_slot */
- for (slot = 1; slot <= 31; slot++) {
- push_block("Device", "S%i", slot); {
- stmt("Name", "_ADR, %#06x0000", slot);
- push_block("Method", "_EJ0,1"); {
- stmt("Store", "%#010x, B0EJ", 1 << slot);
- } pop_block();
- stmt("Name", "_SUN, %i", slot);
- } pop_block();
- }
- }
-
- pop_block();
- /**** PCI0 end ****/
-
-
- /**** GPE start ****/
- push_block("Scope", "\\_GPE");
-
- if (dm_version == QEMU_XEN_TRADITIONAL) {
- stmt("OperationRegion", "PHP, SystemIO, 0x10c0, 0x82");
-
- push_block("Field", "PHP, ByteAcc, NoLock, Preserve");
- indent(); printf("PSTA, 8,\n"); /* hotplug controller event reg */
- indent(); printf("PSTB, 8,\n"); /* hotplug controller slot reg */
- for ( slot = 0; slot < 0x100; slot += 2 )
- {
- indent();
- /* Each hotplug control register manages a pair of pci functions.
*/
- printf("PH%02X, 8,\n", slot);
- }
- pop_block();
- } else {
- stmt("OperationRegion", "PCST, SystemIO, 0xae00, 0x08");
- push_block("Field", "PCST, DWordAcc, NoLock, WriteAsZeros");
- indent(); printf("PCIU, 32,\n");
- indent(); printf("PCID, 32,\n");
- pop_block();
- }
-
- stmt("OperationRegion", "DG1, SystemIO, 0xb044, 0x04");
-
- push_block("Field", "DG1, ByteAcc, NoLock, Preserve");
- indent(); printf("DPT1, 8, DPT2, 8\n");
- pop_block();
-
- if (dm_version == QEMU_XEN_TRADITIONAL) {
- push_block("Method", "_L03, 0, Serialized");
- /* Detect slot and event (remove/add). */
- stmt("Name", "SLT, 0x0");
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |