mbox series

[00/40] RFC: rpi: Enable ACPI booting on ARM with Raspberry Pi 4

Message ID 20211201160315.2203099-1-sjg@chromium.org
Headers show
Series RFC: rpi: Enable ACPI booting on ARM with Raspberry Pi 4 | expand

Message

Simon Glass Dec. 1, 2021, 4:02 p.m. UTC
At present in U-Boot ACPI tables are only generated for x86 devices. It is
possible to build them for ARM as well. That is the subject of this
series.

The goal is to allow a rpi4 boot into Linux on ARM using ACPI rather than
devicetree. This is not due to any feeling that ACPI offers advantages to
the boot flow, merely because it can be done.

This goal is not yet achieved. Mostly all that is achieved is some
refactoring of the ACPI code, but that is enough to get things at least
building on ARM. The rpi-4 the tables are installed and the board boots
to grub, where it is then unable to find the OS on the USB stick that is
inserted. Further work is needed to complete things, but the ACPI changes
can be applied as is.

In terms of review, please ignore the RFC/WIP patches as they need to be
reworked. I am sending this series in this state to avoid sitting on
patches for too long and risking duplicate effort.

The following tables are emitted with this series:

   - GTDT - Generic Timer Description Table
   - APIC - Multiple Advanced Programmable Interrupt Controller
            Description Table (some new records for ARM)
   - DSDT - Differentiated System Description Table
   - DBG2 - Debug Port Table 2
   - FACP - Firmware ACPI Control Structure
   - CSRT - Core System Resource Table
   - PPTT - Processor Properties Topology Table

Missing still are:
   - SSDR - Secondary System Description Table
   - BGRT - Boot Graphics Resource Table

Future work is needed to:
- Finish the remaining two tables
- Get things booting nicely on rpi4
- Find a nice way to select between ACPI and devicetree at runtime
- Obtain the ACPI information from the devicetree instead of #defines
- Use the U-Boot bcm headers instead of importing new ones
- Drop the unused files
- Add some documentation

To test it, boot U-Boot on a rpi_4 with a suitable distribution.

This series is available at u-boot-dm/acpi-working


Simon Glass (40):
  Makefile: Allow LTO to be disabled for a build
  x86: Allow any arch to generate ACPI tables
  x86: Move the acpi table to generic global_data
  arm: Allow supporting ACPI-table generation
  x86: Tidy up use of CONFIG_ACPIGEN
  sandbox: Allow building with GENERATE_ACPI_TABLE
  efi: Correct call to write_acpi_tables()
  efi: Correct address handling with ACPI tables
  acpi: Use finer-grained control of ACPI-table generation
  acpi: Allow include files within the board directory
  acpi: Move acpi_fill_header() to the generic header
  acpi: Add a table start
  acpi: Add a linker list for ACPI tables
  x86: acpi: Split out context creation from base tables
  x86: Use the ACPI table writer
  x86: Move base tables to a writer function
  x86: Move FACS table to a writer function
  x86: Move DSDT table to a writer function
  x86: Move GNVS table to a writer function
  x86: Move FADT table to a writer function
  x86: Move FACP table into separate functions
  x86: Move SSDT table to a writer function
  x86: Move TPM2 table to a writer function
  x86: Move MADT table to a writer function
  x86: Move TCPA table to a writer function
  x86: Move CSRT table to a writer function
  x86: acpi: Update acpi_fill_csrt() to use acpi_ctx
  x86: Move device-specific ACPI tables to a writer function
  x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
  acpi: Collect tables in the acpi_item list
  acpi: Tidy up the item list
  acpi: Tidy up the table list
  doc: Add usage information for the acpi command
  acpi: Add some tables needed by ARM devices
  acpi: Add myself as maintainer
  WIP: Add debugging for ACPI emission
  RFC: Allow passing ACPI tables to bootefi
  WIP: Add ASL files from tianocore
  WIP: Bring in some header files from tianocore
  RFC: rpi: Enable booting with ACPI tables

 MAINTAINERS                                   |   6 +
 Makefile                                      |  18 +-
 arch/Kconfig                                  |   6 +-
 arch/arm/config.mk                            |   4 +-
 arch/arm/include/asm/acpi_table.h             |  15 +
 arch/arm/include/asm/global_data.h            |   2 +-
 .../mach-bcm283x/include/mach/acpi/bcm2711.h  |  93 +++
 .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 124 +++
 .../include/mach/acpi/bcm2836_gpio.h          |  85 ++
 .../include/mach/acpi/bcm2836_gpu.h           |  48 ++
 .../include/mach/acpi/bcm2836_pwm.h           |  34 +
 .../include/mach/acpi/bcm2836_sdhost.h        |  90 ++
 .../include/mach/acpi/bcm2836_sdio.h          | 203 +++++
 arch/sandbox/include/asm/acpi_table.h         |   2 +
 arch/sandbox/include/asm/global_data.h        |   1 -
 arch/sandbox/include/asm/tables.h             |   0
 arch/x86/Kconfig                              |   9 -
 arch/x86/cpu/apollolake/acpi.c                |  17 +-
 arch/x86/cpu/baytrail/acpi.c                  |  27 +-
 arch/x86/cpu/quark/acpi.c                     |  27 +-
 arch/x86/cpu/tangier/acpi.c                   |  34 +-
 arch/x86/include/asm/acpi_table.h             |   4 -
 arch/x86/include/asm/global_data.h            |   1 -
 arch/x86/lib/Makefile                         |   2 +-
 arch/x86/lib/acpi_table.c                     | 374 +++------
 board/raspberrypi/rpi/Makefile                |   2 +
 board/raspberrypi/rpi/acpitables.h            | 189 +++++
 board/raspberrypi/rpi/acpitables.inf          |  79 ++
 board/raspberrypi/rpi/csrt.aslc               | 330 ++++++++
 board/raspberrypi/rpi/dbg2miniuart.aslc       |  81 ++
 board/raspberrypi/rpi/dbg2pl011.aslc          |  81 ++
 board/raspberrypi/rpi/dsdt.asl                | 285 +++++++
 board/raspberrypi/rpi/emmc.asl                | 166 ++++
 board/raspberrypi/rpi/fadt.aslc               |  96 +++
 board/raspberrypi/rpi/gpudevs.asl             | 397 +++++++++
 board/raspberrypi/rpi/gtdt.aslc               |  55 ++
 board/raspberrypi/rpi/iort.aslc               | 100 +++
 board/raspberrypi/rpi/madt.aslc               |  78 ++
 board/raspberrypi/rpi/pci.asl                 | 168 ++++
 board/raspberrypi/rpi/pep.asl                 |  90 ++
 board/raspberrypi/rpi/pep.c                   |  79 ++
 board/raspberrypi/rpi/pep.h                   | 121 +++
 board/raspberrypi/rpi/pptt.aslc               | 191 +++++
 board/raspberrypi/rpi/rhpx.asl                | 195 +++++
 board/raspberrypi/rpi/rpi.c                   | 460 +++++++++-
 board/raspberrypi/rpi/rpi4.dsc                | 790 ++++++++++++++++++
 board/raspberrypi/rpi/sdhc.asl                | 119 +++
 board/raspberrypi/rpi/spcrminiuart.aslc       |  91 ++
 board/raspberrypi/rpi/spcrpl011.aslc          |  91 ++
 board/raspberrypi/rpi/ssdtthermal.asl         |  77 ++
 board/raspberrypi/rpi/uart.asl                | 202 +++++
 board/raspberrypi/rpi/xhci.asl                | 165 ++++
 cmd/acpi.c                                    |  13 +-
 cmd/bootefi.c                                 |  44 +-
 configs/cherryhill_defconfig                  |   1 +
 configs/chromebook_link64_defconfig           |   1 +
 configs/chromebook_link_defconfig             |   1 +
 configs/chromebook_samus_tpl_defconfig        |   1 +
 configs/coreboot64_defconfig                  |   1 +
 configs/coreboot_defconfig                    |   1 +
 configs/crownbay_defconfig                    |   1 +
 configs/efi-x86_payload32_defconfig           |   1 +
 configs/efi-x86_payload64_defconfig           |   1 +
 configs/rpi_4_defconfig                       |   2 +
 configs/slimbootloader_defconfig              |   1 +
 configs/tools-only_defconfig                  |   1 +
 doc/build/gcc.rst                             |  17 +
 doc/usage/acpi.rst                            | 235 ++++++
 doc/usage/index.rst                           |   1 +
 drivers/core/acpi.c                           |  70 +-
 drivers/misc/qfw.c                            |   3 +-
 include/acpi/acpi_table.h                     | 235 +++++-
 include/asm-generic/global_data.h             |   8 +
 include/dm/acpi.h                             | 110 +++
 lib/Kconfig                                   |  18 +
 lib/Makefile                                  |   2 +-
 lib/acpi/Makefile                             |  23 +-
 lib/acpi/acpi_table.c                         |  82 --
 lib/acpi/acpi_writer.c                        | 132 +++
 lib/acpi/base.c                               |  94 +++
 lib/acpi/csrt.c                               |  49 ++
 lib/acpi/dsdt.c                               |  55 ++
 lib/acpi/facs.c                               |  35 +
 lib/acpi/ssdt.c                               |  49 ++
 lib/efi_loader/Makefile                       |   2 -
 lib/efi_loader/efi_acpi.c                     |   5 +-
 scripts/Makefile.lib                          |   3 +-
 test/dm/acpi.c                                |  79 +-
 88 files changed, 6875 insertions(+), 506 deletions(-)
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
 create mode 100644 arch/sandbox/include/asm/tables.h
 create mode 100644 board/raspberrypi/rpi/acpitables.h
 create mode 100644 board/raspberrypi/rpi/acpitables.inf
 create mode 100644 board/raspberrypi/rpi/csrt.aslc
 create mode 100644 board/raspberrypi/rpi/dbg2miniuart.aslc
 create mode 100644 board/raspberrypi/rpi/dbg2pl011.aslc
 create mode 100644 board/raspberrypi/rpi/dsdt.asl
 create mode 100644 board/raspberrypi/rpi/emmc.asl
 create mode 100644 board/raspberrypi/rpi/fadt.aslc
 create mode 100644 board/raspberrypi/rpi/gpudevs.asl
 create mode 100644 board/raspberrypi/rpi/gtdt.aslc
 create mode 100644 board/raspberrypi/rpi/iort.aslc
 create mode 100644 board/raspberrypi/rpi/madt.aslc
 create mode 100644 board/raspberrypi/rpi/pci.asl
 create mode 100644 board/raspberrypi/rpi/pep.asl
 create mode 100644 board/raspberrypi/rpi/pep.c
 create mode 100644 board/raspberrypi/rpi/pep.h
 create mode 100644 board/raspberrypi/rpi/pptt.aslc
 create mode 100644 board/raspberrypi/rpi/rhpx.asl
 create mode 100644 board/raspberrypi/rpi/rpi4.dsc
 create mode 100644 board/raspberrypi/rpi/sdhc.asl
 create mode 100644 board/raspberrypi/rpi/spcrminiuart.aslc
 create mode 100644 board/raspberrypi/rpi/spcrpl011.aslc
 create mode 100644 board/raspberrypi/rpi/ssdtthermal.asl
 create mode 100644 board/raspberrypi/rpi/uart.asl
 create mode 100644 board/raspberrypi/rpi/xhci.asl
 create mode 100644 doc/usage/acpi.rst
 create mode 100644 lib/acpi/acpi_writer.c
 create mode 100644 lib/acpi/base.c
 create mode 100644 lib/acpi/csrt.c
 create mode 100644 lib/acpi/dsdt.c
 create mode 100644 lib/acpi/facs.c
 create mode 100644 lib/acpi/ssdt.c

Comments

Andy Shevchenko Dec. 1, 2021, 5:09 p.m. UTC | #1
On Wed, Dec 1, 2021 at 6:56 PM Simon Glass <sjg@chromium.org> wrote:
>
> At present in U-Boot ACPI tables are only generated for x86 devices. It is
> possible to build them for ARM as well. That is the subject of this
> series.
>
> The goal is to allow a rpi4 boot into Linux on ARM using ACPI rather than
> devicetree. This is not due to any feeling that ACPI offers advantages to
> the boot flow, merely because it can be done.
>
> This goal is not yet achieved. Mostly all that is achieved is some
> refactoring of the ACPI code, but that is enough to get things at least
> building on ARM. The rpi-4 the tables are installed and the board boots
> to grub, where it is then unable to find the OS on the USB stick that is
> inserted. Further work is needed to complete things, but the ACPI changes
> can be applied as is.
>
> In terms of review, please ignore the RFC/WIP patches as they need to be
> reworked. I am sending this series in this state to avoid sitting on
> patches for too long and risking duplicate effort.
>
> The following tables are emitted with this series:
>
>    - GTDT - Generic Timer Description Table
>    - APIC - Multiple Advanced Programmable Interrupt Controller
>             Description Table (some new records for ARM)
>    - DSDT - Differentiated System Description Table
>    - DBG2 - Debug Port Table 2
>    - FACP - Firmware ACPI Control Structure
>    - CSRT - Core System Resource Table
>    - PPTT - Processor Properties Topology Table
>
> Missing still are:
>    - SSDR - Secondary System Description Table

