* [PATCH v5 00/23] Include linux ACPI docs into Sphinx TOC tree
From: Changbin Du @ 2019-04-24 17:52 UTC (permalink / raw)
To: rjw, Jonathan Corbet
Cc: fenghua.yu, mchehab+samsung, linux-doc, linux-gpio, linux-kernel,
linux-acpi, Bjorn Helgaas, linuxppc-dev, Changbin Du
Hi All,
The kernel now uses Sphinx to generate intelligent and beautiful documentation
from reStructuredText files. I converted all of the Linux ACPI/PCI/X86 docs to
reST format in this serias.
The hieararchy of ACPI docs are based on Corbet's suggestion:
https://lkml.org/lkml/2019/4/3/1047
I did some adjustment according to the content and finally they are placed as:
Documentation/firmware-guide/acpi/
├── acpi-lid.rst
├── aml-debugger.rst
├── apei
│ ├── einj.rst
│ └── output_format.rst
├── debug.rst
├── dsd
│ ├── data-node-references.rst
│ └── graph.rst
├── DSD-properties-rules.rst
├── enumeration.rst
├── gpio-properties.rst
├── i2c-muxes.rst
├── lpit.rst
├── method-customizing.rst
├── method-tracing.rst
├── namespace.rst
├── osi.rst
└── video_extension.rst
Documentation/driver-api/acpi/
├── linuxized-acpica.rst
└── scan_handlers.rst
ocumentation/admin-guide/acpi/
├── cppc_sysfs.rst
├── dsdt-override.rst
├── initrd_table_override.rst
└── ssdt-overlays.rst
For you to preview, please visit below url:
http://www.bytemem.com:8080/kernel-doc/index.html
Many thanks for all the comments!
v5: Fix all comments from Mauro. Thanks for your careful review!
Changbin Du (23):
Documentation: ACPI: move namespace.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move enumeration.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move osi.txt to firmware-guide/acpi and convert
to reST
Documentation: ACPI: move linuxized-acpica.txt to driver-api/acpi and
convert to reST
Documentation: ACPI: move scan_handlers.txt to driver-api/acpi and
convert to reST
Documentation: ACPI: move DSD-properties-rules.txt to
firmware-guide/acpi and covert to reST
Documentation: ACPI: move gpio-properties.txt to firmware-guide/acpi
and convert to reST
Documentation: ACPI: move method-customizing.txt to
firmware-guide/acpi and convert to reST
Documentation: ACPI: move initrd_table_override.txt to
admin-guide/acpi and convert to reST
Documentation: ACPI: move dsdt-override.txt to admin-guide/acpi and
convert to reST
Documentation: ACPI: move i2c-muxes.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move acpi-lid.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move dsd/graph.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move dsd/data-node-references.txt to
firmware-guide/acpi and convert to reST
Documentation: ACPI: move debug.txt to firmware-guide/acpi and convert
to reST
Documentation: ACPI: move method-tracing.txt to firmware-guide/acpi
and convert to rsST
Documentation: ACPI: move aml-debugger.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move apei/output_format.txt to
firmware-guide/acpi and convert to reST
Documentation: ACPI: move apei/einj.txt to firmware-guide/acpi and
convert to reST
Documentation: ACPI: move cppc_sysfs.txt to admin-guide/acpi and
convert to reST
Documentation: ACPI: move lpit.txt to firmware-guide/acpi and convert
to reST
Documentation: ACPI: move ssdt-overlays.txt to admin-guide/acpi and
convert to reST
Documentation: ACPI: move video_extension.txt to firmware-guide/acpi
and convert to reST
Documentation/acpi/aml-debugger.txt | 66 ----
Documentation/acpi/apei/output_format.txt | 147 ---------
Documentation/acpi/i2c-muxes.txt | 58 ----
Documentation/acpi/initrd_table_override.txt | 111 -------
Documentation/acpi/method-customizing.txt | 73 -----
Documentation/acpi/method-tracing.txt | 192 ------------
Documentation/acpi/ssdt-overlays.txt | 172 ----------
.../acpi/cppc_sysfs.rst} | 71 +++--
.../acpi/dsdt-override.rst} | 8 +-
Documentation/admin-guide/acpi/index.rst | 4 +
.../acpi/initrd_table_override.rst | 115 +++++++
.../admin-guide/acpi/ssdt-overlays.rst | 180 +++++++++++
Documentation/driver-api/acpi/index.rst | 2 +
.../acpi/linuxized-acpica.rst} | 109 ++++---
.../acpi/scan_handlers.rst} | 24 +-
.../acpi/DSD-properties-rules.rst} | 21 +-
.../acpi/acpi-lid.rst} | 40 ++-
.../firmware-guide/acpi/aml-debugger.rst | 75 +++++
.../acpi/apei/einj.rst} | 94 +++---
.../acpi/apei/output_format.rst | 150 +++++++++
.../acpi/debug.rst} | 31 +-
.../acpi/dsd/data-node-references.rst} | 36 ++-
.../acpi/dsd/graph.rst} | 157 +++++-----
.../acpi/enumeration.rst} | 135 ++++----
.../acpi/gpio-properties.rst} | 78 +++--
.../firmware-guide/acpi/i2c-muxes.rst | 61 ++++
Documentation/firmware-guide/acpi/index.rst | 17 +
.../lpit.txt => firmware-guide/acpi/lpit.rst} | 18 +-
.../acpi/method-customizing.rst | 89 ++++++
.../firmware-guide/acpi/method-tracing.rst | 238 ++++++++++++++
.../acpi/namespace.rst} | 294 +++++++++---------
.../osi.txt => firmware-guide/acpi/osi.rst} | 15 +-
.../acpi/video_extension.rst} | 83 +++--
MAINTAINERS | 2 +-
34 files changed, 1606 insertions(+), 1360 deletions(-)
delete mode 100644 Documentation/acpi/aml-debugger.txt
delete mode 100644 Documentation/acpi/apei/output_format.txt
delete mode 100644 Documentation/acpi/i2c-muxes.txt
delete mode 100644 Documentation/acpi/initrd_table_override.txt
delete mode 100644 Documentation/acpi/method-customizing.txt
delete mode 100644 Documentation/acpi/method-tracing.txt
delete mode 100644 Documentation/acpi/ssdt-overlays.txt
rename Documentation/{acpi/cppc_sysfs.txt => admin-guide/acpi/cppc_sysfs.rst} (51%)
rename Documentation/{acpi/dsdt-override.txt => admin-guide/acpi/dsdt-override.rst} (56%)
create mode 100644 Documentation/admin-guide/acpi/initrd_table_override.rst
create mode 100644 Documentation/admin-guide/acpi/ssdt-overlays.rst
rename Documentation/{acpi/linuxized-acpica.txt => driver-api/acpi/linuxized-acpica.rst} (80%)
rename Documentation/{acpi/scan_handlers.txt => driver-api/acpi/scan_handlers.rst} (90%)
rename Documentation/{acpi/DSD-properties-rules.txt => firmware-guide/acpi/DSD-properties-rules.rst} (88%)
rename Documentation/{acpi/acpi-lid.txt => firmware-guide/acpi/acpi-lid.rst} (86%)
create mode 100644 Documentation/firmware-guide/acpi/aml-debugger.rst
rename Documentation/{acpi/apei/einj.txt => firmware-guide/acpi/apei/einj.rst} (67%)
create mode 100644 Documentation/firmware-guide/acpi/apei/output_format.rst
rename Documentation/{acpi/debug.txt => firmware-guide/acpi/debug.rst} (91%)
rename Documentation/{acpi/dsd/data-node-references.txt => firmware-guide/acpi/dsd/data-node-references.rst} (71%)
rename Documentation/{acpi/dsd/graph.txt => firmware-guide/acpi/dsd/graph.rst} (56%)
rename Documentation/{acpi/enumeration.txt => firmware-guide/acpi/enumeration.rst} (87%)
rename Documentation/{acpi/gpio-properties.txt => firmware-guide/acpi/gpio-properties.rst} (81%)
create mode 100644 Documentation/firmware-guide/acpi/i2c-muxes.rst
rename Documentation/{acpi/lpit.txt => firmware-guide/acpi/lpit.rst} (68%)
create mode 100644 Documentation/firmware-guide/acpi/method-customizing.rst
create mode 100644 Documentation/firmware-guide/acpi/method-tracing.rst
rename Documentation/{acpi/namespace.txt => firmware-guide/acpi/namespace.rst} (56%)
rename Documentation/{acpi/osi.txt => firmware-guide/acpi/osi.rst} (97%)
rename Documentation/{acpi/video_extension.txt => firmware-guide/acpi/video_extension.rst} (70%)
--
2.20.1
^ permalink raw reply
* Re: [PATCH v4 00/63] Include linux ACPI/PCI/X86 docs into Sphinx TOC tree
From: Mauro Carvalho Chehab @ 2019-04-24 17:48 UTC (permalink / raw)
To: Changbin Du
Cc: Fenghua Yu, the arch/x86 maintainers, Jonathan Corbet, Linux PCI,
linux-gpio, open list:DOCUMENTATION, Rafael J. Wysocki,
Linux Kernel Mailing List, ACPI Devel Maling List, Ingo Molnar,
Bjorn Helgaas, Rafael J. Wysocki, Thomas Gleixner, linuxppc-dev
In-Reply-To: <20190424154617.kowr5aamjkeceltr@mail.google.com>
Em Wed, 24 Apr 2019 23:46:18 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> On Tue, Apr 23, 2019 at 12:36:44PM -0500, Bjorn Helgaas wrote:
> > On Tue, Apr 23, 2019 at 06:39:47PM +0200, Rafael J. Wysocki wrote:
> > > On Tue, Apr 23, 2019 at 6:30 PM Changbin Du <changbin.du@gmail.com> wrote:
> > > > Hi Corbet and All,
> > > > The kernel now uses Sphinx to generate intelligent and beautiful
> > > > documentation from reStructuredText files. I converted all of the Linux
> > > > ACPI/PCI/X86 docs to reST format in this serias.
> > > >
> > > > In this version I combined ACPI and PCI docs, and added new x86 docs
> > > > conversion.
> > >
> > > I'm not sure if combining all three into one big patch series has been
> > > a good idea, honestly.
> >
> > Yeah, if you post this again, I would find it easier to deal with if
> > linux-pci only got the PCI-related things. 63 patches is a little too
> > much for one series.
> >
> sure, so I will resend them respectively.
I reviewed up to patch 39. There are too many files on x86 that seems
to be mangled by some tab->whitespace conversion, with caused
very big diffs and lots of broken ascii artwork.
Please ensure that the diffs will contain the minimal amount of stuff
that would be required for them to be properly formatted as ReST
files there.
Ah, perhaps next time you could format the patches with a lower
merge similarity logic (using, for example, the parameter -M10).
Regards,
Mauro
>
> > Bjorn
>
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 39/63] Documentation: x86: convert topology.txt to reST
From: Mauro Carvalho Chehab @ 2019-04-24 17:44 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-40-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:08 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> This converts the plain text documentation to reStructuredText format and
> add it to Sphinx TOC tree. No essential content change.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
> Documentation/x86/index.rst | 1 +
> Documentation/x86/topology.rst | 228 +++++++++++++++++++++++++++++++++
> Documentation/x86/topology.txt | 217 -------------------------------
> 3 files changed, 229 insertions(+), 217 deletions(-)
> create mode 100644 Documentation/x86/topology.rst
> delete mode 100644 Documentation/x86/topology.txt
Why? Please preserve as much as possible from the original file...
it is really hard to see what you're doing. Most of those x86
files are already almost at ReST format (like this one). There's
absolutely **no reason** why you would do so much radical changes
that would below the 50% similarity threshold that would make git
to recognize as a change on the same file!
I'll give a quick review on this one, but it is really hard to be
sure that something is missing, when the similarity is too low.
>
> diff --git a/Documentation/x86/index.rst b/Documentation/x86/index.rst
> index 8f08caf4fbbb..2033791e53bc 100644
> --- a/Documentation/x86/index.rst
> +++ b/Documentation/x86/index.rst
> @@ -9,3 +9,4 @@ Linux x86 Support
> :numbered:
>
> boot
> + topology
> diff --git a/Documentation/x86/topology.rst b/Documentation/x86/topology.rst
> new file mode 100644
> index 000000000000..1df5f56f4882
> --- /dev/null
> +++ b/Documentation/x86/topology.rst
> @@ -0,0 +1,228 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +============
> +x86 Topology
> +============
> +
> +This documents and clarifies the main aspects of x86 topology modelling and
> +representation in the kernel. Update/change when doing changes to the
> +respective code.
> +
> +The architecture-agnostic topology definitions are in
> +Documentation/cputopology.txt. This file holds x86-specific
> +differences/specialities which must not necessarily apply to the generic
> +definitions. Thus, the way to read up on Linux topology on x86 is to start
> +with the generic one and look at this one in parallel for the x86 specifics.
> +
> +Needless to say, code should use the generic functions - this file is *only*
> +here to *document* the inner workings of x86 topology.
> +
> +Started by Thomas Gleixner <tglx@linutronix.de> and Borislav Petkov <bp@alien8.de>.
> +
> +The main aim of the topology facilities is to present adequate interfaces to
> +code which needs to know/query/use the structure of the running system wrt
> +threads, cores, packages, etc.
> +
> +The kernel does not care about the concept of physical sockets because a
> +socket has no relevance to software. It's an electromechanical component. In
> +the past a socket always contained a single package (see below), but with the
> +advent of Multi Chip Modules (MCM) a socket can hold more than one package. So
> +there might be still references to sockets in the code, but they are of
> +historical nature and should be cleaned up.
> +
> +The topology of a system is described in the units of:
> +
> + - packages
> + - cores
> + - threads
> +
> +Package
> +=======
> +
> +Packages contain a number of cores plus shared resources, e.g. DRAM
> +controller, shared caches etc.
> +
> +AMD nomenclature for package is 'Node'.
> +
> +Package-related topology information in the kernel:
> +
> + - cpuinfo_x86.x86_max_cores:
> +
> + The number of cores in a package. This information is retrieved via CPUID.
> +
> + - cpuinfo_x86.phys_proc_id:
> +
> + The physical ID of the package. This information is retrieved via CPUID
> + and deduced from the APIC IDs of the cores in the package.
> +
> + - cpuinfo_x86.logical_id:
> +
> + The logical ID of the package. As we do not trust BIOSes to enumerate the
> + packages in a consistent way, we introduced the concept of logical package
> + ID so we can sanely calculate the number of maximum possible packages in
> + the system and have the packages enumerated linearly.
> +
> + - topology_max_packages():
> +
> + The maximum possible number of packages in the system. Helpful for per
> + package facilities to preallocate per package information.
> +
> + - cpu_llc_id:
> +
> + A per-CPU variable containing:
> +
> + - On Intel, the first APIC ID of the list of CPUs sharing the Last Level
> + Cache.
> +
> + - On AMD, the Node ID or Core Complex ID containing the Last Level
> + Cache. In general, it is a number identifying an LLC uniquely on the
> + system.
> +
> +Cores
> +=====
> +
> +A core consists of 1 or more threads. It does not matter whether the threads
> +are SMT- or CMT-type threads.
> +
> +AMDs nomenclature for a CMT core is "Compute Unit". The kernel always uses
> +"core".
> +
> +Core-related topology information in the kernel:
> +
> + - smp_num_siblings:
> +
> + The number of threads in a core. The number of threads in a package can be
> + calculated by::
> +
> + threads_per_package = cpuinfo_x86.x86_max_cores * smp_num_siblings
> +
> +
> +Threads
> +=======
> +
> +A thread is a single scheduling unit. It's the equivalent to a logical Linux
> +CPU.
> +
> +AMDs nomenclature for CMT threads is "Compute Unit Core". The kernel always
> +uses "thread".
> +
> +Thread-related topology information in the kernel:
> +
> + - topology_core_cpumask():
> +
> + The cpumask contains all online threads in the package to which a thread
> + belongs.
> +
> + The number of online threads is also printed in /proc/cpuinfo "siblings."
> +
> + - topology_sibling_cpumask():
> +
> + The cpumask contains all online threads in the core to which a thread
> + belongs.
> +
> + - topology_logical_package_id():
> +
> + The logical package ID to which a thread belongs.
> +
> + - topology_physical_package_id():
> +
> + The physical package ID to which a thread belongs.
> +
> + - topology_core_id();
> +
> + The ID of the core to which a thread belongs. It is also printed in /proc/cpuinfo
> + "core_id."
> +
> +
> +
> +System topology examples
> +========================
> +
> +.. note:: The alternative Linux CPU enumeration depends on how the BIOS
> + enumerates the threads. Many BIOSes enumerate all threads 0 first and
> + then all threads 1. That has the "advantage" that the logical Linux CPU
> + numbers of threads 0 stay the same whether threads are enabled or not.
> + That's merely an implementation detail and has no practical impact.
> +
> +1) Single Package, Single Core
> +::
I would just place the :: on the above line. Same applies to similar
cases on this file.
> +
> + [package 0] -> [core 0] -> [thread 0] -> Linux CPU 0
> +
> +2) Single Package, Dual Core
> +
> + a) One thread per core
> + ::
> +
> + [package 0] -> [core 0] -> [thread 0] -> Linux CPU 0
> + -> [core 1] -> [thread 0] -> Linux CPU 1
Something got broken here.
> +
> + b) Two threads per core
> + ::
> +
> + [package 0] -> [core 0] -> [thread 0] -> Linux CPU 0
> + -> [thread 1] -> Linux CPU 1
> + -> [core 1] -> [thread 0] -> Linux CPU 2
> + -> [thread 1] -> Linux CPU 3
And here... This one, for example, should be, instead:
[package 0] -> [core 0] -> [thread 0] -> Linux CPU 0
-> [thread 1] -> Linux CPU 1
-> [core 1] -> [thread 0] -> Linux CPU 2
-> [thread 1] -> Linux CPU 3
Clearly there's something that it is messing with tabs on your
x86 conversion.
I'll stop my review here, as it sounds pointless to review it,
as there are too many broken whitespace stuff on your
conversion.
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v2] mm: Fix modifying of page protection by insert_pfn_pmd()
From: Matthew Wilcox @ 2019-04-24 17:38 UTC (permalink / raw)
To: Dan Williams
Cc: Jan Kara, linux-nvdimm, Aneesh Kumar K.V, stable, Linux MM,
Chandan Rajendra, Andrew Morton, linuxppc-dev
In-Reply-To: <CAPcyv4hzRj5yxVJ5-7AZgzzBxEL02xf2xwhDv-U9_osWFm9kiA@mail.gmail.com>
On Wed, Apr 24, 2019 at 10:13:15AM -0700, Dan Williams wrote:
> I think unaligned addresses have always been passed to
> vmf_insert_pfn_pmd(), but nothing cared until this patch. I *think*
> the only change needed is the following, thoughts?
>
> diff --git a/fs/dax.c b/fs/dax.c
> index ca0671d55aa6..82aee9a87efa 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1560,7 +1560,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct
> vm_fault *vmf, pfn_t *pfnp,
> }
>
> trace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, entry);
> - result = vmf_insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn,
> + result = vmf_insert_pfn_pmd(vma, pmd_addr, vmf->pmd, pfn,
> write);
We also call vmf_insert_pfn_pmd() in dax_insert_pfn_mkwrite() -- does
that need to change too?
^ permalink raw reply
* Re: [PATCH v4 38/63] Documentation: x86: convert boot.txt to reST
From: Mauro Carvalho Chehab @ 2019-04-24 17:36 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-39-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:07 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> This converts the plain text documentation to reStructuredText format and
> add it to Sphinx TOC tree. No essential content change.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
> Documentation/x86/boot.rst | 1205 +++++++++++++++++++++++++++++++++++
> Documentation/x86/boot.txt | 1130 --------------------------------
> Documentation/x86/index.rst | 2 +
> 3 files changed, 1207 insertions(+), 1130 deletions(-)
> create mode 100644 Documentation/x86/boot.rst
> delete mode 100644 Documentation/x86/boot.txt
>
> diff --git a/Documentation/x86/boot.rst b/Documentation/x86/boot.rst
> new file mode 100644
> index 000000000000..9f55e832bc47
> --- /dev/null
> +++ b/Documentation/x86/boot.rst
> @@ -0,0 +1,1205 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +===========================
> +The Linux/x86 Boot Protocol
> +===========================
> +
> +On the x86 platform, the Linux kernel uses a rather complicated boot
> +convention. This has evolved partially due to historical aspects, as
> +well as the desire in the early days to have the kernel itself be a
> +bootable image, the complicated PC memory model and due to changed
> +expectations in the PC industry caused by the effective demise of
> +real-mode DOS as a mainstream operating system.
> +
> +Currently, the following versions of the Linux/x86 boot protocol exist.
> +
> +Old kernels:
> + zImage/Image support only. Some very early kernels
> + may not even support a command line.
> +
> +Protocol 2.00:
> + (Kernel 1.3.73) Added bzImage and initrd support, as
> + well as a formalized way to communicate between the
> + boot loader and the kernel. setup.S made relocatable,
> + although the traditional setup area still assumed writable.
> +
> +Protocol 2.01:
> + (Kernel 1.3.76) Added a heap overrun warning.
> +
> +Protocol 2.02:
> + (Kernel 2.4.0-test3-pre3) New command line protocol.
> + Lower the conventional memory ceiling. No overwrite
> + of the traditional setup area, thus making booting
> + safe for systems which use the EBDA from SMM or 32-bit
> + BIOS entry points. zImage deprecated but still supported.
> +
> +Protocol 2.03:
> + (Kernel 2.4.18-pre1) Explicitly makes the highest possible
> + initrd address available to the bootloader.
> +
> +Protocol 2.04:
> + (Kernel 2.6.14) Extend the syssize field to four bytes.
> +
> +Protocol 2.05:
> + (Kernel 2.6.20) Make protected mode kernel relocatable.
> + Introduce relocatable_kernel and kernel_alignment fields.
> +
> +Protocol 2.06:
> + (Kernel 2.6.22) Added a field that contains the size of
> + the boot command line.
> +
> +Protocol 2.07:
> + (Kernel 2.6.24) Added paravirtualised boot protocol.
> + Introduced hardware_subarch and hardware_subarch_data
> + and KEEP_SEGMENTS flag in load_flags.
> +
> +Protocol 2.08:
> + (Kernel 2.6.26) Added crc32 checksum and ELF format
> + payload. Introduced payload_offset and payload_length
> + fields to aid in locating the payload.
> +
> +Protocol 2.09:
> + (Kernel 2.6.26) Added a field of 64-bit physical
> + pointer to single linked list of struct setup_data.
> +
> +Protocol 2.10:
> + (Kernel 2.6.31) Added a protocol for relaxed alignment
> + beyond the kernel_alignment added, new init_size and
> + pref_address fields. Added extended boot loader IDs.
> +
> +Protocol 2.11:
> + (Kernel 3.6) Added a field for offset of EFI handover
> + protocol entry point.
> +
> +Protocol 2.12:
> + (Kernel 3.8) Added the xloadflags field and extension fields
> + to struct boot_params for loading bzImage and ramdisk
> + above 4G in 64bit.
This is a side node, but you should really try to avoid replacing too
many lines, as it makes a lot harder for reviewers for no good reason.
For example, this is the way I would convert this changelog table:
@@ -10,6 +11,7 @@ real-mode DOS as a mainstream operating system.
Currently, the following versions of the Linux/x86 boot protocol exist.
+=============== ===============================================================
Old kernels: zImage/Image support only. Some very early kernels
may not even support a command line.
@@ -64,33 +66,35 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields
Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
xloadflags to support booting a 64-bit kernel from 32-bit
EFI
+=============== ===============================================================
This is simple enough, preserves the original author's intent and
makes a lot easier for reviewers to check what you changed.
> +
> +MEMORY LAYOUT
> +=============
> +
> +The traditional memory map for the kernel loader, used for Image or
> +zImage kernels, typically looks like::
> +
> + | |
> + 0A0000 +------------------------+
> + | Reserved for BIOS | Do not use. Reserved for BIOS EBDA.
> + 09A000 +------------------------+
> + | Command line |
> + | Stack/heap | For use by the kernel real-mode code.
> + 098000 +------------------------+
> + | Kernel setup | The kernel real-mode code.
> + 090200 +------------------------+
> + | Kernel boot sector | The kernel legacy boot sector.
> + 090000 +------------------------+
> + | Protected-mode kernel | The bulk of the kernel image.
> + 010000 +------------------------+
> + | Boot loader | <- Boot sector entry point 0000:7C00
> + 001000 +------------------------+
> + | Reserved for MBR/BIOS |
> + 000800 +------------------------+
> + | Typically used by MBR |
> + 000600 +------------------------+
> + | BIOS use only |
> + 000000 +------------------------+
> +
> +
I might be wrong, but it seems that you broke the above ascii
artwork.
> +When using bzImage, the protected-mode kernel was relocated to
> +0x100000 ("high memory"), and the kernel real-mode block (boot sector,
> +setup, and stack/heap) was made relocatable to any address between
> +0x10000 and end of low memory. Unfortunately, in protocols 2.00 and
> +2.01 the 0x90000+ memory range is still used internally by the kernel;
> +the 2.02 protocol resolves that problem.
> +
> +It is desirable to keep the "memory ceiling" -- the highest point in
> +low memory touched by the boot loader -- as low as possible, since
> +some newer BIOSes have begun to allocate some rather large amounts of
> +memory, called the Extended BIOS Data Area, near the top of low
> +memory. The boot loader should use the "INT 12h" BIOS call to verify
> +how much low memory is available.
> +
> +Unfortunately, if INT 12h reports that the amount of memory is too
> +low, there is usually nothing the boot loader can do but to report an
> +error to the user. The boot loader should therefore be designed to
> +take up as little space in low memory as it reasonably can. For
> +zImage or old bzImage kernels, which need data written into the
> +0x90000 segment, the boot loader should make sure not to use memory
> +above the 0x9A000 point; too many BIOSes will break above that point.
> +
> +For a modern bzImage kernel with boot protocol version >= 2.02, a
> +memory layout like the following is suggested::
> +
> + ~ ~
> + | Protected-mode kernel |
> + 100000 +------------------------+
> + | I/O memory hole |
> + 0A0000 +------------------------+
> + | Reserved for BIOS | Leave as much as possible unused
> + ~ ~
> + | Command line | (Can also be below the X+10000 mark)
> + X+10000 +------------------------+
> + | Stack/heap | For use by the kernel real-mode code.
> + X+08000 +------------------------+
> + | Kernel setup | The kernel real-mode code.
> + | Kernel boot sector | The kernel legacy boot sector.
> + X +------------------------+
> + | Boot loader | <- Boot sector entry point 0000:7C00
> + 001000 +------------------------+
> + | Reserved for MBR/BIOS |
> + 000800 +------------------------+
> + | Typically used by MBR |
> + 000600 +------------------------+
> + | BIOS use only |
> + 000000 +------------------------+
Same here: it sounds to me that you mistakenly replaced some tabs
by spaces.
> +
> +... where the address X is as low as the design of the boot loader
> +permits.
That seems to be the legend of the artwork. I would indent it, in
order to be shown inside the artwork.
> +
> +
> +THE REAL-MODE KERNEL HEADER
> +===========================
> +
> +In the following text, and anywhere in the kernel boot sequence, "a
> +sector" refers to 512 bytes. It is independent of the actual sector
> +size of the underlying medium.
> +
> +The first step in loading a Linux kernel should be to load the
> +real-mode code (boot sector and setup code) and then examine the
> +following header at offset 0x01f1. The real-mode code can total up to
> +32K, although the boot loader may choose to load only the first two
> +sectors (1K) and then examine the bootup sector size.
> +
> +The header looks like::
> +
> + Offset Proto Name Meaning
> + /Size
> +
> + 01F1/1 ALL(1 setup_sects The size of the setup in sectors
> + 01F2/2 ALL root_flags If set, the root is mounted readonly
> + 01F4/4 2.04+(2 syssize The size of the 32-bit code in 16-byte paras
> + 01F8/2 ALL ram_size DO NOT USE - for bootsect.S use only
> + 01FA/2 ALL vid_mode Video mode control
> + 01FC/2 ALL root_dev Default root device number
> + 01FE/2 ALL boot_flag 0xAA55 magic number
> + 0200/2 2.00+ jump Jump instruction
> + 0202/4 2.00+ header Magic signature "HdrS"
> + 0206/2 2.00+ version Boot protocol version supported
> + 0208/4 2.00+ realmode_swtch Boot loader hook (see below)
> + 020C/2 2.00+ start_sys_seg The load-low segment (0x1000) (obsolete)
> + 020E/2 2.00+ kernel_version Pointer to kernel version string
> + 0210/1 2.00+ type_of_loader Boot loader identifier
> + 0211/1 2.00+ loadflags Boot protocol option flags
> + 0212/2 2.00+ setup_move_size Move to high memory size (used with hooks)
> + 0214/4 2.00+ code32_start Boot loader hook (see below)
> + 0218/4 2.00+ ramdisk_image initrd load address (set by boot loader)
> + 021C/4 2.00+ ramdisk_size initrd size (set by boot loader)
> + 0220/4 2.00+ bootsect_kludge DO NOT USE - for bootsect.S use only
> + 0224/2 2.01+ heap_end_ptr Free memory after setup end
> + 0226/1 2.02+(3 ext_loader_ver Extended boot loader version
> + 0227/1 2.02+(3 ext_loader_type Extended boot loader ID
> + 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line
> + 022C/4 2.03+ initrd_addr_max Highest legal initrd address
> + 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel
> + 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not
> + 0235/1 2.10+ min_alignment Minimum alignment, as a power of two
> + 0236/2 2.12+ xloadflags Boot protocol option flags
> + 0238/4 2.06+ cmdline_size Maximum size of the kernel command line
> + 023C/4 2.07+ hardware_subarch Hardware subarchitecture
> + 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data
> + 0248/4 2.08+ payload_offset Offset of kernel payload
> + 024C/4 2.08+ payload_length Length of kernel payload
> + 0250/8 2.09+ setup_data 64-bit physical pointer to linked list
> + of struct setup_data
> + 0258/8 2.10+ pref_address Preferred loading address
> + 0260/4 2.10+ init_size Linear memory required during initialization
> + 0264/4 2.11+ handover_offset Offset of handover entry point
This is a table. Please use table markups and fix some wrong indentation
there, as it makes a lot easier to read it on html, e-pub and pdf formats.
E. g. something like:
====== ======== ===================== ========================================
Offset Proto Name Meaning
/Size
01F1/1 ALL(1) setup_sects The size of the setup in sectors
01F2/2 ALL root_flags If set, the root is mounted readonly
01F4/4 2.04+(2) syssize The size of the 32-bit code in 16-byte
paras
01F8/2 ALL ram_size DO NOT USE - for bootsect.S use only
01FA/2 ALL vid_mode Video mode control
01FC/2 ALL root_dev Default root device number
01FE/2 ALL boot_flag 0xAA55 magic number
0200/2 2.00+ jump Jump instruction
0202/4 2.00+ header Magic signature "HdrS"
0206/2 2.00+ version Boot protocol version supported
0208/4 2.00+ realmode_swtch Boot loader hook (see below)
020C/2 2.00+ start_sys_seg The load-low segment (0x1000) (obsolete)
020E/2 2.00+ kernel_version Pointer to kernel version string
0210/1 2.00+ type_of_loader Boot loader identifier
0211/1 2.00+ loadflags Boot protocol option flags
0212/2 2.00+ setup_move_size Move to high memory size
(used with hooks)
0214/4 2.00+ code32_start Boot loader hook (see below)
0218/4 2.00+ ramdisk_image initrd load address (set by boot loader)
021C/4 2.00+ ramdisk_size initrd size (set by boot loader)
0220/4 2.00+ bootsect_kludge DO NOT USE - for bootsect.S use only
0224/2 2.01+ heap_end_ptr Free memory after setup end
0226/1 2.02+(3) ext_loader_ver Extended boot loader version
0227/1 2.02+(3) ext_loader_type Extended boot loader ID
0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line
022C/4 2.03+ initrd_addr_max Highest legal initrd address
0230/4 2.05+ kernel_alignment Physical addr alignment required for
kernel
0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not
0235/1 2.10+ min_alignment Minimum alignment, as a power of two
0236/2 2.12+ xloadflags Boot protocol option flags
0238/4 2.06+ cmdline_size Maximum size of the kernel command line
023C/4 2.07+ hardware_subarch Hardware subarchitecture
0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data
0248/4 2.08+ payload_offset Offset of kernel payload
024C/4 2.08+ payload_length Length of kernel payload
0250/8 2.09+ setup_data 64-bit physical pointer to linked list
of struct setup_data
0258/8 2.10+ pref_address Preferred loading address
0260/4 2.10+ init_size Linear memory required during
initialization
0264/4 2.11+ handover_offset Offset of handover entry point
====== ======== ===================== ========================================
> +
> +(1) For backwards compatibility, if the setup_sects field contains 0, the
> + real value is 4.
> +
> +(2) For boot protocol prior to 2.04, the upper two bytes of the syssize
> + field are unusable, which means the size of a bzImage kernel
> + cannot be determined.
> +
> +(3) Ignored, but safe to set, for boot protocols 2.02-2.09.
Btw, (1), (2) and (3) here sounds to be footnotes. Perhaps you could use
ReST footnote markups, if ok for the X86 maintainers.
> +
> +If the "HdrS" (0x53726448) magic number is not found at offset 0x202,
> +the boot protocol version is "old". Loading an old kernel, the
> +following parameters should be assumed::
> +
> + Image type = zImage
> + initrd not supported
> + Real-mode kernel must be located at 0x90000.
> +
> +Otherwise, the "version" field contains the protocol version,
> +e.g. protocol version 2.01 will contain 0x0201 in this field. When
> +setting fields in the header, you must make sure only to set fields
> +supported by the protocol version in use.
> +
> +
> +DETAILS OF HEADER FIELDS
> +========================
> +
> +For each field, some are information from the kernel to the bootloader
> +("read"), some are expected to be filled out by the bootloader
> +("write"), and some are expected to be read and modified by the
> +bootloader ("modify").
> +
> +All general purpose boot loaders should write the fields marked
> +(obligatory). Boot loaders who want to load the kernel at a
> +nonstandard address should fill in the fields marked (reloc); other
> +boot loaders can ignore those fields.
> +
> +The byte order of all fields is littleendian (this is x86, after all.)
> +::
> +
> + Field name: setup_sects
> + Type: read
> + Offset/size: 0x1f1/1
> + Protocol: ALL
Marking this as a literal block sounds plain wrong to me. I suspect that
you could use this syntax instead:
:Field name: setup_sects
:Type: read
:Offset/size: 0x1f1/1
:Protocol: ALL
Or:
Field name: setup_sects
-----------------------
Type:
read
Offset/size:
0x1f1/1
Protocol:
ALL
Or (my favorite):
Field name: setup_sects
-----------------------
:Type: read
:Offset/size: 0x1f1/1
:Protocol: ALL
As it is more compact in text, and will provide a much better
html/pdf output. It will also make (IMHO) a lot easier for
people to read in text and seek for an specific field.
Of course, whatever we do here should be applied to all similar
structs inside this file.
> +
> +The size of the setup code in 512-byte sectors. If this field is
> +0, the real value is 4. The real-mode code consists of the boot
> +sector (always one 512-byte sector) plus the setup code.
> +::
> +
> + Field name: root_flags
> + Type: modify (optional)
> + Offset/size: 0x1f2/2
> + Protocol: ALL
> +
> +If this field is nonzero, the root defaults to readonly. The use of
> +this field is deprecated; use the "ro" or "rw" options on the
> +command line instead.
> +::
> +
> + Field name: syssize
> + Type: read
> + Offset/size: 0x1f4/4 (protocol 2.04+) 0x1f4/2 (protocol ALL)
> + Protocol: 2.04+
> +
> +The size of the protected-mode code in units of 16-byte paragraphs.
> +For protocol versions older than 2.04 this field is only two bytes
> +wide, and therefore cannot be trusted for the size of a kernel if
> +the LOAD_HIGH flag is set.
> +::
> +
> + Field name: ram_size
> + Type: kernel internal
> + Offset/size: 0x1f8/2
> + Protocol: ALL
> +
> +This field is obsolete.
> +::
> +
> + Field name: vid_mode
> + Type: modify (obligatory)
> + Offset/size: 0x1fa/2
> +
> +Please see the section on SPECIAL COMMAND LINE OPTIONS.
> +::
> +
> + Field name: root_dev
> + Type: modify (optional)
> + Offset/size: 0x1fc/2
> + Protocol: ALL
> +
> +The default root device device number. The use of this field is
> +deprecated, use the "root=" option on the command line instead.
> +::
> +
> + Field name: boot_flag
> + Type: read
> + Offset/size: 0x1fe/2
> + Protocol: ALL
> +
> +Contains 0xAA55. This is the closest thing old Linux kernels have
> +to a magic number.
> +::
> +
> + Field name: jump
> + Type: read
> + Offset/size: 0x200/2
> + Protocol: 2.00+
> +
> +Contains an x86 jump instruction, 0xEB followed by a signed offset
> +relative to byte 0x202. This can be used to determine the size of
> +the header.
> +::
> +
> + Field name: header
> + Type: read
> + Offset/size: 0x202/4
> + Protocol: 2.00+
> +
> +Contains the magic number "HdrS" (0x53726448).
> +::
> +
> + Field name: version
> + Type: read
> + Offset/size: 0x206/2
> + Protocol: 2.00+
> +
> +Contains the boot protocol version, in (major << 8)+minor format,
> +e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
> +10.17.
> +::
> +
> + Field name: realmode_swtch
> + Type: modify (optional)
> + Offset/size: 0x208/4
> + Protocol: 2.00+
> +
> +Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
> +::
> +
> + Field name: start_sys_seg
> + Type: read
> + Offset/size: 0x20c/2
> + Protocol: 2.00+
> +
> +The load low segment (0x1000). Obsolete.
> +::
> +
> + Field name: kernel_version
> + Type: read
> + Offset/size: 0x20e/2
> + Protocol: 2.00+
> +
> +If set to a nonzero value, contains a pointer to a NUL-terminated
> +human-readable kernel version number string, less 0x200. This can
> +be used to display the kernel version to the user. This value
> +should be less than (0x200*setup_sects).
> +
> +For example, if this value is set to 0x1c00, the kernel version
> +number string can be found at offset 0x1e00 in the kernel file.
> +This is a valid value if and only if the "setup_sects" field
> +contains the value 15 or higher, as::
> +
> + 0x1c00 < 15*0x200 (= 0x1e00) but
> + 0x1c00 >= 14*0x200 (= 0x1c00)
> +
> + 0x1c00 >> 9 = 14, so the minimum value for setup_secs is 15.
> +
> +::
> +
> + Field name: type_of_loader
> + Type: write (obligatory)
> + Offset/size: 0x210/1
> + Protocol: 2.00+
> +
> +If your boot loader has an assigned id (see table below), enter
> +0xTV here, where T is an identifier for the boot loader and V is
> +a version number. Otherwise, enter 0xFF here.
> +
> +For boot loader IDs above T = 0xD, write T = 0xE to this field and
> +write the extended ID minus 0x10 to the ext_loader_type field.
> +Similarly, the ext_loader_ver field can be used to provide more than
> +four bits for the bootloader version.
> +
> +For example, for T = 0x15, V = 0x234, write::
> +
> + type_of_loader <- 0xE4
> + ext_loader_type <- 0x05
> + ext_loader_ver <- 0x23
> +
> +Assigned boot loader ids (hexadecimal)::
> +
> + 0 LILO (0x00 reserved for pre-2.00 bootloader)
> + 1 Loadlin
> + 2 bootsect-loader (0x20, all other values reserved)
> + 3 Syslinux
> + 4 Etherboot/gPXE/iPXE
> + 5 ELILO
> + 7 GRUB
> + 8 U-Boot
> + 9 Xen
> + A Gujin
> + B Qemu
> + C Arcturus Networks uCbootloader
> + D kexec-tools
> + E Extended (see ext_loader_type)
> + F Special (0xFF = undefined)
> + 10 Reserved
> + 11 Minimal Linux Bootloader <http://sebastian-plotz.blogspot.de>
> + 12 OVMF UEFI virtualization stack
Clearly there's something wrong with the last 3 lines, as they aren't
following the expected indentation.
Anyway, IMO the best would be to use a table, instead:
== =======================================
0 LILO
(0x00 reserved for pre-2.00 bootloader)
1 Loadlin
2 bootsect-loader
(0x20, all other values reserved)
3 Syslinux
4 Etherboot/gPXE/iPXE
5 ELILO
7 GRUB
8 U-Boot
9 Xen
A Gujin
B Qemu
C Arcturus Networks uCbootloader
D kexec-tools
E Extended
(see ext_loader_type)
F Special
(0xFF = undefined)
10 Reserved
11 Minimal Linux Bootloader
<http://sebastian-plotz.blogspot.de>
12 OVMF UEFI virtualization stack
== =======================================
> +
> +Please contact <hpa@zytor.com> if you need a bootloader ID value assigned.
> +::
> +
> + Field name: loadflags
> + Type: modify (obligatory)
> + Offset/size: 0x211/1
> + Protocol: 2.00+
> +
> +This field is a bitmask.
> +::
> +
> + Bit 0 (read): LOADED_HIGH
> + - If 0, the protected-mode code is loaded at 0x10000.
> + - If 1, the protected-mode code is loaded at 0x100000.
> +
> + Bit 1 (kernel internal): KASLR_FLAG
> + - Used internally by the compressed kernel to communicate
> + KASLR status to kernel proper.
> + If 1, KASLR enabled.
> + If 0, KASLR disabled.
You need to either add blank lines or add a "- " before the
two if's above.
> +
> + Bit 5 (write): QUIET_FLAG
> + - If 0, print early messages.
> + - If 1, suppress early messages.
> + This requests to the kernel (decompressor and early
> + kernel) to not write early messages that require
> + accessing the display hardware directly.
> +
> + Bit 6 (write): KEEP_SEGMENTS
> + Protocol: 2.07+
> + - If 0, reload the segment registers in the 32bit entry point.
> + - If 1, do not reload the segment registers in the 32bit entry point.
> + Assume that %cs %ds %ss %es are all set to flat segments with
> + a base of 0 (or the equivalent for their environment).
> +
> + Bit 7 (write): CAN_USE_HEAP
> + Set this bit to 1 to indicate that the value entered in the
> + heap_end_ptr is valid. If this field is clear, some setup code
> + functionality will be disabled.
> +
> +::
> +
> + Field name: setup_move_size
> + Type: modify (obligatory)
> + Offset/size: 0x212/2
> + Protocol: 2.00-2.01
> +
> +When using protocol 2.00 or 2.01, if the real mode kernel is not
> +loaded at 0x90000, it gets moved there later in the loading
> +sequence. Fill in this field if you want additional data (such as
> +the kernel command line) moved in addition to the real-mode kernel
> +itself.
> +
> +The unit is bytes starting with the beginning of the boot sector.
> +
> +This field is can be ignored when the protocol is 2.02 or higher, or
> +if the real-mode code is loaded at 0x90000.
> +::
> +
> + Field name: code32_start
> + Type: modify (optional, reloc)
> + Offset/size: 0x214/4
> + Protocol: 2.00+
> +
> +The address to jump to in protected mode. This defaults to the load
> +address of the kernel, and can be used by the boot loader to
> +determine the proper load address.
> +
> +This field can be modified for two purposes:
> +
> + 1. as a boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
> +
> + 2. if a bootloader which does not install a hook loads a
> + relocatable kernel at a nonstandard address it will have to modify
> + this field to point to the load address.
> +
> +::
> +
> + Field name: ramdisk_image
> + Type: write (obligatory)
> + Offset/size: 0x218/4
> + Protocol: 2.00+
> +
> +The 32-bit linear address of the initial ramdisk or ramfs. Leave at
> +zero if there is no initial ramdisk/ramfs.
> +::
> +
> + Field name: ramdisk_size
> + Type: write (obligatory)
> + Offset/size: 0x21c/4
> + Protocol: 2.00+
> +
> +Size of the initial ramdisk or ramfs. Leave at zero if there is no
> +initial ramdisk/ramfs.
> +::
> +
> + Field name: bootsect_kludge
> + Type: kernel internal
> + Offset/size: 0x220/4
> + Protocol: 2.00+
> +
> +This field is obsolete.
> +::
> +
> + Field name: heap_end_ptr
> + Type: write (obligatory)
> + Offset/size: 0x224/2
> + Protocol: 2.01+
> +
> +Set this field to the offset (from the beginning of the real-mode
> +code) of the end of the setup stack/heap, minus 0x0200.
> +::
> +
> + Field name: ext_loader_ver
> + Type: write (optional)
> + Offset/size: 0x226/1
> + Protocol: 2.02+
> +
> +This field is used as an extension of the version number in the
> +type_of_loader field. The total version number is considered to be
> +(type_of_loader & 0x0f) + (ext_loader_ver << 4).
> +
> +The use of this field is boot loader specific. If not written, it
> +is zero.
> +
> +Kernels prior to 2.6.31 did not recognize this field, but it is safe
> +to write for protocol version 2.02 or higher.
> +::
> +
> + Field name: ext_loader_type
> + Type: write (obligatory if (type_of_loader & 0xf0) == 0xe0)
> + Offset/size: 0x227/1
> + Protocol: 2.02+
> +
> +This field is used as an extension of the type number in
> +type_of_loader field. If the type in type_of_loader is 0xE, then
> +the actual type is (ext_loader_type + 0x10).
> +
> +This field is ignored if the type in type_of_loader is not 0xE.
> +
> +Kernels prior to 2.6.31 did not recognize this field, but it is safe
> +to write for protocol version 2.02 or higher.
> +::
> +
> + Field name: cmd_line_ptr
> + Type: write (obligatory)
> + Offset/size: 0x228/4
> + Protocol: 2.02+
> +
> +Set this field to the linear address of the kernel command line.
> +The kernel command line can be located anywhere between the end of
> +the setup heap and 0xA0000; it does not have to be located in the
> +same 64K segment as the real-mode code itself.
> +
> +Fill in this field even if your boot loader does not support a
> +command line, in which case you can point this to an empty string
> +(or better yet, to the string "auto".) If this field is left at
> +zero, the kernel will assume that your boot loader does not support
> +the 2.02+ protocol.
> +::
> +
> + Field name: initrd_addr_max
> + Type: read
> + Offset/size: 0x22c/4
> + Protocol: 2.03+
> +
> +The maximum address that may be occupied by the initial
> +ramdisk/ramfs contents. For boot protocols 2.02 or earlier, this
> +field is not present, and the maximum address is 0x37FFFFFF. (This
> +address is defined as the address of the highest safe byte, so if
> +your ramdisk is exactly 131072 bytes long and this field is
> +0x37FFFFFF, you can start your ramdisk at 0x37FE0000.)
> +::
> +
> + Field name: kernel_alignment
> + Type: read/modify (reloc)
> + Offset/size: 0x230/4
> + Protocol: 2.05+ (read), 2.10+ (modify)
> +
> +Alignment unit required by the kernel (if relocatable_kernel is
> +true.) A relocatable kernel that is loaded at an alignment
> +incompatible with the value in this field will be realigned during
> +kernel initialization.
> +
> +Starting with protocol version 2.10, this reflects the kernel
> +alignment preferred for optimal performance; it is possible for the
> +loader to modify this field to permit a lesser alignment. See the
> +min_alignment and pref_address field below.
> +::
> +
> + Field name: relocatable_kernel
> + Type: read (reloc)
> + Offset/size: 0x234/1
> + Protocol: 2.05+
> +
> +If this field is nonzero, the protected-mode part of the kernel can
> +be loaded at any address that satisfies the kernel_alignment field.
> +After loading, the boot loader must set the code32_start field to
> +point to the loaded code, or to a boot loader hook.
> +::
> +
> + Field name: min_alignment
> + Type: read (reloc)
> + Offset/size: 0x235/1
> + Protocol: 2.10+
> +
> +This field, if nonzero, indicates as a power of two the minimum
> +alignment required, as opposed to preferred, by the kernel to boot.
> +If a boot loader makes use of this field, it should update the
> +kernel_alignment field with the alignment unit desired; typically::
> +
> + kernel_alignment = 1 << min_alignment
> +
> +There may be a considerable performance cost with an excessively
> +misaligned kernel. Therefore, a loader should typically try each
> +power-of-two alignment from kernel_alignment down to this alignment.
> +::
> +
> + Field name: xloadflags
> + Type: read
> + Offset/size: 0x236/2
> + Protocol: 2.12+
> +
> +This field is a bitmask.
> +::
> +
> + Bit 0 (read): XLF_KERNEL_64
> + - If 1, this kernel has the legacy 64-bit entry point at 0x200.
> +
> + Bit 1 (read): XLF_CAN_BE_LOADED_ABOVE_4G
> + - If 1, kernel/boot_params/cmdline/ramdisk can be above 4G.
Please indent it the same way as Bit 0.
> +
> + Bit 2 (read): XLF_EFI_HANDOVER_32
> + - If 1, the kernel supports the 32-bit EFI handoff entry point
> + given at handover_offset.
> +
> + Bit 3 (read): XLF_EFI_HANDOVER_64
> + - If 1, the kernel supports the 64-bit EFI handoff entry point
> + given at handover_offset + 0x200.
> +
> + Bit 4 (read): XLF_EFI_KEXEC
> + - If 1, the kernel supports kexec EFI boot with EFI runtime support.
> +
> +::
> +
> + Field name: cmdline_size
> + Type: read
> + Offset/size: 0x238/4
> + Protocol: 2.06+
> +
> +The maximum size of the command line without the terminating
> +zero. This means that the command line can contain at most
> +cmdline_size characters. With protocol version 2.05 and earlier, the
> +maximum size was 255.
> +::
> +
> + Field name: hardware_subarch
> + Type: write (optional, defaults to x86/PC)
> + Offset/size: 0x23c/4
> + Protocol: 2.07+
> +
> +In a paravirtualized environment the hardware low level architectural
> +pieces such as interrupt handling, page table handling, and
> +accessing process control registers needs to be done differently.
> +
> +This field allows the bootloader to inform the kernel we are in one
> +one of those environments.
> +::
> +
> + 0x00000000 The default x86/PC environment
> + 0x00000001 lguest
> + 0x00000002 Xen
> + 0x00000003 Moorestown MID
> + 0x00000004 CE4100 TV Platform
This is already a table. Just add the markups for it, instead of using '::'
e. g.:
+ ========== ==============================
0x00000000 The default x86/PC environment
0x00000001 lguest
0x00000002 Xen
0x00000003 Moorestown MID
0x00000004 CE4100 TV Platform
+ ========== ==============================
> +
> +::
> +
> + Field name: hardware_subarch_data
> + Type: write (subarch-dependent)
> + Offset/size: 0x240/8
> + Protocol: 2.07+
> +
> +A pointer to data that is specific to hardware subarch
> +This field is currently unused for the default x86/PC environment,
> +do not modify.
> +::
> +
> + Field name: payload_offset
> + Type: read
> + Offset/size: 0x248/4
> + Protocol: 2.08+
> +
> +If non-zero then this field contains the offset from the beginning
> +of the protected-mode code to the payload.
> +
> +The payload may be compressed. The format of both the compressed and
> +uncompressed data should be determined using the standard magic
> +numbers. The currently supported compression formats are gzip
> +(magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
> +(magic number 5D 00), XZ (magic number FD 37), and LZ4 (magic number
> +02 21). The uncompressed payload is currently always ELF (magic
> +number 7F 45 4C 46).
> +::
> +
> + Field name: payload_length
> + Type: read
> + Offset/size: 0x24c/4
> + Protocol: 2.08+
> +
> +The length of the payload.
> +::
> +
> + Field name: setup_data
> + Type: write (special)
> + Offset/size: 0x250/8
> + Protocol: 2.09+
> +
> +The 64-bit physical pointer to NULL terminated single linked list of
> +struct setup_data. This is used to define a more extensible boot
> +parameters passing mechanism. The definition of struct setup_data is
> +as follow::
> +
> + struct setup_data {
> + u64 next;
> + u32 type;
> + u32 len;
> + u8 data[0];
> + };
> +
> +Where, the next is a 64-bit physical pointer to the next node of
> +linked list, the next field of the last node is 0; the type is used
> +to identify the contents of data; the len is the length of data
> +field; the data holds the real payload.
> +
> +This list may be modified at a number of points during the bootup
> +process. Therefore, when modifying this list one should always make
> +sure to consider the case where the linked list already contains
> +entries.
> +::
> +
> + Field name: pref_address
> + Type: read (reloc)
> + Offset/size: 0x258/8
> + Protocol: 2.10+
> +
> +This field, if nonzero, represents a preferred load address for the
> +kernel. A relocating bootloader should attempt to load at this
> +address if possible.
> +
> +A non-relocatable kernel will unconditionally move itself and to run
> +at this address.
> +::
> +
> + Field name: init_size
> + Type: read
> + Offset/size: 0x260/4
> +
> +This field indicates the amount of linear contiguous memory starting
> +at the kernel runtime start address that the kernel needs before it
> +is capable of examining its memory map. This is not the same thing
> +as the total amount of memory the kernel needs to boot, but it can
> +be used by a relocating boot loader to help select a safe load
> +address for the kernel.
> +
> +The kernel runtime start address is determined by the following algorithm::
> +
> + if (relocatable_kernel)
> + runtime_start = align_up(load_address, kernel_alignment)
> + else
> + runtime_start = pref_address
> +
> +::
> +
> + Field name: handover_offset
> + Type: read
> + Offset/size: 0x264/4
> +
> +This field is the offset from the beginning of the kernel image to
> +the EFI handover protocol entry point. Boot loaders using the EFI
> +handover protocol to boot the kernel should jump to this offset.
> +
> +See EFI HANDOVER PROTOCOL below for more details.
> +
> +
> +THE IMAGE CHECKSUM
> +==================
> +
> +From boot protocol version 2.08 onwards the CRC-32 is calculated over
> +the entire file using the characteristic polynomial 0x04C11DB7 and an
> +initial remainder of 0xffffffff. The checksum is appended to the
> +file; therefore the CRC of the file up to the limit specified in the
> +syssize field of the header is always 0.
> +
> +
> +THE KERNEL COMMAND LINE
> +=======================
> +
> +The kernel command line has become an important way for the boot
> +loader to communicate with the kernel. Some of its options are also
> +relevant to the boot loader itself, see "special command line options"
> +below.
> +
> +The kernel command line is a null-terminated string. The maximum
> +length can be retrieved from the field cmdline_size. Before protocol
> +version 2.06, the maximum was 255 characters. A string that is too
> +long will be automatically truncated by the kernel.
> +
> +If the boot protocol version is 2.02 or later, the address of the
> +kernel command line is given by the header field cmd_line_ptr (see
> +above.) This address can be anywhere between the end of the setup
> +heap and 0xA0000.
> +
> +If the protocol version is *not* 2.02 or higher, the kernel
> +command line is entered using the following protocol:
> +
> + - At offset 0x0020 (word), "cmd_line_magic", enter the magic
> + number 0xA33F.
> +
> + - At offset 0x0022 (word), "cmd_line_offset", enter the offset
> + of the kernel command line (relative to the start of the
> + real-mode kernel).
> +
> + - The kernel command line *must* be within the memory region
> + covered by setup_move_size, so you may need to adjust this
> + field.
> +
> +
> +MEMORY LAYOUT OF THE REAL-MODE CODE
> +===================================
> +
> +The real-mode code requires a stack/heap to be set up, as well as
> +memory allocated for the kernel command line. This needs to be done
> +in the real-mode accessible memory in bottom megabyte.
> +
> +It should be noted that modern machines often have a sizable Extended
> +BIOS Data Area (EBDA). As a result, it is advisable to use as little
> +of the low megabyte as possible.
> +
> +Unfortunately, under the following circumstances the 0x90000 memory
> +segment has to be used:
> +
> + - When loading a zImage kernel ((loadflags & 0x01) == 0).
> + - When loading a 2.01 or earlier boot protocol kernel.
> +
> + For the 2.00 and 2.01 boot protocols, the real-mode code
> + can be loaded at another address, but it is internally
> + relocated to 0x90000. For the "old" protocol, the
> + real-mode code must be loaded at 0x90000.
> +
> +When loading at 0x90000, avoid using memory above 0x9a000.
> +
> +For boot protocol 2.02 or higher, the command line does not have to be
> +located in the same 64K segment as the real-mode setup code; it is
> +thus permitted to give the stack/heap the full 64K segment and locate
> +the command line above it.
> +
> +The kernel command line should not be located below the real-mode
> +code, nor should it be located in high memory.
> +
> +
> +SAMPLE BOOT CONFIGURATION
> +=========================
> +
> +As a sample configuration, assume the following layout of the real
> +mode segment.
> +
> +When loading below 0x90000, use the entire segment::
> +
> + 0x0000-0x7fff Real mode kernel
> + 0x8000-0xdfff Stack and heap
> + 0xe000-0xffff Kernel command line
> +
> +When loading at 0x90000 OR the protocol version is 2.01 or earlier::
> +
> + 0x0000-0x7fff Real mode kernel
> + 0x8000-0x97ff Stack and heap
> + 0x9800-0x9fff Kernel command line
Again, tables. Just do:
When loading below 0x90000, use the entire segment:
+ ============= ===================
0x0000-0x7fff Real mode kernel
0x8000-0xdfff Stack and heap
0xe000-0xffff Kernel command line
+ ============= ===================
When loading at 0x90000 OR the protocol version is 2.01 or earlier:
+ ============= ===================
0x0000-0x7fff Real mode kernel
0x8000-0x97ff Stack and heap
0x9800-0x9fff Kernel command line
+ ============= ===================
> +
> +Such a boot loader should enter the following fields in the header::
> +
> + unsigned long base_ptr; /* base address for real-mode segment */
> +
> + if ( setup_sects == 0 ) {
> + setup_sects = 4;
> + }
> +
> + if ( protocol >= 0x0200 ) {
> + type_of_loader = <type code>;
> + if ( loading_initrd ) {
> + ramdisk_image = <initrd_address>;
> + ramdisk_size = <initrd_size>;
> + }
> +
> + if ( protocol >= 0x0202 && loadflags & 0x01 )
> + heap_end = 0xe000;
> + else
> + heap_end = 0x9800;
> +
> + if ( protocol >= 0x0201 ) {
> + heap_end_ptr = heap_end - 0x200;
> + loadflags |= 0x80; /* CAN_USE_HEAP */
> + }
> +
> + if ( protocol >= 0x0202 ) {
> + cmd_line_ptr = base_ptr + heap_end;
> + strcpy(cmd_line_ptr, cmdline);
> + } else {
> + cmd_line_magic = 0xA33F;
> + cmd_line_offset = heap_end;
> + setup_move_size = heap_end + strlen(cmdline)+1;
> + strcpy(base_ptr+cmd_line_offset, cmdline);
> + }
> + } else {
> + /* Very old kernel */
> +
> + heap_end = 0x9800;
> +
> + cmd_line_magic = 0xA33F;
> + cmd_line_offset = heap_end;
> +
> + /* A very old kernel MUST have its real-mode code
> + loaded at 0x90000 */
> +
> + if ( base_ptr != 0x90000 ) {
> + /* Copy the real-mode kernel */
> + memcpy(0x90000, base_ptr, (setup_sects+1)*512);
> + base_ptr = 0x90000; /* Relocated */
> + }
> +
> + strcpy(0x90000+cmd_line_offset, cmdline);
> +
> + /* It is recommended to clear memory up to the 32K mark */
> + memset(0x90000 + (setup_sects+1)*512, 0,
> + (64-(setup_sects+1))*512);
> + }
> +
> +
> +LOADING THE REST OF THE KERNEL
> +==============================
> +
> +The 32-bit (non-real-mode) kernel starts at offset (setup_sects+1)*512
> +in the kernel file (again, if setup_sects == 0 the real value is 4.)
> +It should be loaded at address 0x10000 for Image/zImage kernels and
> +0x100000 for bzImage kernels.
> +
> +The kernel is a bzImage kernel if the protocol >= 2.00 and the 0x01
> +bit (LOAD_HIGH) in the loadflags field is set::
> +
> + is_bzImage = (protocol >= 0x0200) && (loadflags & 0x01);
> + load_address = is_bzImage ? 0x100000 : 0x10000;
> +
> +Note that Image/zImage kernels can be up to 512K in size, and thus use
> +the entire 0x10000-0x90000 range of memory. This means it is pretty
> +much a requirement for these kernels to load the real-mode part at
> +0x90000. bzImage kernels allow much more flexibility.
> +
> +
> +SPECIAL COMMAND LINE OPTIONS
> +============================
> +
> +If the command line provided by the boot loader is entered by the
> +user, the user may expect the following command line options to work.
> +They should normally not be deleted from the kernel command line even
> +though not all of them are actually meaningful to the kernel. Boot
> +loader authors who need additional command line options for the boot
> +loader itself should get them registered in
> +Documentation/admin-guide/kernel-parameters.rst to make sure they will not
> +conflict with actual kernel options now or in the future.
> +
> + vga=<mode>
> + <mode> here is either an integer (in C notation, either
> + decimal, octal, or hexadecimal) or one of the strings
> + "normal" (meaning 0xFFFF), "ext" (meaning 0xFFFE) or "ask"
> + (meaning 0xFFFD). This value should be entered into the
> + vid_mode field, as it is used by the kernel before the command
> + line is parsed.
> +
> + mem=<size>
> + <size> is an integer in C notation optionally followed by
> + (case insensitive) K, M, G, T, P or E (meaning << 10, << 20,
> + << 30, << 40, << 50 or << 60). This specifies the end of
> + memory to the kernel. This affects the possible placement of
> + an initrd, since an initrd should be placed near end of
> + memory. Note that this is an option to *both* the kernel and
> + the bootloader!
> +
> + initrd=<file>
> + An initrd should be loaded. The meaning of <file> is
> + obviously bootloader-dependent, and some boot loaders
> + (e.g. LILO) do not have such a command.
> +
> +In addition, some boot loaders add the following options to the
> +user-specified command line:
> +
> + BOOT_IMAGE=<file>
> + The boot image which was loaded. Again, the meaning of <file>
> + is obviously bootloader-dependent.
> +
> + auto
> + The kernel was booted without explicit user intervention.
> +
> +If these options are added by the boot loader, it is highly
> +recommended that they are located *first*, before the user-specified
> +or configuration-specified command line. Otherwise, "init=/bin/sh"
> +gets confused by the "auto" option.
> +
> +
> +RUNNING THE KERNEL
> +==================
> +
> +The kernel is started by jumping to the kernel entry point, which is
> +located at *segment* offset 0x20 from the start of the real mode
> +kernel. This means that if you loaded your real-mode kernel code at
> +0x90000, the kernel entry point is 9020:0000.
> +
> +At entry, ds = es = ss should point to the start of the real-mode
> +kernel code (0x9000 if the code is loaded at 0x90000), sp should be
> +set up properly, normally pointing to the top of the heap, and
> +interrupts should be disabled. Furthermore, to guard against bugs in
> +the kernel, it is recommended that the boot loader sets fs = gs = ds =
> +es = ss.
> +
> +In our example from above, we would do::
> +
> + /* Note: in the case of the "old" kernel protocol, base_ptr must
> + be == 0x90000 at this point; see the previous sample code */
> +
> + seg = base_ptr >> 4;
> +
> + cli(); /* Enter with interrupts disabled! */
> +
> + /* Set up the real-mode kernel stack */
> + _SS = seg;
> + _SP = heap_end;
> +
> + _DS = _ES = _FS = _GS = seg;
> + jmp_far(seg+0x20, 0); /* Run the kernel */
> +
> +If your boot sector accesses a floppy drive, it is recommended to
> +switch off the floppy motor before running the kernel, since the
> +kernel boot leaves interrupts off and thus the motor will not be
> +switched off, especially if the loaded kernel has the floppy driver as
> +a demand-loaded module!
> +
> +
> +ADVANCED BOOT LOADER HOOKS
> +==========================
> +
> +If the boot loader runs in a particularly hostile environment (such as
> +LOADLIN, which runs under DOS) it may be impossible to follow the
> +standard memory location requirements. Such a boot loader may use the
> +following hooks that, if set, are invoked by the kernel at the
> +appropriate time. The use of these hooks should probably be
> +considered an absolutely last resort!
> +
> +IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and
> +%edi across invocation.
> +
> + realmode_swtch:
> + A 16-bit real mode far subroutine invoked immediately before
> + entering protected mode. The default routine disables NMI, so
> + your routine should probably do so, too.
> +
> + code32_start:
> + A 32-bit flat-mode routine *jumped* to immediately after the
> + transition to protected mode, but before the kernel is
> + uncompressed. No segments, except CS, are guaranteed to be
> + set up (current kernels do, but older ones do not); you should
> + set them up to BOOT_DS (0x18) yourself.
> +
> + After completing your hook, you should jump to the address
> + that was in this field before your boot loader overwrote it
> + (relocated, if appropriate.)
> +
> +
> +32-bit BOOT PROTOCOL
> +====================
> +
> +For machine with some new BIOS other than legacy BIOS, such as EFI,
> +LinuxBIOS, etc, and kexec, the 16-bit real mode setup code in kernel
> +based on legacy BIOS can not be used, so a 32-bit boot protocol needs
> +to be defined.
> +
> +In 32-bit boot protocol, the first step in loading a Linux kernel
> +should be to setup the boot parameters (struct boot_params,
> +traditionally known as "zero page"). The memory for struct boot_params
> +should be allocated and initialized to all zero. Then the setup header
> +from offset 0x01f1 of kernel image on should be loaded into struct
> +boot_params and examined. The end of setup header can be calculated as
> +follow::
> +
> + 0x0202 + byte value at offset 0x0201
> +
> +In addition to read/modify/write the setup header of the struct
> +boot_params as that of 16-bit boot protocol, the boot loader should
> +also fill the additional fields of the struct boot_params as that
> +described in zero-page.txt.
> +
> +After setting up the struct boot_params, the boot loader can load the
> +32/64-bit kernel in the same way as that of 16-bit boot protocol.
> +
> +In 32-bit boot protocol, the kernel is started by jumping to the
> +32-bit kernel entry point, which is the start address of loaded
> +32/64-bit kernel.
> +
> +At entry, the CPU must be in 32-bit protected mode with paging
> +disabled; a GDT must be loaded with the descriptors for selectors
> +__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
> +segment; __BOOT_CS must have execute/read permission, and __BOOT_DS
> +must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
> +must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
> +address of the struct boot_params; %ebp, %edi and %ebx must be zero.
> +
> +64-bit BOOT PROTOCOL
> +====================
> +
> +For machine with 64bit cpus and 64bit kernel, we could use 64bit bootloader
> +and we need a 64-bit boot protocol.
> +
> +In 64-bit boot protocol, the first step in loading a Linux kernel
> +should be to setup the boot parameters (struct boot_params,
> +traditionally known as "zero page"). The memory for struct boot_params
> +could be allocated anywhere (even above 4G) and initialized to all zero.
> +Then, the setup header at offset 0x01f1 of kernel image on should be
> +loaded into struct boot_params and examined. The end of setup header
> +can be calculated as follows::
> +
> + 0x0202 + byte value at offset 0x0201
> +
> +In addition to read/modify/write the setup header of the struct
> +boot_params as that of 16-bit boot protocol, the boot loader should
> +also fill the additional fields of the struct boot_params as described
> +in zero-page.txt.
> +
> +After setting up the struct boot_params, the boot loader can load
> +64-bit kernel in the same way as that of 16-bit boot protocol, but
> +kernel could be loaded above 4G.
> +
> +In 64-bit boot protocol, the kernel is started by jumping to the
> +64-bit kernel entry point, which is the start address of loaded
> +64-bit kernel plus 0x200.
> +
> +At entry, the CPU must be in 64-bit mode with paging enabled.
> +The range with setup_header.init_size from start address of loaded
> +kernel and zero page and command line buffer get ident mapping;
> +a GDT must be loaded with the descriptors for selectors
> +__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
> +segment; __BOOT_CS must have execute/read permission, and __BOOT_DS
> +must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
> +must be __BOOT_DS; interrupt must be disabled; %rsi must hold the base
> +address of the struct boot_params.
> +
> +EFI HANDOVER PROTOCOL
> +=====================
> +
> +This protocol allows boot loaders to defer initialisation to the EFI
> +boot stub. The boot loader is required to load the kernel/initrd(s)
> +from the boot media and jump to the EFI handover protocol entry point
> +which is hdr->handover_offset bytes from the beginning of
> +startup_{32,64}.
> +
> +The function prototype for the handover entry point looks like this::
> +
> + efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp)
> +
> +'handle' is the EFI image handle passed to the boot loader by the EFI
> +firmware, 'table' is the EFI system table - these are the first two
> +arguments of the "handoff state" as described in section 2.3 of the
> +UEFI specification. 'bp' is the boot loader-allocated boot params.
> +
> +The boot loader *must* fill out the following fields in bp::
> +
> + - hdr.code32_start
> + - hdr.cmd_line_ptr
> + - hdr.ramdisk_image (if applicable)
> + - hdr.ramdisk_size (if applicable)
> +
> +All other fields should be zero.
> diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
> deleted file mode 100644
> index f4c2a97bfdbd..000000000000
> --- a/Documentation/x86/boot.txt
> +++ /dev/null
> @@ -1,1130 +0,0 @@
> - THE LINUX/x86 BOOT PROTOCOL
> - ---------------------------
> -
> -On the x86 platform, the Linux kernel uses a rather complicated boot
> -convention. This has evolved partially due to historical aspects, as
> -well as the desire in the early days to have the kernel itself be a
> -bootable image, the complicated PC memory model and due to changed
> -expectations in the PC industry caused by the effective demise of
> -real-mode DOS as a mainstream operating system.
> -
> -Currently, the following versions of the Linux/x86 boot protocol exist.
> -
> -Old kernels: zImage/Image support only. Some very early kernels
> - may not even support a command line.
> -
> -Protocol 2.00: (Kernel 1.3.73) Added bzImage and initrd support, as
> - well as a formalized way to communicate between the
> - boot loader and the kernel. setup.S made relocatable,
> - although the traditional setup area still assumed
> - writable.
> -
> -Protocol 2.01: (Kernel 1.3.76) Added a heap overrun warning.
> -
> -Protocol 2.02: (Kernel 2.4.0-test3-pre3) New command line protocol.
> - Lower the conventional memory ceiling. No overwrite
> - of the traditional setup area, thus making booting
> - safe for systems which use the EBDA from SMM or 32-bit
> - BIOS entry points. zImage deprecated but still
> - supported.
> -
> -Protocol 2.03: (Kernel 2.4.18-pre1) Explicitly makes the highest possible
> - initrd address available to the bootloader.
> -
> -Protocol 2.04: (Kernel 2.6.14) Extend the syssize field to four bytes.
> -
> -Protocol 2.05: (Kernel 2.6.20) Make protected mode kernel relocatable.
> - Introduce relocatable_kernel and kernel_alignment fields.
> -
> -Protocol 2.06: (Kernel 2.6.22) Added a field that contains the size of
> - the boot command line.
> -
> -Protocol 2.07: (Kernel 2.6.24) Added paravirtualised boot protocol.
> - Introduced hardware_subarch and hardware_subarch_data
> - and KEEP_SEGMENTS flag in load_flags.
> -
> -Protocol 2.08: (Kernel 2.6.26) Added crc32 checksum and ELF format
> - payload. Introduced payload_offset and payload_length
> - fields to aid in locating the payload.
> -
> -Protocol 2.09: (Kernel 2.6.26) Added a field of 64-bit physical
> - pointer to single linked list of struct setup_data.
> -
> -Protocol 2.10: (Kernel 2.6.31) Added a protocol for relaxed alignment
> - beyond the kernel_alignment added, new init_size and
> - pref_address fields. Added extended boot loader IDs.
> -
> -Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover
> - protocol entry point.
> -
> -Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields
> - to struct boot_params for loading bzImage and ramdisk
> - above 4G in 64bit.
> -
> -**** MEMORY LAYOUT
> -
> -The traditional memory map for the kernel loader, used for Image or
> -zImage kernels, typically looks like:
> -
> - | |
> -0A0000 +------------------------+
> - | Reserved for BIOS | Do not use. Reserved for BIOS EBDA.
> -09A000 +------------------------+
> - | Command line |
> - | Stack/heap | For use by the kernel real-mode code.
> -098000 +------------------------+
> - | Kernel setup | The kernel real-mode code.
> -090200 +------------------------+
> - | Kernel boot sector | The kernel legacy boot sector.
> -090000 +------------------------+
> - | Protected-mode kernel | The bulk of the kernel image.
> -010000 +------------------------+
> - | Boot loader | <- Boot sector entry point 0000:7C00
> -001000 +------------------------+
> - | Reserved for MBR/BIOS |
> -000800 +------------------------+
> - | Typically used by MBR |
> -000600 +------------------------+
> - | BIOS use only |
> -000000 +------------------------+
> -
> -
> -When using bzImage, the protected-mode kernel was relocated to
> -0x100000 ("high memory"), and the kernel real-mode block (boot sector,
> -setup, and stack/heap) was made relocatable to any address between
> -0x10000 and end of low memory. Unfortunately, in protocols 2.00 and
> -2.01 the 0x90000+ memory range is still used internally by the kernel;
> -the 2.02 protocol resolves that problem.
> -
> -It is desirable to keep the "memory ceiling" -- the highest point in
> -low memory touched by the boot loader -- as low as possible, since
> -some newer BIOSes have begun to allocate some rather large amounts of
> -memory, called the Extended BIOS Data Area, near the top of low
> -memory. The boot loader should use the "INT 12h" BIOS call to verify
> -how much low memory is available.
> -
> -Unfortunately, if INT 12h reports that the amount of memory is too
> -low, there is usually nothing the boot loader can do but to report an
> -error to the user. The boot loader should therefore be designed to
> -take up as little space in low memory as it reasonably can. For
> -zImage or old bzImage kernels, which need data written into the
> -0x90000 segment, the boot loader should make sure not to use memory
> -above the 0x9A000 point; too many BIOSes will break above that point.
> -
> -For a modern bzImage kernel with boot protocol version >= 2.02, a
> -memory layout like the following is suggested:
> -
> - ~ ~
> - | Protected-mode kernel |
> -100000 +------------------------+
> - | I/O memory hole |
> -0A0000 +------------------------+
> - | Reserved for BIOS | Leave as much as possible unused
> - ~ ~
> - | Command line | (Can also be below the X+10000 mark)
> -X+10000 +------------------------+
> - | Stack/heap | For use by the kernel real-mode code.
> -X+08000 +------------------------+
> - | Kernel setup | The kernel real-mode code.
> - | Kernel boot sector | The kernel legacy boot sector.
> -X +------------------------+
> - | Boot loader | <- Boot sector entry point 0000:7C00
> -001000 +------------------------+
> - | Reserved for MBR/BIOS |
> -000800 +------------------------+
> - | Typically used by MBR |
> -000600 +------------------------+
> - | BIOS use only |
> -000000 +------------------------+
> -
> -... where the address X is as low as the design of the boot loader
> -permits.
> -
> -
> -**** THE REAL-MODE KERNEL HEADER
> -
> -In the following text, and anywhere in the kernel boot sequence, "a
> -sector" refers to 512 bytes. It is independent of the actual sector
> -size of the underlying medium.
> -
> -The first step in loading a Linux kernel should be to load the
> -real-mode code (boot sector and setup code) and then examine the
> -following header at offset 0x01f1. The real-mode code can total up to
> -32K, although the boot loader may choose to load only the first two
> -sectors (1K) and then examine the bootup sector size.
> -
> -The header looks like:
> -
> -Offset Proto Name Meaning
> -/Size
> -
> -01F1/1 ALL(1 setup_sects The size of the setup in sectors
> -01F2/2 ALL root_flags If set, the root is mounted readonly
> -01F4/4 2.04+(2 syssize The size of the 32-bit code in 16-byte paras
> -01F8/2 ALL ram_size DO NOT USE - for bootsect.S use only
> -01FA/2 ALL vid_mode Video mode control
> -01FC/2 ALL root_dev Default root device number
> -01FE/2 ALL boot_flag 0xAA55 magic number
> -0200/2 2.00+ jump Jump instruction
> -0202/4 2.00+ header Magic signature "HdrS"
> -0206/2 2.00+ version Boot protocol version supported
> -0208/4 2.00+ realmode_swtch Boot loader hook (see below)
> -020C/2 2.00+ start_sys_seg The load-low segment (0x1000) (obsolete)
> -020E/2 2.00+ kernel_version Pointer to kernel version string
> -0210/1 2.00+ type_of_loader Boot loader identifier
> -0211/1 2.00+ loadflags Boot protocol option flags
> -0212/2 2.00+ setup_move_size Move to high memory size (used with hooks)
> -0214/4 2.00+ code32_start Boot loader hook (see below)
> -0218/4 2.00+ ramdisk_image initrd load address (set by boot loader)
> -021C/4 2.00+ ramdisk_size initrd size (set by boot loader)
> -0220/4 2.00+ bootsect_kludge DO NOT USE - for bootsect.S use only
> -0224/2 2.01+ heap_end_ptr Free memory after setup end
> -0226/1 2.02+(3 ext_loader_ver Extended boot loader version
> -0227/1 2.02+(3 ext_loader_type Extended boot loader ID
> -0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line
> -022C/4 2.03+ initrd_addr_max Highest legal initrd address
> -0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel
> -0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not
> -0235/1 2.10+ min_alignment Minimum alignment, as a power of two
> -0236/2 2.12+ xloadflags Boot protocol option flags
> -0238/4 2.06+ cmdline_size Maximum size of the kernel command line
> -023C/4 2.07+ hardware_subarch Hardware subarchitecture
> -0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data
> -0248/4 2.08+ payload_offset Offset of kernel payload
> -024C/4 2.08+ payload_length Length of kernel payload
> -0250/8 2.09+ setup_data 64-bit physical pointer to linked list
> - of struct setup_data
> -0258/8 2.10+ pref_address Preferred loading address
> -0260/4 2.10+ init_size Linear memory required during initialization
> -0264/4 2.11+ handover_offset Offset of handover entry point
> -
> -(1) For backwards compatibility, if the setup_sects field contains 0, the
> - real value is 4.
> -
> -(2) For boot protocol prior to 2.04, the upper two bytes of the syssize
> - field are unusable, which means the size of a bzImage kernel
> - cannot be determined.
> -
> -(3) Ignored, but safe to set, for boot protocols 2.02-2.09.
> -
> -If the "HdrS" (0x53726448) magic number is not found at offset 0x202,
> -the boot protocol version is "old". Loading an old kernel, the
> -following parameters should be assumed:
> -
> - Image type = zImage
> - initrd not supported
> - Real-mode kernel must be located at 0x90000.
> -
> -Otherwise, the "version" field contains the protocol version,
> -e.g. protocol version 2.01 will contain 0x0201 in this field. When
> -setting fields in the header, you must make sure only to set fields
> -supported by the protocol version in use.
> -
> -
> -**** DETAILS OF HEADER FIELDS
> -
> -For each field, some are information from the kernel to the bootloader
> -("read"), some are expected to be filled out by the bootloader
> -("write"), and some are expected to be read and modified by the
> -bootloader ("modify").
> -
> -All general purpose boot loaders should write the fields marked
> -(obligatory). Boot loaders who want to load the kernel at a
> -nonstandard address should fill in the fields marked (reloc); other
> -boot loaders can ignore those fields.
> -
> -The byte order of all fields is littleendian (this is x86, after all.)
> -
> -Field name: setup_sects
> -Type: read
> -Offset/size: 0x1f1/1
> -Protocol: ALL
> -
> - The size of the setup code in 512-byte sectors. If this field is
> - 0, the real value is 4. The real-mode code consists of the boot
> - sector (always one 512-byte sector) plus the setup code.
> -
> -Field name: root_flags
> -Type: modify (optional)
> -Offset/size: 0x1f2/2
> -Protocol: ALL
> -
> - If this field is nonzero, the root defaults to readonly. The use of
> - this field is deprecated; use the "ro" or "rw" options on the
> - command line instead.
> -
> -Field name: syssize
> -Type: read
> -Offset/size: 0x1f4/4 (protocol 2.04+) 0x1f4/2 (protocol ALL)
> -Protocol: 2.04+
> -
> - The size of the protected-mode code in units of 16-byte paragraphs.
> - For protocol versions older than 2.04 this field is only two bytes
> - wide, and therefore cannot be trusted for the size of a kernel if
> - the LOAD_HIGH flag is set.
> -
> -Field name: ram_size
> -Type: kernel internal
> -Offset/size: 0x1f8/2
> -Protocol: ALL
> -
> - This field is obsolete.
> -
> -Field name: vid_mode
> -Type: modify (obligatory)
> -Offset/size: 0x1fa/2
> -
> - Please see the section on SPECIAL COMMAND LINE OPTIONS.
> -
> -Field name: root_dev
> -Type: modify (optional)
> -Offset/size: 0x1fc/2
> -Protocol: ALL
> -
> - The default root device device number. The use of this field is
> - deprecated, use the "root=" option on the command line instead.
> -
> -Field name: boot_flag
> -Type: read
> -Offset/size: 0x1fe/2
> -Protocol: ALL
> -
> - Contains 0xAA55. This is the closest thing old Linux kernels have
> - to a magic number.
> -
> -Field name: jump
> -Type: read
> -Offset/size: 0x200/2
> -Protocol: 2.00+
> -
> - Contains an x86 jump instruction, 0xEB followed by a signed offset
> - relative to byte 0x202. This can be used to determine the size of
> - the header.
> -
> -Field name: header
> -Type: read
> -Offset/size: 0x202/4
> -Protocol: 2.00+
> -
> - Contains the magic number "HdrS" (0x53726448).
> -
> -Field name: version
> -Type: read
> -Offset/size: 0x206/2
> -Protocol: 2.00+
> -
> - Contains the boot protocol version, in (major << 8)+minor format,
> - e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
> - 10.17.
> -
> -Field name: realmode_swtch
> -Type: modify (optional)
> -Offset/size: 0x208/4
> -Protocol: 2.00+
> -
> - Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
> -
> -Field name: start_sys_seg
> -Type: read
> -Offset/size: 0x20c/2
> -Protocol: 2.00+
> -
> - The load low segment (0x1000). Obsolete.
> -
> -Field name: kernel_version
> -Type: read
> -Offset/size: 0x20e/2
> -Protocol: 2.00+
> -
> - If set to a nonzero value, contains a pointer to a NUL-terminated
> - human-readable kernel version number string, less 0x200. This can
> - be used to display the kernel version to the user. This value
> - should be less than (0x200*setup_sects).
> -
> - For example, if this value is set to 0x1c00, the kernel version
> - number string can be found at offset 0x1e00 in the kernel file.
> - This is a valid value if and only if the "setup_sects" field
> - contains the value 15 or higher, as:
> -
> - 0x1c00 < 15*0x200 (= 0x1e00) but
> - 0x1c00 >= 14*0x200 (= 0x1c00)
> -
> - 0x1c00 >> 9 = 14, so the minimum value for setup_secs is 15.
> -
> -Field name: type_of_loader
> -Type: write (obligatory)
> -Offset/size: 0x210/1
> -Protocol: 2.00+
> -
> - If your boot loader has an assigned id (see table below), enter
> - 0xTV here, where T is an identifier for the boot loader and V is
> - a version number. Otherwise, enter 0xFF here.
> -
> - For boot loader IDs above T = 0xD, write T = 0xE to this field and
> - write the extended ID minus 0x10 to the ext_loader_type field.
> - Similarly, the ext_loader_ver field can be used to provide more than
> - four bits for the bootloader version.
> -
> - For example, for T = 0x15, V = 0x234, write:
> -
> - type_of_loader <- 0xE4
> - ext_loader_type <- 0x05
> - ext_loader_ver <- 0x23
> -
> - Assigned boot loader ids (hexadecimal):
> -
> - 0 LILO (0x00 reserved for pre-2.00 bootloader)
> - 1 Loadlin
> - 2 bootsect-loader (0x20, all other values reserved)
> - 3 Syslinux
> - 4 Etherboot/gPXE/iPXE
> - 5 ELILO
> - 7 GRUB
> - 8 U-Boot
> - 9 Xen
> - A Gujin
> - B Qemu
> - C Arcturus Networks uCbootloader
> - D kexec-tools
> - E Extended (see ext_loader_type)
> - F Special (0xFF = undefined)
> - 10 Reserved
> - 11 Minimal Linux Bootloader <http://sebastian-plotz.blogspot.de>
> - 12 OVMF UEFI virtualization stack
> -
> - Please contact <hpa@zytor.com> if you need a bootloader ID
> - value assigned.
> -
> -Field name: loadflags
> -Type: modify (obligatory)
> -Offset/size: 0x211/1
> -Protocol: 2.00+
> -
> - This field is a bitmask.
> -
> - Bit 0 (read): LOADED_HIGH
> - - If 0, the protected-mode code is loaded at 0x10000.
> - - If 1, the protected-mode code is loaded at 0x100000.
> -
> - Bit 1 (kernel internal): KASLR_FLAG
> - - Used internally by the compressed kernel to communicate
> - KASLR status to kernel proper.
> - If 1, KASLR enabled.
> - If 0, KASLR disabled.
> -
> - Bit 5 (write): QUIET_FLAG
> - - If 0, print early messages.
> - - If 1, suppress early messages.
> - This requests to the kernel (decompressor and early
> - kernel) to not write early messages that require
> - accessing the display hardware directly.
> -
> - Bit 6 (write): KEEP_SEGMENTS
> - Protocol: 2.07+
> - - If 0, reload the segment registers in the 32bit entry point.
> - - If 1, do not reload the segment registers in the 32bit entry point.
> - Assume that %cs %ds %ss %es are all set to flat segments with
> - a base of 0 (or the equivalent for their environment).
> -
> - Bit 7 (write): CAN_USE_HEAP
> - Set this bit to 1 to indicate that the value entered in the
> - heap_end_ptr is valid. If this field is clear, some setup code
> - functionality will be disabled.
> -
> -Field name: setup_move_size
> -Type: modify (obligatory)
> -Offset/size: 0x212/2
> -Protocol: 2.00-2.01
> -
> - When using protocol 2.00 or 2.01, if the real mode kernel is not
> - loaded at 0x90000, it gets moved there later in the loading
> - sequence. Fill in this field if you want additional data (such as
> - the kernel command line) moved in addition to the real-mode kernel
> - itself.
> -
> - The unit is bytes starting with the beginning of the boot sector.
> -
> - This field is can be ignored when the protocol is 2.02 or higher, or
> - if the real-mode code is loaded at 0x90000.
> -
> -Field name: code32_start
> -Type: modify (optional, reloc)
> -Offset/size: 0x214/4
> -Protocol: 2.00+
> -
> - The address to jump to in protected mode. This defaults to the load
> - address of the kernel, and can be used by the boot loader to
> - determine the proper load address.
> -
> - This field can be modified for two purposes:
> -
> - 1. as a boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
> -
> - 2. if a bootloader which does not install a hook loads a
> - relocatable kernel at a nonstandard address it will have to modify
> - this field to point to the load address.
> -
> -Field name: ramdisk_image
> -Type: write (obligatory)
> -Offset/size: 0x218/4
> -Protocol: 2.00+
> -
> - The 32-bit linear address of the initial ramdisk or ramfs. Leave at
> - zero if there is no initial ramdisk/ramfs.
> -
> -Field name: ramdisk_size
> -Type: write (obligatory)
> -Offset/size: 0x21c/4
> -Protocol: 2.00+
> -
> - Size of the initial ramdisk or ramfs. Leave at zero if there is no
> - initial ramdisk/ramfs.
> -
> -Field name: bootsect_kludge
> -Type: kernel internal
> -Offset/size: 0x220/4
> -Protocol: 2.00+
> -
> - This field is obsolete.
> -
> -Field name: heap_end_ptr
> -Type: write (obligatory)
> -Offset/size: 0x224/2
> -Protocol: 2.01+
> -
> - Set this field to the offset (from the beginning of the real-mode
> - code) of the end of the setup stack/heap, minus 0x0200.
> -
> -Field name: ext_loader_ver
> -Type: write (optional)
> -Offset/size: 0x226/1
> -Protocol: 2.02+
> -
> - This field is used as an extension of the version number in the
> - type_of_loader field. The total version number is considered to be
> - (type_of_loader & 0x0f) + (ext_loader_ver << 4).
> -
> - The use of this field is boot loader specific. If not written, it
> - is zero.
> -
> - Kernels prior to 2.6.31 did not recognize this field, but it is safe
> - to write for protocol version 2.02 or higher.
> -
> -Field name: ext_loader_type
> -Type: write (obligatory if (type_of_loader & 0xf0) == 0xe0)
> -Offset/size: 0x227/1
> -Protocol: 2.02+
> -
> - This field is used as an extension of the type number in
> - type_of_loader field. If the type in type_of_loader is 0xE, then
> - the actual type is (ext_loader_type + 0x10).
> -
> - This field is ignored if the type in type_of_loader is not 0xE.
> -
> - Kernels prior to 2.6.31 did not recognize this field, but it is safe
> - to write for protocol version 2.02 or higher.
> -
> -Field name: cmd_line_ptr
> -Type: write (obligatory)
> -Offset/size: 0x228/4
> -Protocol: 2.02+
> -
> - Set this field to the linear address of the kernel command line.
> - The kernel command line can be located anywhere between the end of
> - the setup heap and 0xA0000; it does not have to be located in the
> - same 64K segment as the real-mode code itself.
> -
> - Fill in this field even if your boot loader does not support a
> - command line, in which case you can point this to an empty string
> - (or better yet, to the string "auto".) If this field is left at
> - zero, the kernel will assume that your boot loader does not support
> - the 2.02+ protocol.
> -
> -Field name: initrd_addr_max
> -Type: read
> -Offset/size: 0x22c/4
> -Protocol: 2.03+
> -
> - The maximum address that may be occupied by the initial
> - ramdisk/ramfs contents. For boot protocols 2.02 or earlier, this
> - field is not present, and the maximum address is 0x37FFFFFF. (This
> - address is defined as the address of the highest safe byte, so if
> - your ramdisk is exactly 131072 bytes long and this field is
> - 0x37FFFFFF, you can start your ramdisk at 0x37FE0000.)
> -
> -Field name: kernel_alignment
> -Type: read/modify (reloc)
> -Offset/size: 0x230/4
> -Protocol: 2.05+ (read), 2.10+ (modify)
> -
> - Alignment unit required by the kernel (if relocatable_kernel is
> - true.) A relocatable kernel that is loaded at an alignment
> - incompatible with the value in this field will be realigned during
> - kernel initialization.
> -
> - Starting with protocol version 2.10, this reflects the kernel
> - alignment preferred for optimal performance; it is possible for the
> - loader to modify this field to permit a lesser alignment. See the
> - min_alignment and pref_address field below.
> -
> -Field name: relocatable_kernel
> -Type: read (reloc)
> -Offset/size: 0x234/1
> -Protocol: 2.05+
> -
> - If this field is nonzero, the protected-mode part of the kernel can
> - be loaded at any address that satisfies the kernel_alignment field.
> - After loading, the boot loader must set the code32_start field to
> - point to the loaded code, or to a boot loader hook.
> -
> -Field name: min_alignment
> -Type: read (reloc)
> -Offset/size: 0x235/1
> -Protocol: 2.10+
> -
> - This field, if nonzero, indicates as a power of two the minimum
> - alignment required, as opposed to preferred, by the kernel to boot.
> - If a boot loader makes use of this field, it should update the
> - kernel_alignment field with the alignment unit desired; typically:
> -
> - kernel_alignment = 1 << min_alignment
> -
> - There may be a considerable performance cost with an excessively
> - misaligned kernel. Therefore, a loader should typically try each
> - power-of-two alignment from kernel_alignment down to this alignment.
> -
> -Field name: xloadflags
> -Type: read
> -Offset/size: 0x236/2
> -Protocol: 2.12+
> -
> - This field is a bitmask.
> -
> - Bit 0 (read): XLF_KERNEL_64
> - - If 1, this kernel has the legacy 64-bit entry point at 0x200.
> -
> - Bit 1 (read): XLF_CAN_BE_LOADED_ABOVE_4G
> - - If 1, kernel/boot_params/cmdline/ramdisk can be above 4G.
> -
> - Bit 2 (read): XLF_EFI_HANDOVER_32
> - - If 1, the kernel supports the 32-bit EFI handoff entry point
> - given at handover_offset.
> -
> - Bit 3 (read): XLF_EFI_HANDOVER_64
> - - If 1, the kernel supports the 64-bit EFI handoff entry point
> - given at handover_offset + 0x200.
> -
> - Bit 4 (read): XLF_EFI_KEXEC
> - - If 1, the kernel supports kexec EFI boot with EFI runtime support.
> -
> -Field name: cmdline_size
> -Type: read
> -Offset/size: 0x238/4
> -Protocol: 2.06+
> -
> - The maximum size of the command line without the terminating
> - zero. This means that the command line can contain at most
> - cmdline_size characters. With protocol version 2.05 and earlier, the
> - maximum size was 255.
> -
> -Field name: hardware_subarch
> -Type: write (optional, defaults to x86/PC)
> -Offset/size: 0x23c/4
> -Protocol: 2.07+
> -
> - In a paravirtualized environment the hardware low level architectural
> - pieces such as interrupt handling, page table handling, and
> - accessing process control registers needs to be done differently.
> -
> - This field allows the bootloader to inform the kernel we are in one
> - one of those environments.
> -
> - 0x00000000 The default x86/PC environment
> - 0x00000001 lguest
> - 0x00000002 Xen
> - 0x00000003 Moorestown MID
> - 0x00000004 CE4100 TV Platform
> -
> -Field name: hardware_subarch_data
> -Type: write (subarch-dependent)
> -Offset/size: 0x240/8
> -Protocol: 2.07+
> -
> - A pointer to data that is specific to hardware subarch
> - This field is currently unused for the default x86/PC environment,
> - do not modify.
> -
> -Field name: payload_offset
> -Type: read
> -Offset/size: 0x248/4
> -Protocol: 2.08+
> -
> - If non-zero then this field contains the offset from the beginning
> - of the protected-mode code to the payload.
> -
> - The payload may be compressed. The format of both the compressed and
> - uncompressed data should be determined using the standard magic
> - numbers. The currently supported compression formats are gzip
> - (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
> - (magic number 5D 00), XZ (magic number FD 37), and LZ4 (magic number
> - 02 21). The uncompressed payload is currently always ELF (magic
> - number 7F 45 4C 46).
> -
> -Field name: payload_length
> -Type: read
> -Offset/size: 0x24c/4
> -Protocol: 2.08+
> -
> - The length of the payload.
> -
> -Field name: setup_data
> -Type: write (special)
> -Offset/size: 0x250/8
> -Protocol: 2.09+
> -
> - The 64-bit physical pointer to NULL terminated single linked list of
> - struct setup_data. This is used to define a more extensible boot
> - parameters passing mechanism. The definition of struct setup_data is
> - as follow:
> -
> - struct setup_data {
> - u64 next;
> - u32 type;
> - u32 len;
> - u8 data[0];
> - };
> -
> - Where, the next is a 64-bit physical pointer to the next node of
> - linked list, the next field of the last node is 0; the type is used
> - to identify the contents of data; the len is the length of data
> - field; the data holds the real payload.
> -
> - This list may be modified at a number of points during the bootup
> - process. Therefore, when modifying this list one should always make
> - sure to consider the case where the linked list already contains
> - entries.
> -
> -Field name: pref_address
> -Type: read (reloc)
> -Offset/size: 0x258/8
> -Protocol: 2.10+
> -
> - This field, if nonzero, represents a preferred load address for the
> - kernel. A relocating bootloader should attempt to load at this
> - address if possible.
> -
> - A non-relocatable kernel will unconditionally move itself and to run
> - at this address.
> -
> -Field name: init_size
> -Type: read
> -Offset/size: 0x260/4
> -
> - This field indicates the amount of linear contiguous memory starting
> - at the kernel runtime start address that the kernel needs before it
> - is capable of examining its memory map. This is not the same thing
> - as the total amount of memory the kernel needs to boot, but it can
> - be used by a relocating boot loader to help select a safe load
> - address for the kernel.
> -
> - The kernel runtime start address is determined by the following algorithm:
> -
> - if (relocatable_kernel)
> - runtime_start = align_up(load_address, kernel_alignment)
> - else
> - runtime_start = pref_address
> -
> -Field name: handover_offset
> -Type: read
> -Offset/size: 0x264/4
> -
> - This field is the offset from the beginning of the kernel image to
> - the EFI handover protocol entry point. Boot loaders using the EFI
> - handover protocol to boot the kernel should jump to this offset.
> -
> - See EFI HANDOVER PROTOCOL below for more details.
> -
> -
> -**** THE IMAGE CHECKSUM
> -
> -From boot protocol version 2.08 onwards the CRC-32 is calculated over
> -the entire file using the characteristic polynomial 0x04C11DB7 and an
> -initial remainder of 0xffffffff. The checksum is appended to the
> -file; therefore the CRC of the file up to the limit specified in the
> -syssize field of the header is always 0.
> -
> -
> -**** THE KERNEL COMMAND LINE
> -
> -The kernel command line has become an important way for the boot
> -loader to communicate with the kernel. Some of its options are also
> -relevant to the boot loader itself, see "special command line options"
> -below.
> -
> -The kernel command line is a null-terminated string. The maximum
> -length can be retrieved from the field cmdline_size. Before protocol
> -version 2.06, the maximum was 255 characters. A string that is too
> -long will be automatically truncated by the kernel.
> -
> -If the boot protocol version is 2.02 or later, the address of the
> -kernel command line is given by the header field cmd_line_ptr (see
> -above.) This address can be anywhere between the end of the setup
> -heap and 0xA0000.
> -
> -If the protocol version is *not* 2.02 or higher, the kernel
> -command line is entered using the following protocol:
> -
> - At offset 0x0020 (word), "cmd_line_magic", enter the magic
> - number 0xA33F.
> -
> - At offset 0x0022 (word), "cmd_line_offset", enter the offset
> - of the kernel command line (relative to the start of the
> - real-mode kernel).
> -
> - The kernel command line *must* be within the memory region
> - covered by setup_move_size, so you may need to adjust this
> - field.
> -
> -
> -**** MEMORY LAYOUT OF THE REAL-MODE CODE
> -
> -The real-mode code requires a stack/heap to be set up, as well as
> -memory allocated for the kernel command line. This needs to be done
> -in the real-mode accessible memory in bottom megabyte.
> -
> -It should be noted that modern machines often have a sizable Extended
> -BIOS Data Area (EBDA). As a result, it is advisable to use as little
> -of the low megabyte as possible.
> -
> -Unfortunately, under the following circumstances the 0x90000 memory
> -segment has to be used:
> -
> - - When loading a zImage kernel ((loadflags & 0x01) == 0).
> - - When loading a 2.01 or earlier boot protocol kernel.
> -
> - -> For the 2.00 and 2.01 boot protocols, the real-mode code
> - can be loaded at another address, but it is internally
> - relocated to 0x90000. For the "old" protocol, the
> - real-mode code must be loaded at 0x90000.
> -
> -When loading at 0x90000, avoid using memory above 0x9a000.
> -
> -For boot protocol 2.02 or higher, the command line does not have to be
> -located in the same 64K segment as the real-mode setup code; it is
> -thus permitted to give the stack/heap the full 64K segment and locate
> -the command line above it.
> -
> -The kernel command line should not be located below the real-mode
> -code, nor should it be located in high memory.
> -
> -
> -**** SAMPLE BOOT CONFIGURATION
> -
> -As a sample configuration, assume the following layout of the real
> -mode segment:
> -
> - When loading below 0x90000, use the entire segment:
> -
> - 0x0000-0x7fff Real mode kernel
> - 0x8000-0xdfff Stack and heap
> - 0xe000-0xffff Kernel command line
> -
> - When loading at 0x90000 OR the protocol version is 2.01 or earlier:
> -
> - 0x0000-0x7fff Real mode kernel
> - 0x8000-0x97ff Stack and heap
> - 0x9800-0x9fff Kernel command line
> -
> -Such a boot loader should enter the following fields in the header:
> -
> - unsigned long base_ptr; /* base address for real-mode segment */
> -
> - if ( setup_sects == 0 ) {
> - setup_sects = 4;
> - }
> -
> - if ( protocol >= 0x0200 ) {
> - type_of_loader = <type code>;
> - if ( loading_initrd ) {
> - ramdisk_image = <initrd_address>;
> - ramdisk_size = <initrd_size>;
> - }
> -
> - if ( protocol >= 0x0202 && loadflags & 0x01 )
> - heap_end = 0xe000;
> - else
> - heap_end = 0x9800;
> -
> - if ( protocol >= 0x0201 ) {
> - heap_end_ptr = heap_end - 0x200;
> - loadflags |= 0x80; /* CAN_USE_HEAP */
> - }
> -
> - if ( protocol >= 0x0202 ) {
> - cmd_line_ptr = base_ptr + heap_end;
> - strcpy(cmd_line_ptr, cmdline);
> - } else {
> - cmd_line_magic = 0xA33F;
> - cmd_line_offset = heap_end;
> - setup_move_size = heap_end + strlen(cmdline)+1;
> - strcpy(base_ptr+cmd_line_offset, cmdline);
> - }
> - } else {
> - /* Very old kernel */
> -
> - heap_end = 0x9800;
> -
> - cmd_line_magic = 0xA33F;
> - cmd_line_offset = heap_end;
> -
> - /* A very old kernel MUST have its real-mode code
> - loaded at 0x90000 */
> -
> - if ( base_ptr != 0x90000 ) {
> - /* Copy the real-mode kernel */
> - memcpy(0x90000, base_ptr, (setup_sects+1)*512);
> - base_ptr = 0x90000; /* Relocated */
> - }
> -
> - strcpy(0x90000+cmd_line_offset, cmdline);
> -
> - /* It is recommended to clear memory up to the 32K mark */
> - memset(0x90000 + (setup_sects+1)*512, 0,
> - (64-(setup_sects+1))*512);
> - }
> -
> -
> -**** LOADING THE REST OF THE KERNEL
> -
> -The 32-bit (non-real-mode) kernel starts at offset (setup_sects+1)*512
> -in the kernel file (again, if setup_sects == 0 the real value is 4.)
> -It should be loaded at address 0x10000 for Image/zImage kernels and
> -0x100000 for bzImage kernels.
> -
> -The kernel is a bzImage kernel if the protocol >= 2.00 and the 0x01
> -bit (LOAD_HIGH) in the loadflags field is set:
> -
> - is_bzImage = (protocol >= 0x0200) && (loadflags & 0x01);
> - load_address = is_bzImage ? 0x100000 : 0x10000;
> -
> -Note that Image/zImage kernels can be up to 512K in size, and thus use
> -the entire 0x10000-0x90000 range of memory. This means it is pretty
> -much a requirement for these kernels to load the real-mode part at
> -0x90000. bzImage kernels allow much more flexibility.
> -
> -
> -**** SPECIAL COMMAND LINE OPTIONS
> -
> -If the command line provided by the boot loader is entered by the
> -user, the user may expect the following command line options to work.
> -They should normally not be deleted from the kernel command line even
> -though not all of them are actually meaningful to the kernel. Boot
> -loader authors who need additional command line options for the boot
> -loader itself should get them registered in
> -Documentation/admin-guide/kernel-parameters.rst to make sure they will not
> -conflict with actual kernel options now or in the future.
> -
> - vga=<mode>
> - <mode> here is either an integer (in C notation, either
> - decimal, octal, or hexadecimal) or one of the strings
> - "normal" (meaning 0xFFFF), "ext" (meaning 0xFFFE) or "ask"
> - (meaning 0xFFFD). This value should be entered into the
> - vid_mode field, as it is used by the kernel before the command
> - line is parsed.
> -
> - mem=<size>
> - <size> is an integer in C notation optionally followed by
> - (case insensitive) K, M, G, T, P or E (meaning << 10, << 20,
> - << 30, << 40, << 50 or << 60). This specifies the end of
> - memory to the kernel. This affects the possible placement of
> - an initrd, since an initrd should be placed near end of
> - memory. Note that this is an option to *both* the kernel and
> - the bootloader!
> -
> - initrd=<file>
> - An initrd should be loaded. The meaning of <file> is
> - obviously bootloader-dependent, and some boot loaders
> - (e.g. LILO) do not have such a command.
> -
> -In addition, some boot loaders add the following options to the
> -user-specified command line:
> -
> - BOOT_IMAGE=<file>
> - The boot image which was loaded. Again, the meaning of <file>
> - is obviously bootloader-dependent.
> -
> - auto
> - The kernel was booted without explicit user intervention.
> -
> -If these options are added by the boot loader, it is highly
> -recommended that they are located *first*, before the user-specified
> -or configuration-specified command line. Otherwise, "init=/bin/sh"
> -gets confused by the "auto" option.
> -
> -
> -**** RUNNING THE KERNEL
> -
> -The kernel is started by jumping to the kernel entry point, which is
> -located at *segment* offset 0x20 from the start of the real mode
> -kernel. This means that if you loaded your real-mode kernel code at
> -0x90000, the kernel entry point is 9020:0000.
> -
> -At entry, ds = es = ss should point to the start of the real-mode
> -kernel code (0x9000 if the code is loaded at 0x90000), sp should be
> -set up properly, normally pointing to the top of the heap, and
> -interrupts should be disabled. Furthermore, to guard against bugs in
> -the kernel, it is recommended that the boot loader sets fs = gs = ds =
> -es = ss.
> -
> -In our example from above, we would do:
> -
> - /* Note: in the case of the "old" kernel protocol, base_ptr must
> - be == 0x90000 at this point; see the previous sample code */
> -
> - seg = base_ptr >> 4;
> -
> - cli(); /* Enter with interrupts disabled! */
> -
> - /* Set up the real-mode kernel stack */
> - _SS = seg;
> - _SP = heap_end;
> -
> - _DS = _ES = _FS = _GS = seg;
> - jmp_far(seg+0x20, 0); /* Run the kernel */
> -
> -If your boot sector accesses a floppy drive, it is recommended to
> -switch off the floppy motor before running the kernel, since the
> -kernel boot leaves interrupts off and thus the motor will not be
> -switched off, especially if the loaded kernel has the floppy driver as
> -a demand-loaded module!
> -
> -
> -**** ADVANCED BOOT LOADER HOOKS
> -
> -If the boot loader runs in a particularly hostile environment (such as
> -LOADLIN, which runs under DOS) it may be impossible to follow the
> -standard memory location requirements. Such a boot loader may use the
> -following hooks that, if set, are invoked by the kernel at the
> -appropriate time. The use of these hooks should probably be
> -considered an absolutely last resort!
> -
> -IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and
> -%edi across invocation.
> -
> - realmode_swtch:
> - A 16-bit real mode far subroutine invoked immediately before
> - entering protected mode. The default routine disables NMI, so
> - your routine should probably do so, too.
> -
> - code32_start:
> - A 32-bit flat-mode routine *jumped* to immediately after the
> - transition to protected mode, but before the kernel is
> - uncompressed. No segments, except CS, are guaranteed to be
> - set up (current kernels do, but older ones do not); you should
> - set them up to BOOT_DS (0x18) yourself.
> -
> - After completing your hook, you should jump to the address
> - that was in this field before your boot loader overwrote it
> - (relocated, if appropriate.)
> -
> -
> -**** 32-bit BOOT PROTOCOL
> -
> -For machine with some new BIOS other than legacy BIOS, such as EFI,
> -LinuxBIOS, etc, and kexec, the 16-bit real mode setup code in kernel
> -based on legacy BIOS can not be used, so a 32-bit boot protocol needs
> -to be defined.
> -
> -In 32-bit boot protocol, the first step in loading a Linux kernel
> -should be to setup the boot parameters (struct boot_params,
> -traditionally known as "zero page"). The memory for struct boot_params
> -should be allocated and initialized to all zero. Then the setup header
> -from offset 0x01f1 of kernel image on should be loaded into struct
> -boot_params and examined. The end of setup header can be calculated as
> -follow:
> -
> - 0x0202 + byte value at offset 0x0201
> -
> -In addition to read/modify/write the setup header of the struct
> -boot_params as that of 16-bit boot protocol, the boot loader should
> -also fill the additional fields of the struct boot_params as that
> -described in zero-page.txt.
> -
> -After setting up the struct boot_params, the boot loader can load the
> -32/64-bit kernel in the same way as that of 16-bit boot protocol.
> -
> -In 32-bit boot protocol, the kernel is started by jumping to the
> -32-bit kernel entry point, which is the start address of loaded
> -32/64-bit kernel.
> -
> -At entry, the CPU must be in 32-bit protected mode with paging
> -disabled; a GDT must be loaded with the descriptors for selectors
> -__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
> -segment; __BOOT_CS must have execute/read permission, and __BOOT_DS
> -must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
> -must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
> -address of the struct boot_params; %ebp, %edi and %ebx must be zero.
> -
> -**** 64-bit BOOT PROTOCOL
> -
> -For machine with 64bit cpus and 64bit kernel, we could use 64bit bootloader
> -and we need a 64-bit boot protocol.
> -
> -In 64-bit boot protocol, the first step in loading a Linux kernel
> -should be to setup the boot parameters (struct boot_params,
> -traditionally known as "zero page"). The memory for struct boot_params
> -could be allocated anywhere (even above 4G) and initialized to all zero.
> -Then, the setup header at offset 0x01f1 of kernel image on should be
> -loaded into struct boot_params and examined. The end of setup header
> -can be calculated as follows:
> -
> - 0x0202 + byte value at offset 0x0201
> -
> -In addition to read/modify/write the setup header of the struct
> -boot_params as that of 16-bit boot protocol, the boot loader should
> -also fill the additional fields of the struct boot_params as described
> -in zero-page.txt.
> -
> -After setting up the struct boot_params, the boot loader can load
> -64-bit kernel in the same way as that of 16-bit boot protocol, but
> -kernel could be loaded above 4G.
> -
> -In 64-bit boot protocol, the kernel is started by jumping to the
> -64-bit kernel entry point, which is the start address of loaded
> -64-bit kernel plus 0x200.
> -
> -At entry, the CPU must be in 64-bit mode with paging enabled.
> -The range with setup_header.init_size from start address of loaded
> -kernel and zero page and command line buffer get ident mapping;
> -a GDT must be loaded with the descriptors for selectors
> -__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
> -segment; __BOOT_CS must have execute/read permission, and __BOOT_DS
> -must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
> -must be __BOOT_DS; interrupt must be disabled; %rsi must hold the base
> -address of the struct boot_params.
> -
> -**** EFI HANDOVER PROTOCOL
> -
> -This protocol allows boot loaders to defer initialisation to the EFI
> -boot stub. The boot loader is required to load the kernel/initrd(s)
> -from the boot media and jump to the EFI handover protocol entry point
> -which is hdr->handover_offset bytes from the beginning of
> -startup_{32,64}.
> -
> -The function prototype for the handover entry point looks like this,
> -
> - efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp)
> -
> -'handle' is the EFI image handle passed to the boot loader by the EFI
> -firmware, 'table' is the EFI system table - these are the first two
> -arguments of the "handoff state" as described in section 2.3 of the
> -UEFI specification. 'bp' is the boot loader-allocated boot params.
> -
> -The boot loader *must* fill out the following fields in bp,
> -
> - o hdr.code32_start
> - o hdr.cmd_line_ptr
> - o hdr.ramdisk_image (if applicable)
> - o hdr.ramdisk_size (if applicable)
> -
> -All other fields should be zero.
> diff --git a/Documentation/x86/index.rst b/Documentation/x86/index.rst
> index 7612d3142b2a..8f08caf4fbbb 100644
> --- a/Documentation/x86/index.rst
> +++ b/Documentation/x86/index.rst
> @@ -7,3 +7,5 @@ Linux x86 Support
> .. toctree::
> :maxdepth: 2
> :numbered:
> +
> + boot
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 24/63] Documentation: ACPI: move video_extension.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 17:31 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190424115647.092dec38@coco.lan>
On Wed, Apr 24, 2019 at 11:56:47AM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:53 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > .../acpi/video_extension.rst} | 63 ++++++++++---------
> > 2 files changed, 36 insertions(+), 28 deletions(-)
> > rename Documentation/{acpi/video_extension.txt => firmware-guide/acpi/video_extension.rst} (79%)
> >
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index 0e60f4b7129a..ae609eec4679 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -23,3 +23,4 @@ ACPI Support
> > i2c-muxes
> > acpi-lid
> > lpit
> > + video_extension
> > diff --git a/Documentation/acpi/video_extension.txt b/Documentation/firmware-guide/acpi/video_extension.rst
> > similarity index 79%
> > rename from Documentation/acpi/video_extension.txt
> > rename to Documentation/firmware-guide/acpi/video_extension.rst
> > index 79bf6a4921be..06f7e3230b6e 100644
> > --- a/Documentation/acpi/video_extension.txt
> > +++ b/Documentation/firmware-guide/acpi/video_extension.rst
> > @@ -1,5 +1,8 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +=====================
> > ACPI video extensions
> > -~~~~~~~~~~~~~~~~~~~~~
> > +=====================
> >
> > This driver implement the ACPI Extensions For Display Adapters for
> > integrated graphics devices on motherboard, as specified in ACPI 2.0
> > @@ -8,9 +11,10 @@ defining the video POST device, retrieving EDID information or to
> > setup a video output, etc. Note that this is an ref. implementation
> > only. It may or may not work for your integrated video device.
> >
> > -The ACPI video driver does 3 things regarding backlight control:
> > +The ACPI video driver does 3 things regarding backlight control.
> >
> > -1 Export a sysfs interface for user space to control backlight level
> > +1. Export a sysfs interface for user space to control backlight level
> > +=====================================================================
> >
> > If the ACPI table has a video device, and acpi_backlight=vendor kernel
> > command line is not present, the driver will register a backlight device
>
> Hmm... you didn't touch on this part of the document:
>
> And what ACPI video driver does is:
> actual_brightness: on read, control method _BQC will be evaluated to
> get the brightness level the firmware thinks it is at;
> bl_power: not implemented, will set the current brightness instead;
> brightness: on write, control method _BCM will run to set the requested
> brightness level;
> max_brightness: Derived from the _BCL package(see below);
> type: firmware
>
> You should touch it. My suggestion here is:
>
> And what ACPI video driver does is:
>
> actual_brightness:
> on read, control method _BQC will be evaluated to
> get the brightness level the firmware thinks it is at;
> bl_power:
> not implemented, will set the current brightness instead;
> brightness:
> on write, control method _BCM will run to set the requested
> brightness level;
> max_brightness:
> Derived from the _BCL package(see below);
> type:
> firmware
>
Thanks, done.
> > @@ -32,26 +36,26 @@ type: firmware
> >
> > Note that ACPI video backlight driver will always use index for
> > brightness, actual_brightness and max_brightness. So if we have
> > -the following _BCL package:
> > +the following _BCL package::
> >
> > -Method (_BCL, 0, NotSerialized)
> > -{
> > - Return (Package (0x0C)
> > + Method (_BCL, 0, NotSerialized)
> > {
> > - 0x64,
> > - 0x32,
> > - 0x0A,
> > - 0x14,
> > - 0x1E,
> > - 0x28,
> > - 0x32,
> > - 0x3C,
> > - 0x46,
> > - 0x50,
> > - 0x5A,
> > - 0x64
> > - })
> > -}
> > + Return (Package (0x0C)
> > + {
> > + 0x64,
> > + 0x32,
> > + 0x0A,
> > + 0x14,
> > + 0x1E,
> > + 0x28,
> > + 0x32,
> > + 0x3C,
> > + 0x46,
> > + 0x50,
> > + 0x5A,
> > + 0x64
> > + })
> > + }
> >
> > The first two levels are for when laptop are on AC or on battery and are
> > not used by Linux currently. The remaining 10 levels are supported levels
> > @@ -62,13 +66,15 @@ as a "brightness level" indicator. Thus from the user space perspective
> > the range of available brightness levels is from 0 to 9 (max_brightness)
> > inclusive.
> >
> > -2 Notify user space about hotkey event
> > +2. Notify user space about hotkey event
> > +=======================================
> >
> > There are generally two cases for hotkey event reporting:
> > +
> > i) For some laptops, when user presses the hotkey, a scancode will be
> > generated and sent to user space through the input device created by
> > the keyboard driver as a key type input event, with proper remap, the
> > - following key code will appear to user space:
> > + following key code will appear to user space::
> >
> > EV_KEY, KEY_BRIGHTNESSUP
> > EV_KEY, KEY_BRIGHTNESSDOWN
> > @@ -82,7 +88,7 @@ ii) For some laptops, the press of the hotkey will not generate the
> > about the event. The event value is defined in the ACPI spec. ACPI
> > video driver will generate an key type input event according to the
> > notify value it received and send the event to user space through the
> > - input device it created:
> > + input device it created::
> >
> > event keycode
> > 0x86 KEY_BRIGHTNESSUP
>
> Perhaps making this as a table would work better:
>
> input device it created:
>
> ===== ===================
> event keycode
> ===== ===================
> 0x86 KEY_BRIGHTNESSUP
> 0x87 KEY_BRIGHTNESSDOWN
> etc.
> ===== ===================
>
>
Done.
> > @@ -94,13 +100,14 @@ so this would lead to the same effect as case i) now.
> > Once user space tool receives this event, it can modify the backlight
> > level through the sysfs interface.
> >
> > -3 Change backlight level in the kernel
> > +3. Change backlight level in the kernel
> > +=======================================
> >
> > This works for machines covered by case ii) in Section 2. Once the driver
> > received a notification, it will set the backlight level accordingly. This does
> > not affect the sending of event to user space, they are always sent to user
> > space regardless of whether or not the video module controls the backlight level
> > directly. This behaviour can be controlled through the brightness_switch_enabled
> > -module parameter as documented in admin-guide/kernel-parameters.rst. It is recommended to
> > -disable this behaviour once a GUI environment starts up and wants to have full
> > -control of the backlight level.
> > +module parameter as documented in admin-guide/kernel-parameters.rst. It is
> > +recommended to disable this behaviour once a GUI environment starts up and
> > +wants to have full control of the backlight level.
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 21/63] Documentation: ACPI: move cppc_sysfs.txt to admin-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 17:22 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190424114844.5de4cfa5@coco.lan>
On Wed, Apr 24, 2019 at 11:48:44AM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:50 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > .../acpi/cppc_sysfs.rst} | 71 ++++++++++---------
> > Documentation/admin-guide/acpi/index.rst | 1 +
> > 2 files changed, 40 insertions(+), 32 deletions(-)
> > rename Documentation/{acpi/cppc_sysfs.txt => admin-guide/acpi/cppc_sysfs.rst} (51%)
> >
> > diff --git a/Documentation/acpi/cppc_sysfs.txt b/Documentation/admin-guide/acpi/cppc_sysfs.rst
> > similarity index 51%
> > rename from Documentation/acpi/cppc_sysfs.txt
> > rename to Documentation/admin-guide/acpi/cppc_sysfs.rst
> > index f20fb445135d..a4b99afbe331 100644
> > --- a/Documentation/acpi/cppc_sysfs.txt
> > +++ b/Documentation/admin-guide/acpi/cppc_sysfs.rst
> > @@ -1,5 +1,11 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> >
> > - Collaborative Processor Performance Control (CPPC)
> > +==================================================
> > +Collaborative Processor Performance Control (CPPC)
> > +==================================================
> > +
> > +CPPC
> > +====
> >
> > CPPC defined in the ACPI spec describes a mechanism for the OS to manage the
> > performance of a logical processor on a contigious and abstract performance
> > @@ -10,31 +16,28 @@ For more details on CPPC please refer to the ACPI specification at:
> >
> > http://uefi.org/specifications
> >
> > -Some of the CPPC registers are exposed via sysfs under:
> > -
> > -/sys/devices/system/cpu/cpuX/acpi_cppc/
> > -
>
>
> > -for each cpu X
>
> Hmm... removed by mistake?
>
I comfirmed that no content removed.
> > +Some of the CPPC registers are exposed via sysfs under::
> >
> > ---------------------------------------------------------------------------------
> > + /sys/devices/system/cpu/cpuX/acpi_cppc/
>
> Did you parse this with Sphinx? It doesn't sound a valid ReST construction
> to my eyes, as:
>
> 1) I've seen some versions of Sphinx to abort with severe errors when
> there's no blank line after the horizontal bar markup;
>
> 2) It will very likely ignore the "::" (I didn't test it myself), as you're
> not indenting the horizontal bar. End of indentation will mean the end
> of an (empty) literal block.
>
> So, I would stick with:
>
>
> Some of the CPPC registers are exposed via sysfs under:
>
> /sys/devices/system/cpu/cpuX/acpi_cppc/
>
> ---------------------------------------------------------------------------------
>
> for each cpu X::
>
>
> or:
>
> Some of the CPPC registers are exposed via sysfs under:
>
> /sys/devices/system/cpu/cpuX/acpi_cppc/
>
> for each cpu X
>
> --------------------------------------------------------------------------------
>
> ::
>
> (with is closer to the original author's intent)
>
> Same applies to the other similar changes on this document.
>
I didn't seen any warning here and the generated html is good. So I think it is
ok.
> >
> > -$ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/
> > -/sys/devices/system/cpu/cpu0/acpi_cppc/:
> > -total 0
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
> > --r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
> > +for each cpu X::
> >
> > ---------------------------------------------------------------------------------
> > + $ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/
> > + /sys/devices/system/cpu/cpu0/acpi_cppc/:
> > + total 0
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
> > + -r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
> >
> > * highest_perf : Highest performance of this processor (abstract scale).
> > -* nominal_perf : Highest sustained performance of this processor (abstract scale).
> > +* nominal_perf : Highest sustained performance of this processor
> > + (abstract scale).
> > * lowest_nonlinear_perf : Lowest performance of this processor with nonlinear
> > power savings (abstract scale).
> > * lowest_perf : Lowest performance of this processor (abstract scale).
> > @@ -48,22 +51,26 @@ total 0
> > * feedback_ctrs : Includes both Reference and delivered performance counter.
> > Reference counter ticks up proportional to processor's reference performance.
> > Delivered counter ticks up proportional to processor's delivered performance.
> > -* wraparound_time: Minimum time for the feedback counters to wraparound (seconds).
> > +* wraparound_time: Minimum time for the feedback counters to wraparound
> > + (seconds).
> > * reference_perf : Performance level at which reference performance counter
> > accumulates (abstract scale).
> >
> > ---------------------------------------------------------------------------------
> >
> > - Computing Average Delivered Performance
> > +Computing Average Delivered Performance
> > +=======================================
> > +
> > +Below describes the steps to compute the average performance delivered by
> > +taking two different snapshots of feedback counters at time T1 and T2.
> > +
> > + T1: Read feedback_ctrs as fbc_t1
> > + Wait or run some workload
> >
> > -Below describes the steps to compute the average performance delivered by taking
> > -two different snapshots of feedback counters at time T1 and T2.
> > + T2: Read feedback_ctrs as fbc_t2
> >
> > -T1: Read feedback_ctrs as fbc_t1
> > - Wait or run some workload
> > -T2: Read feedback_ctrs as fbc_t2
> > +::
> >
> > -delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
> > -reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
> > + delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
> > + reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
> >
> > -delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta
> > + delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta
> > diff --git a/Documentation/admin-guide/acpi/index.rst b/Documentation/admin-guide/acpi/index.rst
> > index d68e9914c5ff..9049a7b9f065 100644
> > --- a/Documentation/admin-guide/acpi/index.rst
> > +++ b/Documentation/admin-guide/acpi/index.rst
> > @@ -10,3 +10,4 @@ the Linux ACPI support.
> >
> > initrd_table_override
> > dsdt-override
> > + cppc_sysfs
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* [PATCH 4.4 052/168] ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
From: Greg Kroah-Hartman @ 2019-04-24 17:08 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, alsa-devel, linuxppc-dev, Timur Tabi, Xiubo Li,
Greg Kroah-Hartman, Takashi Iwai, Liam Girdwood, stable,
Jaroslav Kysela, Nicolin Chen, Mark Brown, Wen Yang,
Fabio Estevam
In-Reply-To: <20190424170923.452349382@linuxfoundation.org>
[ Upstream commit 11907e9d3533648615db08140e3045b829d2c141 ]
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.
Signed-off-by: Wen Yang <yellowriver2010@hotmil.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl-asoc-card.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 1b05d1c5d9fd..a32fe14b4687 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -659,6 +659,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
asrc_fail:
of_node_put(asrc_np);
of_node_put(codec_np);
+ put_device(&cpu_pdev->dev);
fail:
of_node_put(cpu_np);
--
2.19.1
^ permalink raw reply related
* [PATCH 4.4 037/168] SoC: imx-sgtl5000: add missing put_device()
From: Greg Kroah-Hartman @ 2019-04-24 17:08 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, alsa-devel, linuxppc-dev, Timur Tabi, Xiubo Li,
Greg Kroah-Hartman, Sascha Hauer, Takashi Iwai, Liam Girdwood,
stable, Jaroslav Kysela, Nicolin Chen, Mark Brown, NXP Linux Team,
Pengutronix Kernel Team, Wen Yang, Shawn Guo, Fabio Estevam,
linux-arm-kernel
In-Reply-To: <20190424170923.452349382@linuxfoundation.org>
[ Upstream commit 8fa857da9744f513036df1c43ab57f338941ae7d ]
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/imx-sgtl5000.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index b99e0b5e00e9..8e525f7ac08d 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -115,6 +115,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
ret = -EPROBE_DEFER;
goto fail;
}
+ put_device(&ssi_pdev->dev);
codec_dev = of_find_i2c_device_by_node(codec_np);
if (!codec_dev) {
dev_err(&pdev->dev, "failed to find codec platform device\n");
--
2.19.1
^ permalink raw reply related
* Re: [PATCH v2] mm: Fix modifying of page protection by insert_pfn_pmd()
From: Dan Williams @ 2019-04-24 17:13 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: Jan Kara, linux-nvdimm, stable, Linux MM, Chandan Rajendra,
Andrew Morton, linuxppc-dev
In-Reply-To: <20190402115125.18803-1-aneesh.kumar@linux.ibm.com>
On Tue, Apr 2, 2019 at 4:51 AM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> With some architectures like ppc64, set_pmd_at() cannot cope with
> a situation where there is already some (different) valid entry present.
>
> Use pmdp_set_access_flags() instead to modify the pfn which is built to
> deal with modifying existing PMD entries.
>
> This is similar to
> commit cae85cb8add3 ("mm/memory.c: fix modifying of page protection by insert_pfn()")
>
> We also do similar update w.r.t insert_pfn_pud eventhough ppc64 don't support
> pud pfn entries now.
>
> Without this patch we also see the below message in kernel log
> "BUG: non-zero pgtables_bytes on freeing mm:"
>
> CC: stable@vger.kernel.org
> Reported-by: Chandan Rajendra <chandan@linux.ibm.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> Changes from v1:
> * Fix the pgtable leak
>
> mm/huge_memory.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
This patch is triggering the following bug in v4.19.35.
kernel BUG at arch/x86/mm/pgtable.c:515!
invalid opcode: 0000 [#1] SMP NOPTI
CPU: 51 PID: 43713 Comm: java Tainted: G OE 4.19.35 #1
RIP: 0010:pmdp_set_access_flags+0x48/0x50
[..]
Call Trace:
vmf_insert_pfn_pmd+0x198/0x350
dax_iomap_fault+0xe82/0x1190
ext4_dax_huge_fault+0x103/0x1f0
? __switch_to_asm+0x40/0x70
__handle_mm_fault+0x3f6/0x1370
? __switch_to_asm+0x34/0x70
? __switch_to_asm+0x40/0x70
handle_mm_fault+0xda/0x200
__do_page_fault+0x249/0x4f0
do_page_fault+0x32/0x110
? page_fault+0x8/0x30
page_fault+0x1e/0x30
I asked the reporter to try a kernel with commit c6f3c5ee40c1
"mm/huge_memory.c: fix modifying of page protection by
insert_pfn_pmd()" reverted and the failing test passed.
I think unaligned addresses have always been passed to
vmf_insert_pfn_pmd(), but nothing cared until this patch. I *think*
the only change needed is the following, thoughts?
diff --git a/fs/dax.c b/fs/dax.c
index ca0671d55aa6..82aee9a87efa 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1560,7 +1560,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct
vm_fault *vmf, pfn_t *pfnp,
}
trace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, entry);
- result = vmf_insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn,
+ result = vmf_insert_pfn_pmd(vma, pmd_addr, vmf->pmd, pfn,
write);
break;
case IOMAP_UNWRITTEN:
I'll ask the reporter to try this fix as well.
^ permalink raw reply related
* Re: [PATCH v4 20/63] Documentation: ACPI: move apei/einj.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 17:12 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190424113349.79e1c577@coco.lan>
On Wed, Apr 24, 2019 at 11:33:49AM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:49 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > .../acpi/apei/einj.rst} | 98 ++++++++++---------
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > 2 files changed, 53 insertions(+), 46 deletions(-)
> > rename Documentation/{acpi/apei/einj.txt => firmware-guide/acpi/apei/einj.rst} (67%)
> >
> > diff --git a/Documentation/acpi/apei/einj.txt b/Documentation/firmware-guide/acpi/apei/einj.rst
> > similarity index 67%
> > rename from Documentation/acpi/apei/einj.txt
> > rename to Documentation/firmware-guide/acpi/apei/einj.rst
> > index e550c8b98139..d85e2667155c 100644
> > --- a/Documentation/acpi/apei/einj.txt
> > +++ b/Documentation/firmware-guide/acpi/apei/einj.rst
> > @@ -1,13 +1,16 @@
> > - APEI Error INJection
> > - ~~~~~~~~~~~~~~~~~~~~
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +====================
> > +APEI Error INJection
> > +====================
> >
> > EINJ provides a hardware error injection mechanism. It is very useful
> > for debugging and testing APEI and RAS features in general.
> >
> > You need to check whether your BIOS supports EINJ first. For that, look
> > -for early boot messages similar to this one:
> > +for early boot messages similar to this one::
> >
> > -ACPI: EINJ 0x000000007370A000 000150 (v01 INTEL 00000001 INTL 00000001)
> > + ACPI: EINJ 0x000000007370A000 000150 (v01 INTEL 00000001 INTL 00000001)
> >
> > which shows that the BIOS is exposing an EINJ table - it is the
> > mechanism through which the injection is done.
> > @@ -23,11 +26,11 @@ order to see the APEI,EINJ,... functionality supported and exposed by
> > the BIOS menu.
> >
> > To use EINJ, make sure the following are options enabled in your kernel
> > -configuration:
> > +configuration::
> >
> > -CONFIG_DEBUG_FS
> > -CONFIG_ACPI_APEI
> > -CONFIG_ACPI_APEI_EINJ
> > + CONFIG_DEBUG_FS
> > + CONFIG_ACPI_APEI
> > + CONFIG_ACPI_APEI_EINJ
> >
> > The EINJ user interface is in <debugfs mount point>/apei/einj.
> >
> > @@ -35,22 +38,22 @@ The following files belong to it:
> >
> > - available_error_type
> >
> > - This file shows which error types are supported:
> > -
> > - Error Type Value Error Description
> > - ================ =================
> > - 0x00000001 Processor Correctable
> > - 0x00000002 Processor Uncorrectable non-fatal
> > - 0x00000004 Processor Uncorrectable fatal
> > - 0x00000008 Memory Correctable
> > - 0x00000010 Memory Uncorrectable non-fatal
> > - 0x00000020 Memory Uncorrectable fatal
> > - 0x00000040 PCI Express Correctable
> > - 0x00000080 PCI Express Uncorrectable fatal
> > - 0x00000100 PCI Express Uncorrectable non-fatal
> > - 0x00000200 Platform Correctable
> > - 0x00000400 Platform Uncorrectable non-fatal
> > - 0x00000800 Platform Uncorrectable fatal
> > + This file shows which error types are supported::
> > +
> > + Error Type Value Error Description
> > + ================ =================
> > + 0x00000001 Processor Correctable
> > + 0x00000002 Processor Uncorrectable non-fatal
> > + 0x00000004 Processor Uncorrectable fatal
> > + 0x00000008 Memory Correctable
> > + 0x00000010 Memory Uncorrectable non-fatal
> > + 0x00000020 Memory Uncorrectable fatal
> > + 0x00000040 PCI Express Correctable
> > + 0x00000080 PCI Express Uncorrectable fatal
> > + 0x00000100 PCI Express Uncorrectable non-fatal
> > + 0x00000200 Platform Correctable
> > + 0x00000400 Platform Uncorrectable non-fatal
> > + 0x00000800 Platform Uncorrectable fatal
>
> This is a table and not a literal block.
>
> The best here to preserve the author's intent is to just adjust the table
> markups in order to make it parseable, e. g.:
>
> This file shows which error types are supported:
>
> ================ ===================================
> Error Type Value Error Description
> ================ ===================================
> 0x00000001 Processor Correctable
> 0x00000002 Processor Uncorrectable non-fatal
> 0x00000004 Processor Uncorrectable fatal
> 0x00000008 Memory Correctable
> 0x00000010 Memory Uncorrectable non-fatal
> 0x00000020 Memory Uncorrectable fatal
> 0x00000040 PCI Express Correctable
> 0x00000080 PCI Express Uncorrectable fatal
> 0x00000100 PCI Express Uncorrectable non-fatal
> 0x00000200 Platform Correctable
> 0x00000400 Platform Uncorrectable non-fatal
> 0x00000800 Platform Uncorrectable fatal
> ================ ===================================
>
Done, thanks.
> After such change:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> >
> > The format of the file contents are as above, except present are only
> > the available error types.
> > @@ -73,9 +76,12 @@ The following files belong to it:
> > injection. Value is a bitmask as specified in ACPI5.0 spec for the
> > SET_ERROR_TYPE_WITH_ADDRESS data structure:
> >
> > - Bit 0 - Processor APIC field valid (see param3 below).
> > - Bit 1 - Memory address and mask valid (param1 and param2).
> > - Bit 2 - PCIe (seg,bus,dev,fn) valid (see param4 below).
> > + Bit 0
> > + Processor APIC field valid (see param3 below).
> > + Bit 1
> > + Memory address and mask valid (param1 and param2).
> > + Bit 2
> > + PCIe (seg,bus,dev,fn) valid (see param4 below).
> >
> > If set to zero, legacy behavior is mimicked where the type of
> > injection specifies just one bit set, and param1 is multiplexed.
> > @@ -121,7 +127,7 @@ BIOS versions based on the ACPI 5.0 specification have more control over
> > the target of the injection. For processor-related errors (type 0x1, 0x2
> > and 0x4), you can set flags to 0x3 (param3 for bit 0, and param1 and
> > param2 for bit 1) so that you have more information added to the error
> > -signature being injected. The actual data passed is this:
> > +signature being injected. The actual data passed is this::
> >
> > memory_address = param1;
> > memory_address_range = param2;
> > @@ -131,7 +137,7 @@ signature being injected. The actual data passed is this:
> > For memory errors (type 0x8, 0x10 and 0x20) the address is set using
> > param1 with a mask in param2 (0x0 is equivalent to all ones). For PCI
> > express errors (type 0x40, 0x80 and 0x100) the segment, bus, device and
> > -function are specified using param1:
> > +function are specified using param1::
> >
> > 31 24 23 16 15 11 10 8 7 0
> > +-------------------------------------------------+
> > @@ -152,26 +158,26 @@ documentation for details (and expect changes to this API if vendors
> > creativity in using this feature expands beyond our expectations).
> >
> >
> > -An error injection example:
> > +An error injection example::
> >
> > -# cd /sys/kernel/debug/apei/einj
> > -# cat available_error_type # See which errors can be injected
> > -0x00000002 Processor Uncorrectable non-fatal
> > -0x00000008 Memory Correctable
> > -0x00000010 Memory Uncorrectable non-fatal
> > -# echo 0x12345000 > param1 # Set memory address for injection
> > -# echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in this page
> > -# echo 0x8 > error_type # Choose correctable memory error
> > -# echo 1 > error_inject # Inject now
> > + # cd /sys/kernel/debug/apei/einj
> > + # cat available_error_type # See which errors can be injected
> > + 0x00000002 Processor Uncorrectable non-fatal
> > + 0x00000008 Memory Correctable
> > + 0x00000010 Memory Uncorrectable non-fatal
> > + # echo 0x12345000 > param1 # Set memory address for injection
> > + # echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in this page
> > + # echo 0x8 > error_type # Choose correctable memory error
> > + # echo 1 > error_inject # Inject now
> >
> > -You should see something like this in dmesg:
> > +You should see something like this in dmesg::
> >
> > -[22715.830801] EDAC sbridge MC3: HANDLING MCE MEMORY ERROR
> > -[22715.834759] EDAC sbridge MC3: CPU 0: Machine Check Event: 0 Bank 7: 8c00004000010090
> > -[22715.834759] EDAC sbridge MC3: TSC 0
> > -[22715.834759] EDAC sbridge MC3: ADDR 12345000 EDAC sbridge MC3: MISC 144780c86
> > -[22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0
> > -[22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0)
> > + [22715.830801] EDAC sbridge MC3: HANDLING MCE MEMORY ERROR
> > + [22715.834759] EDAC sbridge MC3: CPU 0: Machine Check Event: 0 Bank 7: 8c00004000010090
> > + [22715.834759] EDAC sbridge MC3: TSC 0
> > + [22715.834759] EDAC sbridge MC3: ADDR 12345000 EDAC sbridge MC3: MISC 144780c86
> > + [22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0
> > + [22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0)
> >
> > For more information about EINJ, please refer to ACPI specification
> > version 4.0, section 17.5 and ACPI 5.0, section 18.6.
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index 869badba6d7a..fca854f017d8 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -18,6 +18,7 @@ ACPI Support
> > debug
> > aml-debugger
> > apei/output_format
> > + apei/einj
> > gpio-properties
> > i2c-muxes
> > acpi-lid
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* [PATCH 3.18 020/104] SoC: imx-sgtl5000: add missing put_device()
From: Greg Kroah-Hartman @ 2019-04-24 17:08 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, alsa-devel, linuxppc-dev, Timur Tabi, Xiubo Li,
Greg Kroah-Hartman, Sascha Hauer, Takashi Iwai, Liam Girdwood,
stable, Jaroslav Kysela, Nicolin Chen, Mark Brown, NXP Linux Team,
Pengutronix Kernel Team, Wen Yang, Shawn Guo, Fabio Estevam,
linux-arm-kernel
In-Reply-To: <20190424170839.996641496@linuxfoundation.org>
[ Upstream commit 8fa857da9744f513036df1c43ab57f338941ae7d ]
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/imx-sgtl5000.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 1cb22dd034eb..110f3cf361af 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -115,6 +115,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
ret = -EPROBE_DEFER;
goto fail;
}
+ put_device(&ssi_pdev->dev);
codec_dev = of_find_i2c_device_by_node(codec_np);
if (!codec_dev) {
dev_err(&pdev->dev, "failed to find codec platform device\n");
--
2.19.1
^ permalink raw reply related
* Re: [PATCH v4 37/63] Documentation: add Linux x86 docs to Sphinx TOC tree
From: Mauro Carvalho Chehab @ 2019-04-24 17:04 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-38-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:06 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> Add a index.rst for x86 support. More docs will be added later.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
> Documentation/index.rst | 1 +
> Documentation/x86/index.rst | 9 +++++++++
> 2 files changed, 10 insertions(+)
> create mode 100644 Documentation/x86/index.rst
>
> diff --git a/Documentation/index.rst b/Documentation/index.rst
> index d80138284e0f..f185c8040fa9 100644
> --- a/Documentation/index.rst
> +++ b/Documentation/index.rst
> @@ -112,6 +112,7 @@ implementation.
> .. toctree::
> :maxdepth: 2
>
> + x86/index
> sh/index
>
> Filesystem Documentation
> diff --git a/Documentation/x86/index.rst b/Documentation/x86/index.rst
> new file mode 100644
> index 000000000000..7612d3142b2a
> --- /dev/null
> +++ b/Documentation/x86/index.rst
> @@ -0,0 +1,9 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +=================
> +Linux x86 Support
> +=================
> +
> +.. toctree::
> + :maxdepth: 2
> + :numbered:
Looks ok to me:
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Just one reminder: after merging both this and my conversions, we may
need to do some review at the architecture titles, in order to
make them consistent.
On mu conversion patches, I'm using
==================
$arch Architecture
==================
Probably also not the best title. Anyway, this can easily be fixed
with a follow up patch once we get everything merged.
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 36/63] Documentation: PCI: convert endpoint/pci-test-howto.txt to reST
From: Mauro Carvalho Chehab @ 2019-04-24 17:00 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-37-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:05 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> This converts the plain text documentation to reStructuredText format and
> add it to Sphinx TOC tree. No essential content change.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
> Documentation/PCI/endpoint/index.rst | 1 +
> ...{pci-test-howto.txt => pci-test-howto.rst} | 81 +++++++++++++------
> 2 files changed, 56 insertions(+), 26 deletions(-)
> rename Documentation/PCI/endpoint/{pci-test-howto.txt => pci-test-howto.rst} (78%)
>
> diff --git a/Documentation/PCI/endpoint/index.rst b/Documentation/PCI/endpoint/index.rst
> index b680a3fc4fec..d114ea74b444 100644
> --- a/Documentation/PCI/endpoint/index.rst
> +++ b/Documentation/PCI/endpoint/index.rst
> @@ -10,3 +10,4 @@ PCI Endpoint Framework
> pci-endpoint
> pci-endpoint-cfs
> pci-test-function
> + pci-test-howto
> diff --git a/Documentation/PCI/endpoint/pci-test-howto.txt b/Documentation/PCI/endpoint/pci-test-howto.rst
> similarity index 78%
> rename from Documentation/PCI/endpoint/pci-test-howto.txt
> rename to Documentation/PCI/endpoint/pci-test-howto.rst
> index 040479f437a5..909f770a07d6 100644
> --- a/Documentation/PCI/endpoint/pci-test-howto.txt
> +++ b/Documentation/PCI/endpoint/pci-test-howto.rst
> @@ -1,38 +1,51 @@
> - PCI TEST USERGUIDE
> - Kishon Vijay Abraham I <kishon@ti.com>
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +===================
> +PCI Test User Guide
> +===================
> +
> +:Author: Kishon Vijay Abraham I <kishon@ti.com>
>
> This document is a guide to help users use pci-epf-test function driver
> and pci_endpoint_test host driver for testing PCI. The list of steps to
> be followed in the host side and EP side is given below.
>
> -1. Endpoint Device
> +Endpoint Device
> +===============
>
> -1.1 Endpoint Controller Devices
> +Endpoint Controller Devices
> +---------------------------
>
> -To find the list of endpoint controller devices in the system:
> +To find the list of endpoint controller devices in the system::
>
> # ls /sys/class/pci_epc/
> 51000000.pcie_ep
>
> -If PCI_ENDPOINT_CONFIGFS is enabled
> +If PCI_ENDPOINT_CONFIGFS is enabled::
> +
> # ls /sys/kernel/config/pci_ep/controllers
> 51000000.pcie_ep
>
> -1.2 Endpoint Function Drivers
>
> -To find the list of endpoint function drivers in the system:
> +Endpoint Function Drivers
> +-------------------------
> +
> +To find the list of endpoint function drivers in the system::
>
> # ls /sys/bus/pci-epf/drivers
> pci_epf_test
>
> -If PCI_ENDPOINT_CONFIGFS is enabled
> +If PCI_ENDPOINT_CONFIGFS is enabled::
> +
> # ls /sys/kernel/config/pci_ep/functions
> pci_epf_test
>
> -1.3 Creating pci-epf-test Device
> +
> +Creating pci-epf-test Device
> +----------------------------
>
> PCI endpoint function device can be created using the configfs. To create
> -pci-epf-test device, the following commands can be used
> +pci-epf-test device, the following commands can be used::
>
> # mount -t configfs none /sys/kernel/config
> # cd /sys/kernel/config/pci_ep/
> @@ -42,7 +55,7 @@ The "mkdir func1" above creates the pci-epf-test function device that will
> be probed by pci_epf_test driver.
>
> The PCI endpoint framework populates the directory with the following
> -configurable fields.
> +configurable fields::
>
> # ls functions/pci_epf_test/func1
> baseclass_code interrupt_pin progif_code subsys_id
> @@ -51,67 +64,83 @@ configurable fields.
>
> The PCI endpoint function driver populates these entries with default values
> when the device is bound to the driver. The pci-epf-test driver populates
> -vendorid with 0xffff and interrupt_pin with 0x0001
> +vendorid with 0xffff and interrupt_pin with 0x0001::
>
> # cat functions/pci_epf_test/func1/vendorid
> 0xffff
> # cat functions/pci_epf_test/func1/interrupt_pin
> 0x0001
>
> -1.4 Configuring pci-epf-test Device
> +
> +Configuring pci-epf-test Device
> +-------------------------------
>
> The user can configure the pci-epf-test device using configfs entry. In order
> to change the vendorid and the number of MSI interrupts used by the function
> -device, the following commands can be used.
> +device, the following commands can be used::
>
> # echo 0x104c > functions/pci_epf_test/func1/vendorid
> # echo 0xb500 > functions/pci_epf_test/func1/deviceid
> # echo 16 > functions/pci_epf_test/func1/msi_interrupts
> # echo 8 > functions/pci_epf_test/func1/msix_interrupts
>
> -1.5 Binding pci-epf-test Device to EP Controller
> +
> +Binding pci-epf-test Device to EP Controller
> +--------------------------------------------
>
> In order for the endpoint function device to be useful, it has to be bound to
> a PCI endpoint controller driver. Use the configfs to bind the function
> -device to one of the controller driver present in the system.
> +device to one of the controller driver present in the system::
>
> # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/
>
> Once the above step is completed, the PCI endpoint is ready to establish a link
> with the host.
>
> -1.6 Start the Link
> +
> +Start the Link
> +--------------
>
> In order for the endpoint device to establish a link with the host, the _start_
> -field should be populated with '1'.
> +field should be populated with '1'::
>
> # echo 1 > controllers/51000000.pcie_ep/start
>
> -2. RootComplex Device
>
> -2.1 lspci Output
> +RootComplex Device
> +==================
> +
> +lspci Output
> +------------
>
> -Note that the devices listed here correspond to the value populated in 1.4 above
> +Note that the devices listed here correspond to the value populated in 1.4
> +above::
>
> 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
> 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500
>
> -2.2 Using Endpoint Test function Device
> +
> +Using Endpoint Test function Device
> +-----------------------------------
>
> pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint
> -tests. To compile this tool the following commands should be used:
> +tests. To compile this tool the following commands should be used::
>
> # cd <kernel-dir>
> # make -C tools/pci
>
> -or if you desire to compile and install in your system:
> +or if you desire to compile and install in your system::
>
> # cd <kernel-dir>
> # make -C tools/pci install
>
> The tool and script will be located in <rootfs>/usr/bin/
>
> -2.2.1 pcitest.sh Output
> +
> +pcitest.sh Output
> +~~~~~~~~~~~~~~~~~
> +::
> +
> # pcitest.sh
> BAR tests
>
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 35/63] Documentation: PCI: convert endpoint/pci-test-function.txt to reST
From: Mauro Carvalho Chehab @ 2019-04-24 16:58 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-36-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:04 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> This converts the plain text documentation to reStructuredText format and
> add it to Sphinx TOC tree. No essential content change.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> Documentation/PCI/endpoint/index.rst | 1 +
> ...est-function.txt => pci-test-function.rst} | 32 +++++++++++--------
> 2 files changed, 20 insertions(+), 13 deletions(-)
> rename Documentation/PCI/endpoint/{pci-test-function.txt => pci-test-function.rst} (84%)
>
> diff --git a/Documentation/PCI/endpoint/index.rst b/Documentation/PCI/endpoint/index.rst
> index 3951de9f923c..b680a3fc4fec 100644
> --- a/Documentation/PCI/endpoint/index.rst
> +++ b/Documentation/PCI/endpoint/index.rst
> @@ -9,3 +9,4 @@ PCI Endpoint Framework
>
> pci-endpoint
> pci-endpoint-cfs
> + pci-test-function
> diff --git a/Documentation/PCI/endpoint/pci-test-function.txt b/Documentation/PCI/endpoint/pci-test-function.rst
> similarity index 84%
> rename from Documentation/PCI/endpoint/pci-test-function.txt
> rename to Documentation/PCI/endpoint/pci-test-function.rst
> index 5916f1f592bb..ba02cddcec37 100644
> --- a/Documentation/PCI/endpoint/pci-test-function.txt
> +++ b/Documentation/PCI/endpoint/pci-test-function.rst
> @@ -1,5 +1,10 @@
> - PCI TEST
> - Kishon Vijay Abraham I <kishon@ti.com>
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +=================
> +PCI Test Function
> +=================
> +
> +:Author: Kishon Vijay Abraham I <kishon@ti.com>
>
> Traditionally PCI RC has always been validated by using standard
> PCI cards like ethernet PCI cards or USB PCI cards or SATA PCI cards.
> @@ -23,30 +28,31 @@ The PCI endpoint test device has the following registers:
> 8) PCI_ENDPOINT_TEST_IRQ_TYPE
> 9) PCI_ENDPOINT_TEST_IRQ_NUMBER
>
> -*) PCI_ENDPOINT_TEST_MAGIC
> +* PCI_ENDPOINT_TEST_MAGIC
Same comment as on a previous patch. I suspect that the author's intention
for all stuff under Documentation/PCI/endpoint/ (or perhaps this is due
tothe markup language he uses) is to have:
*) foo
as a chapter, e. g. the right conversion would be, instead:
PCI_ENDPOINT_TEST_MAGIC
=======================
(same applies to the other similar markups here and on other files under
the endpoint/ directory)
>
> This register will be used to test BAR0. A known pattern will be written
> and read back from MAGIC register to verify BAR0.
>
> -*) PCI_ENDPOINT_TEST_COMMAND:
> +* PCI_ENDPOINT_TEST_COMMAND:
>
> This register will be used by the host driver to indicate the function
> that the endpoint device must perform.
>
> -Bitfield Description:
> +Bitfield Description::
> +
> Bit 0 : raise legacy IRQ
> Bit 1 : raise MSI IRQ
> Bit 2 : raise MSI-X IRQ
> Bit 3 : read command (read data from RC buffer)
> Bit 4 : write command (write data to RC buffer)
> - Bit 5 : copy command (copy data from one RC buffer to another
> - RC buffer)
> + Bit 5 : copy command (copy data from one RC buffer to another RC buffer)
Please use a table instead:
Bitfield Description:
===== =======================================================
Bit 0 raise legacy IRQ
Bit 1 raise MSI IRQ
Bit 2 raise MSI-X IRQ
Bit 3 read command (read data from RC buffer)
Bit 4 write command (write data to RC buffer)
Bit 5 copy command (copy data from one RC buffer to another
RC buffer)
===== =======================================================
>
> -*) PCI_ENDPOINT_TEST_STATUS
> +* PCI_ENDPOINT_TEST_STATUS
>
> This register reflects the status of the PCI endpoint device.
>
> -Bitfield Description:
> +Bitfield Description::
> +
> Bit 0 : read success
> Bit 1 : read fail
> Bit 2 : write success
> @@ -57,17 +63,17 @@ Bitfield Description:
> Bit 7 : source address is invalid
> Bit 8 : destination address is invalid
Same here:
Bitfield Description:
===== ==============================
Bit 0 read success
Bit 1 read fail
Bit 2 write success
Bit 3 write fail
Bit 4 copy success
Bit 5 copy fail
Bit 6 IRQ raised
Bit 7 source address is invalid
Bit 8 destination address is invalid
===== ==============================
>
> -*) PCI_ENDPOINT_TEST_SRC_ADDR
> +* PCI_ENDPOINT_TEST_SRC_ADDR
>
> This register contains the source address (RC buffer address) for the
> COPY/READ command.
>
> -*) PCI_ENDPOINT_TEST_DST_ADDR
> +* PCI_ENDPOINT_TEST_DST_ADDR
>
> This register contains the destination address (RC buffer address) for
> the COPY/WRITE command.
>
> -*) PCI_ENDPOINT_TEST_IRQ_TYPE
> +* PCI_ENDPOINT_TEST_IRQ_TYPE
>
> This register contains the interrupt type (Legacy/MSI) triggered
> for the READ/WRITE/COPY and raise IRQ (Legacy/MSI) commands.
> @@ -77,7 +83,7 @@ Possible types:
You need a blank line before - MSI, in order to not use a bold font for
"Possible types:".
> - MSI : 1
> - MSI-X : 2
>
> -*) PCI_ENDPOINT_TEST_IRQ_NUMBER
> +* PCI_ENDPOINT_TEST_IRQ_NUMBER
>
> This register contains the triggered ID interrupt.
>
Same here: ou need a blank line on this text:
Admissible values:
+
- Legacy : 0
- MSI : [1 .. 32]
- MSI-X : [1 .. 2048]
In order to avoid using bold font for "Admissible values".
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 17/63] Documentation: ACPI: move method-tracing.txt to firmware-guide/acpi and convert to rsST
From: Changbin Du @ 2019-04-24 16:55 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190424112638.1b9f7cfb@coco.lan>
On Wed, Apr 24, 2019 at 11:26:38AM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:46 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/acpi/method-tracing.txt | 192 ---------------
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > .../firmware-guide/acpi/method-tracing.rst | 225 ++++++++++++++++++
> > 3 files changed, 226 insertions(+), 192 deletions(-)
> > delete mode 100644 Documentation/acpi/method-tracing.txt
> > create mode 100644 Documentation/firmware-guide/acpi/method-tracing.rst
> >
> > diff --git a/Documentation/acpi/method-tracing.txt b/Documentation/acpi/method-tracing.txt
> > deleted file mode 100644
> > index 0aba14c8f459..000000000000
> > --- a/Documentation/acpi/method-tracing.txt
> > +++ /dev/null
> > @@ -1,192 +0,0 @@
> > -ACPICA Trace Facility
> > -
> > -Copyright (C) 2015, Intel Corporation
> > -Author: Lv Zheng <lv.zheng@intel.com>
> > -
> > -
> > -Abstract:
> > -
> > -This document describes the functions and the interfaces of the method
> > -tracing facility.
> > -
> > -1. Functionalities and usage examples:
> > -
> > - ACPICA provides method tracing capability. And two functions are
> > - currently implemented using this capability.
> > -
> > - A. Log reducer
> > - ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
> > - enabled. The debugging messages which are deployed via
> > - ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
> > - level (known as debug layer, configured via
> > - /sys/module/acpi/parameters/debug_layer) and per-type level (known as
> > - debug level, configured via /sys/module/acpi/parameters/debug_level).
> > -
> > - But when the particular layer/level is applied to the control method
> > - evaluations, the quantity of the debugging outputs may still be too
> > - large to be put into the kernel log buffer. The idea thus is worked out
> > - to only enable the particular debug layer/level (normally more detailed)
> > - logs when the control method evaluation is started, and disable the
> > - detailed logging when the control method evaluation is stopped.
> > -
> > - The following command examples illustrate the usage of the "log reducer"
> > - functionality:
> > - a. Filter out the debug layer/level matched logs when control methods
> > - are being evaluated:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0xXXXXXXXX" > trace_debug_layer
> > - # echo "0xYYYYYYYY" > trace_debug_level
> > - # echo "enable" > trace_state
> > - b. Filter out the debug layer/level matched logs when the specified
> > - control method is being evaluated:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0xXXXXXXXX" > trace_debug_layer
> > - # echo "0xYYYYYYYY" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "method" > /sys/module/acpi/parameters/trace_state
> > - c. Filter out the debug layer/level matched logs when the specified
> > - control method is being evaluated for the first time:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0xXXXXXXXX" > trace_debug_layer
> > - # echo "0xYYYYYYYY" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "method-once" > /sys/module/acpi/parameters/trace_state
> > - Where:
> > - 0xXXXXXXXX/0xYYYYYYYY: Refer to Documentation/acpi/debug.txt for
> > - possible debug layer/level masking values.
> > - \PPPP.AAAA.TTTT.HHHH: Full path of a control method that can be found
> > - in the ACPI namespace. It needn't be an entry
> > - of a control method evaluation.
> > -
> > - B. AML tracer
> > -
> > - There are special log entries added by the method tracing facility at
> > - the "trace points" the AML interpreter starts/stops to execute a control
> > - method, or an AML opcode. Note that the format of the log entries are
> > - subject to change:
> > - [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
> > - [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution.
> > - [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution.
> > - [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution.
> > - [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution.
> > - [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
> > - [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
> > - [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution.
> > - [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution.
> > - [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
> > - [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
> > - [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution.
> > - [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution.
> > - [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
> > -
> > - Developers can utilize these special log entries to track the AML
> > - interpretion, thus can aid issue debugging and performance tuning. Note
> > - that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
> > - macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
> > - "AML tracer" logs.
> > -
> > - The following command examples illustrate the usage of the "AML tracer"
> > - functionality:
> > - a. Filter out the method start/stop "AML tracer" logs when control
> > - methods are being evaluated:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0x80" > trace_debug_layer
> > - # echo "0x10" > trace_debug_level
> > - # echo "enable" > trace_state
> > - b. Filter out the method start/stop "AML tracer" when the specified
> > - control method is being evaluated:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0x80" > trace_debug_layer
> > - # echo "0x10" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "method" > trace_state
> > - c. Filter out the method start/stop "AML tracer" logs when the specified
> > - control method is being evaluated for the first time:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0x80" > trace_debug_layer
> > - # echo "0x10" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "method-once" > trace_state
> > - d. Filter out the method/opcode start/stop "AML tracer" when the
> > - specified control method is being evaluated:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0x80" > trace_debug_layer
> > - # echo "0x10" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "opcode" > trace_state
> > - e. Filter out the method/opcode start/stop "AML tracer" when the
> > - specified control method is being evaluated for the first time:
> > - # cd /sys/module/acpi/parameters
> > - # echo "0x80" > trace_debug_layer
> > - # echo "0x10" > trace_debug_level
> > - # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > - # echo "opcode-opcode" > trace_state
> > -
> > - Note that all above method tracing facility related module parameters can
> > - be used as the boot parameters, for example:
> > - acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
> > - acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once
> > -
> > -2. Interface descriptions:
> > -
> > - All method tracing functions can be configured via ACPI module
> > - parameters that are accessible at /sys/module/acpi/parameters/:
> > -
> > - trace_method_name
> > - The full path of the AML method that the user wants to trace.
> > - Note that the full path shouldn't contain the trailing "_"s in its
> > - name segments but may contain "\" to form an absolute path.
> > -
> > - trace_debug_layer
> > - The temporary debug_layer used when the tracing feature is enabled.
> > - Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
> > - used to match all "AML tracer" logs.
> > -
> > - trace_debug_level
> > - The temporary debug_level used when the tracing feature is enabled.
> > - Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
> > - debug_level used to match all "AML tracer" logs.
> > -
> > - trace_state
> > - The status of the tracing feature.
> > - Users can enable/disable this debug tracing feature by executing
> > - the following command:
> > - # echo string > /sys/module/acpi/parameters/trace_state
> > - Where "string" should be one of the following:
> > - "disable"
> > - Disable the method tracing feature.
> > - "enable"
> > - Enable the method tracing feature.
> > - ACPICA debugging messages matching
> > - "trace_debug_layer/trace_debug_level" during any method
> > - execution will be logged.
> > - "method"
> > - Enable the method tracing feature.
> > - ACPICA debugging messages matching
> > - "trace_debug_layer/trace_debug_level" during method execution
> > - of "trace_method_name" will be logged.
> > - "method-once"
> > - Enable the method tracing feature.
> > - ACPICA debugging messages matching
> > - "trace_debug_layer/trace_debug_level" during method execution
> > - of "trace_method_name" will be logged only once.
> > - "opcode"
> > - Enable the method tracing feature.
> > - ACPICA debugging messages matching
> > - "trace_debug_layer/trace_debug_level" during method/opcode
> > - execution of "trace_method_name" will be logged.
> > - "opcode-once"
> > - Enable the method tracing feature.
> > - ACPICA debugging messages matching
> > - "trace_debug_layer/trace_debug_level" during method/opcode
> > - execution of "trace_method_name" will be logged only once.
> > - Note that, the difference between the "enable" and other feature
> > - enabling options are:
> > - 1. When "enable" is specified, since
> > - "trace_debug_layer/trace_debug_level" shall apply to all control
> > - method evaluations, after configuring "trace_state" to "enable",
> > - "trace_method_name" will be reset to NULL.
> > - 2. When "method/opcode" is specified, if
> > - "trace_method_name" is NULL when "trace_state" is configured to
> > - these options, the "trace_debug_layer/trace_debug_level" will
> > - apply to all control method evaluations.
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index a45fea11f998..287a7cbd82ac 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -13,6 +13,7 @@ ACPI Support
> > enumeration
> > osi
> > method-customizing
> > + method-tracing
> > DSD-properties-rules
> > debug
> > gpio-properties
> > diff --git a/Documentation/firmware-guide/acpi/method-tracing.rst b/Documentation/firmware-guide/acpi/method-tracing.rst
> > new file mode 100644
> > index 000000000000..7a997ba168d7
> > --- /dev/null
> > +++ b/Documentation/firmware-guide/acpi/method-tracing.rst
> > @@ -0,0 +1,225 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: <isonum.txt>
> > +
> > +=====================
> > +ACPICA Trace Facility
> > +=====================
> > +
> > +:Copyright: |copy| 2015, Intel Corporation
> > +:Author: Lv Zheng <lv.zheng@intel.com>
> > +
> > +
> > +:Abstract: This document describes the functions and the interfaces of the
> > + method tracing facility.
>
> Same comment as on other patches.
>
Fixed, thanks.
> > +
> > +1. Functionalities and usage examples
> > +=====================================
> > +
> > +ACPICA provides method tracing capability. And two functions are
> > +currently implemented using this capability.
> > +
> > +Log reducer
> > +--------------
> > +
> > +ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
> > +enabled. The debugging messages which are deployed via
> > +ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
> > +level (known as debug layer, configured via
> > +/sys/module/acpi/parameters/debug_layer) and per-type level (known as
> > +debug level, configured via /sys/module/acpi/parameters/debug_level).
> > +
> > +But when the particular layer/level is applied to the control method
> > +evaluations, the quantity of the debugging outputs may still be too
> > +large to be put into the kernel log buffer. The idea thus is worked out
> > +to only enable the particular debug layer/level (normally more detailed)
> > +logs when the control method evaluation is started, and disable the
> > +detailed logging when the control method evaluation is stopped.
> > +
> > +The following command examples illustrate the usage of the "log reducer"
> > +functionality:
> > +
> > +a. Filter out the debug layer/level matched logs when control methods
> > + are being evaluated::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0xXXXXXXXX" > trace_debug_layer
> > + # echo "0xYYYYYYYY" > trace_debug_level
> > + # echo "enable" > trace_state
> > +
> > +b. Filter out the debug layer/level matched logs when the specified
> > + control method is being evaluated::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0xXXXXXXXX" > trace_debug_layer
> > + # echo "0xYYYYYYYY" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "method" > /sys/module/acpi/parameters/trace_state
> > +
> > +c. Filter out the debug layer/level matched logs when the specified
> > + control method is being evaluated for the first time::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0xXXXXXXXX" > trace_debug_layer
> > + # echo "0xYYYYYYYY" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "method-once" > /sys/module/acpi/parameters/trace_state
> > +
> > +Where:
> > + 0xXXXXXXXX/0xYYYYYYYY
> > + Refer to Documentation/acpi/debug.txt for possible debug layer/level
> > + masking values.
> > + \PPPP.AAAA.TTTT.HHHH
> > + Full path of a control method that can be found in the ACPI namespace.
> > + It needn't be an entry of a control method evaluation.
> > +
> > +AML tracer
> > +-------------
>
> The markup is bigger than the line. You should have seen a Sphinx
> warning here.
>
> > +
> > +There are special log entries added by the method tracing facility at
> > +the "trace points" the AML interpreter starts/stops to execute a control
> > +method, or an AML opcode. Note that the format of the log entries are
> > +subject to change::
> > +
> > + [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
> > + [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution.
> > + [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution.
> > + [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution.
> > + [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution.
> > + [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
> > + [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
> > + [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution.
> > + [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution.
> > + [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
> > + [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
> > + [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution.
> > + [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution.
> > + [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
> > +
> > +Developers can utilize these special log entries to track the AML
> > +interpretion, thus can aid issue debugging and performance tuning. Note
> > +that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
> > +macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
> > +"AML tracer" logs.
> > +
> > +The following command examples illustrate the usage of the "AML tracer"
> > +functionality:
> > +
> > +a. Filter out the method start/stop "AML tracer" logs when control
> > + methods are being evaluated::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0x80" > trace_debug_layer
> > + # echo "0x10" > trace_debug_level
> > + # echo "enable" > trace_state
> > +
> > +b. Filter out the method start/stop "AML tracer" when the specified
> > + control method is being evaluated::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0x80" > trace_debug_layer
> > + # echo "0x10" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "method" > trace_state
> > +
> > +c. Filter out the method start/stop "AML tracer" logs when the specified
> > + control method is being evaluated for the first time::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0x80" > trace_debug_layer
> > + # echo "0x10" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "method-once" > trace_state
> > +
> > +d. Filter out the method/opcode start/stop "AML tracer" when the
> > + specified control method is being evaluated::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0x80" > trace_debug_layer
> > + # echo "0x10" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "opcode" > trace_state
> > +
> > +e. Filter out the method/opcode start/stop "AML tracer" when the
> > + specified control method is being evaluated for the first time::
> > +
> > + # cd /sys/module/acpi/parameters
> > + # echo "0x80" > trace_debug_layer
> > + # echo "0x10" > trace_debug_level
> > + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
> > + # echo "opcode-opcode" > trace_state
> > +
> > +Note that all above method tracing facility related module parameters can
> > +be used as the boot parameters, for example::
> > +
> > + acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
> > + acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once
> > +
> > +2. Interface descriptions
> > +=========================
> > +
> > +All method tracing functions can be configured via ACPI module
> > +parameters that are accessible at /sys/module/acpi/parameters/:
> > +
> > +trace_method_name
> > +The full path of the AML method that the user wants to trace.
> > +Note that the full path shouldn't contain the trailing "_"s in its
> > +name segments but may contain "\" to form an absolute path.
> > +
>
>
> > +trace_debug_layer
> > +The temporary debug_layer used when the tracing feature is enabled.
> > +Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
> > +used to match all "AML tracer" logs.
> > +
> > +trace_debug_level
> > +The temporary debug_level used when the tracing feature is enabled.
> > +Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
> > +debug_level used to match all "AML tracer" logs.
> > +
> > +trace_state
> > +The status of the tracing feature.
> > +Users can enable/disable this debug tracing feature by executing
> > +the following command::
>
> For the above, please indent, in order to properly change the
> sysfs node font to bold. Also, mark paragraphs with a \n, e. g:
>
> trace_method_name
> The full path of the AML method that the user wants to trace.
>
> Note that the full path shouldn't contain the trailing "_"s in its
> name segments but may contain "\" to form an absolute path.
>
> trace_debug_layer
> The temporary debug_layer used when the tracing feature is enabled.
>
> Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
> used to match all "AML tracer" logs.
>
> trace_debug_level
> The temporary debug_level used when the tracing feature is enabled.
>
> Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
> debug_level used to match all "AML tracer" logs.
>
> trace_state
> The status of the tracing feature.
>
> Users can enable/disable this debug tracing feature by executing
> the following command::
>
Done, thanks.
> After doing such changes:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
>
> > +
> > + # echo string > /sys/module/acpi/parameters/trace_state
> > +
> > +Where "string" should be one of the following:
> > +
> > +"disable"
> > + Disable the method tracing feature.
> > +"enable"
> > + Enable the method tracing feature.
> > + ACPICA debugging messages matching
> > + "trace_debug_layer/trace_debug_level" during any method
> > + execution will be logged.
> > +"method"
> > + Enable the method tracing feature.
> > + ACPICA debugging messages matching
> > + "trace_debug_layer/trace_debug_level" during method execution
> > + of "trace_method_name" will be logged.
> > +"method-once"
> > + Enable the method tracing feature.
> > + ACPICA debugging messages matching
> > + "trace_debug_layer/trace_debug_level" during method execution
> > + of "trace_method_name" will be logged only once.
> > +"opcode"
> > + Enable the method tracing feature.
> > + ACPICA debugging messages matching
> > + "trace_debug_layer/trace_debug_level" during method/opcode
> > + execution of "trace_method_name" will be logged.
> > +"opcode-once"
> > + Enable the method tracing feature.
> > + ACPICA debugging messages matching
> > + "trace_debug_layer/trace_debug_level" during method/opcode
> > + execution of "trace_method_name" will be logged only once.
> > +
> > +Note that, the difference between the "enable" and other feature
> > +enabling options are:
> > +
> > +1. When "enable" is specified, since
> > + "trace_debug_layer/trace_debug_level" shall apply to all control
> > + method evaluations, after configuring "trace_state" to "enable",
> > + "trace_method_name" will be reset to NULL.
> > +2. When "method/opcode" is specified, if
> > + "trace_method_name" is NULL when "trace_state" is configured to
> > + these options, the "trace_debug_layer/trace_debug_level" will
> > + apply to all control method evaluations.
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 00/63] Include linux ACPI/PCI/X86 docs into Sphinx TOC tree
From: Mauro Carvalho Chehab @ 2019-04-24 16:52 UTC (permalink / raw)
To: Jonathan Corbet
Cc: fenghua.yu, linux-doc, linux-pci, linux-gpio, x86, rjw,
linux-kernel, linux-acpi, mingo, Bjorn Helgaas, tglx,
linuxppc-dev, Changbin Du
In-Reply-To: <20190424101846.7cc4bad7@lwn.net>
Em Wed, 24 Apr 2019 10:18:46 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:
> On Wed, 24 Apr 2019 00:28:29 +0800
> Changbin Du <changbin.du@gmail.com> wrote:
>
> > The kernel now uses Sphinx to generate intelligent and beautiful documentation
> > from reStructuredText files. I converted all of the Linux ACPI/PCI/X86 docs to
> > reST format in this serias.
> >
> > In this version I combined ACPI and PCI docs, and added new x86 docs conversion.
>
> As mentioned by others, this is a lot of stuff; I would really rather see
> each of those groups as separate patch sets.
Yeah, makes sense to me, either to split into separate patchsets or to
group the changes per sub-dir (or both).
> If you can do a reasonably quick turnaround with Mauro's suggestions
> addressed and tags applied, we should be able to get at least some of this
> into 5.2. Thanks, Mauro, for looking at all of this stuff!
Anytime! Just to make clear, I'm still reviewing it... I'm at patch 35/63
now. So, expect more comments from my side.
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 15/63] Documentation: ACPI: move dsd/data-node-references.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:44 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423181748.24f8aed2@coco.lan>
On Tue, Apr 23, 2019 at 06:17:48PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:44 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > .../acpi/dsd/data-node-references.rst} | 28 +++++++++++--------
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > 2 files changed, 17 insertions(+), 12 deletions(-)
> > rename Documentation/{acpi/dsd/data-node-references.txt => firmware-guide/acpi/dsd/data-node-references.rst} (79%)
> >
> > diff --git a/Documentation/acpi/dsd/data-node-references.txt b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst
> > similarity index 79%
> > rename from Documentation/acpi/dsd/data-node-references.txt
> > rename to Documentation/firmware-guide/acpi/dsd/data-node-references.rst
> > index c3871565c8cf..79c5368eaecf 100644
> > --- a/Documentation/acpi/dsd/data-node-references.txt
> > +++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst
> > @@ -1,9 +1,12 @@
> > -Copyright (C) 2018 Intel Corporation
> > -Author: Sakari Ailus <sakari.ailus@linux.intel.com>
> > -
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: <isonum.txt>
> >
> > +===================================
> > Referencing hierarchical data nodes
> > ------------------------------------
> > +===================================
> > +
> > +:Copyright: |copy| 2018 Intel Corporation
> > +:Author: Sakari Ailus <sakari.ailus@linux.intel.com>
> >
> > ACPI in general allows referring to device objects in the tree only.
> > Hierarchical data extension nodes may not be referred to directly, hence this
> > @@ -28,13 +31,14 @@ extension key.
> >
> >
> > Example
> > --------
> > +=======
> >
> > - In the ASL snippet below, the "reference" _DSD property [2] contains a
> > - device object reference to DEV0 and under that device object, a
> > - hierarchical data extension key "node@1" referring to the NOD1 object
> > - and lastly, a hierarchical data extension key "anothernode" referring to
> > - the ANOD object which is also the final target node of the reference.
> > +In the ASL snippet below, the "reference" _DSD property [2] contains a
> > +device object reference to DEV0 and under that device object, a
> > +hierarchical data extension key "node@1" referring to the NOD1 object
> > +and lastly, a hierarchical data extension key "anothernode" referring to
> > +the ANOD object which is also the final target node of the reference.
> > +::
> >
> > Device (DEV0)
> > {
> > @@ -75,10 +79,10 @@ Example
> > })
> > }
> >
> > -Please also see a graph example in graph.txt .
> > +Please also see a graph example in :doc:`graph`.
> >
> > References
> > -----------
> > +==========
> >
> > [1] Hierarchical Data Extension UUID For _DSD.
> > <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
>
> Hmm... on the previous patch, you replaced <URL:some_url> by some_url,
> with makes sense. Please do the same here and on other patches on
> this series with a similar way to describe URLs.
>
Done, thanks.
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index f81cfbcb6878..6d4e0df4f063 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -9,6 +9,7 @@ ACPI Support
> >
> > namespace
> > dsd/graph
> > + dsd/data-node-references
> > enumeration
> > osi
> > method-customizing
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 10/63] Documentation: ACPI: move initrd_table_override.txt to admin-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:33 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423180734.67c6f470@coco.lan>
On Tue, Apr 23, 2019 at 06:07:34PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:39 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/acpi/initrd_table_override.txt | 111 ----------------
> > Documentation/admin-guide/acpi/index.rst | 1 +
> > .../acpi/initrd_table_override.rst | 120 ++++++++++++++++++
> > 3 files changed, 121 insertions(+), 111 deletions(-)
> > delete mode 100644 Documentation/acpi/initrd_table_override.txt
> > create mode 100644 Documentation/admin-guide/acpi/initrd_table_override.rst
> >
> > diff --git a/Documentation/acpi/initrd_table_override.txt b/Documentation/acpi/initrd_table_override.txt
> > deleted file mode 100644
> > index 30437a6db373..000000000000
> > --- a/Documentation/acpi/initrd_table_override.txt
> > +++ /dev/null
> > @@ -1,111 +0,0 @@
> > -Upgrading ACPI tables via initrd
> > -================================
> > -
> > -1) Introduction (What is this about)
> > -2) What is this for
> > -3) How does it work
> > -4) References (Where to retrieve userspace tools)
> > -
> > -1) What is this about
> > ----------------------
> > -
> > -If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
> > -upgrade the ACPI execution environment that is defined by the ACPI tables
> > -via upgrading the ACPI tables provided by the BIOS with an instrumented,
> > -modified, more recent version one, or installing brand new ACPI tables.
> > -
> > -When building initrd with kernel in a single image, option
> > -ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this
> > -feature to work.
> > -
> > -For a full list of ACPI tables that can be upgraded/installed, take a look
> > -at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in
> > -drivers/acpi/tables.c.
> > -All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
> > -be overridable, except:
> > - - ACPI_SIG_RSDP (has a signature of 6 bytes)
> > - - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
> > -Both could get implemented as well.
> > -
> > -
> > -2) What is this for
> > --------------------
> > -
> > -Complain to your platform/BIOS vendor if you find a bug which is so severe
> > -that a workaround is not accepted in the Linux kernel. And this facility
> > -allows you to upgrade the buggy tables before your platform/BIOS vendor
> > -releases an upgraded BIOS binary.
> > -
> > -This facility can be used by platform/BIOS vendors to provide a Linux
> > -compatible environment without modifying the underlying platform firmware.
> > -
> > -This facility also provides a powerful feature to easily debug and test
> > -ACPI BIOS table compatibility with the Linux kernel by modifying old
> > -platform provided ACPI tables or inserting new ACPI tables.
> > -
> > -It can and should be enabled in any kernel because there is no functional
> > -change with not instrumented initrds.
> > -
> > -
> > -3) How does it work
> > --------------------
> > -
> > -# Extract the machine's ACPI tables:
> > -cd /tmp
> > -acpidump >acpidump
> > -acpixtract -a acpidump
> > -# Disassemble, modify and recompile them:
> > -iasl -d *.dat
> > -# For example add this statement into a _PRT (PCI Routing Table) function
> > -# of the DSDT:
> > -Store("HELLO WORLD", debug)
> > -# And increase the OEM Revision. For example, before modification:
> > -DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
> > -# After modification:
> > -DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
> > -iasl -sa dsdt.dsl
> > -# Add the raw ACPI tables to an uncompressed cpio archive.
> > -# They must be put into a /kernel/firmware/acpi directory inside the cpio
> > -# archive. Note that if the table put here matches a platform table
> > -# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
> > -# with a more recent OEM Revision, the platform table will be upgraded by
> > -# this table. If the table put here doesn't match a platform table
> > -# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
> > -# ID), this table will be appended.
> > -mkdir -p kernel/firmware/acpi
> > -cp dsdt.aml kernel/firmware/acpi
> > -# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
> > -# (see osl.c):
> > -iasl -sa facp.dsl
> > -iasl -sa ssdt1.dsl
> > -cp facp.aml kernel/firmware/acpi
> > -cp ssdt1.aml kernel/firmware/acpi
> > -# The uncompressed cpio archive must be the first. Other, typically
> > -# compressed cpio archives, must be concatenated on top of the uncompressed
> > -# one. Following command creates the uncompressed cpio archive and
> > -# concatenates the original initrd on top:
> > -find kernel | cpio -H newc --create > /boot/instrumented_initrd
> > -cat /boot/initrd >>/boot/instrumented_initrd
> > -# reboot with increased acpi debug level, e.g. boot params:
> > -acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
> > -# and check your syslog:
> > -[ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
> > -[ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
> > -
> > -iasl is able to disassemble and recompile quite a lot different,
> > -also static ACPI tables.
> > -
> > -
> > -4) Where to retrieve userspace tools
> > -------------------------------------
> > -
> > -iasl and acpixtract are part of Intel's ACPICA project:
> > -http://acpica.org/
> > -and should be packaged by distributions (for example in the acpica package
> > -on SUSE).
> > -
> > -acpidump can be found in Len Browns pmtools:
> > -ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
> > -This tool is also part of the acpica package on SUSE.
> > -Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
> > -/sys/firmware/acpi/tables
> > diff --git a/Documentation/admin-guide/acpi/index.rst b/Documentation/admin-guide/acpi/index.rst
> > index 3e041206089d..09e4e81e4fb7 100644
> > --- a/Documentation/admin-guide/acpi/index.rst
> > +++ b/Documentation/admin-guide/acpi/index.rst
> > @@ -8,3 +8,4 @@ the Linux ACPI support.
> > .. toctree::
> > :maxdepth: 1
> >
> > + initrd_table_override
> > diff --git a/Documentation/admin-guide/acpi/initrd_table_override.rst b/Documentation/admin-guide/acpi/initrd_table_override.rst
> > new file mode 100644
> > index 000000000000..0787b2b91ded
> > --- /dev/null
> > +++ b/Documentation/admin-guide/acpi/initrd_table_override.rst
> > @@ -0,0 +1,120 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +================================
> > +Upgrading ACPI tables via initrd
> > +================================
> > +
> > +1) Introduction (What is this about)
> > +2) What is this for
> > +3) How does it work
> > +4) References (Where to retrieve userspace tools)
>
> Hmm... I did the same on my conversion, but IMO, the best would be to
> hide (or remove, if ACPI maintainers agree) the contents, as this may
> conflict with the body as people may add new stuff and forget to
> update it.
>
> So, if ACPI maintainers insist on keeping it, I would code this as:
>
> .. Contents
>
> 1) Introduction (What is this about)
> 2) What is this for
> 3) How does it work
> 4) References (Where to retrieve userspace tools)
>
> as this will make this invisible on html/pdf/epub output.
>
I just removed it. If anyone wants it back, please comment. Thanks.
> Anyway, with or without the above change:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> > +
> > +1) What is this about
> > +=====================
> > +
> > +If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
> > +upgrade the ACPI execution environment that is defined by the ACPI tables
> > +via upgrading the ACPI tables provided by the BIOS with an instrumented,
> > +modified, more recent version one, or installing brand new ACPI tables.
> > +
> > +When building initrd with kernel in a single image, option
> > +ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this
> > +feature to work.
> > +
> > +For a full list of ACPI tables that can be upgraded/installed, take a look
> > +at the char `*table_sigs[MAX_ACPI_SIGNATURE];` definition in
> > +drivers/acpi/tables.c.
> > +
> > +All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
> > +be overridable, except:
> > +
> > + - ACPI_SIG_RSDP (has a signature of 6 bytes)
> > + - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
> > +
> > +Both could get implemented as well.
> > +
> > +
> > +2) What is this for
> > +===================
> > +
> > +Complain to your platform/BIOS vendor if you find a bug which is so severe
> > +that a workaround is not accepted in the Linux kernel. And this facility
> > +allows you to upgrade the buggy tables before your platform/BIOS vendor
> > +releases an upgraded BIOS binary.
> > +
> > +This facility can be used by platform/BIOS vendors to provide a Linux
> > +compatible environment without modifying the underlying platform firmware.
> > +
> > +This facility also provides a powerful feature to easily debug and test
> > +ACPI BIOS table compatibility with the Linux kernel by modifying old
> > +platform provided ACPI tables or inserting new ACPI tables.
> > +
> > +It can and should be enabled in any kernel because there is no functional
> > +change with not instrumented initrds.
> > +
> > +
> > +3) How does it work
> > +===================
> > +::
> > +
> > + # Extract the machine's ACPI tables:
> > + cd /tmp
> > + acpidump >acpidump
> > + acpixtract -a acpidump
> > + # Disassemble, modify and recompile them:
> > + iasl -d *.dat
> > + # For example add this statement into a _PRT (PCI Routing Table) function
> > + # of the DSDT:
> > + Store("HELLO WORLD", debug)
> > + # And increase the OEM Revision. For example, before modification:
> > + DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
> > + # After modification:
> > + DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
> > + iasl -sa dsdt.dsl
> > + # Add the raw ACPI tables to an uncompressed cpio archive.
> > + # They must be put into a /kernel/firmware/acpi directory inside the cpio
> > + # archive. Note that if the table put here matches a platform table
> > + # (similar Table Signature, and similar OEMID, and similar OEM Table ID)
> > + # with a more recent OEM Revision, the platform table will be upgraded by
> > + # this table. If the table put here doesn't match a platform table
> > + # (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
> > + # ID), this table will be appended.
> > + mkdir -p kernel/firmware/acpi
> > + cp dsdt.aml kernel/firmware/acpi
> > + # A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
> > + # (see osl.c):
> > + iasl -sa facp.dsl
> > + iasl -sa ssdt1.dsl
> > + cp facp.aml kernel/firmware/acpi
> > + cp ssdt1.aml kernel/firmware/acpi
> > + # The uncompressed cpio archive must be the first. Other, typically
> > + # compressed cpio archives, must be concatenated on top of the uncompressed
> > + # one. Following command creates the uncompressed cpio archive and
> > + # concatenates the original initrd on top:
> > + find kernel | cpio -H newc --create > /boot/instrumented_initrd
> > + cat /boot/initrd >>/boot/instrumented_initrd
> > + # reboot with increased acpi debug level, e.g. boot params:
> > + acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
> > + # and check your syslog:
> > + [ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
> > + [ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
> > +
> > +iasl is able to disassemble and recompile quite a lot different,
> > +also static ACPI tables.
> > +
> > +
> > +4) Where to retrieve userspace tools
> > +====================================
> > +
> > +iasl and acpixtract are part of Intel's ACPICA project:
> > +http://acpica.org/
> > +
> > +and should be packaged by distributions (for example in the acpica package
> > +on SUSE).
> > +
> > +acpidump can be found in Len Browns pmtools:
> > +ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
> > +
> > +This tool is also part of the acpica package on SUSE.
> > +Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
> > +/sys/firmware/acpi/tables
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 09/63] Documentation: ACPI: move method-customizing.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:28 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423180316.7f042bc4@coco.lan>
On Tue, Apr 23, 2019 at 06:03:16PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:38 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/acpi/method-customizing.txt | 73 -----------------
> > Documentation/firmware-guide/acpi/index.rst | 3 +-
> > .../acpi/method-customizing.rst | 82 +++++++++++++++++++
> > 3 files changed, 84 insertions(+), 74 deletions(-)
> > delete mode 100644 Documentation/acpi/method-customizing.txt
> > create mode 100644 Documentation/firmware-guide/acpi/method-customizing.rst
> >
> > diff --git a/Documentation/acpi/method-customizing.txt b/Documentation/acpi/method-customizing.txt
> > deleted file mode 100644
> > index 7235da975f23..000000000000
> > --- a/Documentation/acpi/method-customizing.txt
> > +++ /dev/null
> > @@ -1,73 +0,0 @@
> > -Linux ACPI Custom Control Method How To
> > -=======================================
> > -
> > -Written by Zhang Rui <rui.zhang@intel.com>
> > -
> > -
> > -Linux supports customizing ACPI control methods at runtime.
> > -
> > -Users can use this to
> > -1. override an existing method which may not work correctly,
> > - or just for debugging purposes.
> > -2. insert a completely new method in order to create a missing
> > - method such as _OFF, _ON, _STA, _INI, etc.
> > -For these cases, it is far simpler to dynamically install a single
> > -control method rather than override the entire DSDT, because kernel
> > -rebuild/reboot is not needed and test result can be got in minutes.
> > -
> > -Note: Only ACPI METHOD can be overridden, any other object types like
> > - "Device", "OperationRegion", are not recognized. Methods
> > - declared inside scope operators are also not supported.
> > -Note: The same ACPI control method can be overridden for many times,
> > - and it's always the latest one that used by Linux/kernel.
> > -Note: To get the ACPI debug object output (Store (AAAA, Debug)),
> > - please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
> > -
> > -1. override an existing method
> > - a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
> > - just run "cat /sys/firmware/acpi/tables/DSDT > /tmp/dsdt.dat"
> > - b) disassemble the table by running "iasl -d dsdt.dat".
> > - c) rewrite the ASL code of the method and save it in a new file,
> > - d) package the new file (psr.asl) to an ACPI table format.
> > - Here is an example of a customized \_SB._AC._PSR method,
> > -
> > - DefinitionBlock ("", "SSDT", 1, "", "", 0x20080715)
> > - {
> > - Method (\_SB_.AC._PSR, 0, NotSerialized)
> > - {
> > - Store ("In AC _PSR", Debug)
> > - Return (ACON)
> > - }
> > - }
> > - Note that the full pathname of the method in ACPI namespace
> > - should be used.
> > - e) assemble the file to generate the AML code of the method.
> > - e.g. "iasl -vw 6084 psr.asl" (psr.aml is generated as a result)
> > - If parameter "-vw 6084" is not supported by your iASL compiler,
> > - please try a newer version.
> > - f) mount debugfs by "mount -t debugfs none /sys/kernel/debug"
> > - g) override the old method via the debugfs by running
> > - "cat /tmp/psr.aml > /sys/kernel/debug/acpi/custom_method"
> > -
> > -2. insert a new method
> > - This is easier than overriding an existing method.
> > - We just need to create the ASL code of the method we want to
> > - insert and then follow the step c) ~ g) in section 1.
> > -
> > -3. undo your changes
> > - The "undo" operation is not supported for a new inserted method
> > - right now, i.e. we can not remove a method currently.
> > - For an overridden method, in order to undo your changes, please
> > - save a copy of the method original ASL code in step c) section 1,
> > - and redo step c) ~ g) to override the method with the original one.
> > -
> > -
> > -Note: We can use a kernel with multiple custom ACPI method running,
> > - But each individual write to debugfs can implement a SINGLE
> > - method override. i.e. if we want to insert/override multiple
> > - ACPI methods, we need to redo step c) ~ g) for multiple times.
> > -
> > -Note: Be aware that root can mis-use this driver to modify arbitrary
> > - memory and gain additional rights, if root's privileges got
> > - restricted (for example if root is not allowed to load additional
> > - modules after boot).
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index 61d67763851b..d1d069b26bbc 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -10,5 +10,6 @@ ACPI Support
> > namespace
> > enumeration
> > osi
> > + method-customizing
> > DSD-properties-rules
> > - gpio-properties
> > + gpio-properties
> > \ No newline at end of file
> > diff --git a/Documentation/firmware-guide/acpi/method-customizing.rst b/Documentation/firmware-guide/acpi/method-customizing.rst
> > new file mode 100644
> > index 000000000000..32eb1cdc1549
> > --- /dev/null
> > +++ b/Documentation/firmware-guide/acpi/method-customizing.rst
> > @@ -0,0 +1,82 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +=======================================
> > +Linux ACPI Custom Control Method How To
> > +=======================================
> > +
> > +:Author: Zhang Rui <rui.zhang@intel.com>
> > +
> > +
> > +Linux supports customizing ACPI control methods at runtime.
> > +
> > +Users can use this to:
> > +
> > +1. override an existing method which may not work correctly,
> > + or just for debugging purposes.
> > +2. insert a completely new method in order to create a missing
> > + method such as _OFF, _ON, _STA, _INI, etc.
> > +
> > +For these cases, it is far simpler to dynamically install a single
> > +control method rather than override the entire DSDT, because kernel
> > +rebuild/reboot is not needed and test result can be got in minutes.
> > +
> > +.. note:: Only ACPI METHOD can be overridden, any other object types like
> > + "Device", "OperationRegion", are not recognized. Methods
> > + declared inside scope operators are also not supported.
> > +.. note:: The same ACPI control method can be overridden for many times,
> > + and it's always the latest one that used by Linux/kernel.
> > +.. note:: To get the ACPI debug object output (Store (AAAA, Debug)),
> > + please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
>
> Hmm... this may work (not sure if Sphinx would warn or not), but it
> is visually bad on text mode. I would code it, instead, with something
> like:
>
> .. note::
>
> - Only ACPI METHOD can be overridden, any other object types like
> "Device", "OperationRegion", are not recognized. Methods
> declared inside scope operators are also not supported.
>
> - The same ACPI control method can be overridden for many times,
> and it's always the latest one that used by Linux/kernel.
>
> - To get the ACPI debug object output (Store (AAAA, Debug)),
> please run::
>
> echo 1 > /sys/module/acpi/parameters/aml_debug_output
>
> As this would make it visually better on both text and html formats.
>
No warnings given. Your suggested style is better so applied it. Thanks!
> > +
> > +1. override an existing method
> > +==============================
> > +a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
> > + just run "cat /sys/firmware/acpi/tables/DSDT > /tmp/dsdt.dat"
> > +b) disassemble the table by running "iasl -d dsdt.dat".
> > +c) rewrite the ASL code of the method and save it in a new file,
> > +d) package the new file (psr.asl) to an ACPI table format.
> > + Here is an example of a customized \_SB._AC._PSR method::
> > +
> > + DefinitionBlock ("", "SSDT", 1, "", "", 0x20080715)
> > + {
> > + Method (\_SB_.AC._PSR, 0, NotSerialized)
> > + {
> > + Store ("In AC _PSR", Debug)
> > + Return (ACON)
> > + }
> > + }
> > +
> > + Note that the full pathname of the method in ACPI namespace
> > + should be used.
> > +e) assemble the file to generate the AML code of the method.
> > + e.g. "iasl -vw 6084 psr.asl" (psr.aml is generated as a result)
> > + If parameter "-vw 6084" is not supported by your iASL compiler,
> > + please try a newer version.
>
> I would use ``iasl -vw 6084 psr.asl`` and ``-vw 6084``.
>
> > +f) mount debugfs by "mount -t debugfs none /sys/kernel/debug"
>
> I would do:
>
> f) mount debugfs by running::
>
> mount -t debugfs none /sys/kernel/debug
>
> As it makes a better html document. I believe that the focus here is
> sysadmins. Doing the above makes easier for them to cut and paste
> commands.
>
> > +g) override the old method via the debugfs by running
> > + "cat /tmp/psr.aml > /sys/kernel/debug/acpi/custom_method"
>
> Same applies here: I would also place the "cat" command on a literal
> block.
>
> > +
> > +2. insert a new method
> > +======================
> > +This is easier than overriding an existing method.
> > +We just need to create the ASL code of the method we want to
> > +insert and then follow the step c) ~ g) in section 1.
> > +
> > +3. undo your changes
> > +====================
> > +The "undo" operation is not supported for a new inserted method
> > +right now, i.e. we can not remove a method currently.
> > +For an overridden method, in order to undo your changes, please
> > +save a copy of the method original ASL code in step c) section 1,
> > +and redo step c) ~ g) to override the method with the original one.
> > +
> > +
> > +.. note:: We can use a kernel with multiple custom ACPI method running,
> > + But each individual write to debugfs can implement a SINGLE
> > + method override. i.e. if we want to insert/override multiple
> > + ACPI methods, we need to redo step c) ~ g) for multiple times.
> > +
> > +.. note:: Be aware that root can mis-use this driver to modify arbitrary
> > + memory and gain additional rights, if root's privileges got
> > + restricted (for example if root is not allowed to load additional
> > + modules after boot).
>
> Same comment as above: IMHO, having a single note block with the two
> notes would be better.
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 34/63] Documentation: PCI: convert endpoint/pci-endpoint-cfs.txt to reST
From: Mauro Carvalho Chehab @ 2019-04-24 16:26 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, x86, linux-doc, linux-pci, linux-gpio,
Jonathan Corbet, rjw, linux-kernel, linux-acpi, mingo,
Bjorn Helgaas, tglx, linuxppc-dev
In-Reply-To: <20190423162932.21428-35-changbin.du@gmail.com>
Em Wed, 24 Apr 2019 00:29:03 +0800
Changbin Du <changbin.du@gmail.com> escreveu:
> This converts the plain text documentation to reStructuredText format and
> add it to Sphinx TOC tree. No essential content change.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
> Documentation/PCI/endpoint/index.rst | 1 +
> ...-endpoint-cfs.txt => pci-endpoint-cfs.rst} | 99 +++++++++++--------
> 2 files changed, 57 insertions(+), 43 deletions(-)
> rename Documentation/PCI/endpoint/{pci-endpoint-cfs.txt => pci-endpoint-cfs.rst} (64%)
>
> diff --git a/Documentation/PCI/endpoint/index.rst b/Documentation/PCI/endpoint/index.rst
> index 0db4f2fcd7f0..3951de9f923c 100644
> --- a/Documentation/PCI/endpoint/index.rst
> +++ b/Documentation/PCI/endpoint/index.rst
> @@ -8,3 +8,4 @@ PCI Endpoint Framework
> :maxdepth: 2
>
> pci-endpoint
> + pci-endpoint-cfs
> diff --git a/Documentation/PCI/endpoint/pci-endpoint-cfs.txt b/Documentation/PCI/endpoint/pci-endpoint-cfs.rst
> similarity index 64%
> rename from Documentation/PCI/endpoint/pci-endpoint-cfs.txt
> rename to Documentation/PCI/endpoint/pci-endpoint-cfs.rst
> index d740f29960a4..b6d39cdec56e 100644
> --- a/Documentation/PCI/endpoint/pci-endpoint-cfs.txt
> +++ b/Documentation/PCI/endpoint/pci-endpoint-cfs.rst
> @@ -1,41 +1,51 @@
> - CONFIGURING PCI ENDPOINT USING CONFIGFS
> - Kishon Vijay Abraham I <kishon@ti.com>
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +=======================================
> +Configuring PCI Endpoint Using CONFIGFS
> +=======================================
> +
> +:Author: Kishon Vijay Abraham I <kishon@ti.com>
>
> The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
> PCI endpoint function and to bind the endpoint function
> with the endpoint controller. (For introducing other mechanisms to
> configure the PCI Endpoint Function refer to [1]).
>
> -*) Mounting configfs
> +Mounting configfs
> +=================
>
> The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs
> -directory. configfs can be mounted using the following command.
> +directory. configfs can be mounted using the following command::
>
> mount -t configfs none /sys/kernel/config
>
> -*) Directory Structure
> +Directory Structure
> +===================
>
> The pci_ep configfs has two directories at its root: controllers and
> functions. Every EPC device present in the system will have an entry in
> the *controllers* directory and and every EPF driver present in the system
> will have an entry in the *functions* directory.
> +::
>
> -/sys/kernel/config/pci_ep/
> - .. controllers/
> - .. functions/
> + /sys/kernel/config/pci_ep/
> + .. controllers/
> + .. functions/
>
> -*) Creating EPF Device
> +Creating EPF Device
> +===================
>
> Every registered EPF driver will be listed in controllers directory. The
> entries corresponding to EPF driver will be created by the EPF core.
> +::
>
> -/sys/kernel/config/pci_ep/functions/
> - .. <EPF Driver1>/
> - ... <EPF Device 11>/
> - ... <EPF Device 21>/
> - .. <EPF Driver2>/
> - ... <EPF Device 12>/
> - ... <EPF Device 22>/
> + /sys/kernel/config/pci_ep/functions/
> + .. <EPF Driver1>/
> + ... <EPF Device 11>/
> + ... <EPF Device 21>/
> + .. <EPF Driver2>/
> + ... <EPF Device 12>/
> + ... <EPF Device 22>/
>
> In order to create a <EPF device> of the type probed by <EPF Driver>, the
> user has to create a directory inside <EPF DriverN>.
> @@ -44,34 +54,37 @@ Every <EPF device> directory consists of the following entries that can be
> used to configure the standard configuration header of the endpoint function.
> (These entries are created by the framework when any new <EPF Device> is
> created)
> -
> - .. <EPF Driver1>/
> - ... <EPF Device 11>/
> - ... vendorid
> - ... deviceid
> - ... revid
> - ... progif_code
> - ... subclass_code
> - ... baseclass_code
> - ... cache_line_size
> - ... subsys_vendor_id
> - ... subsys_id
> - ... interrupt_pin
> -
> -*) EPC Device
> +::
> +
> + .. <EPF Driver1>/
> + ... <EPF Device 11>/
> + ... vendorid
> + ... deviceid
> + ... revid
> + ... progif_code
> + ... subclass_code
> + ... baseclass_code
> + ... cache_line_size
> + ... subsys_vendor_id
> + ... subsys_id
> + ... interrupt_pin
> +
> +EPC Device
> +==========
>
> Every registered EPC device will be listed in controllers directory. The
> entries corresponding to EPC device will be created by the EPC core.
> -
> -/sys/kernel/config/pci_ep/controllers/
> - .. <EPC Device1>/
> - ... <Symlink EPF Device11>/
> - ... <Symlink EPF Device12>/
> - ... start
> - .. <EPC Device2>/
> - ... <Symlink EPF Device21>/
> - ... <Symlink EPF Device22>/
> - ... start
> +::
> +
> + /sys/kernel/config/pci_ep/controllers/
> + .. <EPC Device1>/
> + ... <Symlink EPF Device11>/
> + ... <Symlink EPF Device12>/
> + ... start
> + .. <EPC Device2>/
> + ... <Symlink EPF Device21>/
> + ... <Symlink EPF Device22>/
> + ... start
>
> The <EPC Device> directory will have a list of symbolic links to
> <EPF Device>. These symbolic links should be created by the user to
> @@ -81,7 +94,7 @@ The <EPC Device> directory will also have a *start* field. Once
> "1" is written to this field, the endpoint device will be ready to
> establish the link with the host. This is usually done after
> all the EPF devices are created and linked with the EPC device.
> -
> +::
>
> | controllers/
> | <Directory: EPC name>/
> @@ -102,4 +115,4 @@ all the EPF devices are created and linked with the EPC device.
> | interrupt_pin
> | function
>
> -[1] -> Documentation/PCI/endpoint/pci-endpoint.txt
> +[1] :doc:`pci-endpoint`
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v4 08/63] Documentation: ACPI: move gpio-properties.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:21 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423175515.58e78c0b@coco.lan>
On Tue, Apr 23, 2019 at 05:55:15PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:37 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > .../acpi/gpio-properties.rst} | 78 +++++++++++--------
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > MAINTAINERS | 2 +-
> > 3 files changed, 46 insertions(+), 35 deletions(-)
> > rename Documentation/{acpi/gpio-properties.txt => firmware-guide/acpi/gpio-properties.rst} (81%)
> >
> > diff --git a/Documentation/acpi/gpio-properties.txt b/Documentation/firmware-guide/acpi/gpio-properties.rst
> > similarity index 81%
> > rename from Documentation/acpi/gpio-properties.txt
> > rename to Documentation/firmware-guide/acpi/gpio-properties.rst
> > index 88c65cb5bf0a..89c636963544 100644
> > --- a/Documentation/acpi/gpio-properties.txt
> > +++ b/Documentation/firmware-guide/acpi/gpio-properties.rst
> > @@ -1,5 +1,8 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +======================================
> > _DSD Device Properties Related to GPIO
> > ---------------------------------------
> > +======================================
> >
> > With the release of ACPI 5.1, the _DSD configuration object finally
> > allows names to be given to GPIOs (and other things as well) returned
> > @@ -8,7 +11,7 @@ the corresponding GPIO, which is pretty error prone (it depends on
> > the _CRS output ordering, for example).
> >
> > With _DSD we can now query GPIOs using a name instead of an integer
> > -index, like the ASL example below shows:
> > +index, like the ASL example below shows::
> >
> > // Bluetooth device with reset and shutdown GPIOs
> > Device (BTH)
> > @@ -34,15 +37,19 @@ index, like the ASL example below shows:
> > })
> > }
> >
> > -The format of the supported GPIO property is:
> > +The format of the supported GPIO property is::
> >
> > Package () { "name", Package () { ref, index, pin, active_low }}
> >
> > - ref - The device that has _CRS containing GpioIo()/GpioInt() resources,
> > - typically this is the device itself (BTH in our case).
> > - index - Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
> > - pin - Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
> > - active_low - If 1 the GPIO is marked as active_low.
> > +ref
> > + The device that has _CRS containing GpioIo()/GpioInt() resources,
> > + typically this is the device itself (BTH in our case).
> > +index
> > + Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
> > +pin
> > + Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
> > +active_low
> > + If 1 the GPIO is marked as active_low.
> >
> > Since ACPI GpioIo() resource does not have a field saying whether it is
> > active low or high, the "active_low" argument can be used here. Setting
> > @@ -55,7 +62,7 @@ It is possible to leave holes in the array of GPIOs. This is useful in
> > cases like with SPI host controllers where some chip selects may be
> > implemented as GPIOs and some as native signals. For example a SPI host
> > controller can have chip selects 0 and 2 implemented as GPIOs and 1 as
> > -native:
> > +native::
> >
> > Package () {
> > "cs-gpios",
> > @@ -67,7 +74,7 @@ native:
> > }
> >
> > Other supported properties
> > ---------------------------
> > +==========================
> >
> > Following Device Tree compatible device properties are also supported by
> > _DSD device properties for GPIO controllers:
> > @@ -78,7 +85,7 @@ _DSD device properties for GPIO controllers:
> > - input
> > - line-name
> >
> > -Example:
> > +Example::
> >
> > Name (_DSD, Package () {
> > // _DSD Hierarchical Properties Extension UUID
> > @@ -100,7 +107,7 @@ Example:
> >
> > - gpio-line-names
> >
> > -Example:
> > +Example::
> >
> > Package () {
> > "gpio-line-names",
> > @@ -114,7 +121,7 @@ See Documentation/devicetree/bindings/gpio/gpio.txt for more information
> > about these properties.
> >
> > ACPI GPIO Mappings Provided by Drivers
> > ---------------------------------------
> > +======================================
> >
> > There are systems in which the ACPI tables do not contain _DSD but provide _CRS
> > with GpioIo()/GpioInt() resources and device drivers still need to work with
> > @@ -139,16 +146,16 @@ line in that resource starting from zero, and the active-low flag for that line,
> > respectively, in analogy with the _DSD GPIO property format specified above.
> >
> > For the example Bluetooth device discussed previously the data structures in
> > -question would look like this:
> > +question would look like this::
> >
> > -static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
> > -static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
> > + static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
> > + static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
> >
> > -static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
> > - { "reset-gpios", &reset_gpio, 1 },
> > - { "shutdown-gpios", &shutdown_gpio, 1 },
> > - { },
> > -};
> > + static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
> > + { "reset-gpios", &reset_gpio, 1 },
> > + { "shutdown-gpios", &shutdown_gpio, 1 },
> > + { },
> > + };
> >
> > Next, the mapping table needs to be passed as the second argument to
> > acpi_dev_add_driver_gpios() that will register it with the ACPI device object
> > @@ -158,12 +165,12 @@ calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
> > table was previously registered.
> >
> > Using the _CRS fallback
> > ------------------------
> > +=======================
> >
> > If a device does not have _DSD or the driver does not create ACPI GPIO
> > mapping, the Linux GPIO framework refuses to return any GPIOs. This is
> > because the driver does not know what it actually gets. For example if we
> > -have a device like below:
> > +have a device like below::
> >
> > Device (BTH)
> > {
> > @@ -177,7 +184,7 @@ have a device like below:
> > })
> > }
> >
> > -The driver might expect to get the right GPIO when it does:
> > +The driver might expect to get the right GPIO when it does::
>
> Hmm... there is a small typo here:
>
> ": :" -> "::"
>
Good catch! Thanks.
> For the conversion itself, after correcting the above typo:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
>
>
> >
> > desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> >
> > @@ -193,22 +200,25 @@ the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
> > objects, as listed in the above chapter, of the device in question.
> >
> > Getting GPIO descriptor
> > ------------------------
> > +=======================
> > +
> > +There are two main approaches to get GPIO resource from ACPI::
> >
> > -There are two main approaches to get GPIO resource from ACPI:
> > - desc = gpiod_get(dev, connection_id, flags);
> > - desc = gpiod_get_index(dev, connection_id, index, flags);
> > + desc = gpiod_get(dev, connection_id, flags);
> > + desc = gpiod_get_index(dev, connection_id, index, flags);
> >
> > We may consider two different cases here, i.e. when connection ID is
> > provided and otherwise.
> >
> > -Case 1:
> > - desc = gpiod_get(dev, "non-null-connection-id", flags);
> > - desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
> > +Case 1::
> > +
> > + desc = gpiod_get(dev, "non-null-connection-id", flags);
> > + desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
> > +
> > +Case 2::
> >
> > -Case 2:
> > - desc = gpiod_get(dev, NULL, flags);
> > - desc = gpiod_get_index(dev, NULL, index, flags);
> > + desc = gpiod_get(dev, NULL, flags);
> > + desc = gpiod_get_index(dev, NULL, index, flags);
> >
> > Case 1 assumes that corresponding ACPI device description must have
> > defined device properties and will prevent to getting any GPIO resources
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index 0e05b843521c..61d67763851b 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -11,3 +11,4 @@ ACPI Support
> > enumeration
> > osi
> > DSD-properties-rules
> > + gpio-properties
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 09f43f1bdd15..87f930bf32ad 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -6593,7 +6593,7 @@ M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > L: linux-gpio@vger.kernel.org
> > L: linux-acpi@vger.kernel.org
> > S: Maintained
> > -F: Documentation/acpi/gpio-properties.txt
> > +F: Documentation/firmware-guide/acpi/gpio-properties.rst
> > F: drivers/gpio/gpiolib-acpi.c
> >
> > GPIO IR Transmitter
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 00/63] Include linux ACPI/PCI/X86 docs into Sphinx TOC tree
From: Jonathan Corbet @ 2019-04-24 16:18 UTC (permalink / raw)
To: Changbin Du
Cc: fenghua.yu, mchehab+samsung, linux-doc, linux-pci, linux-gpio,
x86, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas, tglx,
linuxppc-dev
In-Reply-To: <20190423162932.21428-1-changbin.du@gmail.com>
On Wed, 24 Apr 2019 00:28:29 +0800
Changbin Du <changbin.du@gmail.com> wrote:
> The kernel now uses Sphinx to generate intelligent and beautiful documentation
> from reStructuredText files. I converted all of the Linux ACPI/PCI/X86 docs to
> reST format in this serias.
>
> In this version I combined ACPI and PCI docs, and added new x86 docs conversion.
As mentioned by others, this is a lot of stuff; I would really rather see
each of those groups as separate patch sets.
If you can do a reasonably quick turnaround with Mauro's suggestions
addressed and tags applied, we should be able to get at least some of this
into 5.2. Thanks, Mauro, for looking at all of this stuff!
Thanks,
jon
^ permalink raw reply
* Re: [PATCH v4 05/63] Documentation: ACPI: move linuxized-acpica.txt to driver-api/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423175030.7d0cc624@coco.lan>
On Tue, Apr 23, 2019 at 05:50:30PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:34 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/driver-api/acpi/index.rst | 1 +
> > .../acpi/linuxized-acpica.rst} | 115 ++++++++++--------
> > 2 files changed, 66 insertions(+), 50 deletions(-)
> > rename Documentation/{acpi/linuxized-acpica.txt => driver-api/acpi/linuxized-acpica.rst} (78%)
> >
> > diff --git a/Documentation/driver-api/acpi/index.rst b/Documentation/driver-api/acpi/index.rst
> > index 898b0c60671a..12649947b19b 100644
> > --- a/Documentation/driver-api/acpi/index.rst
> > +++ b/Documentation/driver-api/acpi/index.rst
> > @@ -5,3 +5,4 @@ ACPI Support
> > .. toctree::
> > :maxdepth: 2
> >
> > + linuxized-acpica
> > diff --git a/Documentation/acpi/linuxized-acpica.txt b/Documentation/driver-api/acpi/linuxized-acpica.rst
> > similarity index 78%
> > rename from Documentation/acpi/linuxized-acpica.txt
> > rename to Documentation/driver-api/acpi/linuxized-acpica.rst
> > index 3ad7b0dfb083..f8aaea668e41 100644
> > --- a/Documentation/acpi/linuxized-acpica.txt
> > +++ b/Documentation/driver-api/acpi/linuxized-acpica.rst
> > @@ -1,31 +1,35 @@
> > -Linuxized ACPICA - Introduction to ACPICA Release Automation
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: <isonum.txt>
> >
> > -Copyright (C) 2013-2016, Intel Corporation
> > -Author: Lv Zheng <lv.zheng@intel.com>
> > +============================================================
> > +Linuxized ACPICA - Introduction to ACPICA Release Automation
> > +============================================================
> >
> > +:Copyright: |copy| 2013-2016, Intel Corporation
> >
> > -Abstract:
> > +:Author: Lv Zheng <lv.zheng@intel.com>
> >
> > -This document describes the ACPICA project and the relationship between
> > -ACPICA and Linux. It also describes how ACPICA code in drivers/acpi/acpica,
> > -include/acpi and tools/power/acpi is automatically updated to follow the
> > -upstream.
> > +:Abstract: This document describes the ACPICA project and the relationship
> > + between ACPICA and Linux. It also describes how ACPICA code in
> > + drivers/acpi/acpica, include/acpi and tools/power/acpi is
> > + automatically updated to follow the upstream.
> >
>
> Same comment as on patch 02: I would keep the abstracts as a chapter,
> in order to make them visible at the index, as this may help readers
> to quickly look at the document's contents.
>
ok, done.
> I'm sure other APCI documents also have abstracts. So, please consider
> this comment also for the other docs.
>
For short description, I'd keep it. For long case, will make it as a chapter.
Thanks.
> Anyway, this is just a suggestion. I'm also fine with the above.
> Either way, for the conversion itself:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> >
> > -1. ACPICA Project
> > +ACPICA Project
> > +==============
> >
> > - The ACPI Component Architecture (ACPICA) project provides an operating
> > - system (OS)-independent reference implementation of the Advanced
> > - Configuration and Power Interface Specification (ACPI). It has been
> > - adapted by various host OSes. By directly integrating ACPICA, Linux can
> > - also benefit from the application experiences of ACPICA from other host
> > - OSes.
> > +The ACPI Component Architecture (ACPICA) project provides an operating
> > +system (OS)-independent reference implementation of the Advanced
> > +Configuration and Power Interface Specification (ACPI). It has been
> > +adapted by various host OSes. By directly integrating ACPICA, Linux can
> > +also benefit from the application experiences of ACPICA from other host
> > +OSes.
> >
> > - The homepage of ACPICA project is: www.acpica.org, it is maintained and
> > - supported by Intel Corporation.
> > +The homepage of ACPICA project is: www.acpica.org, it is maintained and
> > +supported by Intel Corporation.
> >
> > - The following figure depicts the Linux ACPI subsystem where the ACPICA
> > - adaptation is included:
> > +The following figure depicts the Linux ACPI subsystem where the ACPICA
> > +adaptation is included::
> >
> > +---------------------------------------------------------+
> > | |
> > @@ -71,21 +75,27 @@ upstream.
> >
> > Figure 1. Linux ACPI Software Components
> >
> > - NOTE:
> > +.. note::
> > A. OS Service Layer - Provided by Linux to offer OS dependent
> > implementation of the predefined ACPICA interfaces (acpi_os_*).
> > + ::
> > +
> > include/acpi/acpiosxf.h
> > drivers/acpi/osl.c
> > include/acpi/platform
> > include/asm/acenv.h
> > B. ACPICA Functionality - Released from ACPICA code base to offer
> > OS independent implementation of the ACPICA interfaces (acpi_*).
> > + ::
> > +
> > drivers/acpi/acpica
> > include/acpi/ac*.h
> > tools/power/acpi
> > C. Linux/ACPI Functionality - Providing Linux specific ACPI
> > functionality to the other Linux kernel subsystems and user space
> > programs.
> > + ::
> > +
> > drivers/acpi
> > include/linux/acpi.h
> > include/linux/acpi*.h
> > @@ -95,24 +105,27 @@ upstream.
> > ACPI subsystem to offer architecture specific implementation of the
> > ACPI interfaces. They are Linux specific components and are out of
> > the scope of this document.
> > + ::
> > +
> > include/asm/acpi.h
> > include/asm/acpi*.h
> > arch/*/acpi
> >
> > -2. ACPICA Release
> > +ACPICA Release
> > +==============
> >
> > - The ACPICA project maintains its code base at the following repository URL:
> > - https://github.com/acpica/acpica.git. As a rule, a release is made every
> > - month.
> > +The ACPICA project maintains its code base at the following repository URL:
> > +https://github.com/acpica/acpica.git. As a rule, a release is made every
> > +month.
> >
> > - As the coding style adopted by the ACPICA project is not acceptable by
> > - Linux, there is a release process to convert the ACPICA git commits into
> > - Linux patches. The patches generated by this process are referred to as
> > - "linuxized ACPICA patches". The release process is carried out on a local
> > - copy the ACPICA git repository. Each commit in the monthly release is
> > - converted into a linuxized ACPICA patch. Together, they form the monthly
> > - ACPICA release patchset for the Linux ACPI community. This process is
> > - illustrated in the following figure:
> > +As the coding style adopted by the ACPICA project is not acceptable by
> > +Linux, there is a release process to convert the ACPICA git commits into
> > +Linux patches. The patches generated by this process are referred to as
> > +"linuxized ACPICA patches". The release process is carried out on a local
> > +copy the ACPICA git repository. Each commit in the monthly release is
> > +converted into a linuxized ACPICA patch. Together, they form the monthly
> > +ACPICA release patchset for the Linux ACPI community. This process is
> > +illustrated in the following figure::
> >
> > +-----------------------------+
> > | acpica / master (-) commits |
> > @@ -153,7 +166,7 @@ upstream.
> >
> > Figure 2. ACPICA -> Linux Upstream Process
> >
> > - NOTE:
> > +.. note::
> > A. Linuxize Utilities - Provided by the ACPICA repository, including a
> > utility located in source/tools/acpisrc folder and a number of
> > scripts located in generate/linux folder.
> > @@ -170,19 +183,20 @@ upstream.
> > following kernel configuration options:
> > CONFIG_ACPI/CONFIG_ACPI_DEBUG/CONFIG_ACPI_DEBUGGER
> >
> > -3. ACPICA Divergences
> > +ACPICA Divergences
> > +==================
> >
> > - Ideally, all of the ACPICA commits should be converted into Linux patches
> > - automatically without manual modifications, the "linux / master" tree should
> > - contain the ACPICA code that exactly corresponds to the ACPICA code
> > - contained in "new linuxized acpica" tree and it should be possible to run
> > - the release process fully automatically.
> > +Ideally, all of the ACPICA commits should be converted into Linux patches
> > +automatically without manual modifications, the "linux / master" tree should
> > +contain the ACPICA code that exactly corresponds to the ACPICA code
> > +contained in "new linuxized acpica" tree and it should be possible to run
> > +the release process fully automatically.
> >
> > - As a matter of fact, however, there are source code differences between
> > - the ACPICA code in Linux and the upstream ACPICA code, referred to as
> > - "ACPICA Divergences".
> > +As a matter of fact, however, there are source code differences between
> > +the ACPICA code in Linux and the upstream ACPICA code, referred to as
> > +"ACPICA Divergences".
> >
> > - The various sources of ACPICA divergences include:
> > +The various sources of ACPICA divergences include:
> > 1. Legacy divergences - Before the current ACPICA release process was
> > established, there already had been divergences between Linux and
> > ACPICA. Over the past several years those divergences have been greatly
> > @@ -213,11 +227,12 @@ upstream.
> > rebased on the ACPICA side in order to offer better solutions, new ACPICA
> > divergences are generated.
> >
> > -4. ACPICA Development
> > +ACPICA Development
> > +==================
> >
> > - This paragraph guides Linux developers to use the ACPICA upstream release
> > - utilities to obtain Linux patches corresponding to upstream ACPICA commits
> > - before they become available from the ACPICA release process.
> > +This paragraph guides Linux developers to use the ACPICA upstream release
> > +utilities to obtain Linux patches corresponding to upstream ACPICA commits
> > +before they become available from the ACPICA release process.
> >
> > 1. Cherry-pick an ACPICA commit
> >
> > @@ -225,7 +240,7 @@ upstream.
> > you want to cherry pick must be committed into the local repository.
> >
> > Then the gen-patch.sh command can help to cherry-pick an ACPICA commit
> > - from the ACPICA local repository:
> > + from the ACPICA local repository::
> >
> > $ git clone https://github.com/acpica/acpica
> > $ cd acpica
> > @@ -240,7 +255,7 @@ upstream.
> > changes that haven't been applied to Linux yet.
> >
> > You can generate the ACPICA release series yourself and rebase your code on
> > - top of the generated ACPICA release patches:
> > + top of the generated ACPICA release patches::
> >
> > $ git clone https://github.com/acpica/acpica
> > $ cd acpica
> > @@ -254,7 +269,7 @@ upstream.
> > 3. Inspect the current divergences
> >
> > If you have local copies of both Linux and upstream ACPICA, you can generate
> > - a diff file indicating the state of the current divergences:
> > + a diff file indicating the state of the current divergences::
> >
> > # git clone https://github.com/acpica/acpica
> > # git clone http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
* Re: [PATCH v4 02/63] Documentation: ACPI: move namespace.txt to firmware-guide/acpi and convert to reST
From: Changbin Du @ 2019-04-24 16:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: fenghua.yu, x86, Jonathan Corbet, linux-pci, linux-gpio,
linux-doc, rjw, linux-kernel, linux-acpi, mingo, Bjorn Helgaas,
tglx, linuxppc-dev, Changbin Du
In-Reply-To: <20190423173840.2e450b34@coco.lan>
On Tue, Apr 23, 2019 at 05:38:40PM -0300, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Apr 2019 00:28:31 +0800
> Changbin Du <changbin.du@gmail.com> escreveu:
>
> > This converts the plain text documentation to reStructuredText format and
> > add it to Sphinx TOC tree. No essential content change.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > Documentation/firmware-guide/acpi/index.rst | 1 +
> > .../acpi/namespace.rst} | 310 +++++++++---------
> > 2 files changed, 161 insertions(+), 150 deletions(-)
> > rename Documentation/{acpi/namespace.txt => firmware-guide/acpi/namespace.rst} (54%)
> >
> > diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
> > index 0ec7d072ba22..210ad8acd6df 100644
> > --- a/Documentation/firmware-guide/acpi/index.rst
> > +++ b/Documentation/firmware-guide/acpi/index.rst
> > @@ -7,3 +7,4 @@ ACPI Support
> > .. toctree::
> > :maxdepth: 1
> >
> > + namespace
> > diff --git a/Documentation/acpi/namespace.txt b/Documentation/firmware-guide/acpi/namespace.rst
> > similarity index 54%
> > rename from Documentation/acpi/namespace.txt
> > rename to Documentation/firmware-guide/acpi/namespace.rst
> > index 1860cb3865c6..443f0e5d0617 100644
> > --- a/Documentation/acpi/namespace.txt
> > +++ b/Documentation/firmware-guide/acpi/namespace.rst
> > @@ -1,85 +1,88 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: <isonum.txt>
> > +
> > +===================================================
> > ACPI Device Tree - Representation of ACPI Namespace
> > +===================================================
> > +
> > +:Copyright: |copy| 2013, Intel Corporation
> > +
> > +:Author: Lv Zheng <lv.zheng@intel.com>
> > +
> > +:Abstract: The Linux ACPI subsystem converts ACPI namespace objects into a Linux
> > + device tree under the /sys/devices/LNXSYSTEM:00 and updates it upon
> > + receiving ACPI hotplug notification events. For each device object
> > + in this hierarchy there is a corresponding symbolic link in the
> > + /sys/bus/acpi/devices.
> > + This document illustrates the structure of the ACPI device tree.
>
> Well, this is a matter of preference. I would add Abstract as a chapter,
> as this would make it part of the top index, with can be useful.
>
Now it becomes a chapter. Thanks.
> In any case:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> > +
> > +:Credit: Thanks for the help from Zhang Rui <rui.zhang@intel.com> and
> > + Rafael J.Wysocki <rafael.j.wysocki@intel.com>.
> > +
> > +
> > +ACPI Definition Blocks
> > +======================
> > +
> > +The ACPI firmware sets up RSDP (Root System Description Pointer) in the
> > +system memory address space pointing to the XSDT (Extended System
> > +Description Table). The XSDT always points to the FADT (Fixed ACPI
> > +Description Table) using its first entry, the data within the FADT
> > +includes various fixed-length entries that describe fixed ACPI features
> > +of the hardware. The FADT contains a pointer to the DSDT
> > +(Differentiated System Descripition Table). The XSDT also contains
> > +entries pointing to possibly multiple SSDTs (Secondary System
> > +Description Table).
> > +
> > +The DSDT and SSDT data is organized in data structures called definition
> > +blocks that contain definitions of various objects, including ACPI
> > +control methods, encoded in AML (ACPI Machine Language). The data block
> > +of the DSDT along with the contents of SSDTs represents a hierarchical
> > +data structure called the ACPI namespace whose topology reflects the
> > +structure of the underlying hardware platform.
> > +
> > +The relationships between ACPI System Definition Tables described above
> > +are illustrated in the following diagram::
> > +
> > + +---------+ +-------+ +--------+ +------------------------+
> > + | RSDP | +->| XSDT | +->| FADT | | +-------------------+ |
> > + +---------+ | +-------+ | +--------+ +-|->| DSDT | |
> > + | Pointer | | | Entry |-+ | ...... | | | +-------------------+ |
> > + +---------+ | +-------+ | X_DSDT |--+ | | Definition Blocks | |
> > + | Pointer |-+ | ..... | | ...... | | +-------------------+ |
> > + +---------+ +-------+ +--------+ | +-------------------+ |
> > + | Entry |------------------|->| SSDT | |
> > + +- - - -+ | +-------------------| |
> > + | Entry | - - - - - - - -+ | | Definition Blocks | |
> > + +- - - -+ | | +-------------------+ |
> > + | | +- - - - - - - - - -+ |
> > + +-|->| SSDT | |
> > + | +-------------------+ |
> > + | | Definition Blocks | |
> > + | +- - - - - - - - - -+ |
> > + +------------------------+
> > + |
> > + OSPM Loading |
> > + \|/
> > + +----------------+
> > + | ACPI Namespace |
> > + +----------------+
> > +
> > + Figure 1. ACPI Definition Blocks
> > +
> > +.. note:: RSDP can also contain a pointer to the RSDT (Root System
> > + Description Table). Platforms provide RSDT to enable
> > + compatibility with ACPI 1.0 operating systems. The OS is expected
> > + to use XSDT, if present.
> > +
> > +
> > +Example ACPI Namespace
> > +======================
> > +
> > +All definition blocks are loaded into a single namespace. The namespace
> > +is a hierarchy of objects identified by names and paths.
> > +The following naming conventions apply to object names in the ACPI
> > +namespace:
> >
> > -Copyright (C) 2013, Intel Corporation
> > -Author: Lv Zheng <lv.zheng@intel.com>
> > -
> > -
> > -Abstract:
> > -
> > -The Linux ACPI subsystem converts ACPI namespace objects into a Linux
> > -device tree under the /sys/devices/LNXSYSTEM:00 and updates it upon
> > -receiving ACPI hotplug notification events. For each device object in this
> > -hierarchy there is a corresponding symbolic link in the
> > -/sys/bus/acpi/devices.
> > -This document illustrates the structure of the ACPI device tree.
> > -
> > -
> > -Credit:
> > -
> > -Thanks for the help from Zhang Rui <rui.zhang@intel.com> and Rafael J.
> > -Wysocki <rafael.j.wysocki@intel.com>.
> > -
> > -
> > -1. ACPI Definition Blocks
> > -
> > - The ACPI firmware sets up RSDP (Root System Description Pointer) in the
> > - system memory address space pointing to the XSDT (Extended System
> > - Description Table). The XSDT always points to the FADT (Fixed ACPI
> > - Description Table) using its first entry, the data within the FADT
> > - includes various fixed-length entries that describe fixed ACPI features
> > - of the hardware. The FADT contains a pointer to the DSDT
> > - (Differentiated System Descripition Table). The XSDT also contains
> > - entries pointing to possibly multiple SSDTs (Secondary System
> > - Description Table).
> > -
> > - The DSDT and SSDT data is organized in data structures called definition
> > - blocks that contain definitions of various objects, including ACPI
> > - control methods, encoded in AML (ACPI Machine Language). The data block
> > - of the DSDT along with the contents of SSDTs represents a hierarchical
> > - data structure called the ACPI namespace whose topology reflects the
> > - structure of the underlying hardware platform.
> > -
> > - The relationships between ACPI System Definition Tables described above
> > - are illustrated in the following diagram.
> > -
> > - +---------+ +-------+ +--------+ +------------------------+
> > - | RSDP | +->| XSDT | +->| FADT | | +-------------------+ |
> > - +---------+ | +-------+ | +--------+ +-|->| DSDT | |
> > - | Pointer | | | Entry |-+ | ...... | | | +-------------------+ |
> > - +---------+ | +-------+ | X_DSDT |--+ | | Definition Blocks | |
> > - | Pointer |-+ | ..... | | ...... | | +-------------------+ |
> > - +---------+ +-------+ +--------+ | +-------------------+ |
> > - | Entry |------------------|->| SSDT | |
> > - +- - - -+ | +-------------------| |
> > - | Entry | - - - - - - - -+ | | Definition Blocks | |
> > - +- - - -+ | | +-------------------+ |
> > - | | +- - - - - - - - - -+ |
> > - +-|->| SSDT | |
> > - | +-------------------+ |
> > - | | Definition Blocks | |
> > - | +- - - - - - - - - -+ |
> > - +------------------------+
> > - |
> > - OSPM Loading |
> > - \|/
> > - +----------------+
> > - | ACPI Namespace |
> > - +----------------+
> > -
> > - Figure 1. ACPI Definition Blocks
> > -
> > - NOTE: RSDP can also contain a pointer to the RSDT (Root System
> > - Description Table). Platforms provide RSDT to enable
> > - compatibility with ACPI 1.0 operating systems. The OS is expected
> > - to use XSDT, if present.
> > -
> > -
> > -2. Example ACPI Namespace
> > -
> > - All definition blocks are loaded into a single namespace. The namespace
> > - is a hierarchy of objects identified by names and paths.
> > - The following naming conventions apply to object names in the ACPI
> > - namespace:
> > 1. All names are 32 bits long.
> > 2. The first byte of a name must be one of 'A' - 'Z', '_'.
> > 3. Each of the remaining bytes of a name must be one of 'A' - 'Z', '0'
> > @@ -91,7 +94,7 @@ Wysocki <rafael.j.wysocki@intel.com>.
> > (i.e. names prepended with '^' are relative to the parent of the
> > current namespace node).
> >
> > - The figure below shows an example ACPI namespace.
> > +The figure below shows an example ACPI namespace::
> >
> > +------+
> > | \ | Root
> > @@ -184,19 +187,20 @@ Wysocki <rafael.j.wysocki@intel.com>.
> > Figure 2. Example ACPI Namespace
> >
> >
> > -3. Linux ACPI Device Objects
> > +Linux ACPI Device Objects
> > +=========================
> >
> > - The Linux kernel's core ACPI subsystem creates struct acpi_device
> > - objects for ACPI namespace objects representing devices, power resources
> > - processors, thermal zones. Those objects are exported to user space via
> > - sysfs as directories in the subtree under /sys/devices/LNXSYSTM:00. The
> > - format of their names is <bus_id:instance>, where 'bus_id' refers to the
> > - ACPI namespace representation of the given object and 'instance' is used
> > - for distinguishing different object of the same 'bus_id' (it is
> > - two-digit decimal representation of an unsigned integer).
> > +The Linux kernel's core ACPI subsystem creates struct acpi_device
> > +objects for ACPI namespace objects representing devices, power resources
> > +processors, thermal zones. Those objects are exported to user space via
> > +sysfs as directories in the subtree under /sys/devices/LNXSYSTM:00. The
> > +format of their names is <bus_id:instance>, where 'bus_id' refers to the
> > +ACPI namespace representation of the given object and 'instance' is used
> > +for distinguishing different object of the same 'bus_id' (it is
> > +two-digit decimal representation of an unsigned integer).
> >
> > - The value of 'bus_id' depends on the type of the object whose name it is
> > - part of as listed in the table below.
> > +The value of 'bus_id' depends on the type of the object whose name it is
> > +part of as listed in the table below::
> >
> > +---+-----------------+-------+----------+
> > | | Object/Feature | Table | bus_id |
> > @@ -226,10 +230,11 @@ Wysocki <rafael.j.wysocki@intel.com>.
> >
> > Table 1. ACPI Namespace Objects Mapping
> >
> > - The following rules apply when creating struct acpi_device objects on
> > - the basis of the contents of ACPI System Description Tables (as
> > - indicated by the letter in the first column and the notation in the
> > - second column of the table above):
> > +The following rules apply when creating struct acpi_device objects on
> > +the basis of the contents of ACPI System Description Tables (as
> > +indicated by the letter in the first column and the notation in the
> > +second column of the table above):
> > +
> > N:
> > The object's source is an ACPI namespace node (as indicated by the
> > named object's type in the second column). In that case the object's
> > @@ -249,13 +254,14 @@ Wysocki <rafael.j.wysocki@intel.com>.
> > struct acpi_device object with LNXVIDEO 'bus_id' will be created for
> > it.
> >
> > - The third column of the above table indicates which ACPI System
> > - Description Tables contain information used for the creation of the
> > - struct acpi_device objects represented by the given row (xSDT means DSDT
> > - or SSDT).
> > +The third column of the above table indicates which ACPI System
> > +Description Tables contain information used for the creation of the
> > +struct acpi_device objects represented by the given row (xSDT means DSDT
> > +or SSDT).
> > +
> > +The forth column of the above table indicates the 'bus_id' generation
> > +rule of the struct acpi_device object:
> >
> > - The forth column of the above table indicates the 'bus_id' generation
> > - rule of the struct acpi_device object:
> > _HID:
> > _HID in the last column of the table means that the object's bus_id
> > is derived from the _HID/_CID identification objects present under
> > @@ -275,45 +281,47 @@ Wysocki <rafael.j.wysocki@intel.com>.
> > object's bus_id.
> >
> >
> > -4. Linux ACPI Physical Device Glue
> > -
> > - ACPI device (i.e. struct acpi_device) objects may be linked to other
> > - objects in the Linux' device hierarchy that represent "physical" devices
> > - (for example, devices on the PCI bus). If that happens, it means that
> > - the ACPI device object is a "companion" of a device otherwise
> > - represented in a different way and is used (1) to provide configuration
> > - information on that device which cannot be obtained by other means and
> > - (2) to do specific things to the device with the help of its ACPI
> > - control methods. One ACPI device object may be linked this way to
> > - multiple "physical" devices.
> > -
> > - If an ACPI device object is linked to a "physical" device, its sysfs
> > - directory contains the "physical_node" symbolic link to the sysfs
> > - directory of the target device object. In turn, the target device's
> > - sysfs directory will then contain the "firmware_node" symbolic link to
> > - the sysfs directory of the companion ACPI device object.
> > - The linking mechanism relies on device identification provided by the
> > - ACPI namespace. For example, if there's an ACPI namespace object
> > - representing a PCI device (i.e. a device object under an ACPI namespace
> > - object representing a PCI bridge) whose _ADR returns 0x00020000 and the
> > - bus number of the parent PCI bridge is 0, the sysfs directory
> > - representing the struct acpi_device object created for that ACPI
> > - namespace object will contain the 'physical_node' symbolic link to the
> > - /sys/devices/pci0000:00/0000:00:02:0/ sysfs directory of the
> > - corresponding PCI device.
> > -
> > - The linking mechanism is generally bus-specific. The core of its
> > - implementation is located in the drivers/acpi/glue.c file, but there are
> > - complementary parts depending on the bus types in question located
> > - elsewhere. For example, the PCI-specific part of it is located in
> > - drivers/pci/pci-acpi.c.
> > -
> > -
> > -5. Example Linux ACPI Device Tree
> > -
> > - The sysfs hierarchy of struct acpi_device objects corresponding to the
> > - example ACPI namespace illustrated in Figure 2 with the addition of
> > - fixed PWR_BUTTON/SLP_BUTTON devices is shown below.
> > +Linux ACPI Physical Device Glue
> > +===============================
> > +
> > +ACPI device (i.e. struct acpi_device) objects may be linked to other
> > +objects in the Linux' device hierarchy that represent "physical" devices
> > +(for example, devices on the PCI bus). If that happens, it means that
> > +the ACPI device object is a "companion" of a device otherwise
> > +represented in a different way and is used (1) to provide configuration
> > +information on that device which cannot be obtained by other means and
> > +(2) to do specific things to the device with the help of its ACPI
> > +control methods. One ACPI device object may be linked this way to
> > +multiple "physical" devices.
> > +
> > +If an ACPI device object is linked to a "physical" device, its sysfs
> > +directory contains the "physical_node" symbolic link to the sysfs
> > +directory of the target device object. In turn, the target device's
> > +sysfs directory will then contain the "firmware_node" symbolic link to
> > +the sysfs directory of the companion ACPI device object.
> > +The linking mechanism relies on device identification provided by the
> > +ACPI namespace. For example, if there's an ACPI namespace object
> > +representing a PCI device (i.e. a device object under an ACPI namespace
> > +object representing a PCI bridge) whose _ADR returns 0x00020000 and the
> > +bus number of the parent PCI bridge is 0, the sysfs directory
> > +representing the struct acpi_device object created for that ACPI
> > +namespace object will contain the 'physical_node' symbolic link to the
> > +/sys/devices/pci0000:00/0000:00:02:0/ sysfs directory of the
> > +corresponding PCI device.
> > +
> > +The linking mechanism is generally bus-specific. The core of its
> > +implementation is located in the drivers/acpi/glue.c file, but there are
> > +complementary parts depending on the bus types in question located
> > +elsewhere. For example, the PCI-specific part of it is located in
> > +drivers/pci/pci-acpi.c.
> > +
> > +
> > +Example Linux ACPI Device Tree
> > +=================================
> > +
> > +The sysfs hierarchy of struct acpi_device objects corresponding to the
> > +example ACPI namespace illustrated in Figure 2 with the addition of
> > +fixed PWR_BUTTON/SLP_BUTTON devices is shown below::
> >
> > +--------------+---+-----------------+
> > | LNXSYSTEM:00 | \ | acpi:LNXSYSTEM: |
> > @@ -377,12 +385,14 @@ Wysocki <rafael.j.wysocki@intel.com>.
> >
> > Figure 3. Example Linux ACPI Device Tree
> >
> > - NOTE: Each node is represented as "object/path/modalias", where:
> > - 1. 'object' is the name of the object's directory in sysfs.
> > - 2. 'path' is the ACPI namespace path of the corresponding
> > - ACPI namespace object, as returned by the object's 'path'
> > - sysfs attribute.
> > - 3. 'modalias' is the value of the object's 'modalias' sysfs
> > - attribute (as described earlier in this document).
> > - NOTE: N/A indicates the device object does not have the 'path' or the
> > - 'modalias' attribute.
> > +.. note:: Each node is represented as "object/path/modalias", where:
> > +
> > + 1. 'object' is the name of the object's directory in sysfs.
> > + 2. 'path' is the ACPI namespace path of the corresponding
> > + ACPI namespace object, as returned by the object's 'path'
> > + sysfs attribute.
> > + 3. 'modalias' is the value of the object's 'modalias' sysfs
> > + attribute (as described earlier in this document).
> > +
> > +.. note:: N/A indicates the device object does not have the 'path' or the
> > + 'modalias' attribute.
>
>
>
> Thanks,
> Mauro
--
Cheers,
Changbin Du
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox