Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 1 | ACPI on ARMv8 Servers |
| 2 | --------------------- |
| 3 | ACPI can be used for ARMv8 general purpose servers designed to follow |
| 4 | the ARM SBSA (Server Base System Architecture) [0] and SBBR (Server |
| 5 | Base Boot Requirements) [1] specifications. Please note that the SBBR |
| 6 | can be retrieved simply by visiting [1], but the SBSA is currently only |
| 7 | available to those with an ARM login due to ARM IP licensing concerns. |
| 8 | |
| 9 | The ARMv8 kernel implements the reduced hardware model of ACPI version |
| 10 | 5.1 or later. Links to the specification and all external documents |
| 11 | it refers to are managed by the UEFI Forum. The specification is |
| 12 | available at http://www.uefi.org/specifications and documents referenced |
| 13 | by the specification can be found via http://www.uefi.org/acpi. |
| 14 | |
| 15 | If an ARMv8 system does not meet the requirements of the SBSA and SBBR, |
| 16 | or cannot be described using the mechanisms defined in the required ACPI |
| 17 | specifications, then ACPI may not be a good fit for the hardware. |
| 18 | |
| 19 | While the documents mentioned above set out the requirements for building |
| 20 | industry-standard ARMv8 servers, they also apply to more than one operating |
| 21 | system. The purpose of this document is to describe the interaction between |
| 22 | ACPI and Linux only, on an ARMv8 system -- that is, what Linux expects of |
| 23 | ACPI and what ACPI can expect of Linux. |
| 24 | |
| 25 | |
| 26 | Why ACPI on ARM? |
| 27 | ---------------- |
| 28 | Before examining the details of the interface between ACPI and Linux, it is |
| 29 | useful to understand why ACPI is being used. Several technologies already |
| 30 | exist in Linux for describing non-enumerable hardware, after all. In this |
| 31 | section we summarize a blog post [2] from Grant Likely that outlines the |
| 32 | reasoning behind ACPI on ARMv8 servers. Actually, we snitch a good portion |
| 33 | of the summary text almost directly, to be honest. |
| 34 | |
| 35 | The short form of the rationale for ACPI on ARM is: |
| 36 | |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 37 | -- ACPI’s byte code (AML) allows the platform to encode hardware behavior, |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 38 | while DT explicitly does not support this. For hardware vendors, being |
| 39 | able to encode behavior is a key tool used in supporting operating |
| 40 | system releases on new hardware. |
| 41 | |
| 42 | -- ACPI’s OSPM defines a power management model that constrains what the |
| 43 | platform is allowed to do into a specific model, while still providing |
| 44 | flexibility in hardware design. |
| 45 | |
| 46 | -- In the enterprise server environment, ACPI has established bindings (such |
| 47 | as for RAS) which are currently used in production systems. DT does not. |
| 48 | Such bindings could be defined in DT at some point, but doing so means ARM |
| 49 | and x86 would end up using completely different code paths in both firmware |
| 50 | and the kernel. |
| 51 | |
| 52 | -- Choosing a single interface to describe the abstraction between a platform |
| 53 | and an OS is important. Hardware vendors would not be required to implement |
| 54 | both DT and ACPI if they want to support multiple operating systems. And, |
| 55 | agreeing on a single interface instead of being fragmented into per OS |
| 56 | interfaces makes for better interoperability overall. |
| 57 | |
| 58 | -- The new ACPI governance process works well and Linux is now at the same |
| 59 | table as hardware vendors and other OS vendors. In fact, there is no |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 60 | longer any reason to feel that ACPI only belongs to Windows or that |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 61 | Linux is in any way secondary to Microsoft in this arena. The move of |
| 62 | ACPI governance into the UEFI forum has significantly opened up the |
| 63 | specification development process, and currently, a large portion of the |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 64 | changes being made to ACPI are being driven by Linux. |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 65 | |
| 66 | Key to the use of ACPI is the support model. For servers in general, the |
| 67 | responsibility for hardware behaviour cannot solely be the domain of the |
| 68 | kernel, but rather must be split between the platform and the kernel, in |
| 69 | order to allow for orderly change over time. ACPI frees the OS from needing |
| 70 | to understand all the minute details of the hardware so that the OS doesn’t |
| 71 | need to be ported to each and every device individually. It allows the |
| 72 | hardware vendors to take responsibility for power management behaviour without |
| 73 | depending on an OS release cycle which is not under their control. |
| 74 | |
| 75 | ACPI is also important because hardware and OS vendors have already worked |
| 76 | out the mechanisms for supporting a general purpose computing ecosystem. The |
| 77 | infrastructure is in place, the bindings are in place, and the processes are |
| 78 | in place. DT does exactly what Linux needs it to when working with vertically |
| 79 | integrated devices, but there are no good processes for supporting what the |
| 80 | server vendors need. Linux could potentially get there with DT, but doing so |
| 81 | really just duplicates something that already works. ACPI already does what |
| 82 | the hardware vendors need, Microsoft won’t collaborate on DT, and hardware |
| 83 | vendors would still end up providing two completely separate firmware |
| 84 | interfaces -- one for Linux and one for Windows. |
| 85 | |
| 86 | |
| 87 | Kernel Compatibility |
| 88 | -------------------- |
| 89 | One of the primary motivations for ACPI is standardization, and using that |
| 90 | to provide backward compatibility for Linux kernels. In the server market, |
| 91 | software and hardware are often used for long periods. ACPI allows the |
| 92 | kernel and firmware to agree on a consistent abstraction that can be |
| 93 | maintained over time, even as hardware or software change. As long as the |
| 94 | abstraction is supported, systems can be updated without necessarily having |
| 95 | to replace the kernel. |
| 96 | |
| 97 | When a Linux driver or subsystem is first implemented using ACPI, it by |
| 98 | definition ends up requiring a specific version of the ACPI specification |
| 99 | -- it's baseline. ACPI firmware must continue to work, even though it may |
| 100 | not be optimal, with the earliest kernel version that first provides support |
| 101 | for that baseline version of ACPI. There may be a need for additional drivers, |
| 102 | but adding new functionality (e.g., CPU power management) should not break |
| 103 | older kernel versions. Further, ACPI firmware must also work with the most |
| 104 | recent version of the kernel. |
| 105 | |
| 106 | |
| 107 | Relationship with Device Tree |
| 108 | ----------------------------- |
| 109 | ACPI support in drivers and subsystems for ARMv8 should never be mutually |
| 110 | exclusive with DT support at compile time. |
| 111 | |
| 112 | At boot time the kernel will only use one description method depending on |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 113 | parameters passed from the boot loader (including kernel bootargs). |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 114 | |
| 115 | Regardless of whether DT or ACPI is used, the kernel must always be capable |
| 116 | of booting with either scheme (in kernels with both schemes enabled at compile |
| 117 | time). |
| 118 | |
| 119 | |
| 120 | Booting using ACPI tables |
| 121 | ------------------------- |
| 122 | The only defined method for passing ACPI tables to the kernel on ARMv8 |
| 123 | is via the UEFI system configuration table. Just so it is explicit, this |
| 124 | means that ACPI is only supported on platforms that boot via UEFI. |
| 125 | |
| 126 | When an ARMv8 system boots, it can either have DT information, ACPI tables, |
| 127 | or in some very unusual cases, both. If no command line parameters are used, |
| 128 | the kernel will try to use DT for device enumeration; if there is no DT |
| 129 | present, the kernel will try to use ACPI tables, but only if they are present. |
| 130 | In neither is available, the kernel will not boot. If acpi=force is used |
| 131 | on the command line, the kernel will attempt to use ACPI tables first, but |
| 132 | fall back to DT if there are no ACPI tables present. The basic idea is that |
| 133 | the kernel will not fail to boot unless it absolutely has no other choice. |
| 134 | |
| 135 | Processing of ACPI tables may be disabled by passing acpi=off on the kernel |
| 136 | command line; this is the default behavior. |
| 137 | |
| 138 | In order for the kernel to load and use ACPI tables, the UEFI implementation |
| 139 | MUST set the ACPI_20_TABLE_GUID to point to the RSDP table (the table with |
| 140 | the ACPI signature "RSD PTR "). If this pointer is incorrect and acpi=force |
| 141 | is used, the kernel will disable ACPI and try to use DT to boot instead; the |
| 142 | kernel has, in effect, determined that ACPI tables are not present at that |
| 143 | point. |
| 144 | |
| 145 | If the pointer to the RSDP table is correct, the table will be mapped into |
| 146 | the kernel by the ACPI core, using the address provided by UEFI. |
| 147 | |
| 148 | The ACPI core will then locate and map in all other ACPI tables provided by |
| 149 | using the addresses in the RSDP table to find the XSDT (eXtended System |
| 150 | Description Table). The XSDT in turn provides the addresses to all other |
| 151 | ACPI tables provided by the system firmware; the ACPI core will then traverse |
| 152 | this table and map in the tables listed. |
| 153 | |
| 154 | The ACPI core will ignore any provided RSDT (Root System Description Table). |
| 155 | RSDTs have been deprecated and are ignored on arm64 since they only allow |
| 156 | for 32-bit addresses. |
| 157 | |
| 158 | Further, the ACPI core will only use the 64-bit address fields in the FADT |
| 159 | (Fixed ACPI Description Table). Any 32-bit address fields in the FADT will |
| 160 | be ignored on arm64. |
| 161 | |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 162 | Hardware reduced mode (see Section 4.1 of the ACPI 6.1 specification) will |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 163 | be enforced by the ACPI core on arm64. Doing so allows the ACPI core to |
| 164 | run less complex code since it no longer has to provide support for legacy |
| 165 | hardware from other architectures. Any fields that are not to be used for |
| 166 | hardware reduced mode must be set to zero. |
| 167 | |
| 168 | For the ACPI core to operate properly, and in turn provide the information |
| 169 | the kernel needs to configure devices, it expects to find the following |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 170 | tables (all section numbers refer to the ACPI 6.1 specification): |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 171 | |
| 172 | -- RSDP (Root System Description Pointer), section 5.2.5 |
| 173 | |
| 174 | -- XSDT (eXtended System Description Table), section 5.2.8 |
| 175 | |
| 176 | -- FADT (Fixed ACPI Description Table), section 5.2.9 |
| 177 | |
| 178 | -- DSDT (Differentiated System Description Table), section |
| 179 | 5.2.11.1 |
| 180 | |
| 181 | -- MADT (Multiple APIC Description Table), section 5.2.12 |
| 182 | |
| 183 | -- GTDT (Generic Timer Description Table), section 5.2.24 |
| 184 | |
| 185 | -- If PCI is supported, the MCFG (Memory mapped ConFiGuration |
| 186 | Table), section 5.2.6, specifically Table 5-31. |
| 187 | |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 188 | -- If booting without a console=<device> kernel parameter is |
| 189 | supported, the SPCR (Serial Port Console Redirection table), |
| 190 | section 5.2.6, specifically Table 5-31. |
| 191 | |
| 192 | -- If necessary to describe the I/O topology, SMMUs and GIC ITSs, |
| 193 | the IORT (Input Output Remapping Table, section 5.2.6, specifically |
| 194 | Table 5-31). |
| 195 | |
| 196 | -- If NUMA is supported, the SRAT (System Resource Affinity Table) |
| 197 | and SLIT (System Locality distance Information Table), sections |
| 198 | 5.2.16 and 5.2.17, respectively. |
| 199 | |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 200 | If the above tables are not all present, the kernel may or may not be |
| 201 | able to boot properly since it may not be able to configure all of the |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 202 | devices available. This list of tables is not meant to be all inclusive; |
| 203 | in some environments other tables may be needed (e.g., any of the APEI |
| 204 | tables from section 18) to support specific functionality. |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 205 | |
| 206 | |
| 207 | ACPI Detection |
| 208 | -------------- |
| 209 | Drivers should determine their probe() type by checking for a null |
| 210 | value for ACPI_HANDLE, or checking .of_node, or other information in |
| 211 | the device structure. This is detailed further in the "Driver |
| 212 | Recommendations" section. |
| 213 | |
| 214 | In non-driver code, if the presence of ACPI needs to be detected at |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 215 | run time, then check the value of acpi_disabled. If CONFIG_ACPI is not |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 216 | set, acpi_disabled will always be 1. |
| 217 | |
| 218 | |
| 219 | Device Enumeration |
| 220 | ------------------ |
| 221 | Device descriptions in ACPI should use standard recognized ACPI interfaces. |
| 222 | These may contain less information than is typically provided via a Device |
| 223 | Tree description for the same device. This is also one of the reasons that |
| 224 | ACPI can be useful -- the driver takes into account that it may have less |
| 225 | detailed information about the device and uses sensible defaults instead. |
| 226 | If done properly in the driver, the hardware can change and improve over |
| 227 | time without the driver having to change at all. |
| 228 | |
| 229 | Clocks provide an excellent example. In DT, clocks need to be specified |
| 230 | and the drivers need to take them into account. In ACPI, the assumption |
| 231 | is that UEFI will leave the device in a reasonable default state, including |
| 232 | any clock settings. If for some reason the driver needs to change a clock |
| 233 | value, this can be done in an ACPI method; all the driver needs to do is |
| 234 | invoke the method and not concern itself with what the method needs to do |
| 235 | to change the clock. Changing the hardware can then take place over time |
| 236 | by changing what the ACPI method does, and not the driver. |
| 237 | |
| 238 | In DT, the parameters needed by the driver to set up clocks as in the example |
| 239 | above are known as "bindings"; in ACPI, these are known as "Device Properties" |
| 240 | and provided to a driver via the _DSD object. |
| 241 | |
| 242 | ACPI tables are described with a formal language called ASL, the ACPI |
| 243 | Source Language (section 19 of the specification). This means that there |
| 244 | are always multiple ways to describe the same thing -- including device |
| 245 | properties. For example, device properties could use an ASL construct |
| 246 | that looks like this: Name(KEY0, "value0"). An ACPI device driver would |
| 247 | then retrieve the value of the property by evaluating the KEY0 object. |
| 248 | However, using Name() this way has multiple problems: (1) ACPI limits |
| 249 | names ("KEY0") to four characters unlike DT; (2) there is no industry |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 250 | wide registry that maintains a list of names, minimizing re-use; (3) |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 251 | there is also no registry for the definition of property values ("value0"), |
| 252 | again making re-use difficult; and (4) how does one maintain backward |
| 253 | compatibility as new hardware comes out? The _DSD method was created |
| 254 | to solve precisely these sorts of problems; Linux drivers should ALWAYS |
| 255 | use the _DSD method for device properties and nothing else. |
| 256 | |
| 257 | The _DSM object (ACPI Section 9.14.1) could also be used for conveying |
| 258 | device properties to a driver. Linux drivers should only expect it to |
| 259 | be used if _DSD cannot represent the data required, and there is no way |
| 260 | to create a new UUID for the _DSD object. Note that there is even less |
| 261 | regulation of the use of _DSM than there is of _DSD. Drivers that depend |
| 262 | on the contents of _DSM objects will be more difficult to maintain over |
| 263 | time because of this; as of this writing, the use of _DSM is the cause |
| 264 | of quite a few firmware problems and is not recommended. |
| 265 | |
| 266 | Drivers should look for device properties in the _DSD object ONLY; the _DSD |
| 267 | object is described in the ACPI specification section 6.2.5, but this only |
| 268 | describes how to define the structure of an object returned via _DSD, and |
| 269 | how specific data structures are defined by specific UUIDs. Linux should |
| 270 | only use the _DSD Device Properties UUID [5]: |
| 271 | |
| 272 | -- UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 |
| 273 | |
| 274 | -- http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf |
| 275 | |
| 276 | The UEFI Forum provides a mechanism for registering device properties [4] |
| 277 | so that they may be used across all operating systems supporting ACPI. |
| 278 | Device properties that have not been registered with the UEFI Forum should |
| 279 | not be used. |
| 280 | |
| 281 | Before creating new device properties, check to be sure that they have not |
| 282 | been defined before and either registered in the Linux kernel documentation |
| 283 | as DT bindings, or the UEFI Forum as device properties. While we do not want |
| 284 | to simply move all DT bindings into ACPI device properties, we can learn from |
| 285 | what has been previously defined. |
| 286 | |
| 287 | If it is necessary to define a new device property, or if it makes sense to |
| 288 | synthesize the definition of a binding so it can be used in any firmware, |
| 289 | both DT bindings and ACPI device properties for device drivers have review |
| 290 | processes. Use them both. When the driver itself is submitted for review |
| 291 | to the Linux mailing lists, the device property definitions needed must be |
| 292 | submitted at the same time. A driver that supports ACPI and uses device |
| 293 | properties will not be considered complete without their definitions. Once |
| 294 | the device property has been accepted by the Linux community, it must be |
| 295 | registered with the UEFI Forum [4], which will review it again for consistency |
| 296 | within the registry. This may require iteration. The UEFI Forum, though, |
| 297 | will always be the canonical site for device property definitions. |
| 298 | |
| 299 | It may make sense to provide notice to the UEFI Forum that there is the |
| 300 | intent to register a previously unused device property name as a means of |
| 301 | reserving the name for later use. Other operating system vendors will |
| 302 | also be submitting registration requests and this may help smooth the |
| 303 | process. |
| 304 | |
| 305 | Once registration and review have been completed, the kernel provides an |
| 306 | interface for looking up device properties in a manner independent of |
| 307 | whether DT or ACPI is being used. This API should be used [6]; it can |
| 308 | eliminate some duplication of code paths in driver probing functions and |
| 309 | discourage divergence between DT bindings and ACPI device properties. |
| 310 | |
| 311 | |
| 312 | Programmable Power Control Resources |
| 313 | ------------------------------------ |
| 314 | Programmable power control resources include such resources as voltage/current |
| 315 | providers (regulators) and clock sources. |
| 316 | |
| 317 | With ACPI, the kernel clock and regulator framework is not expected to be used |
| 318 | at all. |
| 319 | |
| 320 | The kernel assumes that power control of these resources is represented with |
| 321 | Power Resource Objects (ACPI section 7.1). The ACPI core will then handle |
| 322 | correctly enabling and disabling resources as they are needed. In order to |
| 323 | get that to work, ACPI assumes each device has defined D-states and that these |
| 324 | can be controlled through the optional ACPI methods _PS0, _PS1, _PS2, and _PS3; |
| 325 | in ACPI, _PS0 is the method to invoke to turn a device full on, and _PS3 is for |
| 326 | turning a device full off. |
| 327 | |
| 328 | There are two options for using those Power Resources. They can: |
| 329 | |
| 330 | -- be managed in a _PSx method which gets called on entry to power |
| 331 | state Dx. |
| 332 | |
| 333 | -- be declared separately as power resources with their own _ON and _OFF |
| 334 | methods. They are then tied back to D-states for a particular device |
| 335 | via _PRx which specifies which power resources a device needs to be on |
| 336 | while in Dx. Kernel then tracks number of devices using a power resource |
| 337 | and calls _ON/_OFF as needed. |
| 338 | |
| 339 | The kernel ACPI code will also assume that the _PSx methods follow the normal |
| 340 | ACPI rules for such methods: |
| 341 | |
| 342 | -- If either _PS0 or _PS3 is implemented, then the other method must also |
| 343 | be implemented. |
| 344 | |
| 345 | -- If a device requires usage or setup of a power resource when on, the ASL |
| 346 | should organize that it is allocated/enabled using the _PS0 method. |
| 347 | |
| 348 | -- Resources allocated or enabled in the _PS0 method should be disabled |
| 349 | or de-allocated in the _PS3 method. |
| 350 | |
| 351 | -- Firmware will leave the resources in a reasonable state before handing |
| 352 | over control to the kernel. |
| 353 | |
| 354 | Such code in _PSx methods will of course be very platform specific. But, |
| 355 | this allows the driver to abstract out the interface for operating the device |
| 356 | and avoid having to read special non-standard values from ACPI tables. Further, |
| 357 | abstracting the use of these resources allows the hardware to change over time |
| 358 | without requiring updates to the driver. |
| 359 | |
| 360 | |
| 361 | Clocks |
| 362 | ------ |
| 363 | ACPI makes the assumption that clocks are initialized by the firmware -- |
| 364 | UEFI, in this case -- to some working value before control is handed over |
| 365 | to the kernel. This has implications for devices such as UARTs, or SoC-driven |
| 366 | LCD displays, for example. |
| 367 | |
| 368 | When the kernel boots, the clocks are assumed to be set to reasonable |
| 369 | working values. If for some reason the frequency needs to change -- e.g., |
| 370 | throttling for power management -- the device driver should expect that |
| 371 | process to be abstracted out into some ACPI method that can be invoked |
| 372 | (please see the ACPI specification for further recommendations on standard |
| 373 | methods to be expected). The only exceptions to this are CPU clocks where |
| 374 | CPPC provides a much richer interface than ACPI methods. If the clocks |
| 375 | are not set, there is no direct way for Linux to control them. |
| 376 | |
| 377 | If an SoC vendor wants to provide fine-grained control of the system clocks, |
| 378 | they could do so by providing ACPI methods that could be invoked by Linux |
| 379 | drivers. However, this is NOT recommended and Linux drivers should NOT use |
| 380 | such methods, even if they are provided. Such methods are not currently |
| 381 | standardized in the ACPI specification, and using them could tie a kernel |
| 382 | to a very specific SoC, or tie an SoC to a very specific version of the |
| 383 | kernel, both of which we are trying to avoid. |
| 384 | |
| 385 | |
| 386 | Driver Recommendations |
| 387 | ---------------------- |
| 388 | DO NOT remove any DT handling when adding ACPI support for a driver. The |
| 389 | same device may be used on many different systems. |
| 390 | |
| 391 | DO try to structure the driver so that it is data-driven. That is, set up |
| 392 | a struct containing internal per-device state based on defaults and whatever |
| 393 | else must be discovered by the driver probe function. Then, have the rest |
| 394 | of the driver operate off of the contents of that struct. Doing so should |
| 395 | allow most divergence between ACPI and DT functionality to be kept local to |
| 396 | the probe function instead of being scattered throughout the driver. For |
| 397 | example: |
| 398 | |
| 399 | static int device_probe_dt(struct platform_device *pdev) |
| 400 | { |
| 401 | /* DT specific functionality */ |
| 402 | ... |
| 403 | } |
| 404 | |
| 405 | static int device_probe_acpi(struct platform_device *pdev) |
| 406 | { |
| 407 | /* ACPI specific functionality */ |
| 408 | ... |
| 409 | } |
| 410 | |
| 411 | static int device_probe(struct platform_device *pdev) |
| 412 | { |
| 413 | ... |
| 414 | struct device_node node = pdev->dev.of_node; |
| 415 | ... |
| 416 | |
| 417 | if (node) |
| 418 | ret = device_probe_dt(pdev); |
| 419 | else if (ACPI_HANDLE(&pdev->dev)) |
| 420 | ret = device_probe_acpi(pdev); |
| 421 | else |
| 422 | /* other initialization */ |
| 423 | ... |
| 424 | /* Continue with any generic probe operations */ |
| 425 | ... |
| 426 | } |
| 427 | |
| 428 | DO keep the MODULE_DEVICE_TABLE entries together in the driver to make it |
| 429 | clear the different names the driver is probed for, both from DT and from |
| 430 | ACPI: |
| 431 | |
| 432 | static struct of_device_id virtio_mmio_match[] = { |
| 433 | { .compatible = "virtio,mmio", }, |
| 434 | { } |
| 435 | }; |
| 436 | MODULE_DEVICE_TABLE(of, virtio_mmio_match); |
| 437 | |
| 438 | static const struct acpi_device_id virtio_mmio_acpi_match[] = { |
| 439 | { "LNRO0005", }, |
| 440 | { } |
| 441 | }; |
| 442 | MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match); |
| 443 | |
| 444 | |
| 445 | ASWG |
| 446 | ---- |
| 447 | The ACPI specification changes regularly. During the year 2014, for instance, |
| 448 | version 5.1 was released and version 6.0 substantially completed, with most of |
| 449 | the changes being driven by ARM-specific requirements. Proposed changes are |
| 450 | presented and discussed in the ASWG (ACPI Specification Working Group) which |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 451 | is a part of the UEFI Forum. The current version of the ACPI specification |
| 452 | is 6.1 release in January 2016. |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 453 | |
| 454 | Participation in this group is open to all UEFI members. Please see |
| 455 | http://www.uefi.org/workinggroup for details on group membership. |
| 456 | |
| 457 | It is the intent of the ARMv8 ACPI kernel code to follow the ACPI specification |
| 458 | as closely as possible, and to only implement functionality that complies with |
| 459 | the released standards from UEFI ASWG. As a practical matter, there will be |
| 460 | vendors that provide bad ACPI tables or violate the standards in some way. |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 461 | If this is because of errors, quirks and fix-ups may be necessary, but will |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 462 | be avoided if possible. If there are features missing from ACPI that preclude |
| 463 | it from being used on a platform, ECRs (Engineering Change Requests) should be |
| 464 | submitted to ASWG and go through the normal approval process; for those that |
| 465 | are not UEFI members, many other members of the Linux community are and would |
| 466 | likely be willing to assist in submitting ECRs. |
| 467 | |
| 468 | |
| 469 | Linux Code |
| 470 | ---------- |
| 471 | Individual items specific to Linux on ARM, contained in the the Linux |
| 472 | source code, are in the list that follows: |
| 473 | |
| 474 | ACPI_OS_NAME This macro defines the string to be returned when |
| 475 | an ACPI method invokes the _OS method. On ARM64 |
| 476 | systems, this macro will be "Linux" by default. |
| 477 | The command line parameter acpi_os=<string> |
| 478 | can be used to set it to some other value. The |
| 479 | default value for other architectures is "Microsoft |
| 480 | Windows NT", for example. |
| 481 | |
| 482 | ACPI Objects |
| 483 | ------------ |
| 484 | Detailed expectations for ACPI tables and object are listed in the file |
| 485 | Documentation/arm64/acpi_object_usage.txt. |
| 486 | |
| 487 | |
| 488 | References |
| 489 | ---------- |
| 490 | [0] http://silver.arm.com -- document ARM-DEN-0029, or newer |
| 491 | "Server Base System Architecture", version 2.3, dated 27 Mar 2014 |
| 492 | |
| 493 | [1] http://infocenter.arm.com/help/topic/com.arm.doc.den0044a/Server_Base_Boot_Requirements.pdf |
| 494 | Document ARM-DEN-0044A, or newer: "Server Base Boot Requirements, System |
| 495 | Software on ARM Platforms", dated 16 Aug 2014 |
| 496 | |
| 497 | [2] http://www.secretlab.ca/archives/151, 10 Jan 2015, Copyright (c) 2015, |
Al Stone | 83ce0ef | 2016-06-13 15:41:55 -0600 | [diff] [blame] | 498 | Linaro Ltd., written by Grant Likely. |
Graeme Gregory | dc81f2c | 2015-03-24 14:02:54 +0000 | [diff] [blame] | 499 | |
| 500 | [3] AMD ACPI for Seattle platform documentation: |
| 501 | http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Seattle_ACPI_Guide.pdf |
| 502 | |
| 503 | [4] http://www.uefi.org/acpi -- please see the link for the "ACPI _DSD Device |
| 504 | Property Registry Instructions" |
| 505 | |
| 506 | [5] http://www.uefi.org/acpi -- please see the link for the "_DSD (Device |
| 507 | Specific Data) Implementation Guide" |
| 508 | |
| 509 | [6] Kernel code for the unified device property interface can be found in |
| 510 | include/linux/property.h and drivers/base/property.c. |
| 511 | |
| 512 | |
| 513 | Authors |
| 514 | ------- |
| 515 | Al Stone <al.stone@linaro.org> |
| 516 | Graeme Gregory <graeme.gregory@linaro.org> |
| 517 | Hanjun Guo <hanjun.guo@linaro.org> |
| 518 | |
| 519 | Grant Likely <grant.likely@linaro.org>, for the "Why ACPI on ARM?" section |