SSDT

>    - BGRT - Boot Graphics Resource Table

And SPCR

>
> Future work is needed to:
> - Finish the remaining two tables
> - Get things booting nicely on rpi4
> - Find a nice way to select between ACPI and devicetree at runtime
> - Obtain the ACPI information from the devicetree instead of #defines
> - Use the U-Boot bcm headers instead of importing new ones
> - Drop the unused files
> - Add some documentation
>
> To test it, boot U-Boot on a rpi_4 with a suitable distribution.
>
> This series is available at u-boot-dm/acpi-working
>
>
> Simon Glass (40):
>   Makefile: Allow LTO to be disabled for a build
>   x86: Allow any arch to generate ACPI tables
>   x86: Move the acpi table to generic global_data
>   arm: Allow supporting ACPI-table generation
>   x86: Tidy up use of CONFIG_ACPIGEN
>   sandbox: Allow building with GENERATE_ACPI_TABLE
>   efi: Correct call to write_acpi_tables()
>   efi: Correct address handling with ACPI tables
>   acpi: Use finer-grained control of ACPI-table generation
>   acpi: Allow include files within the board directory
>   acpi: Move acpi_fill_header() to the generic header
>   acpi: Add a table start
>   acpi: Add a linker list for ACPI tables
>   x86: acpi: Split out context creation from base tables
>   x86: Use the ACPI table writer
>   x86: Move base tables to a writer function
>   x86: Move FACS table to a writer function
>   x86: Move DSDT table to a writer function
>   x86: Move GNVS table to a writer function
>   x86: Move FADT table to a writer function
>   x86: Move FACP table into separate functions
>   x86: Move SSDT table to a writer function
>   x86: Move TPM2 table to a writer function
>   x86: Move MADT table to a writer function
>   x86: Move TCPA table to a writer function
>   x86: Move CSRT table to a writer function
>   x86: acpi: Update acpi_fill_csrt() to use acpi_ctx
>   x86: Move device-specific ACPI tables to a writer function
>   x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
>   acpi: Collect tables in the acpi_item list
>   acpi: Tidy up the item list
>   acpi: Tidy up the table list
>   doc: Add usage information for the acpi command
>   acpi: Add some tables needed by ARM devices
>   acpi: Add myself as maintainer
>   WIP: Add debugging for ACPI emission
>   RFC: Allow passing ACPI tables to bootefi
>   WIP: Add ASL files from tianocore
>   WIP: Bring in some header files from tianocore
>   RFC: rpi: Enable booting with ACPI tables
>
>  MAINTAINERS                                   |   6 +
>  Makefile                                      |  18 +-
>  arch/Kconfig                                  |   6 +-
>  arch/arm/config.mk                            |   4 +-
>  arch/arm/include/asm/acpi_table.h             |  15 +
>  arch/arm/include/asm/global_data.h            |   2 +-
>  .../mach-bcm283x/include/mach/acpi/bcm2711.h  |  93 +++
>  .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 124 +++
>  .../include/mach/acpi/bcm2836_gpio.h          |  85 ++
>  .../include/mach/acpi/bcm2836_gpu.h           |  48 ++
>  .../include/mach/acpi/bcm2836_pwm.h           |  34 +
>  .../include/mach/acpi/bcm2836_sdhost.h        |  90 ++
>  .../include/mach/acpi/bcm2836_sdio.h          | 203 +++++
>  arch/sandbox/include/asm/acpi_table.h         |   2 +
>  arch/sandbox/include/asm/global_data.h        |   1 -
>  arch/sandbox/include/asm/tables.h             |   0
>  arch/x86/Kconfig                              |   9 -
>  arch/x86/cpu/apollolake/acpi.c                |  17 +-
>  arch/x86/cpu/baytrail/acpi.c                  |  27 +-
>  arch/x86/cpu/quark/acpi.c                     |  27 +-
>  arch/x86/cpu/tangier/acpi.c                   |  34 +-
>  arch/x86/include/asm/acpi_table.h             |   4 -
>  arch/x86/include/asm/global_data.h            |   1 -
>  arch/x86/lib/Makefile                         |   2 +-
>  arch/x86/lib/acpi_table.c                     | 374 +++------
>  board/raspberrypi/rpi/Makefile                |   2 +
>  board/raspberrypi/rpi/acpitables.h            | 189 +++++
>  board/raspberrypi/rpi/acpitables.inf          |  79 ++
>  board/raspberrypi/rpi/csrt.aslc               | 330 ++++++++
>  board/raspberrypi/rpi/dbg2miniuart.aslc       |  81 ++
>  board/raspberrypi/rpi/dbg2pl011.aslc          |  81 ++
>  board/raspberrypi/rpi/dsdt.asl                | 285 +++++++
>  board/raspberrypi/rpi/emmc.asl                | 166 ++++
>  board/raspberrypi/rpi/fadt.aslc               |  96 +++
>  board/raspberrypi/rpi/gpudevs.asl             | 397 +++++++++
>  board/raspberrypi/rpi/gtdt.aslc               |  55 ++
>  board/raspberrypi/rpi/iort.aslc               | 100 +++
>  board/raspberrypi/rpi/madt.aslc               |  78 ++
>  board/raspberrypi/rpi/pci.asl                 | 168 ++++
>  board/raspberrypi/rpi/pep.asl                 |  90 ++
>  board/raspberrypi/rpi/pep.c                   |  79 ++
>  board/raspberrypi/rpi/pep.h                   | 121 +++
>  board/raspberrypi/rpi/pptt.aslc               | 191 +++++
>  board/raspberrypi/rpi/rhpx.asl                | 195 +++++
>  board/raspberrypi/rpi/rpi.c                   | 460 +++++++++-
>  board/raspberrypi/rpi/rpi4.dsc                | 790 ++++++++++++++++++
>  board/raspberrypi/rpi/sdhc.asl                | 119 +++
>  board/raspberrypi/rpi/spcrminiuart.aslc       |  91 ++
>  board/raspberrypi/rpi/spcrpl011.aslc          |  91 ++
>  board/raspberrypi/rpi/ssdtthermal.asl         |  77 ++
>  board/raspberrypi/rpi/uart.asl                | 202 +++++
>  board/raspberrypi/rpi/xhci.asl                | 165 ++++
>  cmd/acpi.c                                    |  13 +-
>  cmd/bootefi.c                                 |  44 +-
>  configs/cherryhill_defconfig                  |   1 +
>  configs/chromebook_link64_defconfig           |   1 +
>  configs/chromebook_link_defconfig             |   1 +
>  configs/chromebook_samus_tpl_defconfig        |   1 +
>  configs/coreboot64_defconfig                  |   1 +
>  configs/coreboot_defconfig                    |   1 +
>  configs/crownbay_defconfig                    |   1 +
>  configs/efi-x86_payload32_defconfig           |   1 +
>  configs/efi-x86_payload64_defconfig           |   1 +
>  configs/rpi_4_defconfig                       |   2 +
>  configs/slimbootloader_defconfig              |   1 +
>  configs/tools-only_defconfig                  |   1 +
>  doc/build/gcc.rst                             |  17 +
>  doc/usage/acpi.rst                            | 235 ++++++
>  doc/usage/index.rst                           |   1 +
>  drivers/core/acpi.c                           |  70 +-
>  drivers/misc/qfw.c                            |   3 +-
>  include/acpi/acpi_table.h                     | 235 +++++-
>  include/asm-generic/global_data.h             |   8 +
>  include/dm/acpi.h                             | 110 +++
>  lib/Kconfig                                   |  18 +
>  lib/Makefile                                  |   2 +-
>  lib/acpi/Makefile                             |  23 +-
>  lib/acpi/acpi_table.c                         |  82 --
>  lib/acpi/acpi_writer.c                        | 132 +++
>  lib/acpi/base.c                               |  94 +++
>  lib/acpi/csrt.c                               |  49 ++
>  lib/acpi/dsdt.c                               |  55 ++
>  lib/acpi/facs.c                               |  35 +
>  lib/acpi/ssdt.c                               |  49 ++
>  lib/efi_loader/Makefile                       |   2 -
>  lib/efi_loader/efi_acpi.c                     |   5 +-
>  scripts/Makefile.lib                          |   3 +-
>  test/dm/acpi.c                                |  79 +-
>  88 files changed, 6875 insertions(+), 506 deletions(-)
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
>  create mode 100644 arch/sandbox/include/asm/tables.h
>  create mode 100644 board/raspberrypi/rpi/acpitables.h
>  create mode 100644 board/raspberrypi/rpi/acpitables.inf
>  create mode 100644 board/raspberrypi/rpi/csrt.aslc
>  create mode 100644 board/raspberrypi/rpi/dbg2miniuart.aslc
>  create mode 100644 board/raspberrypi/rpi/dbg2pl011.aslc
>  create mode 100644 board/raspberrypi/rpi/dsdt.asl
>  create mode 100644 board/raspberrypi/rpi/emmc.asl
>  create mode 100644 board/raspberrypi/rpi/fadt.aslc
>  create mode 100644 board/raspberrypi/rpi/gpudevs.asl
>  create mode 100644 board/raspberrypi/rpi/gtdt.aslc
>  create mode 100644 board/raspberrypi/rpi/iort.aslc
>  create mode 100644 board/raspberrypi/rpi/madt.aslc
>  create mode 100644 board/raspberrypi/rpi/pci.asl
>  create mode 100644 board/raspberrypi/rpi/pep.asl
>  create mode 100644 board/raspberrypi/rpi/pep.c
>  create mode 100644 board/raspberrypi/rpi/pep.h
>  create mode 100644 board/raspberrypi/rpi/pptt.aslc
>  create mode 100644 board/raspberrypi/rpi/rhpx.asl
>  create mode 100644 board/raspberrypi/rpi/rpi4.dsc
>  create mode 100644 board/raspberrypi/rpi/sdhc.asl
>  create mode 100644 board/raspberrypi/rpi/spcrminiuart.aslc
>  create mode 100644 board/raspberrypi/rpi/spcrpl011.aslc
>  create mode 100644 board/raspberrypi/rpi/ssdtthermal.asl
>  create mode 100644 board/raspberrypi/rpi/uart.asl
>  create mode 100644 board/raspberrypi/rpi/xhci.asl
>  create mode 100644 doc/usage/acpi.rst
>  create mode 100644 lib/acpi/acpi_writer.c
>  create mode 100644 lib/acpi/base.c
>  create mode 100644 lib/acpi/csrt.c
>  create mode 100644 lib/acpi/dsdt.c
>  create mode 100644 lib/acpi/facs.c
>  create mode 100644 lib/acpi/ssdt.c
>
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>
François Ozog Dec. 1, 2021, 5:50 p.m. UTC | #2
Hi



Le mer. 1 déc. 2021 à 18:16, Andy Shevchenko <andy.shevchenko@gmail.com> a
écrit :

> On Wed, Dec 1, 2021 at 6:56 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > At present in U-Boot ACPI tables are only generated for x86 devices. It
> is
> > possible to build them for ARM as well. That is the subject of this
> > series.
> >

in the case of RPI4 what is needed is a translator from DT handed by
Videocore. If you mean generated from an assumed configuration, that may
not be good. Doing static ACPI based on assumptions as a first step is a
dangerous path.

>
> > The goal is to allow a rpi4 boot into Linux on ARM using ACPI rather than
> > devicetree. This is not due to any feeling that ACPI offers advantages to
> > the boot flow, merely because it can be done.
> >
> > This goal is not yet achieved. Mostly all that is achieved is some
> > refactoring of the ACPI code, but that is enough to get things at least
> > building on ARM. The rpi-4 the tables are installed and the board boots
> > to grub, where it is then unable to find the OS on the USB stick that is
> > inserted. Further work is needed to complete things, but the ACPI changes
> > can be applied as is.
> >
> > In terms of review, please ignore the RFC/WIP patches as they need to be
> > reworked. I am sending this series in this state to avoid sitting on
> > patches for too long and risking duplicate effort.
> >
> > The following tables are emitted with this series:
> >
> >    - GTDT - Generic Timer Description Table
> >    - APIC - Multiple Advanced Programmable Interrupt Controller
> >             Description Table (some new records for ARM)
> >    - DSDT - Differentiated System Description Table
> >    - DBG2 - Debug Port Table 2
> >    - FACP - Firmware ACPI Control Structure
> >    - CSRT - Core System Resource Table
> >    - PPTT - Processor Properties Topology Table
> >
> > Missing still are:
> >    - SSDR - Secondary System Description Table
>
> SSDT
>
> >    - BGRT - Boot Graphics Resource Table
>
> And SPCR
>
> >
> > Future work is needed to:
> > - Finish the remaining two tables
> > - Get things booting nicely on rpi4
> > - Find a nice way to select between ACPI and devicetree at runtime
> > - Obtain the ACPI information from the devicetree instead of #defines
> > - Use the U-Boot bcm headers instead of importing new ones
> > - Drop the unused files
> > - Add some documentation
> >
> > To test it, boot U-Boot on a rpi_4 with a suitable distribution.
> >
> > This series is available at u-boot-dm/acpi-working
> >
> >
> > Simon Glass (40):
> >   Makefile: Allow LTO to be disabled for a build
> >   x86: Allow any arch to generate ACPI tables
> >   x86: Move the acpi table to generic global_data
> >   arm: Allow supporting ACPI-table generation
> >   x86: Tidy up use of CONFIG_ACPIGEN
> >   sandbox: Allow building with GENERATE_ACPI_TABLE
> >   efi: Correct call to write_acpi_tables()
> >   efi: Correct address handling with ACPI tables
> >   acpi: Use finer-grained control of ACPI-table generation
> >   acpi: Allow include files within the board directory
> >   acpi: Move acpi_fill_header() to the generic header
> >   acpi: Add a table start
> >   acpi: Add a linker list for ACPI tables
> >   x86: acpi: Split out context creation from base tables
> >   x86: Use the ACPI table writer
> >   x86: Move base tables to a writer function
> >   x86: Move FACS table to a writer function
> >   x86: Move DSDT table to a writer function
> >   x86: Move GNVS table to a writer function
> >   x86: Move FADT table to a writer function
> >   x86: Move FACP table into separate functions
> >   x86: Move SSDT table to a writer function
> >   x86: Move TPM2 table to a writer function
> >   x86: Move MADT table to a writer function
> >   x86: Move TCPA table to a writer function
> >   x86: Move CSRT table to a writer function
> >   x86: acpi: Update acpi_fill_csrt() to use acpi_ctx
> >   x86: Move device-specific ACPI tables to a writer function
> >   x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
> >   acpi: Collect tables in the acpi_item list
> >   acpi: Tidy up the item list
> >   acpi: Tidy up the table list
> >   doc: Add usage information for the acpi command
> >   acpi: Add some tables needed by ARM devices
> >   acpi: Add myself as maintainer
> >   WIP: Add debugging for ACPI emission
> >   RFC: Allow passing ACPI tables to bootefi
> >   WIP: Add ASL files from tianocore
> >   WIP: Bring in some header files from tianocore
> >   RFC: rpi: Enable booting with ACPI tables
> >
> >  MAINTAINERS                                   |   6 +
> >  Makefile                                      |  18 +-
> >  arch/Kconfig                                  |   6 +-
> >  arch/arm/config.mk                            |   4 +-
> >  arch/arm/include/asm/acpi_table.h             |  15 +
> >  arch/arm/include/asm/global_data.h            |   2 +-
> >  .../mach-bcm283x/include/mach/acpi/bcm2711.h  |  93 +++
> >  .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 124 +++
> >  .../include/mach/acpi/bcm2836_gpio.h          |  85 ++
> >  .../include/mach/acpi/bcm2836_gpu.h           |  48 ++
> >  .../include/mach/acpi/bcm2836_pwm.h           |  34 +
> >  .../include/mach/acpi/bcm2836_sdhost.h        |  90 ++
> >  .../include/mach/acpi/bcm2836_sdio.h          | 203 +++++
> >  arch/sandbox/include/asm/acpi_table.h         |   2 +
> >  arch/sandbox/include/asm/global_data.h        |   1 -
> >  arch/sandbox/include/asm/tables.h             |   0
> >  arch/x86/Kconfig                              |   9 -
> >  arch/x86/cpu/apollolake/acpi.c                |  17 +-
> >  arch/x86/cpu/baytrail/acpi.c                  |  27 +-
> >  arch/x86/cpu/quark/acpi.c                     |  27 +-
> >  arch/x86/cpu/tangier/acpi.c                   |  34 +-
> >  arch/x86/include/asm/acpi_table.h             |   4 -
> >  arch/x86/include/asm/global_data.h            |   1 -
> >  arch/x86/lib/Makefile                         |   2 +-
> >  arch/x86/lib/acpi_table.c                     | 374 +++------
> >  board/raspberrypi/rpi/Makefile                |   2 +
> >  board/raspberrypi/rpi/acpitables.h            | 189 +++++
> >  board/raspberrypi/rpi/acpitables.inf          |  79 ++
> >  board/raspberrypi/rpi/csrt.aslc               | 330 ++++++++
> >  board/raspberrypi/rpi/dbg2miniuart.aslc       |  81 ++
> >  board/raspberrypi/rpi/dbg2pl011.aslc          |  81 ++
> >  board/raspberrypi/rpi/dsdt.asl                | 285 +++++++
> >  board/raspberrypi/rpi/emmc.asl                | 166 ++++
> >  board/raspberrypi/rpi/fadt.aslc               |  96 +++
> >  board/raspberrypi/rpi/gpudevs.asl             | 397 +++++++++
> >  board/raspberrypi/rpi/gtdt.aslc               |  55 ++
> >  board/raspberrypi/rpi/iort.aslc               | 100 +++
> >  board/raspberrypi/rpi/madt.aslc               |  78 ++
> >  board/raspberrypi/rpi/pci.asl                 | 168 ++++
> >  board/raspberrypi/rpi/pep.asl                 |  90 ++
> >  board/raspberrypi/rpi/pep.c                   |  79 ++
> >  board/raspberrypi/rpi/pep.h                   | 121 +++
> >  board/raspberrypi/rpi/pptt.aslc               | 191 +++++
> >  board/raspberrypi/rpi/rhpx.asl                | 195 +++++
> >  board/raspberrypi/rpi/rpi.c                   | 460 +++++++++-
> >  board/raspberrypi/rpi/rpi4.dsc                | 790 ++++++++++++++++++
> >  board/raspberrypi/rpi/sdhc.asl                | 119 +++
> >  board/raspberrypi/rpi/spcrminiuart.aslc       |  91 ++
> >  board/raspberrypi/rpi/spcrpl011.aslc          |  91 ++
> >  board/raspberrypi/rpi/ssdtthermal.asl         |  77 ++
> >  board/raspberrypi/rpi/uart.asl                | 202 +++++
> >  board/raspberrypi/rpi/xhci.asl                | 165 ++++
> >  cmd/acpi.c                                    |  13 +-
> >  cmd/bootefi.c                                 |  44 +-
> >  configs/cherryhill_defconfig                  |   1 +
> >  configs/chromebook_link64_defconfig           |   1 +
> >  configs/chromebook_link_defconfig             |   1 +
> >  configs/chromebook_samus_tpl_defconfig        |   1 +
> >  configs/coreboot64_defconfig                  |   1 +
> >  configs/coreboot_defconfig                    |   1 +
> >  configs/crownbay_defconfig                    |   1 +
> >  configs/efi-x86_payload32_defconfig           |   1 +
> >  configs/efi-x86_payload64_defconfig           |   1 +
> >  configs/rpi_4_defconfig                       |   2 +
> >  configs/slimbootloader_defconfig              |   1 +
> >  configs/tools-only_defconfig                  |   1 +
> >  doc/build/gcc.rst                             |  17 +
> >  doc/usage/acpi.rst                            | 235 ++++++
> >  doc/usage/index.rst                           |   1 +
> >  drivers/core/acpi.c                           |  70 +-
> >  drivers/misc/qfw.c                            |   3 +-
> >  include/acpi/acpi_table.h                     | 235 +++++-
> >  include/asm-generic/global_data.h             |   8 +
> >  include/dm/acpi.h                             | 110 +++
> >  lib/Kconfig                                   |  18 +
> >  lib/Makefile                                  |   2 +-
> >  lib/acpi/Makefile                             |  23 +-
> >  lib/acpi/acpi_table.c                         |  82 --
> >  lib/acpi/acpi_writer.c                        | 132 +++
> >  lib/acpi/base.c                               |  94 +++
> >  lib/acpi/csrt.c                               |  49 ++
> >  lib/acpi/dsdt.c                               |  55 ++
> >  lib/acpi/facs.c                               |  35 +
> >  lib/acpi/ssdt.c                               |  49 ++
> >  lib/efi_loader/Makefile                       |   2 -
> >  lib/efi_loader/efi_acpi.c                     |   5 +-
> >  scripts/Makefile.lib                          |   3 +-
> >  test/dm/acpi.c                                |  79 +-
> >  88 files changed, 6875 insertions(+), 506 deletions(-)
> >  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
> >  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
> >  create mode 100644
> arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
> >  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
> >  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
> >  create mode 100644
> arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
> >  create mode 100644
> arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
> >  create mode 100644 arch/sandbox/include/asm/tables.h
> >  create mode 100644 board/raspberrypi/rpi/acpitables.h
> >  create mode 100644 board/raspberrypi/rpi/acpitables.inf
> >  create mode 100644 board/raspberrypi/rpi/csrt.aslc
> >  create mode 100644 board/raspberrypi/rpi/dbg2miniuart.aslc
> >  create mode 100644 board/raspberrypi/rpi/dbg2pl011.aslc
> >  create mode 100644 board/raspberrypi/rpi/dsdt.asl
> >  create mode 100644 board/raspberrypi/rpi/emmc.asl
> >  create mode 100644 board/raspberrypi/rpi/fadt.aslc
> >  create mode 100644 board/raspberrypi/rpi/gpudevs.asl
> >  create mode 100644 board/raspberrypi/rpi/gtdt.aslc
> >  create mode 100644 board/raspberrypi/rpi/iort.aslc
> >  create mode 100644 board/raspberrypi/rpi/madt.aslc
> >  create mode 100644 board/raspberrypi/rpi/pci.asl
> >  create mode 100644 board/raspberrypi/rpi/pep.asl
> >  create mode 100644 board/raspberrypi/rpi/pep.c
> >  create mode 100644 board/raspberrypi/rpi/pep.h
> >  create mode 100644 board/raspberrypi/rpi/pptt.aslc
> >  create mode 100644 board/raspberrypi/rpi/rhpx.asl
> >  create mode 100644 board/raspberrypi/rpi/rpi4.dsc
> >  create mode 100644 board/raspberrypi/rpi/sdhc.asl
> >  create mode 100644 board/raspberrypi/rpi/spcrminiuart.aslc
> >  create mode 100644 board/raspberrypi/rpi/spcrpl011.aslc
> >  create mode 100644 board/raspberrypi/rpi/ssdtthermal.asl
> >  create mode 100644 board/raspberrypi/rpi/uart.asl
> >  create mode 100644 board/raspberrypi/rpi/xhci.asl
> >  create mode 100644 doc/usage/acpi.rst
> >  create mode 100644 lib/acpi/acpi_writer.c
> >  create mode 100644 lib/acpi/base.c
> >  create mode 100644 lib/acpi/csrt.c
> >  create mode 100644 lib/acpi/dsdt.c
> >  create mode 100644 lib/acpi/facs.c
> >  create mode 100644 lib/acpi/ssdt.c
> >
> > --
> > 2.34.0.rc2.393.gf8c9666880-goog
> >
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
Tom Rini Dec. 1, 2021, 6:23 p.m. UTC | #3
On Wed, Dec 01, 2021 at 06:50:05PM +0100, François Ozog wrote:
> Hi
> 
> 
> 
> Le mer. 1 déc. 2021 à 18:16, Andy Shevchenko <andy.shevchenko@gmail.com> a
> écrit :
> 
> > On Wed, Dec 1, 2021 at 6:56 PM Simon Glass <sjg@chromium.org> wrote:
> > >
> > > At present in U-Boot ACPI tables are only generated for x86 devices. It
> > is
> > > possible to build them for ARM as well. That is the subject of this
> > > series.
> > >
> 
> in the case of RPI4 what is needed is a translator from DT handed by
> Videocore. If you mean generated from an assumed configuration, that may
> not be good. Doing static ACPI based on assumptions as a first step is a
> dangerous path.

There are certainly some downsides to using a Pi, which is a lowest
common denominator platform, and so yes, some things we need to keep in
mind moving forward with more platforms.
Simon Glass Dec. 15, 2021, 3:28 a.m. UTC | #4
Hi Bin,

On Wed, 1 Dec 2021 at 09:04, Simon Glass <sjg@chromium.org> wrote:
>
> At present in U-Boot ACPI tables are only generated for x86 devices. It is
> possible to build them for ARM as well. That is the subject of this
> series.
>
> The goal is to allow a rpi4 boot into Linux on ARM using ACPI rather than
> devicetree. This is not due to any feeling that ACPI offers advantages to
> the boot flow, merely because it can be done.
>
> This goal is not yet achieved. Mostly all that is achieved is some
> refactoring of the ACPI code, but that is enough to get things at least
> building on ARM. The rpi-4 the tables are installed and the board boots
> to grub, where it is then unable to find the OS on the USB stick that is
> inserted. Further work is needed to complete things, but the ACPI changes
> can be applied as is.
>
> In terms of review, please ignore the RFC/WIP patches as they need to be
> reworked. I am sending this series in this state to avoid sitting on
> patches for too long and risking duplicate effort.
>
> The following tables are emitted with this series:
>
>    - GTDT - Generic Timer Description Table
>    - APIC - Multiple Advanced Programmable Interrupt Controller
>             Description Table (some new records for ARM)
>    - DSDT - Differentiated System Description Table
>    - DBG2 - Debug Port Table 2
>    - FACP - Firmware ACPI Control Structure
>    - CSRT - Core System Resource Table
>    - PPTT - Processor Properties Topology Table
>
> Missing still are:
>    - SSDR - Secondary System Description Table
>    - BGRT - Boot Graphics Resource Table
>
> Future work is needed to:
> - Finish the remaining two tables
> - Get things booting nicely on rpi4
> - Find a nice way to select between ACPI and devicetree at runtime
> - Obtain the ACPI information from the devicetree instead of #defines
> - Use the U-Boot bcm headers instead of importing new ones
> - Drop the unused files
> - Add some documentation
>
> To test it, boot U-Boot on a rpi_4 with a suitable distribution.
>
> This series is available at u-boot-dm/acpi-working
>
>
> Simon Glass (40):
>   Makefile: Allow LTO to be disabled for a build
>   x86: Allow any arch to generate ACPI tables
>   x86: Move the acpi table to generic global_data
>   arm: Allow supporting ACPI-table generation
>   x86: Tidy up use of CONFIG_ACPIGEN
>   sandbox: Allow building with GENERATE_ACPI_TABLE
>   efi: Correct call to write_acpi_tables()
>   efi: Correct address handling with ACPI tables
>   acpi: Use finer-grained control of ACPI-table generation
>   acpi: Allow include files within the board directory
>   acpi: Move acpi_fill_header() to the generic header
>   acpi: Add a table start
>   acpi: Add a linker list for ACPI tables
>   x86: acpi: Split out context creation from base tables
>   x86: Use the ACPI table writer
>   x86: Move base tables to a writer function
>   x86: Move FACS table to a writer function
>   x86: Move DSDT table to a writer function
>   x86: Move GNVS table to a writer function
>   x86: Move FADT table to a writer function
>   x86: Move FACP table into separate functions
>   x86: Move SSDT table to a writer function
>   x86: Move TPM2 table to a writer function
>   x86: Move MADT table to a writer function
>   x86: Move TCPA table to a writer function
>   x86: Move CSRT table to a writer function
>   x86: acpi: Update acpi_fill_csrt() to use acpi_ctx
>   x86: Move device-specific ACPI tables to a writer function
>   x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
>   acpi: Collect tables in the acpi_item list
>   acpi: Tidy up the item list
>   acpi: Tidy up the table list
>   doc: Add usage information for the acpi command
>   acpi: Add some tables needed by ARM devices
>   acpi: Add myself as maintainer
>   WIP: Add debugging for ACPI emission
>   RFC: Allow passing ACPI tables to bootefi
>   WIP: Add ASL files from tianocore
>   WIP: Bring in some header files from tianocore
>   RFC: rpi: Enable booting with ACPI tables
>
>  MAINTAINERS                                   |   6 +
>  Makefile                                      |  18 +-
>  arch/Kconfig                                  |   6 +-
>  arch/arm/config.mk                            |   4 +-
>  arch/arm/include/asm/acpi_table.h             |  15 +
>  arch/arm/include/asm/global_data.h            |   2 +-
>  .../mach-bcm283x/include/mach/acpi/bcm2711.h  |  93 +++
>  .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 124 +++
>  .../include/mach/acpi/bcm2836_gpio.h          |  85 ++
>  .../include/mach/acpi/bcm2836_gpu.h           |  48 ++
>  .../include/mach/acpi/bcm2836_pwm.h           |  34 +
>  .../include/mach/acpi/bcm2836_sdhost.h        |  90 ++
>  .../include/mach/acpi/bcm2836_sdio.h          | 203 +++++
>  arch/sandbox/include/asm/acpi_table.h         |   2 +
>  arch/sandbox/include/asm/global_data.h        |   1 -
>  arch/sandbox/include/asm/tables.h             |   0
>  arch/x86/Kconfig                              |   9 -
>  arch/x86/cpu/apollolake/acpi.c                |  17 +-
>  arch/x86/cpu/baytrail/acpi.c                  |  27 +-
>  arch/x86/cpu/quark/acpi.c                     |  27 +-
>  arch/x86/cpu/tangier/acpi.c                   |  34 +-
>  arch/x86/include/asm/acpi_table.h             |   4 -
>  arch/x86/include/asm/global_data.h            |   1 -
>  arch/x86/lib/Makefile                         |   2 +-
>  arch/x86/lib/acpi_table.c                     | 374 +++------
>  board/raspberrypi/rpi/Makefile                |   2 +
>  board/raspberrypi/rpi/acpitables.h            | 189 +++++
>  board/raspberrypi/rpi/acpitables.inf          |  79 ++
>  board/raspberrypi/rpi/csrt.aslc               | 330 ++++++++
>  board/raspberrypi/rpi/dbg2miniuart.aslc       |  81 ++
>  board/raspberrypi/rpi/dbg2pl011.aslc          |  81 ++
>  board/raspberrypi/rpi/dsdt.asl                | 285 +++++++
>  board/raspberrypi/rpi/emmc.asl                | 166 ++++
>  board/raspberrypi/rpi/fadt.aslc               |  96 +++
>  board/raspberrypi/rpi/gpudevs.asl             | 397 +++++++++
>  board/raspberrypi/rpi/gtdt.aslc               |  55 ++
>  board/raspberrypi/rpi/iort.aslc               | 100 +++
>  board/raspberrypi/rpi/madt.aslc               |  78 ++
>  board/raspberrypi/rpi/pci.asl                 | 168 ++++
>  board/raspberrypi/rpi/pep.asl                 |  90 ++
>  board/raspberrypi/rpi/pep.c                   |  79 ++
>  board/raspberrypi/rpi/pep.h                   | 121 +++
>  board/raspberrypi/rpi/pptt.aslc               | 191 +++++
>  board/raspberrypi/rpi/rhpx.asl                | 195 +++++
>  board/raspberrypi/rpi/rpi.c                   | 460 +++++++++-
>  board/raspberrypi/rpi/rpi4.dsc                | 790 ++++++++++++++++++
>  board/raspberrypi/rpi/sdhc.asl                | 119 +++
>  board/raspberrypi/rpi/spcrminiuart.aslc       |  91 ++
>  board/raspberrypi/rpi/spcrpl011.aslc          |  91 ++
>  board/raspberrypi/rpi/ssdtthermal.asl         |  77 ++
>  board/raspberrypi/rpi/uart.asl                | 202 +++++
>  board/raspberrypi/rpi/xhci.asl                | 165 ++++
>  cmd/acpi.c                                    |  13 +-
>  cmd/bootefi.c                                 |  44 +-
>  configs/cherryhill_defconfig                  |   1 +
>  configs/chromebook_link64_defconfig           |   1 +
>  configs/chromebook_link_defconfig             |   1 +
>  configs/chromebook_samus_tpl_defconfig        |   1 +
>  configs/coreboot64_defconfig                  |   1 +
>  configs/coreboot_defconfig                    |   1 +
>  configs/crownbay_defconfig                    |   1 +
>  configs/efi-x86_payload32_defconfig           |   1 +
>  configs/efi-x86_payload64_defconfig           |   1 +
>  configs/rpi_4_defconfig                       |   2 +
>  configs/slimbootloader_defconfig              |   1 +
>  configs/tools-only_defconfig                  |   1 +
>  doc/build/gcc.rst                             |  17 +
>  doc/usage/acpi.rst                            | 235 ++++++
>  doc/usage/index.rst                           |   1 +
>  drivers/core/acpi.c                           |  70 +-
>  drivers/misc/qfw.c                            |   3 +-
>  include/acpi/acpi_table.h                     | 235 +++++-
>  include/asm-generic/global_data.h             |   8 +
>  include/dm/acpi.h                             | 110 +++
>  lib/Kconfig                                   |  18 +
>  lib/Makefile                                  |   2 +-
>  lib/acpi/Makefile                             |  23 +-
>  lib/acpi/acpi_table.c                         |  82 --
>  lib/acpi/acpi_writer.c                        | 132 +++
>  lib/acpi/base.c                               |  94 +++
>  lib/acpi/csrt.c                               |  49 ++
>  lib/acpi/dsdt.c                               |  55 ++
>  lib/acpi/facs.c                               |  35 +
>  lib/acpi/ssdt.c                               |  49 ++
>  lib/efi_loader/Makefile                       |   2 -
>  lib/efi_loader/efi_acpi.c                     |   5 +-
>  scripts/Makefile.lib                          |   3 +-
>  test/dm/acpi.c                                |  79 +-
>  88 files changed, 6875 insertions(+), 506 deletions(-)
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
>  create mode 100644 arch/sandbox/include/asm/tables.h
>  create mode 100644 board/raspberrypi/rpi/acpitables.h
>  create mode 100644 board/raspberrypi/rpi/acpitables.inf
>  create mode 100644 board/raspberrypi/rpi/csrt.aslc
>  create mode 100644 board/raspberrypi/rpi/dbg2miniuart.aslc
>  create mode 100644 board/raspberrypi/rpi/dbg2pl011.aslc
>  create mode 100644 board/raspberrypi/rpi/dsdt.asl
>  create mode 100644 board/raspberrypi/rpi/emmc.asl
>  create mode 100644 board/raspberrypi/rpi/fadt.aslc
>  create mode 100644 board/raspberrypi/rpi/gpudevs.asl
>  create mode 100644 board/raspberrypi/rpi/gtdt.aslc
>  create mode 100644 board/raspberrypi/rpi/iort.aslc
>  create mode 100644 board/raspberrypi/rpi/madt.aslc
>  create mode 100644 board/raspberrypi/rpi/pci.asl
>  create mode 100644 board/raspberrypi/rpi/pep.asl
>  create mode 100644 board/raspberrypi/rpi/pep.c
>  create mode 100644 board/raspberrypi/rpi/pep.h
>  create mode 100644 board/raspberrypi/rpi/pptt.aslc
>  create mode 100644 board/raspberrypi/rpi/rhpx.asl
>  create mode 100644 board/raspberrypi/rpi/rpi4.dsc
>  create mode 100644 board/raspberrypi/rpi/sdhc.asl
>  create mode 100644 board/raspberrypi/rpi/spcrminiuart.aslc
>  create mode 100644 board/raspberrypi/rpi/spcrpl011.aslc
>  create mode 100644 board/raspberrypi/rpi/ssdtthermal.asl
>  create mode 100644 board/raspberrypi/rpi/uart.asl
>  create mode 100644 board/raspberrypi/rpi/xhci.asl
>  create mode 100644 doc/usage/acpi.rst
>  create mode 100644 lib/acpi/acpi_writer.c
>  create mode 100644 lib/acpi/base.c
>  create mode 100644 lib/acpi/csrt.c
>  create mode 100644 lib/acpi/dsdt.c
>  create mode 100644 lib/acpi/facs.c
>  create mode 100644 lib/acpi/ssdt.c
>
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>

Any thoughts on this series? It affects x86 quite a bit, so I would
appreciate any testing you can do. I have tried on coral, which uses
ACPI a lot.

Regards,
Simon
Simon Glass Jan. 22, 2022, 10:48 p.m. UTC | #5
Hi,

On Tue, 14 Dec 2021 at 20:28, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Wed, 1 Dec 2021 at 09:04, Simon Glass <sjg@chromium.org> wrote:
> >
> > At present in U-Boot ACPI tables are only generated for x86 devices. It is
> > possible to build them for ARM as well. That is the subject of this
> > series.
> >
> > The goal is to allow a rpi4 boot into Linux on ARM using ACPI rather than
> > devicetree. This is not due to any feeling that ACPI offers advantages to
> > the boot flow, merely because it can be done.
> >
> > This goal is not yet achieved. Mostly all that is achieved is some
> > refactoring of the ACPI code, but that is enough to get things at least
> > building on ARM. The rpi-4 the tables are installed and the board boots
> > to grub, where it is then unable to find the OS on the USB stick that is
> > inserted. Further work is needed to complete things, but the ACPI changes
> > can be applied as is.
> >
> > In terms of review, please ignore the RFC/WIP patches as they need to be
> > reworked. I am sending this series in this state to avoid sitting on
> > patches for too long and risking duplicate effort.
> >
> > The following tables are emitted with this series:
> >
> >    - GTDT - Generic Timer Description Table
> >    - APIC - Multiple Advanced Programmable Interrupt Controller
> >             Description Table (some new records for ARM)
> >    - DSDT - Differentiated System Description Table
> >    - DBG2 - Debug Port Table 2
> >    - FACP - Firmware ACPI Control Structure
> >    - CSRT - Core System Resource Table
> >    - PPTT - Processor Properties Topology Table
> >
> > Missing still are:
> >    - SSDR - Secondary System Description Table
> >    - BGRT - Boot Graphics Resource Table
> >
> > Future work is needed to:
> > - Finish the remaining two tables
> > - Get things booting nicely on rpi4
> > - Find a nice way to select between ACPI and devicetree at runtime
> > - Obtain the ACPI information from the devicetree instead of #defines
> > - Use the U-Boot bcm headers instead of importing new ones
> > - Drop the unused files
> > - Add some documentation
> >
> > To test it, boot U-Boot on a rpi_4 with a suitable distribution.
> >
> > This series is available at u-boot-dm/acpi-working
> >

[..]

Thanks Andy for the review. I'm going to apply the first part of this
tomorrow and see if we can get it in before rc1. Then I'll give the
rpi bit another crack.

Regards,
Simon