Pull devicetree updates from Rob Herring: - Refactor powerpc and arm64 kexec DT handling to common code. This enables IMA on arm64. - Add kbuild support for applying DT overlays at build time. The first user are the DT unittests. - Fix kerneldoc formatting and W=1 warnings in drivers/of/ - Fix handling 64-bit flag on PCI resources - Bump dtschema version required to v2021.2.1 - Enable undocumented compatible checks for dtbs_check. This allows tracking of missing binding schemas. - DT docs improvements. Regroup the DT docs and add the example schema and DT kernel ABI docs to the doc build. - Convert Broadcom Bluetooth and video-mux bindings to schema - Add QCom sm8250 Venus video codec binding schema - Add vendor prefixes for AESOP, YIC System Co., Ltd, and Siliconfile Technologies Inc. - Cleanup of DT schema type references on common properties and standard unit properties * tag 'devicetree-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (64 commits) powerpc: If kexec_build_elf_info() fails return immediately from elf64_load() powerpc: Free fdt on error in elf64_load() of: overlay: Fix kerneldoc warning in of_overlay_remove() of: linux/of.h: fix kernel-doc warnings of/pci: Add IORESOURCE_MEM_64 to resource flags for 64-bit memory addresses dt-bindings: bcm4329-fmac: add optional brcm,ccode-map docs: dt: update writing-schema.rst references dt-bindings: media: venus: Add sm8250 dt schema of: base: Fix spelling issue with function param 'prop' docs: dt: Add DT API documentation of: Add missing 'Return' section in kerneldoc comments of: Fix kerneldoc output formatting docs: dt: Group DT docs into relevant sub-sections docs: dt: Make 'Devicetree' wording more consistent docs: dt: writing-schema: Include the example schema in the doc build docs: dt: writing-schema: Remove spurious indentation dt-bindings: Fix reference in submitting-patches.rst to the DT ABI doc dt-bindings: ddr: Add optional manufacturer and revision ID to LPDDR3 dt-bindings: media: video-interfaces: Drop the example devicetree: bindings: clock: Minor typo fix in the file armada3700-tbg-clock.txt ...
Unified · Split
| @@ -5,7 +5,7 @@ DT_MK_SCHEMA ?= dt-mk-schema · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | DT_SCHEMA_LINT = $(shell which yamllint) | 6 | DT_SCHEMA_LINT = $(shell which yamllint) |
| 7 | 7 | ||
| 8 | DT_SCHEMA_MIN_VERSION = 2020.8.1 | 8 | DT_SCHEMA_MIN_VERSION = 2021.2.1 |
| 9 | 9 | ||
| 10 | PHONY += check_dtschema_version | 10 | PHONY += check_dtschema_version |
| 11 | check_dtschema_version: | 11 | check_dtschema_version: |
| @@ -55,6 +55,9 @@ override DTC_FLAGS := \ · 43 unmodified lines | |||
| 55 | -Wno-graph_child_address \ | 55 | -Wno-graph_child_address \ |
| 56 | -Wno-interrupt_provider | 56 | -Wno-interrupt_provider |
| 57 | 57 | ||
| 58 | # Disable undocumented compatible checks until warning free | ||
| 59 | override DT_CHECKER_FLAGS ?= | ||
| 60 | |||
| 58 | $(obj)/processed-schema-examples.json: $(DT_DOCS) $(src)/.yamllint check_dtschema_version FORCE | 61 | $(obj)/processed-schema-examples.json: $(DT_DOCS) $(src)/.yamllint check_dtschema_version FORCE |
| 59 | $(call if_changed_rule,chkdt) | 62 | $(call if_changed_rule,chkdt) |
| 60 | 63 | ||
| @@ -26,10 +26,7 @@ properties: · 25 unmodified lines | |||
| 26 | - const: simple-mfd | 26 | - const: simple-mfd |
| 27 | 27 | ||
| 28 | mboxes: | 28 | mboxes: |
| 29 | $ref: '/schemas/types.yaml#/definitions/phandle' | 29 | maxItems: 1 |
| 30 | description: | | ||
| 31 | Phandle to the firmware device's Mailbox. | ||
| 32 | (See: ../mailbox/mailbox.txt for more information) | ||
| 33 | 30 | ||
| 34 | clocks: | 31 | clocks: |
| 35 | type: object | 32 | type: object |
| @@ -258,13 +258,11 @@ properties: · 257 unmodified lines | |||
| 258 | where voltage is in V, frequency is in MHz. | 258 | where voltage is in V, frequency is in MHz. |
| 259 | 259 | ||
| 260 | power-domains: | 260 | power-domains: |
| 261 | $ref: '/schemas/types.yaml#/definitions/phandle-array' | ||
| 262 | description: | 261 | description: |
| 263 | List of phandles and PM domain specifiers, as defined by bindings of the | 262 | List of phandles and PM domain specifiers, as defined by bindings of the |
| 264 | PM domain provider (see also ../power_domain.txt). | 263 | PM domain provider (see also ../power_domain.txt). |
| 265 | 264 | ||
| 266 | power-domain-names: | 265 | power-domain-names: |
| 267 | $ref: '/schemas/types.yaml#/definitions/string-array' | ||
| 268 | description: | 266 | description: |
| 269 | A list of power domain name strings sorted in the same order as the | 267 | A list of power domain name strings sorted in the same order as the |
| 270 | power-domains property. | 268 | power-domains property. |
| @@ -44,7 +44,7 @@ examples: · 43 unmodified lines | |||
| 44 | - | | 44 | - | |
| 45 | clk@1c20000 { | 45 | clk@1c20000 { |
| 46 | #clock-cells = <0>; | 46 | #clock-cells = <0>; |
| 47 | compatible = "allwinner,sun4i-a10-pll1"; | 47 | compatible = "allwinner,sun4i-a10-pll1-clk"; |
| 48 | reg = <0x01c20000 0x4>; | 48 | reg = <0x01c20000 0x4>; |
| 49 | clocks = <&osc24M>; | 49 | clocks = <&osc24M>; |
| 50 | clock-output-names = "osc24M"; | 50 | clock-output-names = "osc24M"; |
| @@ -1,6 +1,6 @@ | |||
| 1 | * Time Base Generator Clock bindings for Marvell Armada 37xx SoCs | 1 | * Time Base Generator Clock bindings for Marvell Armada 37xx SoCs |
| 2 | 2 | ||
| 3 | Marvell Armada 37xx SoCs provde Time Base Generator clocks which are | 3 | Marvell Armada 37xx SoCs provide Time Base Generator clocks which are |
| 4 | used as parent clocks for the peripheral clocks. | 4 | used as parent clocks for the peripheral clocks. |
| 5 | 5 | ||
| 6 | The TBG clock consumer should specify the desired clock by having the | 6 | The TBG clock consumer should specify the desired clock by having the |
| @@ -18,10 +18,12 @@ description: | · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | properties: | 19 | properties: |
| 20 | compatible: | 20 | compatible: |
| 21 | oneOf: | 21 | enum: |
| 22 | - items: | 22 | - socionext,milbeaut-m10v-ccu |
| 23 | - enum: | 23 | |
| 24 | - socionext,milbeaut-m10v-ccu | 24 | reg: |
| 25 | maxItems: 1 | ||
| 26 | |||
| 25 | clocks: | 27 | clocks: |
| 26 | maxItems: 1 | 28 | maxItems: 1 |
| 27 | description: external clock | 29 | description: external clock |
| @@ -41,7 +43,7 @@ examples: · 13 unmodified lines | |||
| 41 | # Clock controller node: | 43 | # Clock controller node: |
| 42 | - | | 44 | - | |
| 43 | m10v-clk-ctrl@1d021000 { | 45 | m10v-clk-ctrl@1d021000 { |
| 44 | compatible = "socionext,milbeaut-m10v-clk-ccu"; | 46 | compatible = "socionext,milbeaut-m10v-ccu"; |
| 45 | reg = <0x1d021000 0x4000>; | 47 | reg = <0x1d021000 0x4000>; |
| 46 | #clock-cells = <1>; | 48 | #clock-cells = <1>; |
| 47 | clocks = <&clki40mhz>; | 49 | clocks = <&clki40mhz>; |
| @@ -12,6 +12,9 @@ Required properties: · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | Optional properties: | 13 | Optional properties: |
| 14 | 14 | ||
| 15 | - manufacturer-id : <u32> Manufacturer ID value read from Mode Register 5 | ||
| 16 | - revision-id : <u32 u32> Revision IDs read from Mode Registers 6 and 7 | ||
| 17 | |||
| 15 | The following optional properties represent the minimum value of some AC | 18 | The following optional properties represent the minimum value of some AC |
| 16 | timing parameters of the DDR device in terms of number of clock cycles. | 19 | timing parameters of the DDR device in terms of number of clock cycles. |
| 17 | These values shall be obtained from the device data-sheet. | 20 | These values shall be obtained from the device data-sheet. |
| @@ -49,6 +52,8 @@ samsung_K3QF2F20DB: lpddr3 { · 31 unmodified lines | |||
| 49 | compatible = "samsung,K3QF2F20DB", "jedec,lpddr3"; | 52 | compatible = "samsung,K3QF2F20DB", "jedec,lpddr3"; |
| 50 | density = <16384>; | 53 | density = <16384>; |
| 51 | io-width = <32>; | 54 | io-width = <32>; |
| 55 | manufacturer-id = <1>; | ||
| 56 | revision-id = <123 234>; | ||
| 52 | #address-cells = <1>; | 57 | #address-cells = <1>; |
| 53 | #size-cells = <0>; | 58 | #size-cells = <0>; |
| 54 | 59 | ||
| @@ -73,7 +73,6 @@ properties: · 72 unmodified lines | |||
| 73 | clock-output-names: | 73 | clock-output-names: |
| 74 | description: | 74 | description: |
| 75 | Name of the LCD pixel clock created. | 75 | Name of the LCD pixel clock created. |
| 76 | $ref: /schemas/types.yaml#/definitions/string-array | ||
| 77 | maxItems: 1 | 76 | maxItems: 1 |
| 78 | 77 | ||
| 79 | dmas: | 78 | dmas: |
| @@ -77,12 +77,6 @@ examples: · 76 unmodified lines | |||
| 77 | 77 | ||
| 78 | clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr"; | 78 | clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr"; |
| 79 | 79 | ||
| 80 | pitouchscreen: panel@0 { | ||
| 81 | compatible = "raspberrypi,touchscreen"; | ||
| 82 | reg = <0>; | ||
| 83 | |||
| 84 | /* ... */ | ||
| 85 | }; | ||
| 86 | }; | 80 | }; |
| 87 | 81 | ||
| 88 | ... | 82 | ... |
| @@ -2,14 +2,14 @@ Qualcomm Technologies, Inc. DPU KMS · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | Description: | 3 | Description: |
| 4 | 4 | ||
| 5 | Device tree bindings for MSM Mobile Display Subsytem(MDSS) that encapsulates | 5 | Device tree bindings for MSM Mobile Display Subsystem(MDSS) that encapsulates |
| 6 | sub-blocks like DPU display controller, DSI and DP interfaces etc. | 6 | sub-blocks like DPU display controller, DSI and DP interfaces etc. |
| 7 | The DPU display controller is found in SDM845 SoC. | 7 | The DPU display controller is found in SDM845 SoC. |
| 8 | 8 | ||
| 9 | MDSS: | 9 | MDSS: |
| 10 | Required properties: | 10 | Required properties: |
| 11 | - compatible: "qcom,sdm845-mdss", "qcom,sc7180-mdss" | 11 | - compatible: "qcom,sdm845-mdss", "qcom,sc7180-mdss" |
| 12 | - reg: physical base address and length of contoller's registers. | 12 | - reg: physical base address and length of controller's registers. |
| 13 | - reg-names: register region names. The following region is required: | 13 | - reg-names: register region names. The following region is required: |
| 14 | * "mdss" | 14 | * "mdss" |
| 15 | - power-domains: a power domain consumer specifier according to | 15 | - power-domains: a power domain consumer specifier according to |
| @@ -40,7 +40,7 @@ additionalProperties: false · 39 unmodified lines | |||
| 40 | examples: | 40 | examples: |
| 41 | - | | 41 | - | |
| 42 | panel { | 42 | panel { |
| 43 | compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; | 43 | compatible = "startek,startek-kd050c", "panel-dpi"; |
| 44 | label = "osddisplay"; | 44 | label = "osddisplay"; |
| 45 | power-supply = <&vcc_supply>; | 45 | power-supply = <&vcc_supply>; |
| 46 | backlight = <&backlight>; | 46 | backlight = <&backlight>; |
| @@ -64,7 +64,7 @@ examples: · 63 unmodified lines | |||
| 64 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 64 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 65 | #include <dt-bindings/dma/qcom-gpi.h> | 65 | #include <dt-bindings/dma/qcom-gpi.h> |
| 66 | gpi_dma0: dma-controller@800000 { | 66 | gpi_dma0: dma-controller@800000 { |
| 67 | compatible = "qcom,gpi-dma"; | 67 | compatible = "qcom,sdm845-gpi-dma"; |
| 68 | #dma-cells = <3>; | 68 | #dma-cells = <3>; |
| 69 | reg = <0x00800000 0x60000>; | 69 | reg = <0x00800000 0x60000>; |
| 70 | iommus = <&apps_smmu 0x0016 0x0>; | 70 | iommus = <&apps_smmu 0x0016 0x0>; |
| @@ -43,8 +43,7 @@ properties: · 42 unmodified lines | |||
| 43 | 43 | ||
| 44 | gpio-ranges: true | 44 | gpio-ranges: true |
| 45 | 45 | ||
| 46 | gpio-ranges-group-names: | 46 | gpio-ranges-group-names: true |
| 47 | $ref: /schemas/types.yaml#/definitions/string-array | ||
| 48 | 47 | ||
| 49 | socionext,interrupt-ranges: | 48 | socionext,interrupt-ranges: |
| 50 | description: | | 49 | description: | |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | $id: "http://devicetree.org/schemas/i2c/xlnx,xps-iic-2.00.a.yaml#" | 4 | $id: "http://devicetree.org/schemas/i2c/xlnx,xps-iic-2.00.a.yaml#" |
| 5 | $schema: "http://devicetree.org/meta-schemas/core.yaml#" | 5 | $schema: "http://devicetree.org/meta-schemas/core.yaml#" |
| 6 | 6 | ||
| 7 | title: ilinx IIC controller Device Tree Bindings | 7 | title: Xilinx IIC controller Device Tree Bindings |
| 8 | 8 | ||
| 9 | maintainers: | 9 | maintainers: |
| 10 | - info@mocean-labs.com | 10 | - info@mocean-labs.com |
| @@ -157,9 +157,10 @@ examples: · 156 unmodified lines | |||
| 157 | i2c-scl-hz = <100000>; | 157 | i2c-scl-hz = <100000>; |
| 158 | 158 | ||
| 159 | /* I2C device. */ | 159 | /* I2C device. */ |
| 160 | nunchuk: nunchuk@52 { | 160 | eeprom@57 { |
| 161 | compatible = "nintendo,nunchuk"; | 161 | compatible = "atmel,24c01"; |
| 162 | reg = <0x52 0x0 0x10>; | 162 | reg = <0x57 0x0 0x10>; |
| 163 | pagesize = <0x8>; | ||
| 163 | }; | 164 | }; |
| 164 | 165 | ||
| 165 | /* I3C device with a static I2C address. */ | 166 | /* I3C device with a static I2C address. */ |
| @@ -53,11 +53,6 @@ examples: · 52 unmodified lines | |||
| 53 | #address-cells = <1>; | 53 | #address-cells = <1>; |
| 54 | #size-cells = <1>; | 54 | #size-cells = <1>; |
| 55 | 55 | ||
| 56 | ts_adc_syscon: ts_adc_syscon@180a6000 { | ||
| 57 | compatible = "brcm,iproc-ts-adc-syscon","syscon"; | ||
| 58 | reg = <0x180a6000 0xc30>; | ||
| 59 | }; | ||
| 60 | |||
| 61 | adc { | 56 | adc { |
| 62 | compatible = "brcm,iproc-static-adc"; | 57 | compatible = "brcm,iproc-static-adc"; |
| 63 | adc-syscon = <&ts_adc_syscon>; | 58 | adc-syscon = <&ts_adc_syscon>; |
| @@ -83,7 +83,7 @@ examples: · 82 unmodified lines | |||
| 83 | #size-cells = <0>; | 83 | #size-cells = <0>; |
| 84 | 84 | ||
| 85 | gyroscope@0 { | 85 | gyroscope@0 { |
| 86 | compatible = "nxp,fxas2102c"; | 86 | compatible = "nxp,fxas21002c"; |
| 87 | reg = <0x0>; | 87 | reg = <0x0>; |
| 88 | 88 | ||
| 89 | spi-max-frequency = <2000000>; | 89 | spi-max-frequency = <2000000>; |
| @@ -48,7 +48,6 @@ properties: · 47 unmodified lines | |||
| 48 | vdd-supply: true | 48 | vdd-supply: true |
| 49 | 49 | ||
| 50 | capella,aset-resistance-ohms: | 50 | capella,aset-resistance-ohms: |
| 51 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 52 | enum: [50000, 100000, 300000, 600000] | 51 | enum: [50000, 100000, 300000, 600000] |
| 53 | description: > | 52 | description: > |
| 54 | Sensitivity calibration resistance. Note that calibration curves | 53 | Sensitivity calibration resistance. Note that calibration curves |
| @@ -11,12 +11,12 @@ maintainers: · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | properties: | 12 | properties: |
| 13 | compatible: | 13 | compatible: |
| 14 | const: upisemi,asd5182 | 14 | const: upisemi,usd5182 |
| 15 | 15 | ||
| 16 | reg: | 16 | reg: |
| 17 | maxItems: 1 | 17 | maxItems: 1 |
| 18 | 18 | ||
| 19 | upsemi,glass-coef: | 19 | upisemi,glass-coef: |
| 20 | $ref: /schemas/types.yaml#/definitions/uint32 | 20 | $ref: /schemas/types.yaml#/definitions/uint32 |
| 21 | description: | | 21 | description: | |
| 22 | glass attenuation factor - compensation factor of resolution 1000 | 22 | glass attenuation factor - compensation factor of resolution 1000 |
| @@ -1,12 +1,9 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | =========== | ||
| 4 | Device Tree | ||
| 5 | =========== | ||
| 6 | |||
| 7 | .. toctree:: | 3 | .. toctree:: |
| 8 | :maxdepth: 1 | 4 | :maxdepth: 1 |
| 9 | 5 | ||
| 10 | ABI | 6 | ABI |
| 11 | submitting-patches | ||
| 12 | writing-bindings | 7 | writing-bindings |
| 8 | writing-schema | ||
| 9 | submitting-patches | ||
| @@ -32,6 +32,5 @@ properties: · 31 unmodified lines | |||
| 32 | Duration in seconds which the key should be kept pressed for device to | 32 | Duration in seconds which the key should be kept pressed for device to |
| 33 | power off automatically. Device with key pressed shutdown feature can | 33 | power off automatically. Device with key pressed shutdown feature can |
| 34 | specify this property. | 34 | specify this property. |
| 35 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 36 | 35 | ||
| 37 | additionalProperties: true | 36 | additionalProperties: true |
| @@ -47,7 +47,7 @@ examples: · 46 unmodified lines | |||
| 47 | - | | 47 | - | |
| 48 | #include <dt-bindings/interrupt-controller/irq.h> | 48 | #include <dt-bindings/interrupt-controller/irq.h> |
| 49 | htintc: interrupt-controller@1fb000080 { | 49 | htintc: interrupt-controller@1fb000080 { |
| 50 | compatible = "loongson,htintc-1.0"; | 50 | compatible = "loongson,htpic-1.0"; |
| 51 | reg = <0xfb000080 0x40>; | 51 | reg = <0xfb000080 0x40>; |
| 52 | interrupt-controller; | 52 | interrupt-controller; |
| 53 | #interrupt-cells = <1>; | 53 | #interrupt-cells = <1>; |
| @@ -14,6 +14,17 @@ properties: · 13 unmodified lines | |||
| 14 | compatible: | 14 | compatible: |
| 15 | const: intel,lgm-ssoled | 15 | const: intel,lgm-ssoled |
| 16 | 16 | ||
| 17 | reg: | ||
| 18 | maxItems: 1 | ||
| 19 | |||
| 20 | clocks: | ||
| 21 | maxItems: 2 | ||
| 22 | |||
| 23 | clock-names: | ||
| 24 | items: | ||
| 25 | - const: sso | ||
| 26 | - const: fpid | ||
| 27 | |||
| 17 | gpio-controller: true | 28 | gpio-controller: true |
| 18 | 29 | ||
| 19 | '#gpio-cells': | 30 | '#gpio-cells': |
| @@ -36,8 +47,15 @@ properties: · 16 unmodified lines | |||
| 36 | 47 | ||
| 37 | additionalProperties: false | 48 | additionalProperties: false |
| 38 | 49 | ||
| 50 | properties: | ||
| 51 | '#address-cells': | ||
| 52 | const: 1 | ||
| 53 | |||
| 54 | '#size-cells': | ||
| 55 | const: 0 | ||
| 56 | |||
| 39 | patternProperties: | 57 | patternProperties: |
| 40 | "^led@[0-23]$": | 58 | "^led@[0-2]$": |
| 41 | type: object | 59 | type: object |
| 42 | 60 | ||
| 43 | properties: | 61 | properties: |
| @@ -81,7 +99,7 @@ examples: · 37 unmodified lines | |||
| 81 | #include <dt-bindings/leds/common.h> | 99 | #include <dt-bindings/leds/common.h> |
| 82 | 100 | ||
| 83 | ssogpio: ssogpio@e0d40000 { | 101 | ssogpio: ssogpio@e0d40000 { |
| 84 | compatible = "intel,sso-led"; | 102 | compatible = "intel,lgm-ssoled"; |
| 85 | reg = <0xE0D40000 0x2E4>; | 103 | reg = <0xE0D40000 0x2E4>; |
| 86 | gpio-controller; | 104 | gpio-controller; |
| 87 | #gpio-cells = <2>; | 105 | #gpio-cells = <2>; |
| @@ -103,8 +121,8 @@ examples: · 15 unmodified lines | |||
| 103 | led-gpio = <&ssogpio 0 0>; | 121 | led-gpio = <&ssogpio 0 0>; |
| 104 | }; | 122 | }; |
| 105 | 123 | ||
| 106 | led@23 { | 124 | led@2 { |
| 107 | reg = <23>; | 125 | reg = <2>; |
| 108 | function = LED_FUNCTION_POWER; | 126 | function = LED_FUNCTION_POWER; |
| 109 | color = <LED_COLOR_ID_GREEN>; | 127 | color = <LED_COLOR_ID_GREEN>; |
| 110 | led-gpio = <&ssogpio 23 0>; | 128 | led-gpio = <&ssogpio 23 0>; |
| @@ -0,0 +1,167 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | |||
| 3 | %YAML 1.2 | ||
| 4 | --- | ||
| 5 | $id: "http://devicetree.org/schemas/media/qcom,sm8250-venus.yaml#" | ||
| 6 | $schema: "http://devicetree.org/meta-schemas/core.yaml#" | ||
| 7 | |||
| 8 | title: Qualcomm Venus video encode and decode accelerators | ||
| 9 | |||
| 10 | maintainers: | ||
| 11 | - Stanimir Varbanov <stanimir.varbanov@linaro.org> | ||
| 12 | |||
| 13 | description: | | ||
| 14 | The Venus IP is a video encode and decode accelerator present | ||
| 15 | on Qualcomm platforms | ||
| 16 | |||
| 17 | properties: | ||
| 18 | compatible: | ||
| 19 | const: qcom,sm8250-venus | ||
| 20 | |||
| 21 | reg: | ||
| 22 | maxItems: 1 | ||
| 23 | |||
| 24 | interrupts: | ||
| 25 | maxItems: 1 | ||
| 26 | |||
| 27 | power-domains: | ||
| 28 | minItems: 2 | ||
| 29 | maxItems: 3 | ||
| 30 | |||
| 31 | power-domain-names: | ||
| 32 | minItems: 2 | ||
| 33 | maxItems: 3 | ||
| 34 | items: | ||
| 35 | - const: venus | ||
| 36 | - const: vcodec0 | ||
| 37 | - const: mx | ||
| 38 | |||
| 39 | clocks: | ||
| 40 | maxItems: 3 | ||
| 41 | |||
| 42 | clock-names: | ||
| 43 | items: | ||
| 44 | - const: iface | ||
| 45 | - const: core | ||
| 46 | - const: vcodec0_core | ||
| 47 | |||
| 48 | iommus: | ||
| 49 | maxItems: 1 | ||
| 50 | |||
| 51 | memory-region: | ||
| 52 | maxItems: 1 | ||
| 53 | |||
| 54 | interconnects: | ||
| 55 | maxItems: 2 | ||
| 56 | |||
| 57 | interconnect-names: | ||
| 58 | items: | ||
| 59 | - const: cpu-cfg | ||
| 60 | - const: video-mem | ||
| 61 | |||
| 62 | resets: | ||
| 63 | maxItems: 2 | ||
| 64 | |||
| 65 | reset-names: | ||
| 66 | items: | ||
| 67 | - const: bus | ||
| 68 | - const: core | ||
| 69 | |||
| 70 | video-decoder: | ||
| 71 | type: object | ||
| 72 | |||
| 73 | properties: | ||
| 74 | compatible: | ||
| 75 | const: venus-decoder | ||
| 76 | |||
| 77 | required: | ||
| 78 | - compatible | ||
| 79 | |||
| 80 | additionalProperties: false | ||
| 81 | |||
| 82 | video-encoder: | ||
| 83 | type: object | ||
| 84 | |||
| 85 | properties: | ||
| 86 | compatible: | ||
| 87 | const: venus-encoder | ||
| 88 | |||
| 89 | required: | ||
| 90 | - compatible | ||
| 91 | |||
| 92 | additionalProperties: false | ||
| 93 | |||
| 94 | video-firmware: | ||
| 95 | type: object | ||
| 96 | |||
| 97 | description: | | ||
| 98 | Firmware subnode is needed when the platform does not | ||
| 99 | have TrustZone. | ||
| 100 | |||
| 101 | properties: | ||
| 102 | iommus: | ||
| 103 | maxItems: 1 | ||
| 104 | |||
| 105 | required: | ||
| 106 | - iommus | ||
| 107 | |||
| 108 | required: | ||
| 109 | - compatible | ||
| 110 | - reg | ||
| 111 | - interrupts | ||
| 112 | - power-domains | ||
| 113 | - power-domain-names | ||
| 114 | - clocks | ||
| 115 | - clock-names | ||
| 116 | - interconnects | ||
| 117 | - interconnect-names | ||
| 118 | - iommus | ||
| 119 | - memory-region | ||
| 120 | - resets | ||
| 121 | - reset-names | ||
| 122 | - video-decoder | ||
| 123 | - video-encoder | ||
| 124 | |||
| 125 | additionalProperties: false | ||
| 126 | |||
| 127 | examples: | ||
| 128 | - | | ||
| 129 | #include <dt-bindings/interrupt-controller/arm-gic.h> | ||
| 130 | #include <dt-bindings/clock/qcom,videocc-sm8250.h> | ||
| 131 | #include <dt-bindings/interconnect/qcom,sm8250.h> | ||
| 132 | #include <dt-bindings/clock/qcom,gcc-sm8250.h> | ||
| 133 | #include <dt-bindings/power/qcom-rpmpd.h> | ||
| 134 | |||
| 135 | venus: video-codec@aa00000 { | ||
| 136 | compatible = "qcom,sm8250-venus"; | ||
| 137 | reg = <0x0aa00000 0xff000>; | ||
| 138 | interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; | ||
| 139 | power-domains = <&videocc MVS0C_GDSC>, | ||
| 140 | <&videocc MVS0_GDSC>, | ||
| 141 | <&rpmhpd SM8250_MX>; | ||
| 142 | power-domain-names = "venus", "vcodec0", "mx"; | ||
| 143 | |||
| 144 | clocks = <&gcc GCC_VIDEO_AXI0_CLK>, | ||
| 145 | <&videocc VIDEO_CC_MVS0C_CLK>, | ||
| 146 | <&videocc VIDEO_CC_MVS0_CLK>; | ||
| 147 | clock-names = "iface", "core", "vcodec0_core"; | ||
| 148 | |||
| 149 | interconnects = <&gem_noc MASTER_AMPSS_M0 &config_noc SLAVE_VENUS_CFG>, | ||
| 150 | <&mmss_noc MASTER_VIDEO_P0 &mc_virt SLAVE_EBI_CH0>; | ||
| 151 | interconnect-names = "cpu-cfg", "video-mem"; | ||
| 152 | |||
| 153 | iommus = <&apps_smmu 0x2100 0x0400>; | ||
| 154 | memory-region = <&video_mem>; | ||
| 155 | |||
| 156 | resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, | ||
| 157 | <&videocc VIDEO_CC_MVS0C_CLK_ARES>; | ||
| 158 | reset-names = "bus", "core"; | ||
| 159 | |||
| 160 | video-decoder { | ||
| 161 | compatible = "venus-decoder"; | ||
| 162 | }; | ||
| 163 | |||
| 164 | video-encoder { | ||
| 165 | compatible = "venus-encoder"; | ||
| 166 | }; | ||
| 167 | }; | ||
| @@ -215,130 +215,3 @@ properties: · 214 unmodified lines | |||
| 215 | CCP2, for instance. | 215 | CCP2, for instance. |
| 216 | 216 | ||
| 217 | additionalProperties: true | 217 | additionalProperties: true |
| 218 | |||
| 219 | examples: | ||
| 220 | # The example snippet below describes two data pipelines. ov772x and imx074 | ||
| 221 | # are camera sensors with a parallel and serial (MIPI CSI-2) video bus | ||
| 222 | # respectively. Both sensors are on the I2C control bus corresponding to the | ||
| 223 | # i2c0 controller node. ov772x sensor is linked directly to the ceu0 video | ||
| 224 | # host interface. imx074 is linked to ceu0 through the MIPI CSI-2 receiver | ||
| 225 | # (csi2). ceu0 has a (single) DMA engine writing captured data to memory. | ||
| 226 | # ceu0 node has a single 'port' node which may indicate that at any time | ||
| 227 | # only one of the following data pipelines can be active: | ||
| 228 | # ov772x -> ceu0 or imx074 -> csi2 -> ceu0. | ||
| 229 | - | | ||
| 230 | ceu@fe910000 { | ||
| 231 | compatible = "renesas,sh-mobile-ceu"; | ||
| 232 | reg = <0xfe910000 0xa0>; | ||
| 233 | interrupts = <0x880>; | ||
| 234 | |||
| 235 | mclk: master_clock { | ||
| 236 | compatible = "renesas,ceu-clock"; | ||
| 237 | #clock-cells = <1>; | ||
| 238 | clock-frequency = <50000000>; /* Max clock frequency */ | ||
| 239 | clock-output-names = "mclk"; | ||
| 240 | }; | ||
| 241 | |||
| 242 | port { | ||
| 243 | #address-cells = <1>; | ||
| 244 | #size-cells = <0>; | ||
| 245 | |||
| 246 | /* Parallel bus endpoint */ | ||
| 247 | ceu0_1: endpoint@1 { | ||
| 248 | reg = <1>; /* Local endpoint # */ | ||
| 249 | remote-endpoint = <&ov772x_1_1>; /* Remote phandle */ | ||
| 250 | bus-width = <8>; /* Used data lines */ | ||
| 251 | data-shift = <2>; /* Lines 9:2 are used */ | ||
| 252 | |||
| 253 | /* If hsync-active/vsync-active are missing, | ||
| 254 | embedded BT.656 sync is used */ | ||
| 255 | hsync-active = <0>; /* Active low */ | ||
| 256 | vsync-active = <0>; /* Active low */ | ||
| 257 | data-active = <1>; /* Active high */ | ||
| 258 | pclk-sample = <1>; /* Rising */ | ||
| 259 | }; | ||
| 260 | |||
| 261 | /* MIPI CSI-2 bus endpoint */ | ||
| 262 | ceu0_0: endpoint@0 { | ||
| 263 | reg = <0>; | ||
| 264 | remote-endpoint = <&csi2_2>; | ||
| 265 | }; | ||
| 266 | }; | ||
| 267 | }; | ||
| 268 | |||
| 269 | i2c { | ||
| 270 | #address-cells = <1>; | ||
| 271 | #size-cells = <0>; | ||
| 272 | |||
| 273 | camera@21 { | ||
| 274 | compatible = "ovti,ov772x"; | ||
| 275 | reg = <0x21>; | ||
| 276 | vddio-supply = <®ulator1>; | ||
| 277 | vddcore-supply = <®ulator2>; | ||
| 278 | |||
| 279 | clock-frequency = <20000000>; | ||
| 280 | clocks = <&mclk 0>; | ||
| 281 | clock-names = "xclk"; | ||
| 282 | |||
| 283 | port { | ||
| 284 | /* With 1 endpoint per port no need for addresses. */ | ||
| 285 | ov772x_1_1: endpoint { | ||
| 286 | bus-width = <8>; | ||
| 287 | remote-endpoint = <&ceu0_1>; | ||
| 288 | hsync-active = <1>; | ||
| 289 | vsync-active = <0>; /* Who came up with an | ||
| 290 | inverter here ?... */ | ||
| 291 | data-active = <1>; | ||
| 292 | pclk-sample = <1>; | ||
| 293 | }; | ||
| 294 | }; | ||
| 295 | }; | ||
| 296 | |||
| 297 | camera@1a { | ||
| 298 | compatible = "sony,imx074"; | ||
| 299 | reg = <0x1a>; | ||
| 300 | vddio-supply = <®ulator1>; | ||
| 301 | vddcore-supply = <®ulator2>; | ||
| 302 | |||
| 303 | clock-frequency = <30000000>; /* Shared clock with ov772x_1 */ | ||
| 304 | clocks = <&mclk 0>; | ||
| 305 | clock-names = "sysclk"; /* Assuming this is the | ||
| 306 | name in the datasheet */ | ||
| 307 | port { | ||
| 308 | imx074_1: endpoint { | ||
| 309 | clock-lanes = <0>; | ||
| 310 | data-lanes = <1 2>; | ||
| 311 | remote-endpoint = <&csi2_1>; | ||
| 312 | }; | ||
| 313 | }; | ||
| 314 | }; | ||
| 315 | }; | ||
| 316 | |||
| 317 | csi2: csi2@ffc90000 { | ||
| 318 | compatible = "renesas,sh-mobile-csi2"; | ||
| 319 | reg = <0xffc90000 0x1000>; | ||
| 320 | interrupts = <0x17a0>; | ||
| 321 | #address-cells = <1>; | ||
| 322 | #size-cells = <0>; | ||
| 323 | |||
| 324 | port@1 { | ||
| 325 | compatible = "renesas,csi2c"; /* One of CSI2I and CSI2C. */ | ||
| 326 | reg = <1>; /* CSI-2 PHY #1 of 2: PHY_S, | ||
| 327 | PHY_M has port address 0, | ||
| 328 | is unused. */ | ||
| 329 | csi2_1: endpoint { | ||
| 330 | clock-lanes = <0>; | ||
| 331 | data-lanes = <2 1>; | ||
| 332 | remote-endpoint = <&imx074_1>; | ||
| 333 | }; | ||
| 334 | }; | ||
| 335 | port@2 { | ||
| 336 | reg = <2>; /* port 2: link to the CEU */ | ||
| 337 | |||
| 338 | csi2_2: endpoint { | ||
| 339 | remote-endpoint = <&ceu0_0>; | ||
| 340 | }; | ||
| 341 | }; | ||
| 342 | }; | ||
| 343 | |||
| 344 | ... | ||
| @@ -1,60 +0,0 @@ | |||
| 1 | Video Multiplexer | ||
| 2 | ================= | ||
| 3 | |||
| 4 | Video multiplexers allow to select between multiple input ports. Video received | ||
| 5 | on the active input port is passed through to the output port. Muxes described | ||
| 6 | by this binding are controlled by a multiplexer controller that is described by | ||
| 7 | the bindings in Documentation/devicetree/bindings/mux/mux-controller.txt | ||
| 8 | |||
| 9 | Required properties: | ||
| 10 | - compatible : should be "video-mux" | ||
| 11 | - mux-controls : mux controller node to use for operating the mux | ||
| 12 | - #address-cells: should be <1> | ||
| 13 | - #size-cells: should be <0> | ||
| 14 | - port@*: at least three port nodes containing endpoints connecting to the | ||
| 15 | source and sink devices according to of_graph bindings. The last port is | ||
| 16 | the output port, all others are inputs. | ||
| 17 | |||
| 18 | Optionally, #address-cells, #size-cells, and port nodes can be grouped under a | ||
| 19 | ports node as described in Documentation/devicetree/bindings/graph.txt. | ||
| 20 | |||
| 21 | Example: | ||
| 22 | |||
| 23 | mux: mux-controller { | ||
| 24 | compatible = "gpio-mux"; | ||
| 25 | #mux-control-cells = <0>; | ||
| 26 | |||
| 27 | mux-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; | ||
| 28 | }; | ||
| 29 | |||
| 30 | video-mux { | ||
| 31 | compatible = "video-mux"; | ||
| 32 | mux-controls = <&mux>; | ||
| 33 | #address-cells = <1>; | ||
| 34 | #size-cells = <0>; | ||
| 35 | |||
| 36 | port@0 { | ||
| 37 | reg = <0>; | ||
| 38 | |||
| 39 | mux_in0: endpoint { | ||
| 40 | remote-endpoint = <&video_source0_out>; | ||
| 41 | }; | ||
| 42 | }; | ||
| 43 | |||
| 44 | port@1 { | ||
| 45 | reg = <1>; | ||
| 46 | |||
| 47 | mux_in1: endpoint { | ||
| 48 | remote-endpoint = <&video_source1_out>; | ||
| 49 | }; | ||
| 50 | }; | ||
| 51 | |||
| 52 | port@2 { | ||
| 53 | reg = <2>; | ||
| 54 | |||
| 55 | mux_out: endpoint { | ||
| 56 | remote-endpoint = <&capture_interface_in>; | ||
| 57 | }; | ||
| 58 | }; | ||
| 59 | }; | ||
| 60 | }; | ||
| @@ -0,0 +1,106 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/media/video-mux.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Video Multiplexer | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Sakari Ailus <sakari.ailus@linux.intel.com> | ||
| 11 | - Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
| 12 | |||
| 13 | description: | ||
| 14 | Video multiplexers allow to select between multiple input ports. Video | ||
| 15 | received on the active input port is passed through to the output port. Muxes | ||
| 16 | described by this binding are controlled by a multiplexer controller. | ||
| 17 | |||
| 18 | properties: | ||
| 19 | compatible: | ||
| 20 | const: video-mux | ||
| 21 | |||
| 22 | mux-controls: | ||
| 23 | maxItems: 1 | ||
| 24 | |||
| 25 | '#address-cells': | ||
| 26 | const: 1 | ||
| 27 | |||
| 28 | '#size-cells': | ||
| 29 | const: 0 | ||
| 30 | |||
| 31 | ports: | ||
| 32 | $ref: /schemas/graph.yaml#/properties/ports | ||
| 33 | |||
| 34 | patternProperties: | ||
| 35 | '^port@': | ||
| 36 | $ref: /schemas/graph.yaml#/properties/port | ||
| 37 | |||
| 38 | required: | ||
| 39 | - port@0 | ||
| 40 | - port@1 | ||
| 41 | - port@2 | ||
| 42 | |||
| 43 | patternProperties: | ||
| 44 | '^port@': | ||
| 45 | $ref: /schemas/graph.yaml#/properties/port | ||
| 46 | description: | ||
| 47 | At least three port nodes containing endpoints connecting to the source | ||
| 48 | and sink devices according to of_graph bindings. The last port is the | ||
| 49 | output port, all others are inputs. | ||
| 50 | |||
| 51 | required: | ||
| 52 | - compatible | ||
| 53 | - mux-controls | ||
| 54 | |||
| 55 | oneOf: | ||
| 56 | - required: | ||
| 57 | - ports | ||
| 58 | - required: | ||
| 59 | - port@0 | ||
| 60 | - port@1 | ||
| 61 | - port@2 | ||
| 62 | |||
| 63 | additionalProperties: false | ||
| 64 | |||
| 65 | examples: | ||
| 66 | - | | ||
| 67 | #include <dt-bindings/gpio/gpio.h> | ||
| 68 | |||
| 69 | mux: mux-controller { | ||
| 70 | compatible = "gpio-mux"; | ||
| 71 | #mux-control-cells = <0>; | ||
| 72 | |||
| 73 | mux-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; | ||
| 74 | }; | ||
| 75 | |||
| 76 | video-mux { | ||
| 77 | compatible = "video-mux"; | ||
| 78 | mux-controls = <&mux>; | ||
| 79 | #address-cells = <1>; | ||
| 80 | #size-cells = <0>; | ||
| 81 | |||
| 82 | port@0 { | ||
| 83 | reg = <0>; | ||
| 84 | |||
| 85 | mux_in0: endpoint { | ||
| 86 | remote-endpoint = <&video_source0_out>; | ||
| 87 | }; | ||
| 88 | }; | ||
| 89 | |||
| 90 | port@1 { | ||
| 91 | reg = <1>; | ||
| 92 | |||
| 93 | mux_in1: endpoint { | ||
| 94 | remote-endpoint = <&video_source1_out>; | ||
| 95 | }; | ||
| 96 | }; | ||
| 97 | |||
| 98 | port@2 { | ||
| 99 | reg = <2>; | ||
| 100 | |||
| 101 | mux_out: endpoint { | ||
| 102 | remote-endpoint = <&capture_interface_in>; | ||
| 103 | }; | ||
| 104 | }; | ||
| 105 | }; | ||
| 106 | ... | ||
| @@ -34,7 +34,7 @@ properties: · 33 unmodified lines | |||
| 34 | - description: EMC general interrupt | 34 | - description: EMC general interrupt |
| 35 | 35 | ||
| 36 | memory-region: | 36 | memory-region: |
| 37 | $ref: /schemas/types.yaml#/definitions/phandle | 37 | maxItems: 1 |
| 38 | description: | 38 | description: |
| 39 | phandle to a reserved memory region describing the table of EMC | 39 | phandle to a reserved memory region describing the table of EMC |
| 40 | frequencies trained by the firmware | 40 | frequencies trained by the firmware |
| @@ -57,7 +57,6 @@ properties: · 56 unmodified lines | |||
| 57 | - const: per | 57 | - const: per |
| 58 | 58 | ||
| 59 | clock-frequency: | 59 | clock-frequency: |
| 60 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 61 | description: | | 60 | description: | |
| 62 | The oscillator frequency driving the flexcan device, filled in by the | 61 | The oscillator frequency driving the flexcan device, filled in by the |
| 63 | boot loader. This property should only be used the used operating system | 62 | boot loader. This property should only be used the used operating system |
| @@ -0,0 +1,109 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/net/wireless/brcm,bcm4329-fmac.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Broadcom BCM4329 family fullmac wireless SDIO devices | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Arend van Spriel <arend@broadcom.com> | ||
| 11 | |||
| 12 | description: | ||
| 13 | The Broadcom Single chip MAC part for the BCM4329 family and | ||
| 14 | later Cypress chips in the same family named CYW4373 and similar. | ||
| 15 | These chips also have a Bluetooth portion described in a separate | ||
| 16 | binding. | ||
| 17 | |||
| 18 | properties: | ||
| 19 | compatible: | ||
| 20 | oneOf: | ||
| 21 | - items: | ||
| 22 | - enum: | ||
| 23 | - brcm,bcm43143-fmac | ||
| 24 | - brcm,bcm4341b0-fmac | ||
| 25 | - brcm,bcm4341b4-fmac | ||
| 26 | - brcm,bcm4341b5-fmac | ||
| 27 | - brcm,bcm4329-fmac | ||
| 28 | - brcm,bcm4330-fmac | ||
| 29 | - brcm,bcm4334-fmac | ||
| 30 | - brcm,bcm43340-fmac | ||
| 31 | - brcm,bcm4335-fmac | ||
| 32 | - brcm,bcm43362-fmac | ||
| 33 | - brcm,bcm4339-fmac | ||
| 34 | - brcm,bcm43430a0-fmac | ||
| 35 | - brcm,bcm43430a1-fmac | ||
| 36 | - brcm,bcm43455-fmac | ||
| 37 | - brcm,bcm43456-fmac | ||
| 38 | - brcm,bcm4354-fmac | ||
| 39 | - brcm,bcm4356-fmac | ||
| 40 | - brcm,bcm4359-fmac | ||
| 41 | - cypress,cyw4373-fmac | ||
| 42 | - cypress,cyw43012-fmac | ||
| 43 | - const: brcm,bcm4329-fmac | ||
| 44 | - const: brcm,bcm4329-fmac | ||
| 45 | |||
| 46 | reg: | ||
| 47 | description: SDIO function number for the device, for most cases | ||
| 48 | this will be 1. | ||
| 49 | |||
| 50 | interrupts: | ||
| 51 | maxItems: 1 | ||
| 52 | description: Out-of-band (OOB) IRQ line for waking up the host | ||
| 53 | in response to WLAN activity. This corresponds to the HOST_WAKE | ||
| 54 | line into the chip. | ||
| 55 | |||
| 56 | interrupt-names: | ||
| 57 | description: Name for the OOB IRQ, this must be set to "host-wake". | ||
| 58 | const: host-wake | ||
| 59 | |||
| 60 | brcm,drive-strength: | ||
| 61 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 62 | description: Drive strength used for the SDIO pins on the device in mA. | ||
| 63 | minimum: 0 | ||
| 64 | maximum: 32 | ||
| 65 | |||
| 66 | reset-gpios: | ||
| 67 | maxItems: 1 | ||
| 68 | description: A GPIO line connected to the WL_RST line, if present | ||
| 69 | this shall be flagged as active low. | ||
| 70 | |||
| 71 | brcm,ccode-map: | ||
| 72 | $ref: /schemas/types.yaml#/definitions/string-array | ||
| 73 | description: Multiple strings for translating ISO3166 country code to | ||
| 74 | brcmfmac firmware country code and revision. | ||
| 75 | items: | ||
| 76 | pattern: '^[A-Z][A-Z]-[A-Z][0-9A-Z]-[0-9]+$' | ||
| 77 | |||
| 78 | required: | ||
| 79 | - compatible | ||
| 80 | - reg | ||
| 81 | |||
| 82 | additionalProperties: false | ||
| 83 | |||
| 84 | examples: | ||
| 85 | - | | ||
| 86 | #include <dt-bindings/interrupt-controller/irq.h> | ||
| 87 | #include <dt-bindings/gpio/gpio.h> | ||
| 88 | mmc@80118000 { | ||
| 89 | compatible = "arm,pl18x", "arm,primecell"; | ||
| 90 | reg = <0x80118000 0x1000>; | ||
| 91 | clocks = <&clk 0>, <&clk 1>; | ||
| 92 | clock-names = "mclk", "apb_pclk"; | ||
| 93 | interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>; | ||
| 94 | bus-width = <4>; | ||
| 95 | non-removable; | ||
| 96 | vmmc-supply = <&wl_bt_reg>; | ||
| 97 | #address-cells = <1>; | ||
| 98 | #size-cells = <0>; | ||
| 99 | |||
| 100 | wifi@1 { | ||
| 101 | compatible = "brcm,bcm4334-fmac", "brcm,bcm4329-fmac"; | ||
| 102 | reg = <1>; | ||
| 103 | interrupt-parent = <&gpio>; | ||
| 104 | interrupts = <24 IRQ_TYPE_EDGE_FALLING>; | ||
| 105 | interrupt-names = "host-wake"; | ||
| 106 | reset-gpios = <&gpio 23 GPIO_ACTIVE_LOW>; | ||
| 107 | brcm,ccode-map = "JP-JP-78", "US-Q2-86"; | ||
| 108 | }; | ||
| 109 | }; | ||
| @@ -1,38 +0,0 @@ | |||
| 1 | Broadcom BCM43xx Fullmac wireless SDIO devices | ||
| 2 | |||
| 3 | This node provides properties for controlling the Broadcom wireless device. The | ||
| 4 | node is expected to be specified as a child node to the SDIO controller that | ||
| 5 | connects the device to the system. | ||
| 6 | |||
| 7 | Required properties: | ||
| 8 | |||
| 9 | - compatible : Should be "brcm,bcm4329-fmac". | ||
| 10 | |||
| 11 | Optional properties: | ||
| 12 | - brcm,drive-strength : drive strength used for SDIO pins on device in mA | ||
| 13 | (default = 6). | ||
| 14 | - interrupts : specifies attributes for the out-of-band interrupt (host-wake). | ||
| 15 | When not specified the device will use in-band SDIO interrupts. | ||
| 16 | - interrupt-names : name of the out-of-band interrupt, which must be set | ||
| 17 | to "host-wake". | ||
| 18 | |||
| 19 | Example: | ||
| 20 | |||
| 21 | mmc3: mmc@1c12000 { | ||
| 22 | #address-cells = <1>; | ||
| 23 | #size-cells = <0>; | ||
| 24 | |||
| 25 | pinctrl-names = "default"; | ||
| 26 | pinctrl-0 = <&mmc3_pins_a>; | ||
| 27 | vmmc-supply = <®_vmmc3>; | ||
| 28 | bus-width = <4>; | ||
| 29 | non-removable; | ||
| 30 | |||
| 31 | brcmf: wifi@1 { | ||
| 32 | reg = <1>; | ||
| 33 | compatible = "brcm,bcm4329-fmac"; | ||
| 34 | interrupt-parent = <&pio>; | ||
| 35 | interrupts = <10 8>; /* PH10 / EINT10 */ | ||
| 36 | interrupt-names = "host-wake"; | ||
| 37 | }; | ||
| 38 | }; | ||
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | %YAML 1.2 | 2 | %YAML 1.2 |
| 3 | --- | 3 | --- |
| 4 | $id: http://devicetree.org/schemas/nvmem/nvmem-consumer.yaml# | 4 | $id: http://devicetree.org/schemas/nvmem/nvmem-consumer.yaml# |
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | 5 | $schema: http://devicetree.org/meta-schemas/base.yaml# |
| 6 | 6 | ||
| 7 | title: NVMEM (Non Volatile Memory) Consumer Device Tree Bindings | 7 | title: NVMEM (Non Volatile Memory) Consumer Device Tree Bindings |
| 8 | 8 | ||
| @@ -23,12 +23,10 @@ properties: · 14 unmodified lines | |||
| 23 | List of phandle to the nvmem data cells. | 23 | List of phandle to the nvmem data cells. |
| 24 | 24 | ||
| 25 | nvmem-names: | 25 | nvmem-names: |
| 26 | $ref: /schemas/types.yaml#/definitions/string-array | ||
| 27 | description: | 26 | description: |
| 28 | Names for the each nvmem provider. | 27 | Names for the each nvmem provider. |
| 29 | 28 | ||
| 30 | nvmem-cell-names: | 29 | nvmem-cell-names: |
| 31 | $ref: /schemas/types.yaml#/definitions/string-array | ||
| 32 | description: | 30 | description: |
| 33 | Names for each nvmem-cells specified. | 31 | Names for each nvmem-cells specified. |
| 34 | 32 | ||
| @@ -222,7 +222,7 @@ examples: · 221 unmodified lines | |||
| 222 | }; | 222 | }; |
| 223 | 223 | ||
| 224 | serdes@5000000 { | 224 | serdes@5000000 { |
| 225 | compatible = "cdns,ti,sierra-phy-t0"; | 225 | compatible = "ti,sierra-phy-t0"; |
| 226 | reg-names = "serdes"; | 226 | reg-names = "serdes"; |
| 227 | reg = <0x5000000 0x10000>; | 227 | reg = <0x5000000 0x10000>; |
| 228 | #address-cells = <1>; | 228 | #address-cells = <1>; |
| @@ -39,7 +39,6 @@ properties: · 38 unmodified lines | |||
| 39 | maxItems: 1 | 39 | maxItems: 1 |
| 40 | 40 | ||
| 41 | ti,watchdog-timeout-ms: | 41 | ti,watchdog-timeout-ms: |
| 42 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 43 | default: 0 | 42 | default: 0 |
| 44 | description: | | 43 | description: | |
| 45 | Watchdog timer in ms. 0 (default) disables the watchdog | 44 | Watchdog timer in ms. 0 (default) disables the watchdog |
| @@ -61,7 +61,7 @@ examples: · 60 unmodified lines | |||
| 61 | #size-cells = <0>; | 61 | #size-cells = <0>; |
| 62 | 62 | ||
| 63 | cw2015@62 { | 63 | cw2015@62 { |
| 64 | compatible = "cellwise,cw201x"; | 64 | compatible = "cellwise,cw2015"; |
| 65 | reg = <0x62>; | 65 | reg = <0x62>; |
| 66 | cellwise,battery-profile = /bits/ 8 < | 66 | cellwise,battery-profile = /bits/ 8 < |
| 67 | 0x17 0x67 0x80 0x73 0x6E 0x6C 0x6B 0x63 | 67 | 0x17 0x67 0x80 0x73 0x6E 0x6C 0x6B 0x63 |
| @@ -29,12 +29,10 @@ properties: · 28 unmodified lines | |||
| 29 | description: I2C address of the charger. | 29 | description: I2C address of the charger. |
| 30 | 30 | ||
| 31 | lltc,rsnsb-micro-ohms: | 31 | lltc,rsnsb-micro-ohms: |
| 32 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 33 | description: Battery sense resistor in microohm. | 32 | description: Battery sense resistor in microohm. |
| 34 | minimum: 1000 | 33 | minimum: 1000 |
| 35 | 34 | ||
| 36 | lltc,rsnsi-micro-ohms: | 35 | lltc,rsnsi-micro-ohms: |
| 37 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 38 | description: Input current sense resistor in microohm. | 36 | description: Input current sense resistor in microohm. |
| 39 | minimum: 1000 | 37 | minimum: 1000 |
| 40 | 38 | ||
| @@ -18,25 +18,3 @@ properties: · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | additionalProperties: true | 19 | additionalProperties: true |
| 20 | 20 | ||
| 21 | examples: | ||
| 22 | - | | ||
| 23 | power { | ||
| 24 | #address-cells = <1>; | ||
| 25 | #size-cells = <0>; | ||
| 26 | |||
| 27 | usb_charger:charger@e { | ||
| 28 | compatible = "some,usb-charger"; | ||
| 29 | reg = <0xe>; | ||
| 30 | }; | ||
| 31 | |||
| 32 | ac_charger:charger@c { | ||
| 33 | compatible = "some,ac-charger"; | ||
| 34 | reg = <0xc>; | ||
| 35 | }; | ||
| 36 | |||
| 37 | battery:battery@b { | ||
| 38 | compatible = "some,battery"; | ||
| 39 | reg = <0xb>; | ||
| 40 | power-supplies = <&usb_charger>, <&ac_charger>; | ||
| 41 | }; | ||
| 42 | }; | ||
| @@ -23,7 +23,6 @@ properties: · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | properties: | 24 | properties: |
| 25 | qcom,soft-start-us: | 25 | qcom,soft-start-us: |
| 26 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 27 | description: Regulator soft start time in microseconds. | 26 | description: Regulator soft start time in microseconds. |
| 28 | enum: [200, 400, 600, 800] | 27 | enum: [200, 400, 600, 800] |
| 29 | default: 200 | 28 | default: 200 |
| @@ -93,7 +93,7 @@ properties: · 92 unmodified lines | |||
| 93 | # The following are the optional properties: | 93 | # The following are the optional properties: |
| 94 | 94 | ||
| 95 | memory-region: | 95 | memory-region: |
| 96 | $ref: /schemas/types.yaml#/definitions/phandle | 96 | maxItems: 1 |
| 97 | description: | | 97 | description: | |
| 98 | phandle to the reserved memory node to be associated | 98 | phandle to the reserved memory node to be associated |
| 99 | with the remoteproc device. The reserved memory node | 99 | with the remoteproc device. The reserved memory node |
| @@ -144,7 +144,7 @@ examples: · 143 unmodified lines | |||
| 144 | interrupts = <1>; | 144 | interrupts = <1>; |
| 145 | 145 | ||
| 146 | bluetooth { | 146 | bluetooth { |
| 147 | compatible = "brcm,bcm43341-bt"; | 147 | compatible = "brcm,bcm4330-bt"; |
| 148 | interrupt-parent = <&gpio>; | 148 | interrupt-parent = <&gpio>; |
| 149 | interrupts = <10>; | 149 | interrupts = <10>; |
| 150 | }; | 150 | }; |
| @@ -29,11 +29,9 @@ properties: · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | clock-frequency: | 30 | clock-frequency: |
| 31 | description: common clock binding; frequency of MCKO | 31 | description: common clock binding; frequency of MCKO |
| 32 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 33 | 32 | ||
| 34 | clock-output-names: | 33 | clock-output-names: |
| 35 | description: common clock name | 34 | description: common clock name |
| 36 | $ref: /schemas/types.yaml#/definitions/string | ||
| 37 | 35 | ||
| 38 | required: | 36 | required: |
| 39 | - compatible | 37 | - compatible |
| @@ -32,7 +32,7 @@ properties: · 31 unmodified lines | |||
| 32 | The last one integer is the length of the shared memory. | 32 | The last one integer is the length of the shared memory. |
| 33 | 33 | ||
| 34 | memory-region: | 34 | memory-region: |
| 35 | $ref: '/schemas/types.yaml#/definitions/phandle' | 35 | maxItems: 1 |
| 36 | description: | | 36 | description: | |
| 37 | Shared memory region to EC. A "shared-dma-pool". | 37 | Shared memory region to EC. A "shared-dma-pool". |
| 38 | See ../reserved-memory/reserved-memory.txt for details. | 38 | See ../reserved-memory/reserved-memory.txt for details. |
| @@ -78,7 +78,6 @@ properties: · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | clock-frequency: | 79 | clock-frequency: |
| 80 | description: for audio_clkout0/1/2/3 | 80 | description: for audio_clkout0/1/2/3 |
| 81 | $ref: /schemas/types.yaml#/definitions/uint32-array | ||
| 82 | 81 | ||
| 83 | clkout-lr-asynchronous: | 82 | clkout-lr-asynchronous: |
| 84 | description: audio_clkoutn is asynchronizes with lr-clock. | 83 | description: audio_clkoutn is asynchronizes with lr-clock. |
| @@ -90,8 +90,8 @@ examples: · 89 unmodified lines | |||
| 90 | #address-cells = <1>; | 90 | #address-cells = <1>; |
| 91 | #size-cells = <0>; | 91 | #size-cells = <0>; |
| 92 | 92 | ||
| 93 | ethernet-switch@0 { | 93 | display@0 { |
| 94 | compatible = "micrel,ks8995m"; | 94 | compatible = "lg,lg4573"; |
| 95 | spi-max-frequency = <1000000>; | 95 | spi-max-frequency = <1000000>; |
| 96 | reg = <0>; | 96 | reg = <0>; |
| 97 | }; | 97 | }; |
| @@ -181,22 +181,23 @@ additionalProperties: true · 180 unmodified lines | |||
| 181 | 181 | ||
| 182 | examples: | 182 | examples: |
| 183 | - | | 183 | - | |
| 184 | spi@f00 { | 184 | spi@80010000 { |
| 185 | #address-cells = <1>; | 185 | #address-cells = <1>; |
| 186 | #size-cells = <0>; | 186 | #size-cells = <0>; |
| 187 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | 187 | compatible = "fsl,imx28-spi"; |
| 188 | reg = <0xf00 0x20>; | 188 | reg = <0x80010000 0x2000>; |
| 189 | interrupts = <2 13 0 2 14 0>; | 189 | interrupts = <96>; |
| 190 | interrupt-parent = <&mpc5200_pic>; | 190 | dmas = <&dma_apbh 0>; |
| 191 | 191 | dma-names = "rx-tx"; | |
| 192 | ethernet-switch@0 { | 192 | |
| 193 | compatible = "micrel,ks8995m"; | 193 | display@0 { |
| 194 | compatible = "lg,lg4573"; | ||
| 194 | spi-max-frequency = <1000000>; | 195 | spi-max-frequency = <1000000>; |
| 195 | reg = <0>; | 196 | reg = <0>; |
| 196 | }; | 197 | }; |
| 197 | 198 | ||
| 198 | codec@1 { | 199 | sensor@1 { |
| 199 | compatible = "ti,tlv320aic26"; | 200 | compatible = "bosch,bme680"; |
| 200 | spi-max-frequency = <100000>; | 201 | spi-max-frequency = <100000>; |
| 201 | reg = <1>; | 202 | reg = <1>; |
| 202 | }; | 203 | }; |
| @@ -75,16 +75,12 @@ examples: · 74 unmodified lines | |||
| 75 | spi-flash@0 { | 75 | spi-flash@0 { |
| 76 | compatible = "jedec,spi-nor"; | 76 | compatible = "jedec,spi-nor"; |
| 77 | reg = <0>; | 77 | reg = <0>; |
| 78 | #address-cells = <1>; | ||
| 79 | #size-cells = <0>; | ||
| 80 | spi-max-frequency = <40000000>; | 78 | spi-max-frequency = <40000000>; |
| 81 | }; | 79 | }; |
| 82 | 80 | ||
| 83 | spi-device@1 { | 81 | sensor@1 { |
| 84 | compatible = "lineartechnology,ltc2488"; | 82 | compatible = "bosch,bme680"; |
| 85 | reg = <1>; | 83 | reg = <1>; |
| 86 | #address-cells = <1>; | ||
| 87 | #size-cells = <0>; | ||
| 88 | spi-max-frequency = <10000000>; | 84 | spi-max-frequency = <10000000>; |
| 89 | }; | 85 | }; |
| 90 | }; | 86 | }; |
| @@ -96,12 +96,6 @@ examples: · 95 unmodified lines | |||
| 96 | dma-names = "rx", "tx"; | 96 | dma-names = "rx", "tx"; |
| 97 | cs-gpios = <&gpioa 11 0>; | 97 | cs-gpios = <&gpioa 11 0>; |
| 98 | 98 | ||
| 99 | aardvark@0 { | ||
| 100 | compatible = "totalphase,aardvark"; | ||
| 101 | reg = <0>; | ||
| 102 | spi-max-frequency = <4000000>; | ||
| 103 | st,spi-midi-ns = <4000>; | ||
| 104 | }; | ||
| 105 | }; | 99 | }; |
| 106 | 100 | ||
| 107 | ... | 101 | ... |
| @@ -1,7 +1,7 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ========================================== | 3 | ========================================== |
| 4 | Submitting devicetree (DT) binding patches | 4 | Submitting Devicetree (DT) binding patches |
| 5 | ========================================== | 5 | ========================================== |
| 6 | 6 | ||
| 7 | I. For patch submitters | 7 | I. For patch submitters |
| @@ -25,7 +25,7 @@ I. For patch submitters · 17 unmodified lines | |||
| 25 | 25 | ||
| 26 | make dt_binding_check | 26 | make dt_binding_check |
| 27 | 27 | ||
| 28 | See Documentation/devicetree/writing-schema.rst for more details about | 28 | See Documentation/devicetree/bindings/writing-schema.rst for more details about |
| 29 | schema and tools setup. | 29 | schema and tools setup. |
| 30 | 30 | ||
| 31 | 3) DT binding files should be dual licensed. The preferred license tag is | 31 | 3) DT binding files should be dual licensed. The preferred license tag is |
| @@ -84,7 +84,7 @@ II. For kernel maintainers · 52 unmodified lines | |||
| 84 | III. Notes | 84 | III. Notes |
| 85 | ========== | 85 | ========== |
| 86 | 86 | ||
| 87 | 0) Please see ...bindings/ABI.txt for details regarding devicetree ABI. | 87 | 0) Please see :doc:`ABI` for details regarding devicetree ABI. |
| 88 | 88 | ||
| 89 | 1) This document is intended as a general familiarization with the process as | 89 | 1) This document is intended as a general familiarization with the process as |
| 90 | decided at the 2013 Kernel Summit. When in doubt, the current word of the | 90 | decided at the 2013 Kernel Summit. When in doubt, the current word of the |
| @@ -59,7 +59,6 @@ patternProperties: · 58 unmodified lines | |||
| 59 | 59 | ||
| 60 | properties: | 60 | properties: |
| 61 | reg: | 61 | reg: |
| 62 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 63 | description: Specify the sensor channel. There are 8 channels in PMIC5's ADC TM | 62 | description: Specify the sensor channel. There are 8 channels in PMIC5's ADC TM |
| 64 | minimum: 0 | 63 | minimum: 0 |
| 65 | maximum: 7 | 64 | maximum: 7 |
| @@ -78,7 +77,6 @@ patternProperties: · 12 unmodified lines | |||
| 78 | also known as absolute calibration. | 77 | also known as absolute calibration. |
| 79 | 78 | ||
| 80 | qcom,hw-settle-time-us: | 79 | qcom,hw-settle-time-us: |
| 81 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 82 | description: Time between AMUX getting configured and the ADC starting conversion. | 80 | description: Time between AMUX getting configured and the ADC starting conversion. |
| 83 | enum: [15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000] | 81 | enum: [15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000] |
| 84 | 82 | ||
| @@ -23,6 +23,9 @@ properties: · 22 unmodified lines | |||
| 23 | maxItems: 1 | 23 | maxItems: 1 |
| 24 | interrupts: | 24 | interrupts: |
| 25 | maxItems: 1 | 25 | maxItems: 1 |
| 26 | |||
| 27 | spi-max-frequency: true | ||
| 28 | |||
| 26 | compatible: | 29 | compatible: |
| 27 | items: | 30 | items: |
| 28 | - enum: | 31 | - enum: |
| @@ -16,7 +16,6 @@ properties: · 15 unmodified lines | |||
| 16 | pattern: "^usb(@.*)?" | 16 | pattern: "^usb(@.*)?" |
| 17 | 17 | ||
| 18 | phys: | 18 | phys: |
| 19 | $ref: /schemas/types.yaml#/definitions/phandle-array | ||
| 20 | description: | 19 | description: |
| 21 | List of all the USB PHYs on this HCD | 20 | List of all the USB PHYs on this HCD |
| 22 | 21 | ||
| @@ -57,6 +57,8 @@ patternProperties: · 56 unmodified lines | |||
| 57 | description: Advantech Corporation | 57 | description: Advantech Corporation |
| 58 | "^aeroflexgaisler,.*": | 58 | "^aeroflexgaisler,.*": |
| 59 | description: Aeroflex Gaisler AB | 59 | description: Aeroflex Gaisler AB |
| 60 | "^aesop,.*": | ||
| 61 | description: AESOP Embedded Forum | ||
| 60 | "^al,.*": | 62 | "^al,.*": |
| 61 | description: Annapurna Labs | 63 | description: Annapurna Labs |
| 62 | "^alcatel,.*": | 64 | "^alcatel,.*": |
| @@ -1030,6 +1032,8 @@ patternProperties: · 967 unmodified lines | |||
| 1030 | description: Silergy Corp. | 1032 | description: Silergy Corp. |
| 1031 | "^silex-insight,.*": | 1033 | "^silex-insight,.*": |
| 1032 | description: Silex Insight | 1034 | description: Silex Insight |
| 1035 | "^siliconfile,.*": | ||
| 1036 | description: Siliconfile Technologies lnc. | ||
| 1033 | "^siliconmitus,.*": | 1037 | "^siliconmitus,.*": |
| 1034 | description: Silicon Mitus, Inc. | 1038 | description: Silicon Mitus, Inc. |
| 1035 | "^siemens,.*": | 1039 | "^siemens,.*": |
| @@ -1282,6 +1286,8 @@ patternProperties: · 246 unmodified lines | |||
| 1282 | description: Yamaha Corporation | 1286 | description: Yamaha Corporation |
| 1283 | "^yes-optoelectronics,.*": | 1287 | "^yes-optoelectronics,.*": |
| 1284 | description: Yes Optoelectronics Co.,Ltd. | 1288 | description: Yes Optoelectronics Co.,Ltd. |
| 1289 | "^yic,.*": | ||
| 1290 | description: YIC System Co., Ltd. | ||
| 1285 | "^ylm,.*": | 1291 | "^ylm,.*": |
| 1286 | description: Shenzhen Yangliming Electronic Technology Co., Ltd. | 1292 | description: Shenzhen Yangliming Electronic Technology Co., Ltd. |
| 1287 | "^yna,.*": | 1293 | "^yna,.*": |
| @@ -1,6 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | Writing DeviceTree Bindings in json-schema | 3 | Writing Devicetree Bindings in json-schema |
| 4 | ========================================== | 4 | ========================================== |
| 5 | 5 | ||
| 6 | Devicetree bindings are written using json-schema vocabulary. Schema files are | 6 | Devicetree bindings are written using json-schema vocabulary. Schema files are |
| @@ -8,6 +8,8 @@ written in a JSON compatible subset of YAML. YAML is used instead of JSON as it · 1 unmodified line | |||
| 8 | is considered more human readable and has some advantages such as allowing | 8 | is considered more human readable and has some advantages such as allowing |
| 9 | comments (Prefixed with '#'). | 9 | comments (Prefixed with '#'). |
| 10 | 10 | ||
| 11 | Also see :ref:`example-schema`. | ||
| 12 | |||
| 11 | Schema Contents | 13 | Schema Contents |
| 12 | --------------- | 14 | --------------- |
| 13 | 15 | ||
| @@ -46,12 +48,12 @@ select · 32 unmodified lines | |||
| 46 | schema. By default without 'select', nodes are matched against their possible | 48 | schema. By default without 'select', nodes are matched against their possible |
| 47 | compatible string values or node name. Most bindings should not need select. | 49 | compatible string values or node name. Most bindings should not need select. |
| 48 | 50 | ||
| 49 | allOf | 51 | allOf |
| 50 | Optional. A list of other schemas to include. This is used to | 52 | Optional. A list of other schemas to include. This is used to |
| 51 | include other schemas the binding conforms to. This may be schemas for a | 53 | include other schemas the binding conforms to. This may be schemas for a |
| 52 | particular class of devices such as I2C or SPI controllers. | 54 | particular class of devices such as I2C or SPI controllers. |
| 53 | 55 | ||
| 54 | properties | 56 | properties |
| 55 | A set of sub-schema defining all the DT properties for the | 57 | A set of sub-schema defining all the DT properties for the |
| 56 | binding. The exact schema syntax depends on whether properties are known, | 58 | binding. The exact schema syntax depends on whether properties are known, |
| 57 | common properties (e.g. 'interrupts') or are binding/vendor specific properties. | 59 | common properties (e.g. 'interrupts') or are binding/vendor specific properties. |
| @@ -170,3 +172,12 @@ json-schema Resources · 112 unmodified lines | |||
| 170 | `JSON-Schema Specifications <http://json-schema.org/>`_ | 172 | `JSON-Schema Specifications <http://json-schema.org/>`_ |
| 171 | 173 | ||
| 172 | `Using JSON Schema Book <http://usingjsonschema.com/>`_ | 174 | `Using JSON Schema Book <http://usingjsonschema.com/>`_ |
| 175 | |||
| 176 | .. _example-schema: | ||
| 177 | |||
| 178 | Annotated Example Schema | ||
| 179 | ------------------------ | ||
| 180 | |||
| 181 | Also available as a separate file: :download:`example-schema.yaml` | ||
| 182 | |||
| 183 | .. literalinclude:: example-schema.yaml | ||
| @@ -1,10 +1,10 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ============= | 3 | ===================== |
| 4 | DT Changesets | 4 | Devicetree Changesets |
| 5 | ============= | 5 | ===================== |
| 6 | 6 | ||
| 7 | A DT changeset is a method which allows one to apply changes | 7 | A Devicetree changeset is a method which allows one to apply changes |
| 8 | in the live tree in such a way that either the full set of changes | 8 | in the live tree in such a way that either the full set of changes |
| 9 | will be applied, or none of them will be. If an error occurs partway | 9 | will be applied, or none of them will be. If an error occurs partway |
| 10 | through applying the changeset, then the tree will be rolled back to the | 10 | through applying the changeset, then the tree will be rolled back to the |
| @@ -1,11 +1,11 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ================================== | 3 | ================================= |
| 4 | Device Tree Dynamic Resolver Notes | 4 | Devicetree Dynamic Resolver Notes |
| 5 | ================================== | 5 | ================================= |
| 6 | 6 | ||
| 7 | This document describes the implementation of the in-kernel | 7 | This document describes the implementation of the in-kernel |
| 8 | Device Tree resolver, residing in drivers/of/resolver.c | 8 | DeviceTree resolver, residing in drivers/of/resolver.c |
| 9 | 9 | ||
| 10 | How the resolver works | 10 | How the resolver works |
| 11 | ---------------------- | 11 | ---------------------- |
| @@ -1,17 +1,30 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ============================= | 3 | ============================= |
| 4 | Open Firmware and Device Tree | 4 | Open Firmware and Devicetree |
| 5 | ============================= | 5 | ============================= |
| 6 | 6 | ||
| 7 | Kernel Devicetree Usage | ||
| 8 | ======================= | ||
| 7 | .. toctree:: | 9 | .. toctree:: |
| 8 | :maxdepth: 1 | 10 | :maxdepth: 1 |
| 9 | 11 | ||
| 10 | usage-model | 12 | usage-model |
| 11 | writing-schema | 13 | of_unittest |
| 14 | kernel-api | ||
| 15 | |||
| 16 | Devicetree Overlays | ||
| 17 | =================== | ||
| 18 | .. toctree:: | ||
| 19 | :maxdepth: 1 | ||
| 20 | |||
| 12 | changesets | 21 | changesets |
| 13 | dynamic-resolution-notes | 22 | dynamic-resolution-notes |
| 14 | of_unittest | ||
| 15 | overlay-notes | 23 | overlay-notes |
| 16 | 24 | ||
| 25 | Devicetree Bindings | ||
| 26 | =================== | ||
| 27 | .. toctree:: | ||
| 28 | :maxdepth: 1 | ||
| 29 | |||
| 17 | bindings/index | 30 | bindings/index |
| @@ -0,0 +1,57 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | .. _devicetree: | ||
| 3 | |||
| 4 | ====================================== | ||
| 5 | DeviceTree Kernel API | ||
| 6 | ====================================== | ||
| 7 | |||
| 8 | Core functions | ||
| 9 | -------------- | ||
| 10 | |||
| 11 | .. kernel-doc:: drivers/of/base.c | ||
| 12 | :export: | ||
| 13 | |||
| 14 | .. kernel-doc:: include/linux/of.h | ||
| 15 | :internal: | ||
| 16 | |||
| 17 | .. kernel-doc:: drivers/of/property.c | ||
| 18 | :export: | ||
| 19 | |||
| 20 | .. kernel-doc:: include/linux/of_graph.h | ||
| 21 | :internal: | ||
| 22 | |||
| 23 | .. kernel-doc:: drivers/of/address.c | ||
| 24 | :export: | ||
| 25 | |||
| 26 | .. kernel-doc:: drivers/of/irq.c | ||
| 27 | :export: | ||
| 28 | |||
| 29 | .. kernel-doc:: drivers/of/fdt.c | ||
| 30 | :export: | ||
| 31 | |||
| 32 | Driver model functions | ||
| 33 | ---------------------- | ||
| 34 | |||
| 35 | .. kernel-doc:: include/linux/of_device.h | ||
| 36 | :internal: | ||
| 37 | |||
| 38 | .. kernel-doc:: drivers/of/device.c | ||
| 39 | :export: | ||
| 40 | |||
| 41 | .. kernel-doc:: include/linux/of_platform.h | ||
| 42 | :internal: | ||
| 43 | |||
| 44 | .. kernel-doc:: drivers/of/platform.c | ||
| 45 | :export: | ||
| 46 | |||
| 47 | Overlay and Dynamic DT functions | ||
| 48 | -------------------------------- | ||
| 49 | |||
| 50 | .. kernel-doc:: drivers/of/resolver.c | ||
| 51 | :export: | ||
| 52 | |||
| 53 | .. kernel-doc:: drivers/of/dynamic.c | ||
| 54 | :export: | ||
| 55 | |||
| 56 | .. kernel-doc:: drivers/of/overlay.c | ||
| 57 | :export: | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ================================== | 3 | ================================= |
| 4 | Open Firmware Device Tree Unittest | 4 | Open Firmware Devicetree Unittest |
| 5 | ================================== | 5 | ================================= |
| 6 | 6 | ||
| 7 | Author: Gaurav Minocha <gaurav.minocha.os@gmail.com> | 7 | Author: Gaurav Minocha <gaurav.minocha.os@gmail.com> |
| 8 | 8 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ========================= | 3 | ======================== |
| 4 | Device Tree Overlay Notes | 4 | Devicetree Overlay Notes |
| 5 | ========================= | 5 | ======================== |
| 6 | 6 | ||
| 7 | This document describes the implementation of the in-kernel | 7 | This document describes the implementation of the in-kernel |
| 8 | device tree overlay functionality residing in drivers/of/overlay.c and is a | 8 | device tree overlay functionality residing in drivers/of/overlay.c and is a |
| @@ -11,7 +11,7 @@ companion document to Documentation/devicetree/dynamic-resolution-notes.rst[1] · 2 unmodified lines | |||
| 11 | How overlays work | 11 | How overlays work |
| 12 | ----------------- | 12 | ----------------- |
| 13 | 13 | ||
| 14 | A Device Tree's overlay purpose is to modify the kernel's live tree, and | 14 | A Devicetree's overlay purpose is to modify the kernel's live tree, and |
| 15 | have the modification affecting the state of the kernel in a way that | 15 | have the modification affecting the state of the kernel in a way that |
| 16 | is reflecting the changes. | 16 | is reflecting the changes. |
| 17 | Since the kernel mainly deals with devices, any new device node that result | 17 | Since the kernel mainly deals with devices, any new device node that result |
| @@ -1,8 +1,8 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ========================= | 3 | ======================== |
| 4 | Linux and the Device Tree | 4 | Linux and the Devicetree |
| 5 | ========================= | 5 | ======================== |
| 6 | 6 | ||
| 7 | The Linux usage model for device tree data | 7 | The Linux usage model for device tree data |
| 8 | 8 | ||
| @@ -14,7 +14,7 @@ at devicetree.org\ [1]_. · 5 unmodified lines | |||
| 14 | 14 | ||
| 15 | .. [1] https://www.devicetree.org/specifications/ | 15 | .. [1] https://www.devicetree.org/specifications/ |
| 16 | 16 | ||
| 17 | The "Open Firmware Device Tree", or simply Device Tree (DT), is a data | 17 | The "Open Firmware Device Tree", or simply Devicetree (DT), is a data |
| 18 | structure and language for describing hardware. More specifically, it | 18 | structure and language for describing hardware. More specifically, it |
| 19 | is a description of hardware that is readable by an operating system | 19 | is a description of hardware that is readable by an operating system |
| 20 | so that the operating system doesn't need to hard code details of the | 20 | so that the operating system doesn't need to hard code details of the |
| @@ -1113,6 +1113,7 @@ config KEXEC · 1112 unmodified lines | |||
| 1113 | config KEXEC_FILE | 1113 | config KEXEC_FILE |
| 1114 | bool "kexec file based system call" | 1114 | bool "kexec file based system call" |
| 1115 | select KEXEC_CORE | 1115 | select KEXEC_CORE |
| 1116 | select HAVE_IMA_KEXEC if IMA | ||
| 1116 | help | 1117 | help |
| 1117 | This is new version of kexec system call. This system call is | 1118 | This is new version of kexec system call. This system call is |
| 1118 | file based and takes file descriptors as system call argument | 1119 | file based and takes file descriptors as system call argument |
| @@ -96,10 +96,6 @@ struct kimage_arch { · 95 unmodified lines | |||
| 96 | void *dtb; | 96 | void *dtb; |
| 97 | phys_addr_t dtb_mem; | 97 | phys_addr_t dtb_mem; |
| 98 | phys_addr_t kern_reloc; | 98 | phys_addr_t kern_reloc; |
| 99 | /* Core ELF header buffer */ | ||
| 100 | void *elf_headers; | ||
| 101 | unsigned long elf_headers_mem; | ||
| 102 | unsigned long elf_headers_sz; | ||
| 103 | }; | 99 | }; |
| 104 | 100 | ||
| 105 | #ifdef CONFIG_KEXEC_FILE | 101 | #ifdef CONFIG_KEXEC_FILE |
| @@ -15,23 +15,12 @@ · 14 unmodified lines | |||
| 15 | #include <linux/kexec.h> | 15 | #include <linux/kexec.h> |
| 16 | #include <linux/libfdt.h> | 16 | #include <linux/libfdt.h> |
| 17 | #include <linux/memblock.h> | 17 | #include <linux/memblock.h> |
| 18 | #include <linux/of.h> | ||
| 18 | #include <linux/of_fdt.h> | 19 | #include <linux/of_fdt.h> |
| 19 | #include <linux/random.h> | ||
| 20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
| 22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
| 23 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
| 24 | #include <asm/byteorder.h> | ||
| 25 | |||
| 26 | /* relevant device tree properties */ | ||
| 27 | #define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr" | ||
| 28 | #define FDT_PROP_MEM_RANGE "linux,usable-memory-range" | ||
| 29 | #define FDT_PROP_INITRD_START "linux,initrd-start" | ||
| 30 | #define FDT_PROP_INITRD_END "linux,initrd-end" | ||
| 31 | #define FDT_PROP_BOOTARGS "bootargs" | ||
| 32 | #define FDT_PROP_KASLR_SEED "kaslr-seed" | ||
| 33 | #define FDT_PROP_RNG_SEED "rng-seed" | ||
| 34 | #define RNG_SEED_SIZE 128 | ||
| 35 | 24 | ||
| 36 | const struct kexec_file_ops * const kexec_file_loaders[] = { | 25 | const struct kexec_file_ops * const kexec_file_loaders[] = { |
| 37 | &kexec_image_ops, | 26 | &kexec_image_ops, |
| @@ -40,174 +29,16 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { · 2 unmodified lines | |||
| 40 | 29 | ||
| 41 | int arch_kimage_file_post_load_cleanup(struct kimage *image) | 30 | int arch_kimage_file_post_load_cleanup(struct kimage *image) |
| 42 | { | 31 | { |
| 43 | vfree(image->arch.dtb); | 32 | kvfree(image->arch.dtb); |
| 44 | image->arch.dtb = NULL; | 33 | image->arch.dtb = NULL; |
| 45 | 34 | ||
| 46 | vfree(image->arch.elf_headers); | 35 | vfree(image->elf_headers); |
| 47 | image->arch.elf_headers = NULL; | 36 | image->elf_headers = NULL; |
| 48 | image->arch.elf_headers_sz = 0; | 37 | image->elf_headers_sz = 0; |
| 49 | 38 | ||
| 50 | return kexec_image_post_load_cleanup_default(image); | 39 | return kexec_image_post_load_cleanup_default(image); |
| 51 | } | 40 | } |
| 52 | 41 | ||
| 53 | static int setup_dtb(struct kimage *image, | ||
| 54 | unsigned long initrd_load_addr, unsigned long initrd_len, | ||
| 55 | char *cmdline, void *dtb) | ||
| 56 | { | ||
| 57 | int off, ret; | ||
| 58 | |||
| 59 | ret = fdt_path_offset(dtb, "/chosen"); | ||
| 60 | if (ret < 0) | ||
| 61 | goto out; | ||
| 62 | |||
| 63 | off = ret; | ||
| 64 | |||
| 65 | ret = fdt_delprop(dtb, off, FDT_PROP_KEXEC_ELFHDR); | ||
| 66 | if (ret && ret != -FDT_ERR_NOTFOUND) | ||
| 67 | goto out; | ||
| 68 | ret = fdt_delprop(dtb, off, FDT_PROP_MEM_RANGE); | ||
| 69 | if (ret && ret != -FDT_ERR_NOTFOUND) | ||
| 70 | goto out; | ||
| 71 | |||
| 72 | if (image->type == KEXEC_TYPE_CRASH) { | ||
| 73 | /* add linux,elfcorehdr */ | ||
| 74 | ret = fdt_appendprop_addrrange(dtb, 0, off, | ||
| 75 | FDT_PROP_KEXEC_ELFHDR, | ||
| 76 | image->arch.elf_headers_mem, | ||
| 77 | image->arch.elf_headers_sz); | ||
| 78 | if (ret) | ||
| 79 | return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL); | ||
| 80 | |||
| 81 | /* add linux,usable-memory-range */ | ||
| 82 | ret = fdt_appendprop_addrrange(dtb, 0, off, | ||
| 83 | FDT_PROP_MEM_RANGE, | ||
| 84 | crashk_res.start, | ||
| 85 | crashk_res.end - crashk_res.start + 1); | ||
| 86 | if (ret) | ||
| 87 | return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL); | ||
| 88 | } | ||
| 89 | |||
| 90 | /* add bootargs */ | ||
| 91 | if (cmdline) { | ||
| 92 | ret = fdt_setprop_string(dtb, off, FDT_PROP_BOOTARGS, cmdline); | ||
| 93 | if (ret) | ||
| 94 | goto out; | ||
| 95 | } else { | ||
| 96 | ret = fdt_delprop(dtb, off, FDT_PROP_BOOTARGS); | ||
| 97 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 98 | goto out; | ||
| 99 | } | ||
| 100 | |||
| 101 | /* add initrd-* */ | ||
| 102 | if (initrd_load_addr) { | ||
| 103 | ret = fdt_setprop_u64(dtb, off, FDT_PROP_INITRD_START, | ||
| 104 | initrd_load_addr); | ||
| 105 | if (ret) | ||
| 106 | goto out; | ||
| 107 | |||
| 108 | ret = fdt_setprop_u64(dtb, off, FDT_PROP_INITRD_END, | ||
| 109 | initrd_load_addr + initrd_len); | ||
| 110 | if (ret) | ||
| 111 | goto out; | ||
| 112 | } else { | ||
| 113 | ret = fdt_delprop(dtb, off, FDT_PROP_INITRD_START); | ||
| 114 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 115 | goto out; | ||
| 116 | |||
| 117 | ret = fdt_delprop(dtb, off, FDT_PROP_INITRD_END); | ||
| 118 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 119 | goto out; | ||
| 120 | } | ||
| 121 | |||
| 122 | /* add kaslr-seed */ | ||
| 123 | ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED); | ||
| 124 | if (ret == -FDT_ERR_NOTFOUND) | ||
| 125 | ret = 0; | ||
| 126 | else if (ret) | ||
| 127 | goto out; | ||
| 128 | |||
| 129 | if (rng_is_initialized()) { | ||
| 130 | u64 seed = get_random_u64(); | ||
| 131 | ret = fdt_setprop_u64(dtb, off, FDT_PROP_KASLR_SEED, seed); | ||
| 132 | if (ret) | ||
| 133 | goto out; | ||
| 134 | } else { | ||
| 135 | pr_notice("RNG is not initialised: omitting \"%s\" property\n", | ||
| 136 | FDT_PROP_KASLR_SEED); | ||
| 137 | } | ||
| 138 | |||
| 139 | /* add rng-seed */ | ||
| 140 | if (rng_is_initialized()) { | ||
| 141 | void *rng_seed; | ||
| 142 | ret = fdt_setprop_placeholder(dtb, off, FDT_PROP_RNG_SEED, | ||
| 143 | RNG_SEED_SIZE, &rng_seed); | ||
| 144 | if (ret) | ||
| 145 | goto out; | ||
| 146 | get_random_bytes(rng_seed, RNG_SEED_SIZE); | ||
| 147 | } else { | ||
| 148 | pr_notice("RNG is not initialised: omitting \"%s\" property\n", | ||
| 149 | FDT_PROP_RNG_SEED); | ||
| 150 | } | ||
| 151 | |||
| 152 | out: | ||
| 153 | if (ret) | ||
| 154 | return (ret == -FDT_ERR_NOSPACE) ? -ENOMEM : -EINVAL; | ||
| 155 | |||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | /* | ||
| 160 | * More space needed so that we can add initrd, bootargs, kaslr-seed, | ||
| 161 | * rng-seed, userable-memory-range and elfcorehdr. | ||
| 162 | */ | ||
| 163 | #define DTB_EXTRA_SPACE 0x1000 | ||
| 164 | |||
| 165 | static int create_dtb(struct kimage *image, | ||
| 166 | unsigned long initrd_load_addr, unsigned long initrd_len, | ||
| 167 | char *cmdline, void **dtb) | ||
| 168 | { | ||
| 169 | void *buf; | ||
| 170 | size_t buf_size; | ||
| 171 | size_t cmdline_len; | ||
| 172 | int ret; | ||
| 173 | |||
| 174 | cmdline_len = cmdline ? strlen(cmdline) : 0; | ||
| 175 | buf_size = fdt_totalsize(initial_boot_params) | ||
| 176 | + cmdline_len + DTB_EXTRA_SPACE; | ||
| 177 | |||
| 178 | for (;;) { | ||
| 179 | buf = vmalloc(buf_size); | ||
| 180 | if (!buf) | ||
| 181 | return -ENOMEM; | ||
| 182 | |||
| 183 | /* duplicate a device tree blob */ | ||
| 184 | ret = fdt_open_into(initial_boot_params, buf, buf_size); | ||
| 185 | if (ret) { | ||
| 186 | vfree(buf); | ||
| 187 | return -EINVAL; | ||
| 188 | } | ||
| 189 | |||
| 190 | ret = setup_dtb(image, initrd_load_addr, initrd_len, | ||
| 191 | cmdline, buf); | ||
| 192 | if (ret) { | ||
| 193 | vfree(buf); | ||
| 194 | if (ret == -ENOMEM) { | ||
| 195 | /* unlikely, but just in case */ | ||
| 196 | buf_size += DTB_EXTRA_SPACE; | ||
| 197 | continue; | ||
| 198 | } else { | ||
| 199 | return ret; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | |||
| 203 | /* trim it */ | ||
| 204 | fdt_pack(buf); | ||
| 205 | *dtb = buf; | ||
| 206 | |||
| 207 | return 0; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | static int prepare_elf_headers(void **addr, unsigned long *sz) | 42 | static int prepare_elf_headers(void **addr, unsigned long *sz) |
| 212 | { | 43 | { |
| 213 | struct crash_mem *cmem; | 44 | struct crash_mem *cmem; |
| @@ -284,12 +115,12 @@ int load_other_segments(struct kimage *image, · 70 unmodified lines | |||
| 284 | vfree(headers); | 115 | vfree(headers); |
| 285 | goto out_err; | 116 | goto out_err; |
| 286 | } | 117 | } |
| 287 | image->arch.elf_headers = headers; | 118 | image->elf_headers = headers; |
| 288 | image->arch.elf_headers_mem = kbuf.mem; | 119 | image->elf_load_addr = kbuf.mem; |
| 289 | image->arch.elf_headers_sz = headers_sz; | 120 | image->elf_headers_sz = headers_sz; |
| 290 | 121 | ||
| 291 | pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", | 122 | pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", |
| 292 | image->arch.elf_headers_mem, kbuf.bufsz, kbuf.memsz); | 123 | image->elf_load_addr, kbuf.bufsz, kbuf.memsz); |
| 293 | } | 124 | } |
| 294 | 125 | ||
| 295 | /* load initrd */ | 126 | /* load initrd */ |
| @@ -314,12 +145,15 @@ int load_other_segments(struct kimage *image, · 18 unmodified lines | |||
| 314 | } | 145 | } |
| 315 | 146 | ||
| 316 | /* load dtb */ | 147 | /* load dtb */ |
| 317 | ret = create_dtb(image, initrd_load_addr, initrd_len, cmdline, &dtb); | 148 | dtb = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, |
| 318 | if (ret) { | 149 | initrd_len, cmdline, 0); |
| 150 | if (!dtb) { | ||
| 319 | pr_err("Preparing for new dtb failed\n"); | 151 | pr_err("Preparing for new dtb failed\n"); |
| 320 | goto out_err; | 152 | goto out_err; |
| 321 | } | 153 | } |
| 322 | 154 | ||
| 155 | /* trim it */ | ||
| 156 | fdt_pack(dtb); | ||
| 323 | dtb_len = fdt_totalsize(dtb); | 157 | dtb_len = fdt_totalsize(dtb); |
| 324 | kbuf.buffer = dtb; | 158 | kbuf.buffer = dtb; |
| 325 | kbuf.bufsz = dtb_len; | 159 | kbuf.bufsz = dtb_len; |
| @@ -343,6 +177,6 @@ int load_other_segments(struct kimage *image, · 17 unmodified lines | |||
| 343 | 177 | ||
| 344 | out_err: | 178 | out_err: |
| 345 | image->nr_segments = orig_segments; | 179 | image->nr_segments = orig_segments; |
| 346 | vfree(dtb); | 180 | kvfree(dtb); |
| 347 | return ret; | 181 | return ret; |
| 348 | } | 182 | } |
| @@ -548,7 +548,7 @@ config KEXEC · 547 unmodified lines | |||
| 548 | config KEXEC_FILE | 548 | config KEXEC_FILE |
| 549 | bool "kexec file based system call" | 549 | bool "kexec file based system call" |
| 550 | select KEXEC_CORE | 550 | select KEXEC_CORE |
| 551 | select HAVE_IMA_KEXEC | 551 | select HAVE_IMA_KEXEC if IMA |
| 552 | select BUILD_BIN2C | 552 | select BUILD_BIN2C |
| 553 | select KEXEC_ELF | 553 | select KEXEC_ELF |
| 554 | depends on PPC64 | 554 | depends on PPC64 |
| @@ -1,30 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_POWERPC_IMA_H | ||
| 3 | #define _ASM_POWERPC_IMA_H | ||
| 4 | |||
| 5 | struct kimage; | ||
| 6 | |||
| 7 | int ima_get_kexec_buffer(void **addr, size_t *size); | ||
| 8 | int ima_free_kexec_buffer(void); | ||
| 9 | |||
| 10 | #ifdef CONFIG_IMA | ||
| 11 | void remove_ima_buffer(void *fdt, int chosen_node); | ||
| 12 | #else | ||
| 13 | static inline void remove_ima_buffer(void *fdt, int chosen_node) {} | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #ifdef CONFIG_IMA_KEXEC | ||
| 17 | int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr, | ||
| 18 | size_t size); | ||
| 19 | |||
| 20 | int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node); | ||
| 21 | #else | ||
| 22 | static inline int setup_ima_buffer(const struct kimage *image, void *fdt, | ||
| 23 | int chosen_node) | ||
| 24 | { | ||
| 25 | remove_ima_buffer(fdt, chosen_node); | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | #endif /* CONFIG_IMA_KEXEC */ | ||
| 29 | |||
| 30 | #endif /* _ASM_POWERPC_IMA_H */ | ||
| @@ -107,15 +107,7 @@ struct kimage_arch { · 106 unmodified lines | |||
| 107 | 107 | ||
| 108 | unsigned long backup_start; | 108 | unsigned long backup_start; |
| 109 | void *backup_buf; | 109 | void *backup_buf; |
| 110 | 110 | void *fdt; | |
| 111 | unsigned long elfcorehdr_addr; | ||
| 112 | unsigned long elf_headers_sz; | ||
| 113 | void *elf_headers; | ||
| 114 | |||
| 115 | #ifdef CONFIG_IMA_KEXEC | ||
| 116 | phys_addr_t ima_buffer_addr; | ||
| 117 | size_t ima_buffer_size; | ||
| 118 | #endif | ||
| 119 | }; | 111 | }; |
| 120 | 112 | ||
| 121 | char *setup_kdump_cmdline(struct kimage *image, char *cmdline, | 113 | char *setup_kdump_cmdline(struct kimage *image, char *cmdline, |
| @@ -123,10 +115,6 @@ char *setup_kdump_cmdline(struct kimage *image, char *cmdline, · 1 unmodified line | |||
| 123 | int setup_purgatory(struct kimage *image, const void *slave_code, | 115 | int setup_purgatory(struct kimage *image, const void *slave_code, |
| 124 | const void *fdt, unsigned long kernel_load_addr, | 116 | const void *fdt, unsigned long kernel_load_addr, |
| 125 | unsigned long fdt_load_addr); | 117 | unsigned long fdt_load_addr); |
| 126 | int setup_new_fdt(const struct kimage *image, void *fdt, | ||
| 127 | unsigned long initrd_load_addr, unsigned long initrd_len, | ||
| 128 | const char *cmdline); | ||
| 129 | int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size); | ||
| 130 | 118 | ||
| 131 | #ifdef CONFIG_PPC64 | 119 | #ifdef CONFIG_PPC64 |
| 132 | struct kexec_buf; | 120 | struct kexec_buf; |
| @@ -136,7 +124,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, · 3 unmodified lines | |||
| 136 | int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, | 124 | int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, |
| 137 | const void *fdt, unsigned long kernel_load_addr, | 125 | const void *fdt, unsigned long kernel_load_addr, |
| 138 | unsigned long fdt_load_addr); | 126 | unsigned long fdt_load_addr); |
| 139 | unsigned int kexec_fdt_totalsize_ppc64(struct kimage *image); | 127 | unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image); |
| 140 | int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, | 128 | int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, |
| 141 | unsigned long initrd_load_addr, | 129 | unsigned long initrd_load_addr, |
| 142 | unsigned long initrd_len, const char *cmdline); | 130 | unsigned long initrd_len, const char *cmdline); |
| @@ -9,13 +9,6 @@ obj-$(CONFIG_PPC32) += relocate_32.o · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o | 10 | obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o |
| 11 | 11 | ||
| 12 | ifdef CONFIG_HAVE_IMA_KEXEC | ||
| 13 | ifdef CONFIG_IMA | ||
| 14 | obj-y += ima.o | ||
| 15 | endif | ||
| 16 | endif | ||
| 17 | |||
| 18 | |||
| 19 | # Disable GCOV, KCOV & sanitizers in odd or sensitive code | 12 | # Disable GCOV, KCOV & sanitizers in odd or sensitive code |
| 20 | GCOV_PROFILE_core_$(BITS).o := n | 13 | GCOV_PROFILE_core_$(BITS).o := n |
| 21 | KCOV_INSTRUMENT_core_$(BITS).o := n | 14 | KCOV_INSTRUMENT_core_$(BITS).o := n |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | #include <linux/kexec.h> | 19 | #include <linux/kexec.h> |
| 20 | #include <linux/libfdt.h> | 20 | #include <linux/libfdt.h> |
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/of.h> | ||
| 22 | #include <linux/of_fdt.h> | 23 | #include <linux/of_fdt.h> |
| 23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 24 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| @@ -29,7 +30,6 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 4 unmodified lines | |||
| 29 | unsigned long cmdline_len) | 30 | unsigned long cmdline_len) |
| 30 | { | 31 | { |
| 31 | int ret; | 32 | int ret; |
| 32 | unsigned int fdt_size; | ||
| 33 | unsigned long kernel_load_addr; | 33 | unsigned long kernel_load_addr; |
| 34 | unsigned long initrd_load_addr = 0, fdt_load_addr; | 34 | unsigned long initrd_load_addr = 0, fdt_load_addr; |
| 35 | void *fdt; | 35 | void *fdt; |
| @@ -45,7 +45,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 9 unmodified lines | |||
| 45 | 45 | ||
| 46 | ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); | 46 | ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); |
| 47 | if (ret) | 47 | if (ret) |
| 48 | goto out; | 48 | return ERR_PTR(ret); |
| 49 | 49 | ||
| 50 | if (image->type == KEXEC_TYPE_CRASH) { | 50 | if (image->type == KEXEC_TYPE_CRASH) { |
| 51 | /* min & max buffer values for kdump case */ | 51 | /* min & max buffer values for kdump case */ |
| @@ -102,15 +102,10 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 50 unmodified lines | |||
| 102 | pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); | 102 | pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | fdt_size = kexec_fdt_totalsize_ppc64(image); | 105 | fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, |
| 106 | fdt = kmalloc(fdt_size, GFP_KERNEL); | 106 | initrd_len, cmdline, |
| 107 | kexec_extra_fdt_size_ppc64(image)); | ||
| 107 | if (!fdt) { | 108 | if (!fdt) { |
| 108 | pr_err("Not enough memory for the device tree.\n"); | ||
| 109 | ret = -ENOMEM; | ||
| 110 | goto out; | ||
| 111 | } | ||
| 112 | ret = fdt_open_into(initial_boot_params, fdt, fdt_size); | ||
| 113 | if (ret < 0) { | ||
| 114 | pr_err("Error setting up the new device tree.\n"); | 109 | pr_err("Error setting up the new device tree.\n"); |
| 115 | ret = -EINVAL; | 110 | ret = -EINVAL; |
| 116 | goto out; | 111 | goto out; |
| @@ -119,18 +114,22 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 2 unmodified lines | |||
| 119 | ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr, | 114 | ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr, |
| 120 | initrd_len, cmdline); | 115 | initrd_len, cmdline); |
| 121 | if (ret) | 116 | if (ret) |
| 122 | goto out; | 117 | goto out_free_fdt; |
| 123 | 118 | ||
| 124 | fdt_pack(fdt); | 119 | fdt_pack(fdt); |
| 125 | 120 | ||
| 126 | kbuf.buffer = fdt; | 121 | kbuf.buffer = fdt; |
| 127 | kbuf.bufsz = kbuf.memsz = fdt_size; | 122 | kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt); |
| 128 | kbuf.buf_align = PAGE_SIZE; | 123 | kbuf.buf_align = PAGE_SIZE; |
| 129 | kbuf.top_down = true; | 124 | kbuf.top_down = true; |
| 130 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | 125 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; |
| 131 | ret = kexec_add_buffer(&kbuf); | 126 | ret = kexec_add_buffer(&kbuf); |
| 132 | if (ret) | 127 | if (ret) |
| 133 | goto out; | 128 | goto out_free_fdt; |
| 129 | |||
| 130 | /* FDT will be freed in arch_kimage_file_post_load_cleanup */ | ||
| 131 | image->arch.fdt = fdt; | ||
| 132 | |||
| 134 | fdt_load_addr = kbuf.mem; | 133 | fdt_load_addr = kbuf.mem; |
| 135 | 134 | ||
| 136 | pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); | 135 | pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); |
| @@ -141,12 +140,15 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 4 unmodified lines | |||
| 141 | if (ret) | 140 | if (ret) |
| 142 | pr_err("Error setting up the purgatory.\n"); | 141 | pr_err("Error setting up the purgatory.\n"); |
| 143 | 142 | ||
| 143 | goto out; | ||
| 144 | |||
| 145 | out_free_fdt: | ||
| 146 | kvfree(fdt); | ||
| 144 | out: | 147 | out: |
| 145 | kfree(modified_cmdline); | 148 | kfree(modified_cmdline); |
| 146 | kexec_free_elf_info(&elf_info); | 149 | kexec_free_elf_info(&elf_info); |
| 147 | 150 | ||
| 148 | /* Make kimage_file_post_load_cleanup free the fdt buffer for us. */ | 151 | return ret ? ERR_PTR(ret) : NULL; |
| 149 | return ret ? ERR_PTR(ret) : fdt; | ||
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | const struct kexec_file_ops kexec_elf64_ops = { | 154 | const struct kexec_file_ops kexec_elf64_ops = { |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | |||
| 19 | #include <linux/of_fdt.h> | 19 | #include <linux/of_fdt.h> |
| 20 | #include <linux/libfdt.h> | 20 | #include <linux/libfdt.h> |
| 21 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
| 22 | #include <asm/ima.h> | ||
| 23 | 22 | ||
| 24 | #define SLAVE_CODE_SIZE 256 /* First 0x100 bytes */ | 23 | #define SLAVE_CODE_SIZE 256 /* First 0x100 bytes */ |
| 25 | 24 | ||
| @@ -45,7 +44,7 @@ char *setup_kdump_cmdline(struct kimage *image, char *cmdline, · 19 unmodified lines | |||
| 45 | return NULL; | 44 | return NULL; |
| 46 | 45 | ||
| 47 | elfcorehdr_strlen = sprintf(cmdline_ptr, "elfcorehdr=0x%lx ", | 46 | elfcorehdr_strlen = sprintf(cmdline_ptr, "elfcorehdr=0x%lx ", |
| 48 | image->arch.elfcorehdr_addr); | 47 | image->elf_load_addr); |
| 49 | 48 | ||
| 50 | if (elfcorehdr_strlen + cmdline_len > COMMAND_LINE_SIZE) { | 49 | if (elfcorehdr_strlen + cmdline_len > COMMAND_LINE_SIZE) { |
| 51 | pr_err("Appending elfcorehdr=<addr> exceeds cmdline size\n"); | 50 | pr_err("Appending elfcorehdr=<addr> exceeds cmdline size\n"); |
| @@ -108,183 +107,3 @@ int setup_purgatory(struct kimage *image, const void *slave_code, · 56 unmodified lines | |||
| 108 | 107 | ||
| 109 | return 0; | 108 | return 0; |
| 110 | } | 109 | } |
| 111 | |||
| 112 | /** | ||
| 113 | * delete_fdt_mem_rsv - delete memory reservation with given address and size | ||
| 114 | * | ||
| 115 | * Return: 0 on success, or negative errno on error. | ||
| 116 | */ | ||
| 117 | int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size) | ||
| 118 | { | ||
| 119 | int i, ret, num_rsvs = fdt_num_mem_rsv(fdt); | ||
| 120 | |||
| 121 | for (i = 0; i < num_rsvs; i++) { | ||
| 122 | uint64_t rsv_start, rsv_size; | ||
| 123 | |||
| 124 | ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size); | ||
| 125 | if (ret) { | ||
| 126 | pr_err("Malformed device tree.\n"); | ||
| 127 | return -EINVAL; | ||
| 128 | } | ||
| 129 | |||
| 130 | if (rsv_start == start && rsv_size == size) { | ||
| 131 | ret = fdt_del_mem_rsv(fdt, i); | ||
| 132 | if (ret) { | ||
| 133 | pr_err("Error deleting device tree reservation.\n"); | ||
| 134 | return -EINVAL; | ||
| 135 | } | ||
| 136 | |||
| 137 | return 0; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 141 | return -ENOENT; | ||
| 142 | } | ||
| 143 | |||
| 144 | /* | ||
| 145 | * setup_new_fdt - modify /chosen and memory reservation for the next kernel | ||
| 146 | * @image: kexec image being loaded. | ||
| 147 | * @fdt: Flattened device tree for the next kernel. | ||
| 148 | * @initrd_load_addr: Address where the next initrd will be loaded. | ||
| 149 | * @initrd_len: Size of the next initrd, or 0 if there will be none. | ||
| 150 | * @cmdline: Command line for the next kernel, or NULL if there will | ||
| 151 | * be none. | ||
| 152 | * | ||
| 153 | * Return: 0 on success, or negative errno on error. | ||
| 154 | */ | ||
| 155 | int setup_new_fdt(const struct kimage *image, void *fdt, | ||
| 156 | unsigned long initrd_load_addr, unsigned long initrd_len, | ||
| 157 | const char *cmdline) | ||
| 158 | { | ||
| 159 | int ret, chosen_node; | ||
| 160 | const void *prop; | ||
| 161 | |||
| 162 | /* Remove memory reservation for the current device tree. */ | ||
| 163 | ret = delete_fdt_mem_rsv(fdt, __pa(initial_boot_params), | ||
| 164 | fdt_totalsize(initial_boot_params)); | ||
| 165 | if (ret == 0) | ||
| 166 | pr_debug("Removed old device tree reservation.\n"); | ||
| 167 | else if (ret != -ENOENT) | ||
| 168 | return ret; | ||
| 169 | |||
| 170 | chosen_node = fdt_path_offset(fdt, "/chosen"); | ||
| 171 | if (chosen_node == -FDT_ERR_NOTFOUND) { | ||
| 172 | chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"), | ||
| 173 | "chosen"); | ||
| 174 | if (chosen_node < 0) { | ||
| 175 | pr_err("Error creating /chosen.\n"); | ||
| 176 | return -EINVAL; | ||
| 177 | } | ||
| 178 | } else if (chosen_node < 0) { | ||
| 179 | pr_err("Malformed device tree: error reading /chosen.\n"); | ||
| 180 | return -EINVAL; | ||
| 181 | } | ||
| 182 | |||
| 183 | /* Did we boot using an initrd? */ | ||
| 184 | prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", NULL); | ||
| 185 | if (prop) { | ||
| 186 | uint64_t tmp_start, tmp_end, tmp_size; | ||
| 187 | |||
| 188 | tmp_start = fdt64_to_cpu(*((const fdt64_t *) prop)); | ||
| 189 | |||
| 190 | prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", NULL); | ||
| 191 | if (!prop) { | ||
| 192 | pr_err("Malformed device tree.\n"); | ||
| 193 | return -EINVAL; | ||
| 194 | } | ||
| 195 | tmp_end = fdt64_to_cpu(*((const fdt64_t *) prop)); | ||
| 196 | |||
| 197 | /* | ||
| 198 | * kexec reserves exact initrd size, while firmware may | ||
| 199 | * reserve a multiple of PAGE_SIZE, so check for both. | ||
| 200 | */ | ||
| 201 | tmp_size = tmp_end - tmp_start; | ||
| 202 | ret = delete_fdt_mem_rsv(fdt, tmp_start, tmp_size); | ||
| 203 | if (ret == -ENOENT) | ||
| 204 | ret = delete_fdt_mem_rsv(fdt, tmp_start, | ||
| 205 | round_up(tmp_size, PAGE_SIZE)); | ||
| 206 | if (ret == 0) | ||
| 207 | pr_debug("Removed old initrd reservation.\n"); | ||
| 208 | else if (ret != -ENOENT) | ||
| 209 | return ret; | ||
| 210 | |||
| 211 | /* If there's no new initrd, delete the old initrd's info. */ | ||
| 212 | if (initrd_len == 0) { | ||
| 213 | ret = fdt_delprop(fdt, chosen_node, | ||
| 214 | "linux,initrd-start"); | ||
| 215 | if (ret) { | ||
| 216 | pr_err("Error deleting linux,initrd-start.\n"); | ||
| 217 | return -EINVAL; | ||
| 218 | } | ||
| 219 | |||
| 220 | ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end"); | ||
| 221 | if (ret) { | ||
| 222 | pr_err("Error deleting linux,initrd-end.\n"); | ||
| 223 | return -EINVAL; | ||
| 224 | } | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | if (initrd_len) { | ||
| 229 | ret = fdt_setprop_u64(fdt, chosen_node, | ||
| 230 | "linux,initrd-start", | ||
| 231 | initrd_load_addr); | ||
| 232 | if (ret < 0) | ||
| 233 | goto err; | ||
| 234 | |||
| 235 | /* initrd-end is the first address after the initrd image. */ | ||
| 236 | ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end", | ||
| 237 | initrd_load_addr + initrd_len); | ||
| 238 | if (ret < 0) | ||
| 239 | goto err; | ||
| 240 | |||
| 241 | ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len); | ||
| 242 | if (ret) { | ||
| 243 | pr_err("Error reserving initrd memory: %s\n", | ||
| 244 | fdt_strerror(ret)); | ||
| 245 | return -EINVAL; | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | if (cmdline != NULL) { | ||
| 250 | ret = fdt_setprop_string(fdt, chosen_node, "bootargs", cmdline); | ||
| 251 | if (ret < 0) | ||
| 252 | goto err; | ||
| 253 | } else { | ||
| 254 | ret = fdt_delprop(fdt, chosen_node, "bootargs"); | ||
| 255 | if (ret && ret != -FDT_ERR_NOTFOUND) { | ||
| 256 | pr_err("Error deleting bootargs.\n"); | ||
| 257 | return -EINVAL; | ||
| 258 | } | ||
| 259 | } | ||
| 260 | |||
| 261 | if (image->type == KEXEC_TYPE_CRASH) { | ||
| 262 | /* | ||
| 263 | * Avoid elfcorehdr from being stomped on in kdump kernel by | ||
| 264 | * setting up memory reserve map. | ||
| 265 | */ | ||
| 266 | ret = fdt_add_mem_rsv(fdt, image->arch.elfcorehdr_addr, | ||
| 267 | image->arch.elf_headers_sz); | ||
| 268 | if (ret) { | ||
| 269 | pr_err("Error reserving elfcorehdr memory: %s\n", | ||
| 270 | fdt_strerror(ret)); | ||
| 271 | goto err; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 275 | ret = setup_ima_buffer(image, fdt, chosen_node); | ||
| 276 | if (ret) { | ||
| 277 | pr_err("Error setting up the new device tree.\n"); | ||
| 278 | return ret; | ||
| 279 | } | ||
| 280 | |||
| 281 | ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0); | ||
| 282 | if (ret) | ||
| 283 | goto err; | ||
| 284 | |||
| 285 | return 0; | ||
| 286 | |||
| 287 | err: | ||
| 288 | pr_err("Error setting up the new device tree.\n"); | ||
| 289 | return -EINVAL; | ||
| 290 | } | ||
| @@ -816,9 +816,9 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf) · 815 unmodified lines | |||
| 816 | goto out; | 816 | goto out; |
| 817 | } | 817 | } |
| 818 | 818 | ||
| 819 | image->arch.elfcorehdr_addr = kbuf->mem; | 819 | image->elf_load_addr = kbuf->mem; |
| 820 | image->arch.elf_headers_sz = headers_sz; | 820 | image->elf_headers_sz = headers_sz; |
| 821 | image->arch.elf_headers = headers; | 821 | image->elf_headers = headers; |
| 822 | out: | 822 | out: |
| 823 | kfree(cmem); | 823 | kfree(cmem); |
| 824 | return ret; | 824 | return ret; |
| @@ -852,7 +852,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, · 27 unmodified lines | |||
| 852 | return ret; | 852 | return ret; |
| 853 | } | 853 | } |
| 854 | pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", | 854 | pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", |
| 855 | image->arch.elfcorehdr_addr, kbuf->bufsz, kbuf->memsz); | 855 | image->elf_load_addr, kbuf->bufsz, kbuf->memsz); |
| 856 | 856 | ||
| 857 | return 0; | 857 | return 0; |
| 858 | } | 858 | } |
| @@ -927,37 +927,27 @@ out: · 68 unmodified lines | |||
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | /** | 929 | /** |
| 930 | * kexec_fdt_totalsize_ppc64 - Return the estimated size needed to setup FDT | 930 | * kexec_extra_fdt_size_ppc64 - Return the estimated additional size needed to |
| 931 | * for kexec/kdump kernel. | 931 | * setup FDT for kexec/kdump kernel. |
| 932 | * @image: kexec image being loaded. | 932 | * @image: kexec image being loaded. |
| 933 | * | 933 | * |
| 934 | * Returns the estimated size needed for kexec/kdump kernel FDT. | 934 | * Returns the estimated extra size needed for kexec/kdump kernel FDT. |
| 935 | */ | 935 | */ |
| 936 | unsigned int kexec_fdt_totalsize_ppc64(struct kimage *image) | 936 | unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image) |
| 937 | { | 937 | { |
| 938 | unsigned int fdt_size; | ||
| 939 | u64 usm_entries; | 938 | u64 usm_entries; |
| 940 | 939 | ||
| 941 | /* | ||
| 942 | * The below estimate more than accounts for a typical kexec case where | ||
| 943 | * the additional space is to accommodate things like kexec cmdline, | ||
| 944 | * chosen node with properties for initrd start & end addresses and | ||
| 945 | * a property to indicate kexec boot.. | ||
| 946 | */ | ||
| 947 | fdt_size = fdt_totalsize(initial_boot_params) + (2 * COMMAND_LINE_SIZE); | ||
| 948 | if (image->type != KEXEC_TYPE_CRASH) | 940 | if (image->type != KEXEC_TYPE_CRASH) |
| 949 | return fdt_size; | 941 | return 0; |
| 950 | 942 | ||
| 951 | /* | 943 | /* |
| 952 | * For kdump kernel, also account for linux,usable-memory and | 944 | * For kdump kernel, account for linux,usable-memory and |
| 953 | * linux,drconf-usable-memory properties. Get an approximate on the | 945 | * linux,drconf-usable-memory properties. Get an approximate on the |
| 954 | * number of usable memory entries and use for FDT size estimation. | 946 | * number of usable memory entries and use for FDT size estimation. |
| 955 | */ | 947 | */ |
| 956 | usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) + | 948 | usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) + |
| 957 | (2 * (resource_size(&crashk_res) / drmem_lmb_size()))); | 949 | (2 * (resource_size(&crashk_res) / drmem_lmb_size()))); |
| 958 | fdt_size += (unsigned int)(usm_entries * sizeof(u64)); | 950 | return (unsigned int)(usm_entries * sizeof(u64)); |
| 959 | |||
| 960 | return fdt_size; | ||
| 961 | } | 951 | } |
| 962 | 952 | ||
| 963 | /** | 953 | /** |
| @@ -979,10 +969,6 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, · 15 unmodified lines | |||
| 979 | struct crash_mem *umem = NULL, *rmem = NULL; | 969 | struct crash_mem *umem = NULL, *rmem = NULL; |
| 980 | int i, nr_ranges, ret; | 970 | int i, nr_ranges, ret; |
| 981 | 971 | ||
| 982 | ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline); | ||
| 983 | if (ret) | ||
| 984 | goto out; | ||
| 985 | |||
| 986 | /* | 972 | /* |
| 987 | * Restrict memory usage for kdump kernel by setting up | 973 | * Restrict memory usage for kdump kernel by setting up |
| 988 | * usable memory ranges and memory reserve map. | 974 | * usable memory ranges and memory reserve map. |
| @@ -1142,9 +1128,12 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) · 153 unmodified lines | |||
| 1142 | vfree(image->arch.backup_buf); | 1128 | vfree(image->arch.backup_buf); |
| 1143 | image->arch.backup_buf = NULL; | 1129 | image->arch.backup_buf = NULL; |
| 1144 | 1130 | ||
| 1145 | vfree(image->arch.elf_headers); | 1131 | vfree(image->elf_headers); |
| 1146 | image->arch.elf_headers = NULL; | 1132 | image->elf_headers = NULL; |
| 1147 | image->arch.elf_headers_sz = 0; | 1133 | image->elf_headers_sz = 0; |
| 1134 | |||
| 1135 | kvfree(image->arch.fdt); | ||
| 1136 | image->arch.fdt = NULL; | ||
| 1148 | 1137 | ||
| 1149 | return kexec_image_post_load_cleanup_default(image); | 1138 | return kexec_image_post_load_cleanup_default(image); |
| 1150 | } | 1139 | } |
| @@ -1,219 +0,0 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2016 IBM Corporation | ||
| 4 | * | ||
| 5 | * Authors: | ||
| 6 | * Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/slab.h> | ||
| 10 | #include <linux/kexec.h> | ||
| 11 | #include <linux/of.h> | ||
| 12 | #include <linux/memblock.h> | ||
| 13 | #include <linux/libfdt.h> | ||
| 14 | |||
| 15 | static int get_addr_size_cells(int *addr_cells, int *size_cells) | ||
| 16 | { | ||
| 17 | struct device_node *root; | ||
| 18 | |||
| 19 | root = of_find_node_by_path("/"); | ||
| 20 | if (!root) | ||
| 21 | return -EINVAL; | ||
| 22 | |||
| 23 | *addr_cells = of_n_addr_cells(root); | ||
| 24 | *size_cells = of_n_size_cells(root); | ||
| 25 | |||
| 26 | of_node_put(root); | ||
| 27 | |||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | |||
| 31 | static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr, | ||
| 32 | size_t *size) | ||
| 33 | { | ||
| 34 | int ret, addr_cells, size_cells; | ||
| 35 | |||
| 36 | ret = get_addr_size_cells(&addr_cells, &size_cells); | ||
| 37 | if (ret) | ||
| 38 | return ret; | ||
| 39 | |||
| 40 | if (len < 4 * (addr_cells + size_cells)) | ||
| 41 | return -ENOENT; | ||
| 42 | |||
| 43 | *addr = of_read_number(prop, addr_cells); | ||
| 44 | *size = of_read_number(prop + 4 * addr_cells, size_cells); | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | /** | ||
| 50 | * ima_get_kexec_buffer - get IMA buffer from the previous kernel | ||
| 51 | * @addr: On successful return, set to point to the buffer contents. | ||
| 52 | * @size: On successful return, set to the buffer size. | ||
| 53 | * | ||
| 54 | * Return: 0 on success, negative errno on error. | ||
| 55 | */ | ||
| 56 | int ima_get_kexec_buffer(void **addr, size_t *size) | ||
| 57 | { | ||
| 58 | int ret, len; | ||
| 59 | unsigned long tmp_addr; | ||
| 60 | size_t tmp_size; | ||
| 61 | const void *prop; | ||
| 62 | |||
| 63 | prop = of_get_property(of_chosen, "linux,ima-kexec-buffer", &len); | ||
| 64 | if (!prop) | ||
| 65 | return -ENOENT; | ||
| 66 | |||
| 67 | ret = do_get_kexec_buffer(prop, len, &tmp_addr, &tmp_size); | ||
| 68 | if (ret) | ||
| 69 | return ret; | ||
| 70 | |||
| 71 | *addr = __va(tmp_addr); | ||
| 72 | *size = tmp_size; | ||
| 73 | |||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * ima_free_kexec_buffer - free memory used by the IMA buffer | ||
| 79 | */ | ||
| 80 | int ima_free_kexec_buffer(void) | ||
| 81 | { | ||
| 82 | int ret; | ||
| 83 | unsigned long addr; | ||
| 84 | size_t size; | ||
| 85 | struct property *prop; | ||
| 86 | |||
| 87 | prop = of_find_property(of_chosen, "linux,ima-kexec-buffer", NULL); | ||
| 88 | if (!prop) | ||
| 89 | return -ENOENT; | ||
| 90 | |||
| 91 | ret = do_get_kexec_buffer(prop->value, prop->length, &addr, &size); | ||
| 92 | if (ret) | ||
| 93 | return ret; | ||
| 94 | |||
| 95 | ret = of_remove_property(of_chosen, prop); | ||
| 96 | if (ret) | ||
| 97 | return ret; | ||
| 98 | |||
| 99 | return memblock_free(addr, size); | ||
| 100 | |||
| 101 | } | ||
| 102 | |||
| 103 | /** | ||
| 104 | * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt | ||
| 105 | * | ||
| 106 | * The IMA measurement buffer is of no use to a subsequent kernel, so we always | ||
| 107 | * remove it from the device tree. | ||
| 108 | */ | ||
| 109 | void remove_ima_buffer(void *fdt, int chosen_node) | ||
| 110 | { | ||
| 111 | int ret, len; | ||
| 112 | unsigned long addr; | ||
| 113 | size_t size; | ||
| 114 | const void *prop; | ||
| 115 | |||
| 116 | prop = fdt_getprop(fdt, chosen_node, "linux,ima-kexec-buffer", &len); | ||
| 117 | if (!prop) | ||
| 118 | return; | ||
| 119 | |||
| 120 | ret = do_get_kexec_buffer(prop, len, &addr, &size); | ||
| 121 | fdt_delprop(fdt, chosen_node, "linux,ima-kexec-buffer"); | ||
| 122 | if (ret) | ||
| 123 | return; | ||
| 124 | |||
| 125 | ret = delete_fdt_mem_rsv(fdt, addr, size); | ||
| 126 | if (!ret) | ||
| 127 | pr_debug("Removed old IMA buffer reservation.\n"); | ||
| 128 | } | ||
| 129 | |||
| 130 | #ifdef CONFIG_IMA_KEXEC | ||
| 131 | /** | ||
| 132 | * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer | ||
| 133 | * | ||
| 134 | * Architectures should use this function to pass on the IMA buffer | ||
| 135 | * information to the next kernel. | ||
| 136 | * | ||
| 137 | * Return: 0 on success, negative errno on error. | ||
| 138 | */ | ||
| 139 | int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr, | ||
| 140 | size_t size) | ||
| 141 | { | ||
| 142 | image->arch.ima_buffer_addr = load_addr; | ||
| 143 | image->arch.ima_buffer_size = size; | ||
| 144 | |||
| 145 | return 0; | ||
| 146 | } | ||
| 147 | |||
| 148 | static int write_number(void *p, u64 value, int cells) | ||
| 149 | { | ||
| 150 | if (cells == 1) { | ||
| 151 | u32 tmp; | ||
| 152 | |||
| 153 | if (value > U32_MAX) | ||
| 154 | return -EINVAL; | ||
| 155 | |||
| 156 | tmp = cpu_to_be32(value); | ||
| 157 | memcpy(p, &tmp, sizeof(tmp)); | ||
| 158 | } else if (cells == 2) { | ||
| 159 | u64 tmp; | ||
| 160 | |||
| 161 | tmp = cpu_to_be64(value); | ||
| 162 | memcpy(p, &tmp, sizeof(tmp)); | ||
| 163 | } else | ||
| 164 | return -EINVAL; | ||
| 165 | |||
| 166 | return 0; | ||
| 167 | } | ||
| 168 | |||
| 169 | /** | ||
| 170 | * setup_ima_buffer - add IMA buffer information to the fdt | ||
| 171 | * @image: kexec image being loaded. | ||
| 172 | * @fdt: Flattened device tree for the next kernel. | ||
| 173 | * @chosen_node: Offset to the chosen node. | ||
| 174 | * | ||
| 175 | * Return: 0 on success, or negative errno on error. | ||
| 176 | */ | ||
| 177 | int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node) | ||
| 178 | { | ||
| 179 | int ret, addr_cells, size_cells, entry_size; | ||
| 180 | u8 value[16]; | ||
| 181 | |||
| 182 | remove_ima_buffer(fdt, chosen_node); | ||
| 183 | if (!image->arch.ima_buffer_size) | ||
| 184 | return 0; | ||
| 185 | |||
| 186 | ret = get_addr_size_cells(&addr_cells, &size_cells); | ||
| 187 | if (ret) | ||
| 188 | return ret; | ||
| 189 | |||
| 190 | entry_size = 4 * (addr_cells + size_cells); | ||
| 191 | |||
| 192 | if (entry_size > sizeof(value)) | ||
| 193 | return -EINVAL; | ||
| 194 | |||
| 195 | ret = write_number(value, image->arch.ima_buffer_addr, addr_cells); | ||
| 196 | if (ret) | ||
| 197 | return ret; | ||
| 198 | |||
| 199 | ret = write_number(value + 4 * addr_cells, image->arch.ima_buffer_size, | ||
| 200 | size_cells); | ||
| 201 | if (ret) | ||
| 202 | return ret; | ||
| 203 | |||
| 204 | ret = fdt_setprop(fdt, chosen_node, "linux,ima-kexec-buffer", value, | ||
| 205 | entry_size); | ||
| 206 | if (ret < 0) | ||
| 207 | return -EINVAL; | ||
| 208 | |||
| 209 | ret = fdt_add_mem_rsv(fdt, image->arch.ima_buffer_addr, | ||
| 210 | image->arch.ima_buffer_size); | ||
| 211 | if (ret) | ||
| 212 | return -EINVAL; | ||
| 213 | |||
| 214 | pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n", | ||
| 215 | image->arch.ima_buffer_addr, image->arch.ima_buffer_size); | ||
| 216 | |||
| 217 | return 0; | ||
| 218 | } | ||
| 219 | #endif /* CONFIG_IMA_KEXEC */ | ||
| @@ -150,11 +150,6 @@ struct kimage_arch { · 149 unmodified lines | |||
| 150 | pud_t *pud; | 150 | pud_t *pud; |
| 151 | pmd_t *pmd; | 151 | pmd_t *pmd; |
| 152 | pte_t *pte; | 152 | pte_t *pte; |
| 153 | |||
| 154 | /* Core ELF header buffer */ | ||
| 155 | void *elf_headers; | ||
| 156 | unsigned long elf_headers_sz; | ||
| 157 | unsigned long elf_load_addr; | ||
| 158 | }; | 153 | }; |
| 159 | #endif /* CONFIG_X86_32 */ | 154 | #endif /* CONFIG_X86_32 */ |
| 160 | 155 | ||
| @@ -323,8 +323,8 @@ static int memmap_exclude_ranges(struct kimage *image, struct crash_mem *cmem, · 322 unmodified lines | |||
| 323 | cmem->nr_ranges = 1; | 323 | cmem->nr_ranges = 1; |
| 324 | 324 | ||
| 325 | /* Exclude elf header region */ | 325 | /* Exclude elf header region */ |
| 326 | start = image->arch.elf_load_addr; | 326 | start = image->elf_load_addr; |
| 327 | end = start + image->arch.elf_headers_sz - 1; | 327 | end = start + image->elf_headers_sz - 1; |
| 328 | return crash_exclude_mem_range(cmem, start, end); | 328 | return crash_exclude_mem_range(cmem, start, end); |
| 329 | } | 329 | } |
| 330 | 330 | ||
| @@ -407,20 +407,20 @@ int crash_load_segments(struct kimage *image) · 76 unmodified lines | |||
| 407 | if (ret) | 407 | if (ret) |
| 408 | return ret; | 408 | return ret; |
| 409 | 409 | ||
| 410 | image->arch.elf_headers = kbuf.buffer; | 410 | image->elf_headers = kbuf.buffer; |
| 411 | image->arch.elf_headers_sz = kbuf.bufsz; | 411 | image->elf_headers_sz = kbuf.bufsz; |
| 412 | 412 | ||
| 413 | kbuf.memsz = kbuf.bufsz; | 413 | kbuf.memsz = kbuf.bufsz; |
| 414 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; | 414 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; |
| 415 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | 415 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; |
| 416 | ret = kexec_add_buffer(&kbuf); | 416 | ret = kexec_add_buffer(&kbuf); |
| 417 | if (ret) { | 417 | if (ret) { |
| 418 | vfree((void *)image->arch.elf_headers); | 418 | vfree((void *)image->elf_headers); |
| 419 | return ret; | 419 | return ret; |
| 420 | } | 420 | } |
| 421 | image->arch.elf_load_addr = kbuf.mem; | 421 | image->elf_load_addr = kbuf.mem; |
| 422 | pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n", | 422 | pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n", |
| 423 | image->arch.elf_load_addr, kbuf.bufsz, kbuf.bufsz); | 423 | image->elf_load_addr, kbuf.bufsz, kbuf.bufsz); |
| 424 | 424 | ||
| 425 | return ret; | 425 | return ret; |
| 426 | } | 426 | } |
| @@ -75,7 +75,7 @@ static int setup_cmdline(struct kimage *image, struct boot_params *params, · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | if (image->type == KEXEC_TYPE_CRASH) { | 76 | if (image->type == KEXEC_TYPE_CRASH) { |
| 77 | len = sprintf(cmdline_ptr, | 77 | len = sprintf(cmdline_ptr, |
| 78 | "elfcorehdr=0x%lx ", image->arch.elf_load_addr); | 78 | "elfcorehdr=0x%lx ", image->elf_load_addr); |
| 79 | } | 79 | } |
| 80 | memcpy(cmdline_ptr + len, cmdline, cmdline_len); | 80 | memcpy(cmdline_ptr + len, cmdline, cmdline_len); |
| 81 | cmdline_len += len; | 81 | cmdline_len += len; |
| @@ -402,8 +402,8 @@ void machine_kexec(struct kimage *image) · 401 unmodified lines | |||
| 402 | #ifdef CONFIG_KEXEC_FILE | 402 | #ifdef CONFIG_KEXEC_FILE |
| 403 | void *arch_kexec_kernel_image_load(struct kimage *image) | 403 | void *arch_kexec_kernel_image_load(struct kimage *image) |
| 404 | { | 404 | { |
| 405 | vfree(image->arch.elf_headers); | 405 | vfree(image->elf_headers); |
| 406 | image->arch.elf_headers = NULL; | 406 | image->elf_headers = NULL; |
| 407 | 407 | ||
| 408 | if (!image->fops || !image->fops->load) | 408 | if (!image->fops || !image->fops->load) |
| 409 | return ERR_PTR(-ENOEXEC); | 409 | return ERR_PTR(-ENOEXEC); |
| @@ -14,4 +14,10 @@ obj-$(CONFIG_OF_RESOLVE) += resolver.o · 13 unmodified lines | |||
| 14 | obj-$(CONFIG_OF_OVERLAY) += overlay.o | 14 | obj-$(CONFIG_OF_OVERLAY) += overlay.o |
| 15 | obj-$(CONFIG_OF_NUMA) += of_numa.o | 15 | obj-$(CONFIG_OF_NUMA) += of_numa.o |
| 16 | 16 | ||
| 17 | ifdef CONFIG_KEXEC_FILE | ||
| 18 | ifdef CONFIG_OF_FLATTREE | ||
| 19 | obj-y += kexec.o | ||
| 20 | endif | ||
| 21 | endif | ||
| 22 | |||
| 17 | obj-$(CONFIG_OF_UNITTEST) += unittest-data/ | 23 | obj-$(CONFIG_OF_UNITTEST) += unittest-data/ |
| @@ -117,9 +117,12 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr) · 116 unmodified lines | |||
| 117 | flags |= IORESOURCE_IO; | 117 | flags |= IORESOURCE_IO; |
| 118 | break; | 118 | break; |
| 119 | case 0x02: /* 32 bits */ | 119 | case 0x02: /* 32 bits */ |
| 120 | case 0x03: /* 64 bits */ | ||
| 121 | flags |= IORESOURCE_MEM; | 120 | flags |= IORESOURCE_MEM; |
| 122 | break; | 121 | break; |
| 122 | |||
| 123 | case 0x03: /* 64 bits */ | ||
| 124 | flags |= IORESOURCE_MEM | IORESOURCE_MEM_64; | ||
| 125 | break; | ||
| 123 | } | 126 | } |
| 124 | if (w & 0x40000000) | 127 | if (w & 0x40000000) |
| 125 | flags |= IORESOURCE_PREFETCH; | 128 | flags |= IORESOURCE_PREFETCH; |
| @@ -861,6 +864,9 @@ static int __of_address_to_resource(struct device_node *dev, · 735 unmodified lines | |||
| 861 | 864 | ||
| 862 | /** | 865 | /** |
| 863 | * of_address_to_resource - Translate device tree address and return as resource | 866 | * of_address_to_resource - Translate device tree address and return as resource |
| 867 | * @dev: Caller's Device Node | ||
| 868 | * @index: Index into the array | ||
| 869 | * @r: Pointer to resource array | ||
| 864 | * | 870 | * |
| 865 | * Note that if your address is a PIO address, the conversion will fail if | 871 | * Note that if your address is a PIO address, the conversion will fail if |
| 866 | * the physical address can't be internally converted to an IO token with | 872 | * the physical address can't be internally converted to an IO token with |
| @@ -244,7 +244,7 @@ struct device_node *__of_find_all_nodes(struct device_node *prev) · 243 unmodified lines | |||
| 244 | * @prev: Previous node or NULL to start iteration | 244 | * @prev: Previous node or NULL to start iteration |
| 245 | * of_node_put() will be called on it | 245 | * of_node_put() will be called on it |
| 246 | * | 246 | * |
| 247 | * Returns a node pointer with refcount incremented, use | 247 | * Return: A node pointer with refcount incremented, use |
| 248 | * of_node_put() on it when done. | 248 | * of_node_put() on it when done. |
| 249 | */ | 249 | */ |
| 250 | struct device_node *of_find_all_nodes(struct device_node *prev) | 250 | struct device_node *of_find_all_nodes(struct device_node *prev) |
| @@ -305,7 +305,7 @@ bool __weak arch_match_cpu_phys_id(int cpu, u64 phys_id) · 54 unmodified lines | |||
| 305 | return (u32)phys_id == cpu; | 305 | return (u32)phys_id == cpu; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | /** | 308 | /* |
| 309 | * Checks if the given "prop_name" property holds the physical id of the | 309 | * Checks if the given "prop_name" property holds the physical id of the |
| 310 | * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not | 310 | * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not |
| 311 | * NULL, local thread number within the core is returned in it. | 311 | * NULL, local thread number within the core is returned in it. |
| @@ -374,7 +374,7 @@ bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun, · 62 unmodified lines | |||
| 374 | * before booting secondary cores. This function uses arch_match_cpu_phys_id | 374 | * before booting secondary cores. This function uses arch_match_cpu_phys_id |
| 375 | * which can be overridden by architecture specific implementation. | 375 | * which can be overridden by architecture specific implementation. |
| 376 | * | 376 | * |
| 377 | * Returns a node pointer for the logical cpu with refcount incremented, use | 377 | * Return: A node pointer for the logical cpu with refcount incremented, use |
| 378 | * of_node_put() on it when done. Returns NULL if not found. | 378 | * of_node_put() on it when done. Returns NULL if not found. |
| 379 | */ | 379 | */ |
| 380 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | 380 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) |
| @@ -394,8 +394,8 @@ EXPORT_SYMBOL(of_get_cpu_node); · 13 unmodified lines | |||
| 394 | * | 394 | * |
| 395 | * @cpu_node: Pointer to the device_node for CPU. | 395 | * @cpu_node: Pointer to the device_node for CPU. |
| 396 | * | 396 | * |
| 397 | * Returns the logical CPU number of the given CPU device_node. | 397 | * Return: The logical CPU number of the given CPU device_node or -ENODEV if the |
| 398 | * Returns -ENODEV if the CPU is not found. | 398 | * CPU is not found. |
| 399 | */ | 399 | */ |
| 400 | int of_cpu_node_to_id(struct device_node *cpu_node) | 400 | int of_cpu_node_to_id(struct device_node *cpu_node) |
| 401 | { | 401 | { |
| @@ -427,7 +427,7 @@ EXPORT_SYMBOL(of_cpu_node_to_id); · 25 unmodified lines | |||
| 427 | * bindings. This function check for both and returns the idle state node for | 427 | * bindings. This function check for both and returns the idle state node for |
| 428 | * the requested index. | 428 | * the requested index. |
| 429 | * | 429 | * |
| 430 | * In case an idle state node is found at @index, the refcount is incremented | 430 | * Return: An idle state node if found at @index. The refcount is incremented |
| 431 | * for it, so call of_node_put() on it when done. Returns NULL if not found. | 431 | * for it, so call of_node_put() on it when done. Returns NULL if not found. |
| 432 | */ | 432 | */ |
| 433 | struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, | 433 | struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, |
| @@ -561,7 +561,7 @@ int of_device_compatible_match(struct device_node *device, · 127 unmodified lines | |||
| 561 | * of_machine_is_compatible - Test root of device tree for a given compatible value | 561 | * of_machine_is_compatible - Test root of device tree for a given compatible value |
| 562 | * @compat: compatible string to look for in root node's compatible property. | 562 | * @compat: compatible string to look for in root node's compatible property. |
| 563 | * | 563 | * |
| 564 | * Returns a positive integer if the root node has the given value in its | 564 | * Return: A positive integer if the root node has the given value in its |
| 565 | * compatible property. | 565 | * compatible property. |
| 566 | */ | 566 | */ |
| 567 | int of_machine_is_compatible(const char *compat) | 567 | int of_machine_is_compatible(const char *compat) |
| @@ -583,7 +583,7 @@ EXPORT_SYMBOL(of_machine_is_compatible); · 15 unmodified lines | |||
| 583 | * | 583 | * |
| 584 | * @device: Node to check for availability, with locks already held | 584 | * @device: Node to check for availability, with locks already held |
| 585 | * | 585 | * |
| 586 | * Returns true if the status property is absent or set to "okay" or "ok", | 586 | * Return: True if the status property is absent or set to "okay" or "ok", |
| 587 | * false otherwise | 587 | * false otherwise |
| 588 | */ | 588 | */ |
| 589 | static bool __of_device_is_available(const struct device_node *device) | 589 | static bool __of_device_is_available(const struct device_node *device) |
| @@ -611,7 +611,7 @@ static bool __of_device_is_available(const struct device_node *device) · 21 unmodified lines | |||
| 611 | * | 611 | * |
| 612 | * @device: Node to check for availability | 612 | * @device: Node to check for availability |
| 613 | * | 613 | * |
| 614 | * Returns true if the status property is absent or set to "okay" or "ok", | 614 | * Return: True if the status property is absent or set to "okay" or "ok", |
| 615 | * false otherwise | 615 | * false otherwise |
| 616 | */ | 616 | */ |
| 617 | bool of_device_is_available(const struct device_node *device) | 617 | bool of_device_is_available(const struct device_node *device) |
| @@ -632,7 +632,7 @@ EXPORT_SYMBOL(of_device_is_available); · 14 unmodified lines | |||
| 632 | * | 632 | * |
| 633 | * @device: Node to check for endianness | 633 | * @device: Node to check for endianness |
| 634 | * | 634 | * |
| 635 | * Returns true if the device has a "big-endian" property, or if the kernel | 635 | * Return: True if the device has a "big-endian" property, or if the kernel |
| 636 | * was compiled for BE *and* the device has a "native-endian" property. | 636 | * was compiled for BE *and* the device has a "native-endian" property. |
| 637 | * Returns false otherwise. | 637 | * Returns false otherwise. |
| 638 | * | 638 | * |
| @@ -651,11 +651,11 @@ bool of_device_is_big_endian(const struct device_node *device) · 12 unmodified lines | |||
| 651 | EXPORT_SYMBOL(of_device_is_big_endian); | 651 | EXPORT_SYMBOL(of_device_is_big_endian); |
| 652 | 652 | ||
| 653 | /** | 653 | /** |
| 654 | * of_get_parent - Get a node's parent if any | 654 | * of_get_parent - Get a node's parent if any |
| 655 | * @node: Node to get parent | 655 | * @node: Node to get parent |
| 656 | * | 656 | * |
| 657 | * Returns a node pointer with refcount incremented, use | 657 | * Return: A node pointer with refcount incremented, use |
| 658 | * of_node_put() on it when done. | 658 | * of_node_put() on it when done. |
| 659 | */ | 659 | */ |
| 660 | struct device_node *of_get_parent(const struct device_node *node) | 660 | struct device_node *of_get_parent(const struct device_node *node) |
| 661 | { | 661 | { |
| @@ -673,15 +673,15 @@ struct device_node *of_get_parent(const struct device_node *node) · 11 unmodified lines | |||
| 673 | EXPORT_SYMBOL(of_get_parent); | 673 | EXPORT_SYMBOL(of_get_parent); |
| 674 | 674 | ||
| 675 | /** | 675 | /** |
| 676 | * of_get_next_parent - Iterate to a node's parent | 676 | * of_get_next_parent - Iterate to a node's parent |
| 677 | * @node: Node to get parent of | 677 | * @node: Node to get parent of |
| 678 | * | 678 | * |
| 679 | * This is like of_get_parent() except that it drops the | 679 | * This is like of_get_parent() except that it drops the |
| 680 | * refcount on the passed node, making it suitable for iterating | 680 | * refcount on the passed node, making it suitable for iterating |
| 681 | * through a node's parents. | 681 | * through a node's parents. |
| 682 | * | 682 | * |
| 683 | * Returns a node pointer with refcount incremented, use | 683 | * Return: A node pointer with refcount incremented, use |
| 684 | * of_node_put() on it when done. | 684 | * of_node_put() on it when done. |
| 685 | */ | 685 | */ |
| 686 | struct device_node *of_get_next_parent(struct device_node *node) | 686 | struct device_node *of_get_next_parent(struct device_node *node) |
| 687 | { | 687 | { |
| @@ -719,13 +719,13 @@ static struct device_node *__of_get_next_child(const struct device_node *node, · 31 unmodified lines | |||
| 719 | child = __of_get_next_child(parent, child)) | 719 | child = __of_get_next_child(parent, child)) |
| 720 | 720 | ||
| 721 | /** | 721 | /** |
| 722 | * of_get_next_child - Iterate a node childs | 722 | * of_get_next_child - Iterate a node childs |
| 723 | * @node: parent node | 723 | * @node: parent node |
| 724 | * @prev: previous child of the parent node, or NULL to get first | 724 | * @prev: previous child of the parent node, or NULL to get first |
| 725 | * | 725 | * |
| 726 | * Returns a node pointer with refcount incremented, use of_node_put() on | 726 | * Return: A node pointer with refcount incremented, use of_node_put() on |
| 727 | * it when done. Returns NULL when prev is the last child. Decrements the | 727 | * it when done. Returns NULL when prev is the last child. Decrements the |
| 728 | * refcount of prev. | 728 | * refcount of prev. |
| 729 | */ | 729 | */ |
| 730 | struct device_node *of_get_next_child(const struct device_node *node, | 730 | struct device_node *of_get_next_child(const struct device_node *node, |
| 731 | struct device_node *prev) | 731 | struct device_node *prev) |
| @@ -741,12 +741,12 @@ struct device_node *of_get_next_child(const struct device_node *node, · 9 unmodified lines | |||
| 741 | EXPORT_SYMBOL(of_get_next_child); | 741 | EXPORT_SYMBOL(of_get_next_child); |
| 742 | 742 | ||
| 743 | /** | 743 | /** |
| 744 | * of_get_next_available_child - Find the next available child node | 744 | * of_get_next_available_child - Find the next available child node |
| 745 | * @node: parent node | 745 | * @node: parent node |
| 746 | * @prev: previous child of the parent node, or NULL to get first | 746 | * @prev: previous child of the parent node, or NULL to get first |
| 747 | * | 747 | * |
| 748 | * This function is like of_get_next_child(), except that it | 748 | * This function is like of_get_next_child(), except that it |
| 749 | * automatically skips any disabled nodes (i.e. status = "disabled"). | 749 | * automatically skips any disabled nodes (i.e. status = "disabled"). |
| 750 | */ | 750 | */ |
| 751 | struct device_node *of_get_next_available_child(const struct device_node *node, | 751 | struct device_node *of_get_next_available_child(const struct device_node *node, |
| 752 | struct device_node *prev) | 752 | struct device_node *prev) |
| @@ -772,12 +772,12 @@ struct device_node *of_get_next_available_child(const struct device_node *node, · 19 unmodified lines | |||
| 772 | EXPORT_SYMBOL(of_get_next_available_child); | 772 | EXPORT_SYMBOL(of_get_next_available_child); |
| 773 | 773 | ||
| 774 | /** | 774 | /** |
| 775 | * of_get_next_cpu_node - Iterate on cpu nodes | 775 | * of_get_next_cpu_node - Iterate on cpu nodes |
| 776 | * @prev: previous child of the /cpus node, or NULL to get first | 776 | * @prev: previous child of the /cpus node, or NULL to get first |
| 777 | * | 777 | * |
| 778 | * Returns a cpu node pointer with refcount incremented, use of_node_put() | 778 | * Return: A cpu node pointer with refcount incremented, use of_node_put() |
| 779 | * on it when done. Returns NULL when prev is the last child. Decrements | 779 | * on it when done. Returns NULL when prev is the last child. Decrements |
| 780 | * the refcount of prev. | 780 | * the refcount of prev. |
| 781 | */ | 781 | */ |
| 782 | struct device_node *of_get_next_cpu_node(struct device_node *prev) | 782 | struct device_node *of_get_next_cpu_node(struct device_node *prev) |
| 783 | { | 783 | { |
| @@ -816,7 +816,7 @@ EXPORT_SYMBOL(of_get_next_cpu_node); · 32 unmodified lines | |||
| 816 | * Lookup child node whose compatible property contains the given compatible | 816 | * Lookup child node whose compatible property contains the given compatible |
| 817 | * string. | 817 | * string. |
| 818 | * | 818 | * |
| 819 | * Returns a node pointer with refcount incremented, use of_node_put() on it | 819 | * Return: a node pointer with refcount incremented, use of_node_put() on it |
| 820 | * when done; or NULL if not found. | 820 | * when done; or NULL if not found. |
| 821 | */ | 821 | */ |
| 822 | struct device_node *of_get_compatible_child(const struct device_node *parent, | 822 | struct device_node *of_get_compatible_child(const struct device_node *parent, |
| @@ -834,15 +834,15 @@ struct device_node *of_get_compatible_child(const struct device_node *parent, · 11 unmodified lines | |||
| 834 | EXPORT_SYMBOL(of_get_compatible_child); | 834 | EXPORT_SYMBOL(of_get_compatible_child); |
| 835 | 835 | ||
| 836 | /** | 836 | /** |
| 837 | * of_get_child_by_name - Find the child node by name for a given parent | 837 | * of_get_child_by_name - Find the child node by name for a given parent |
| 838 | * @node: parent node | 838 | * @node: parent node |
| 839 | * @name: child name to look for. | 839 | * @name: child name to look for. |
| 840 | * | 840 | * |
| 841 | * This function looks for child node for given matching name | 841 | * This function looks for child node for given matching name |
| 842 | * | 842 | * |
| 843 | * Returns a node pointer if found, with refcount incremented, use | 843 | * Return: A node pointer if found, with refcount incremented, use |
| 844 | * of_node_put() on it when done. | 844 | * of_node_put() on it when done. |
| 845 | * Returns NULL if node is not found. | 845 | * Returns NULL if node is not found. |
| 846 | */ | 846 | */ |
| 847 | struct device_node *of_get_child_by_name(const struct device_node *node, | 847 | struct device_node *of_get_child_by_name(const struct device_node *node, |
| 848 | const char *name) | 848 | const char *name) |
| @@ -893,22 +893,22 @@ struct device_node *__of_find_node_by_full_path(struct device_node *node, · 44 unmodified lines | |||
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | /** | 895 | /** |
| 896 | * of_find_node_opts_by_path - Find a node matching a full OF path | 896 | * of_find_node_opts_by_path - Find a node matching a full OF path |
| 897 | * @path: Either the full path to match, or if the path does not | 897 | * @path: Either the full path to match, or if the path does not |
| 898 | * start with '/', the name of a property of the /aliases | 898 | * start with '/', the name of a property of the /aliases |
| 899 | * node (an alias). In the case of an alias, the node | 899 | * node (an alias). In the case of an alias, the node |
| 900 | * matching the alias' value will be returned. | 900 | * matching the alias' value will be returned. |
| 901 | * @opts: Address of a pointer into which to store the start of | 901 | * @opts: Address of a pointer into which to store the start of |
| 902 | * an options string appended to the end of the path with | 902 | * an options string appended to the end of the path with |
| 903 | * a ':' separator. | 903 | * a ':' separator. |
| 904 | * | 904 | * |
| 905 | * Valid paths: | 905 | * Valid paths: |
| 906 | * /foo/bar Full path | 906 | * * /foo/bar Full path |
| 907 | * foo Valid alias | 907 | * * foo Valid alias |
| 908 | * foo/bar Valid alias + relative path | 908 | * * foo/bar Valid alias + relative path |
| 909 | * | 909 | * |
| 910 | * Returns a node pointer with refcount incremented, use | 910 | * Return: A node pointer with refcount incremented, use |
| 911 | * of_node_put() on it when done. | 911 | * of_node_put() on it when done. |
| 912 | */ | 912 | */ |
| 913 | struct device_node *of_find_node_opts_by_path(const char *path, const char **opts) | 913 | struct device_node *of_find_node_opts_by_path(const char *path, const char **opts) |
| 914 | { | 914 | { |
| @@ -958,15 +958,15 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt · 43 unmodified lines | |||
| 958 | EXPORT_SYMBOL(of_find_node_opts_by_path); | 958 | EXPORT_SYMBOL(of_find_node_opts_by_path); |
| 959 | 959 | ||
| 960 | /** | 960 | /** |
| 961 | * of_find_node_by_name - Find a node by its "name" property | 961 | * of_find_node_by_name - Find a node by its "name" property |
| 962 | * @from: The node to start searching from or NULL; the node | 962 | * @from: The node to start searching from or NULL; the node |
| 963 | * you pass will not be searched, only the next one | 963 | * you pass will not be searched, only the next one |
| 964 | * will. Typically, you pass what the previous call | 964 | * will. Typically, you pass what the previous call |
| 965 | * returned. of_node_put() will be called on @from. | 965 | * returned. of_node_put() will be called on @from. |
| 966 | * @name: The name string to match against | 966 | * @name: The name string to match against |
| 967 | * | 967 | * |
| 968 | * Returns a node pointer with refcount incremented, use | 968 | * Return: A node pointer with refcount incremented, use |
| 969 | * of_node_put() on it when done. | 969 | * of_node_put() on it when done. |
| 970 | */ | 970 | */ |
| 971 | struct device_node *of_find_node_by_name(struct device_node *from, | 971 | struct device_node *of_find_node_by_name(struct device_node *from, |
| 972 | const char *name) | 972 | const char *name) |
| @@ -985,16 +985,16 @@ struct device_node *of_find_node_by_name(struct device_node *from, · 12 unmodified lines | |||
| 985 | EXPORT_SYMBOL(of_find_node_by_name); | 985 | EXPORT_SYMBOL(of_find_node_by_name); |
| 986 | 986 | ||
| 987 | /** | 987 | /** |
| 988 | * of_find_node_by_type - Find a node by its "device_type" property | 988 | * of_find_node_by_type - Find a node by its "device_type" property |
| 989 | * @from: The node to start searching from, or NULL to start searching | 989 | * @from: The node to start searching from, or NULL to start searching |
| 990 | * the entire device tree. The node you pass will not be | 990 | * the entire device tree. The node you pass will not be |
| 991 | * searched, only the next one will; typically, you pass | 991 | * searched, only the next one will; typically, you pass |
| 992 | * what the previous call returned. of_node_put() will be | 992 | * what the previous call returned. of_node_put() will be |
| 993 | * called on from for you. | 993 | * called on from for you. |
| 994 | * @type: The type string to match against | 994 | * @type: The type string to match against |
| 995 | * | 995 | * |
| 996 | * Returns a node pointer with refcount incremented, use | 996 | * Return: A node pointer with refcount incremented, use |
| 997 | * of_node_put() on it when done. | 997 | * of_node_put() on it when done. |
| 998 | */ | 998 | */ |
| 999 | struct device_node *of_find_node_by_type(struct device_node *from, | 999 | struct device_node *of_find_node_by_type(struct device_node *from, |
| 1000 | const char *type) | 1000 | const char *type) |
| @@ -1013,18 +1013,18 @@ struct device_node *of_find_node_by_type(struct device_node *from, · 12 unmodified lines | |||
| 1013 | EXPORT_SYMBOL(of_find_node_by_type); | 1013 | EXPORT_SYMBOL(of_find_node_by_type); |
| 1014 | 1014 | ||
| 1015 | /** | 1015 | /** |
| 1016 | * of_find_compatible_node - Find a node based on type and one of the | 1016 | * of_find_compatible_node - Find a node based on type and one of the |
| 1017 | * tokens in its "compatible" property | 1017 | * tokens in its "compatible" property |
| 1018 | * @from: The node to start searching from or NULL, the node | 1018 | * @from: The node to start searching from or NULL, the node |
| 1019 | * you pass will not be searched, only the next one | 1019 | * you pass will not be searched, only the next one |
| 1020 | * will; typically, you pass what the previous call | 1020 | * will; typically, you pass what the previous call |
| 1021 | * returned. of_node_put() will be called on it | 1021 | * returned. of_node_put() will be called on it |
| 1022 | * @type: The type string to match "device_type" or NULL to ignore | 1022 | * @type: The type string to match "device_type" or NULL to ignore |
| 1023 | * @compatible: The string to match to one of the tokens in the device | 1023 | * @compatible: The string to match to one of the tokens in the device |
| 1024 | * "compatible" list. | 1024 | * "compatible" list. |
| 1025 | * | 1025 | * |
| 1026 | * Returns a node pointer with refcount incremented, use | 1026 | * Return: A node pointer with refcount incremented, use |
| 1027 | * of_node_put() on it when done. | 1027 | * of_node_put() on it when done. |
| 1028 | */ | 1028 | */ |
| 1029 | struct device_node *of_find_compatible_node(struct device_node *from, | 1029 | struct device_node *of_find_compatible_node(struct device_node *from, |
| 1030 | const char *type, const char *compatible) | 1030 | const char *type, const char *compatible) |
| @@ -1044,16 +1044,16 @@ struct device_node *of_find_compatible_node(struct device_node *from, · 13 unmodified lines | |||
| 1044 | EXPORT_SYMBOL(of_find_compatible_node); | 1044 | EXPORT_SYMBOL(of_find_compatible_node); |
| 1045 | 1045 | ||
| 1046 | /** | 1046 | /** |
| 1047 | * of_find_node_with_property - Find a node which has a property with | 1047 | * of_find_node_with_property - Find a node which has a property with |
| 1048 | * the given name. | 1048 | * the given name. |
| 1049 | * @from: The node to start searching from or NULL, the node | 1049 | * @from: The node to start searching from or NULL, the node |
| 1050 | * you pass will not be searched, only the next one | 1050 | * you pass will not be searched, only the next one |
| 1051 | * will; typically, you pass what the previous call | 1051 | * will; typically, you pass what the previous call |
| 1052 | * returned. of_node_put() will be called on it | 1052 | * returned. of_node_put() will be called on it |
| 1053 | * @prop_name: The name of the property to look for. | 1053 | * @prop_name: The name of the property to look for. |
| 1054 | * | 1054 | * |
| 1055 | * Returns a node pointer with refcount incremented, use | 1055 | * Return: A node pointer with refcount incremented, use |
| 1056 | * of_node_put() on it when done. | 1056 | * of_node_put() on it when done. |
| 1057 | */ | 1057 | */ |
| 1058 | struct device_node *of_find_node_with_property(struct device_node *from, | 1058 | struct device_node *of_find_node_with_property(struct device_node *from, |
| 1059 | const char *prop_name) | 1059 | const char *prop_name) |
| @@ -1102,10 +1102,10 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches, · 42 unmodified lines | |||
| 1102 | 1102 | ||
| 1103 | /** | 1103 | /** |
| 1104 | * of_match_node - Tell if a device_node has a matching of_match structure | 1104 | * of_match_node - Tell if a device_node has a matching of_match structure |
| 1105 | * @matches: array of of device match structures to search in | 1105 | * @matches: array of of device match structures to search in |
| 1106 | * @node: the of device structure to match against | 1106 | * @node: the of device structure to match against |
| 1107 | * | 1107 | * |
| 1108 | * Low level utility function used by device matching. | 1108 | * Low level utility function used by device matching. |
| 1109 | */ | 1109 | */ |
| 1110 | const struct of_device_id *of_match_node(const struct of_device_id *matches, | 1110 | const struct of_device_id *of_match_node(const struct of_device_id *matches, |
| 1111 | const struct device_node *node) | 1111 | const struct device_node *node) |
| @@ -1121,17 +1121,17 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, · 9 unmodified lines | |||
| 1121 | EXPORT_SYMBOL(of_match_node); | 1121 | EXPORT_SYMBOL(of_match_node); |
| 1122 | 1122 | ||
| 1123 | /** | 1123 | /** |
| 1124 | * of_find_matching_node_and_match - Find a node based on an of_device_id | 1124 | * of_find_matching_node_and_match - Find a node based on an of_device_id |
| 1125 | * match table. | 1125 | * match table. |
| 1126 | * @from: The node to start searching from or NULL, the node | 1126 | * @from: The node to start searching from or NULL, the node |
| 1127 | * you pass will not be searched, only the next one | 1127 | * you pass will not be searched, only the next one |
| 1128 | * will; typically, you pass what the previous call | 1128 | * will; typically, you pass what the previous call |
| 1129 | * returned. of_node_put() will be called on it | 1129 | * returned. of_node_put() will be called on it |
| 1130 | * @matches: array of of device match structures to search in | 1130 | * @matches: array of of device match structures to search in |
| 1131 | * @match Updated to point at the matches entry which matched | 1131 | * @match: Updated to point at the matches entry which matched |
| 1132 | * | 1132 | * |
| 1133 | * Returns a node pointer with refcount incremented, use | 1133 | * Return: A node pointer with refcount incremented, use |
| 1134 | * of_node_put() on it when done. | 1134 | * of_node_put() on it when done. |
| 1135 | */ | 1135 | */ |
| 1136 | struct device_node *of_find_matching_node_and_match(struct device_node *from, | 1136 | struct device_node *of_find_matching_node_and_match(struct device_node *from, |
| 1137 | const struct of_device_id *matches, | 1137 | const struct of_device_id *matches, |
| @@ -1170,7 +1170,7 @@ EXPORT_SYMBOL(of_find_matching_node_and_match); · 32 unmodified lines | |||
| 1170 | * It does this by stripping the manufacturer prefix (as delimited by a ',') | 1170 | * It does this by stripping the manufacturer prefix (as delimited by a ',') |
| 1171 | * from the first entry in the compatible list property. | 1171 | * from the first entry in the compatible list property. |
| 1172 | * | 1172 | * |
| 1173 | * This routine returns 0 on success, <0 on failure. | 1173 | * Return: This routine returns 0 on success, <0 on failure. |
| 1174 | */ | 1174 | */ |
| 1175 | int of_modalias_node(struct device_node *node, char *modalias, int len) | 1175 | int of_modalias_node(struct device_node *node, char *modalias, int len) |
| 1176 | { | 1176 | { |
| @@ -1190,7 +1190,7 @@ EXPORT_SYMBOL_GPL(of_modalias_node); · 13 unmodified lines | |||
| 1190 | * of_find_node_by_phandle - Find a node given a phandle | 1190 | * of_find_node_by_phandle - Find a node given a phandle |
| 1191 | * @handle: phandle of the node to find | 1191 | * @handle: phandle of the node to find |
| 1192 | * | 1192 | * |
| 1193 | * Returns a node pointer with refcount incremented, use | 1193 | * Return: A node pointer with refcount incremented, use |
| 1194 | * of_node_put() on it when done. | 1194 | * of_node_put() on it when done. |
| 1195 | */ | 1195 | */ |
| 1196 | struct device_node *of_find_node_by_phandle(phandle handle) | 1196 | struct device_node *of_find_node_by_phandle(phandle handle) |
| @@ -1426,7 +1426,7 @@ static int __of_parse_phandle_with_args(const struct device_node *np, · 229 unmodified lines | |||
| 1426 | * @index: For properties holding a table of phandles, this is the index into | 1426 | * @index: For properties holding a table of phandles, this is the index into |
| 1427 | * the table | 1427 | * the table |
| 1428 | * | 1428 | * |
| 1429 | * Returns the device_node pointer with refcount incremented. Use | 1429 | * Return: The device_node pointer with refcount incremented. Use |
| 1430 | * of_node_put() on it when done. | 1430 | * of_node_put() on it when done. |
| 1431 | */ | 1431 | */ |
| 1432 | struct device_node *of_parse_phandle(const struct device_node *np, | 1432 | struct device_node *of_parse_phandle(const struct device_node *np, |
| @@ -1460,21 +1460,21 @@ EXPORT_SYMBOL(of_parse_phandle); · 27 unmodified lines | |||
| 1460 | * Caller is responsible to call of_node_put() on the returned out_args->np | 1460 | * Caller is responsible to call of_node_put() on the returned out_args->np |
| 1461 | * pointer. | 1461 | * pointer. |
| 1462 | * | 1462 | * |
| 1463 | * Example: | 1463 | * Example:: |
| 1464 | * | 1464 | * |
| 1465 | * phandle1: node1 { | 1465 | * phandle1: node1 { |
| 1466 | * #list-cells = <2>; | 1466 | * #list-cells = <2>; |
| 1467 | * } | 1467 | * }; |
| 1468 | * | 1468 | * |
| 1469 | * phandle2: node2 { | 1469 | * phandle2: node2 { |
| 1470 | * #list-cells = <1>; | 1470 | * #list-cells = <1>; |
| 1471 | * } | 1471 | * }; |
| 1472 | * | 1472 | * |
| 1473 | * node3 { | 1473 | * node3 { |
| 1474 | * list = <&phandle1 1 2 &phandle2 3>; | 1474 | * list = <&phandle1 1 2 &phandle2 3>; |
| 1475 | * } | 1475 | * }; |
| 1476 | * | 1476 | * |
| 1477 | * To get a device_node of the `node2' node you may call this: | 1477 | * To get a device_node of the ``node2`` node you may call this: |
| 1478 | * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); | 1478 | * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); |
| 1479 | */ | 1479 | */ |
| 1480 | int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, | 1480 | int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, |
| @@ -1512,29 +1512,29 @@ EXPORT_SYMBOL(of_parse_phandle_with_args); · 31 unmodified lines | |||
| 1512 | * Caller is responsible to call of_node_put() on the returned out_args->np | 1512 | * Caller is responsible to call of_node_put() on the returned out_args->np |
| 1513 | * pointer. | 1513 | * pointer. |
| 1514 | * | 1514 | * |
| 1515 | * Example: | 1515 | * Example:: |
| 1516 | * | 1516 | * |
| 1517 | * phandle1: node1 { | 1517 | * phandle1: node1 { |
| 1518 | * #list-cells = <2>; | 1518 | * #list-cells = <2>; |
| 1519 | * } | 1519 | * }; |
| 1520 | * | 1520 | * |
| 1521 | * phandle2: node2 { | 1521 | * phandle2: node2 { |
| 1522 | * #list-cells = <1>; | 1522 | * #list-cells = <1>; |
| 1523 | * } | 1523 | * }; |
| 1524 | * | 1524 | * |
| 1525 | * phandle3: node3 { | 1525 | * phandle3: node3 { |
| 1526 | * #list-cells = <1>; | 1526 | * #list-cells = <1>; |
| 1527 | * list-map = <0 &phandle2 3>, | 1527 | * list-map = <0 &phandle2 3>, |
| 1528 | * <1 &phandle2 2>, | 1528 | * <1 &phandle2 2>, |
| 1529 | * <2 &phandle1 5 1>; | 1529 | * <2 &phandle1 5 1>; |
| 1530 | * list-map-mask = <0x3>; | 1530 | * list-map-mask = <0x3>; |
| 1531 | * }; | 1531 | * }; |
| 1532 | * | 1532 | * |
| 1533 | * node4 { | 1533 | * node4 { |
| 1534 | * list = <&phandle1 1 2 &phandle3 0>; | 1534 | * list = <&phandle1 1 2 &phandle3 0>; |
| 1535 | * } | 1535 | * }; |
| 1536 | * | 1536 | * |
| 1537 | * To get a device_node of the `node2' node you may call this: | 1537 | * To get a device_node of the ``node2`` node you may call this: |
| 1538 | * of_parse_phandle_with_args(node4, "list", "list", 1, &args); | 1538 | * of_parse_phandle_with_args(node4, "list", "list", 1, &args); |
| 1539 | */ | 1539 | */ |
| 1540 | int of_parse_phandle_with_args_map(const struct device_node *np, | 1540 | int of_parse_phandle_with_args_map(const struct device_node *np, |
| @@ -1694,19 +1694,19 @@ EXPORT_SYMBOL(of_parse_phandle_with_args_map); · 153 unmodified lines | |||
| 1694 | * Caller is responsible to call of_node_put() on the returned out_args->np | 1694 | * Caller is responsible to call of_node_put() on the returned out_args->np |
| 1695 | * pointer. | 1695 | * pointer. |
| 1696 | * | 1696 | * |
| 1697 | * Example: | 1697 | * Example:: |
| 1698 | * | 1698 | * |
| 1699 | * phandle1: node1 { | 1699 | * phandle1: node1 { |
| 1700 | * } | 1700 | * }; |
| 1701 | * | 1701 | * |
| 1702 | * phandle2: node2 { | 1702 | * phandle2: node2 { |
| 1703 | * } | 1703 | * }; |
| 1704 | * | 1704 | * |
| 1705 | * node3 { | 1705 | * node3 { |
| 1706 | * list = <&phandle1 0 2 &phandle2 2 3>; | 1706 | * list = <&phandle1 0 2 &phandle2 2 3>; |
| 1707 | * } | 1707 | * }; |
| 1708 | * | 1708 | * |
| 1709 | * To get a device_node of the `node2' node you may call this: | 1709 | * To get a device_node of the ``node2`` node you may call this: |
| 1710 | * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); | 1710 | * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); |
| 1711 | */ | 1711 | */ |
| 1712 | int of_parse_phandle_with_fixed_args(const struct device_node *np, | 1712 | int of_parse_phandle_with_fixed_args(const struct device_node *np, |
| @@ -1726,7 +1726,7 @@ EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); · 13 unmodified lines | |||
| 1726 | * @list_name: property name that contains a list | 1726 | * @list_name: property name that contains a list |
| 1727 | * @cells_name: property name that specifies phandles' arguments count | 1727 | * @cells_name: property name that specifies phandles' arguments count |
| 1728 | * | 1728 | * |
| 1729 | * Returns the number of phandle + argument tuples within a property. It | 1729 | * Return: The number of phandle + argument tuples within a property. It |
| 1730 | * is a typical pattern to encode a list of phandle and variable | 1730 | * is a typical pattern to encode a list of phandle and variable |
| 1731 | * arguments into a single property. The number of arguments is encoded | 1731 | * arguments into a single property. The number of arguments is encoded |
| 1732 | * by a property in the phandle-target node. For example, a gpios | 1732 | * by a property in the phandle-target node. For example, a gpios |
| @@ -1774,6 +1774,8 @@ EXPORT_SYMBOL(of_count_phandle_with_args); · 41 unmodified lines | |||
| 1774 | 1774 | ||
| 1775 | /** | 1775 | /** |
| 1776 | * __of_add_property - Add a property to a node without lock operations | 1776 | * __of_add_property - Add a property to a node without lock operations |
| 1777 | * @np: Caller's Device Node | ||
| 1778 | * @prop: Property to add | ||
| 1777 | */ | 1779 | */ |
| 1778 | int __of_add_property(struct device_node *np, struct property *prop) | 1780 | int __of_add_property(struct device_node *np, struct property *prop) |
| 1779 | { | 1781 | { |
| @@ -1795,6 +1797,8 @@ int __of_add_property(struct device_node *np, struct property *prop) · 15 unmodified lines | |||
| 1795 | 1797 | ||
| 1796 | /** | 1798 | /** |
| 1797 | * of_add_property - Add a property to a node | 1799 | * of_add_property - Add a property to a node |
| 1800 | * @np: Caller's Device Node | ||
| 1801 | * @prop: Property to add | ||
| 1798 | */ | 1802 | */ |
| 1799 | int of_add_property(struct device_node *np, struct property *prop) | 1803 | int of_add_property(struct device_node *np, struct property *prop) |
| 1800 | { | 1804 | { |
| @@ -1839,6 +1843,8 @@ int __of_remove_property(struct device_node *np, struct property *prop) · 38 unmodified lines | |||
| 1839 | 1843 | ||
| 1840 | /** | 1844 | /** |
| 1841 | * of_remove_property - Remove a property from a node. | 1845 | * of_remove_property - Remove a property from a node. |
| 1846 | * @np: Caller's Device Node | ||
| 1847 | * @prop: Property to remove | ||
| 1842 | * | 1848 | * |
| 1843 | * Note that we don't actually remove it, since we have given out | 1849 | * Note that we don't actually remove it, since we have given out |
| 1844 | * who-knows-how-many pointers to the data using get-property. | 1850 | * who-knows-how-many pointers to the data using get-property. |
| @@ -1946,13 +1952,12 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np, · 101 unmodified lines | |||
| 1946 | 1952 | ||
| 1947 | /** | 1953 | /** |
| 1948 | * of_alias_scan - Scan all properties of the 'aliases' node | 1954 | * of_alias_scan - Scan all properties of the 'aliases' node |
| 1955 | * @dt_alloc: An allocator that provides a virtual address to memory | ||
| 1956 | * for storing the resulting tree | ||
| 1949 | * | 1957 | * |
| 1950 | * The function scans all the properties of the 'aliases' node and populates | 1958 | * The function scans all the properties of the 'aliases' node and populates |
| 1951 | * the global lookup table with the properties. It returns the | 1959 | * the global lookup table with the properties. It returns the |
| 1952 | * number of alias properties found, or an error code in case of failure. | 1960 | * number of alias properties found, or an error code in case of failure. |
| 1953 | * | ||
| 1954 | * @dt_alloc: An allocator that provides a virtual address to memory | ||
| 1955 | * for storing the resulting tree | ||
| 1956 | */ | 1961 | */ |
| 1957 | void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | 1962 | void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) |
| 1958 | { | 1963 | { |
| @@ -2021,7 +2026,9 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) · 62 unmodified lines | |||
| 2021 | * @stem: Alias stem of the given device_node | 2026 | * @stem: Alias stem of the given device_node |
| 2022 | * | 2027 | * |
| 2023 | * The function travels the lookup table to get the alias id for the given | 2028 | * The function travels the lookup table to get the alias id for the given |
| 2024 | * device_node and alias stem. It returns the alias id if found. | 2029 | * device_node and alias stem. |
| 2030 | * | ||
| 2031 | * Return: The alias id if found. | ||
| 2025 | */ | 2032 | */ |
| 2026 | int of_alias_get_id(struct device_node *np, const char *stem) | 2033 | int of_alias_get_id(struct device_node *np, const char *stem) |
| 2027 | { | 2034 | { |
| @@ -2125,13 +2132,14 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_id); · 97 unmodified lines | |||
| 2125 | 2132 | ||
| 2126 | /** | 2133 | /** |
| 2127 | * of_console_check() - Test and setup console for DT setup | 2134 | * of_console_check() - Test and setup console for DT setup |
| 2128 | * @dn - Pointer to device node | 2135 | * @dn: Pointer to device node |
| 2129 | * @name - Name to use for preferred console without index. ex. "ttyS" | 2136 | * @name: Name to use for preferred console without index. ex. "ttyS" |
| 2130 | * @index - Index to use for preferred console. | 2137 | * @index: Index to use for preferred console. |
| 2131 | * | 2138 | * |
| 2132 | * Check if the given device node matches the stdout-path property in the | 2139 | * Check if the given device node matches the stdout-path property in the |
| 2133 | * /chosen node. If it does then register it as the preferred console and return | 2140 | * /chosen node. If it does then register it as the preferred console. |
| 2134 | * TRUE. Otherwise return FALSE. | 2141 | * |
| 2142 | * Return: TRUE if console successfully setup. Otherwise return FALSE. | ||
| 2135 | */ | 2143 | */ |
| 2136 | bool of_console_check(struct device_node *dn, char *name, int index) | 2144 | bool of_console_check(struct device_node *dn, char *name, int index) |
| 2137 | { | 2145 | { |
| @@ -2147,12 +2155,12 @@ bool of_console_check(struct device_node *dn, char *name, int index) · 9 unmodified lines | |||
| 2147 | EXPORT_SYMBOL_GPL(of_console_check); | 2155 | EXPORT_SYMBOL_GPL(of_console_check); |
| 2148 | 2156 | ||
| 2149 | /** | 2157 | /** |
| 2150 | * of_find_next_cache_node - Find a node's subsidiary cache | 2158 | * of_find_next_cache_node - Find a node's subsidiary cache |
| 2151 | * @np: node of type "cpu" or "cache" | 2159 | * @np: node of type "cpu" or "cache" |
| 2152 | * | 2160 | * |
| 2153 | * Returns a node pointer with refcount incremented, use | 2161 | * Return: A node pointer with refcount incremented, use |
| 2154 | * of_node_put() on it when done. Caller should hold a reference | 2162 | * of_node_put() on it when done. Caller should hold a reference |
| 2155 | * to np. | 2163 | * to np. |
| 2156 | */ | 2164 | */ |
| 2157 | struct device_node *of_find_next_cache_node(const struct device_node *np) | 2165 | struct device_node *of_find_next_cache_node(const struct device_node *np) |
| 2158 | { | 2166 | { |
| @@ -2182,7 +2190,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np) · 23 unmodified lines | |||
| 2182 | * | 2190 | * |
| 2183 | * @cpu: cpu number(logical index) for which the last cache level is needed | 2191 | * @cpu: cpu number(logical index) for which the last cache level is needed |
| 2184 | * | 2192 | * |
| 2185 | * Returns the the level at which the last cache is present. It is exactly | 2193 | * Return: The the level at which the last cache is present. It is exactly |
| 2186 | * same as the total number of cache levels for the given logical cpu. | 2194 | * same as the total number of cache levels for the given logical cpu. |
| 2187 | */ | 2195 | */ |
| 2188 | int of_find_last_cache_level(unsigned int cpu) | 2196 | int of_find_last_cache_level(unsigned int cpu) |
| @@ -53,7 +53,7 @@ int of_device_add(struct platform_device *ofdev) · 52 unmodified lines | |||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * of_dma_configure - Setup DMA configuration | 56 | * of_dma_configure_id - Setup DMA configuration |
| 57 | * @dev: Device to apply DMA configuration | 57 | * @dev: Device to apply DMA configuration |
| 58 | * @np: Pointer to OF node having DMA configuration | 58 | * @np: Pointer to OF node having DMA configuration |
| 59 | * @force_dma: Whether device is to be set up by of_dma_configure() even if | 59 | * @force_dma: Whether device is to be set up by of_dma_configure() even if |
| @@ -258,6 +258,9 @@ EXPORT_SYMBOL_GPL(of_device_request_module); · 198 unmodified lines | |||
| 258 | 258 | ||
| 259 | /** | 259 | /** |
| 260 | * of_device_modalias - Fill buffer with newline terminated modalias string | 260 | * of_device_modalias - Fill buffer with newline terminated modalias string |
| 261 | * @dev: Calling device | ||
| 262 | * @str: Modalias string | ||
| 263 | * @len: Size of @str | ||
| 261 | */ | 264 | */ |
| 262 | ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len) | 265 | ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len) |
| 263 | { | 266 | { |
| @@ -275,6 +278,8 @@ EXPORT_SYMBOL_GPL(of_device_modalias); · 11 unmodified lines | |||
| 275 | 278 | ||
| 276 | /** | 279 | /** |
| 277 | * of_device_uevent - Display OF related uevent information | 280 | * of_device_uevent - Display OF related uevent information |
| 281 | * @dev: Device to apply DMA configuration | ||
| 282 | * @env: Kernel object's userspace event reference | ||
| 278 | */ | 283 | */ |
| 279 | void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) | 284 | void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 280 | { | 285 | { |
| @@ -27,7 +27,7 @@ static struct device_node *kobj_to_device_node(struct kobject *kobj) · 26 unmodified lines | |||
| 27 | * @node: Node to inc refcount, NULL is supported to simplify writing of | 27 | * @node: Node to inc refcount, NULL is supported to simplify writing of |
| 28 | * callers | 28 | * callers |
| 29 | * | 29 | * |
| 30 | * Returns node. | 30 | * Return: The node with refcount incremented. |
| 31 | */ | 31 | */ |
| 32 | struct device_node *of_node_get(struct device_node *node) | 32 | struct device_node *of_node_get(struct device_node *node) |
| 33 | { | 33 | { |
| @@ -104,7 +104,8 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) · 70 unmodified lines | |||
| 104 | * @arg - argument of the of notifier | 104 | * @arg - argument of the of notifier |
| 105 | * | 105 | * |
| 106 | * Returns the new state of a device based on the notifier used. | 106 | * Returns the new state of a device based on the notifier used. |
| 107 | * Returns 0 on device going from enabled to disabled, 1 on device | 107 | * |
| 108 | * Return: 0 on device going from enabled to disabled, 1 on device | ||
| 108 | * going from disabled to enabled and -1 on no change. | 109 | * going from disabled to enabled and -1 on no change. |
| 109 | */ | 110 | */ |
| 110 | int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr) | 111 | int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr) |
| @@ -229,6 +230,7 @@ static void __of_attach_node(struct device_node *np) · 118 unmodified lines | |||
| 229 | 230 | ||
| 230 | /** | 231 | /** |
| 231 | * of_attach_node() - Plug a device node into the tree and global list. | 232 | * of_attach_node() - Plug a device node into the tree and global list. |
| 233 | * @np: Pointer to the caller's Device Node | ||
| 232 | */ | 234 | */ |
| 233 | int of_attach_node(struct device_node *np) | 235 | int of_attach_node(struct device_node *np) |
| 234 | { | 236 | { |
| @@ -281,6 +283,7 @@ void __of_detach_node(struct device_node *np) · 46 unmodified lines | |||
| 281 | 283 | ||
| 282 | /** | 284 | /** |
| 283 | * of_detach_node() - "Unplug" a node from the device tree. | 285 | * of_detach_node() - "Unplug" a node from the device tree. |
| 286 | * @np: Pointer to the caller's Device Node | ||
| 284 | */ | 287 | */ |
| 285 | int of_detach_node(struct device_node *np) | 288 | int of_detach_node(struct device_node *np) |
| 286 | { | 289 | { |
| @@ -318,7 +321,7 @@ static void property_list_free(struct property *prop_list) · 31 unmodified lines | |||
| 318 | 321 | ||
| 319 | /** | 322 | /** |
| 320 | * of_node_release() - release a dynamically allocated node | 323 | * of_node_release() - release a dynamically allocated node |
| 321 | * @kref: kref element of the node to be released | 324 | * @kobj: kernel object of the node to be released |
| 322 | * | 325 | * |
| 323 | * In of_node_put() this function is passed to kref_put() as the destructor. | 326 | * In of_node_put() this function is passed to kref_put() as the destructor. |
| 324 | */ | 327 | */ |
| @@ -372,7 +375,8 @@ void of_node_release(struct kobject *kobj) · 47 unmodified lines | |||
| 372 | * property structure and the property name & contents. The property's | 375 | * property structure and the property name & contents. The property's |
| 373 | * flags have the OF_DYNAMIC bit set so that we can differentiate between | 376 | * flags have the OF_DYNAMIC bit set so that we can differentiate between |
| 374 | * dynamically allocated properties and not. | 377 | * dynamically allocated properties and not. |
| 375 | * Returns the newly allocated property or NULL on out of memory error. | 378 | * |
| 379 | * Return: The newly allocated property or NULL on out of memory error. | ||
| 376 | */ | 380 | */ |
| 377 | struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) | 381 | struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) |
| 378 | { | 382 | { |
| @@ -415,7 +419,7 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) · 36 unmodified lines | |||
| 415 | * another node. The node data are dynamically allocated and all the node | 419 | * another node. The node data are dynamically allocated and all the node |
| 416 | * flags have the OF_DYNAMIC & OF_DETACHED bits set. | 420 | * flags have the OF_DYNAMIC & OF_DETACHED bits set. |
| 417 | * | 421 | * |
| 418 | * Returns the newly allocated node or NULL on out of memory error. | 422 | * Return: The newly allocated node or NULL on out of memory error. |
| 419 | */ | 423 | */ |
| 420 | struct device_node *__of_node_dup(const struct device_node *np, | 424 | struct device_node *__of_node_dup(const struct device_node *np, |
| 421 | const char *full_name) | 425 | const char *full_name) |
| @@ -781,7 +785,8 @@ static int __of_changeset_apply(struct of_changeset *ocs) · 359 unmodified lines | |||
| 781 | * Any side-effects of live tree state changes are applied here on | 785 | * Any side-effects of live tree state changes are applied here on |
| 782 | * success, like creation/destruction of devices and side-effects | 786 | * success, like creation/destruction of devices and side-effects |
| 783 | * like creation of sysfs properties and directories. | 787 | * like creation of sysfs properties and directories. |
| 784 | * Returns 0 on success, a negative error value in case of an error. | 788 | * |
| 789 | * Return: 0 on success, a negative error value in case of an error. | ||
| 785 | * On error the partially applied effects are reverted. | 790 | * On error the partially applied effects are reverted. |
| 786 | */ | 791 | */ |
| 787 | int of_changeset_apply(struct of_changeset *ocs) | 792 | int of_changeset_apply(struct of_changeset *ocs) |
| @@ -875,7 +880,8 @@ static int __of_changeset_revert(struct of_changeset *ocs) · 87 unmodified lines | |||
| 875 | * was before the application. | 880 | * was before the application. |
| 876 | * Any side-effects like creation/destruction of devices and | 881 | * Any side-effects like creation/destruction of devices and |
| 877 | * removal of sysfs properties and directories are applied. | 882 | * removal of sysfs properties and directories are applied. |
| 878 | * Returns 0 on success, a negative error value in case of an error. | 883 | * |
| 884 | * Return: 0 on success, a negative error value in case of an error. | ||
| 879 | */ | 885 | */ |
| 880 | int of_changeset_revert(struct of_changeset *ocs) | 886 | int of_changeset_revert(struct of_changeset *ocs) |
| 881 | { | 887 | { |
| @@ -903,7 +909,8 @@ EXPORT_SYMBOL_GPL(of_changeset_revert); · 21 unmodified lines | |||
| 903 | * + OF_RECONFIG_ADD_PROPERTY | 909 | * + OF_RECONFIG_ADD_PROPERTY |
| 904 | * + OF_RECONFIG_REMOVE_PROPERTY, | 910 | * + OF_RECONFIG_REMOVE_PROPERTY, |
| 905 | * + OF_RECONFIG_UPDATE_PROPERTY | 911 | * + OF_RECONFIG_UPDATE_PROPERTY |
| 906 | * Returns 0 on success, a negative error value in case of an error. | 912 | * |
| 913 | * Return: 0 on success, a negative error value in case of an error. | ||
| 907 | */ | 914 | */ |
| 908 | int of_changeset_action(struct of_changeset *ocs, unsigned long action, | 915 | int of_changeset_action(struct of_changeset *ocs, unsigned long action, |
| 909 | struct device_node *np, struct property *prop) | 916 | struct device_node *np, struct property *prop) |
| @@ -282,7 +282,7 @@ static void reverse_nodes(struct device_node *parent) · 281 unmodified lines | |||
| 282 | * @dad: Parent struct device_node | 282 | * @dad: Parent struct device_node |
| 283 | * @nodepp: The device_node tree created by the call | 283 | * @nodepp: The device_node tree created by the call |
| 284 | * | 284 | * |
| 285 | * It returns the size of unflattened device tree or error code | 285 | * Return: The size of unflattened device tree or error code |
| 286 | */ | 286 | */ |
| 287 | static int unflatten_dt_nodes(const void *blob, | 287 | static int unflatten_dt_nodes(const void *blob, |
| 288 | void *mem, | 288 | void *mem, |
| @@ -351,11 +351,6 @@ static int unflatten_dt_nodes(const void *blob, · 62 unmodified lines | |||
| 351 | 351 | ||
| 352 | /** | 352 | /** |
| 353 | * __unflatten_device_tree - create tree of device_nodes from flat blob | 353 | * __unflatten_device_tree - create tree of device_nodes from flat blob |
| 354 | * | ||
| 355 | * unflattens a device-tree, creating the | ||
| 356 | * tree of struct device_node. It also fills the "name" and "type" | ||
| 357 | * pointers of the nodes so the normal device-tree walking functions | ||
| 358 | * can be used. | ||
| 359 | * @blob: The blob to expand | 354 | * @blob: The blob to expand |
| 360 | * @dad: Parent device node | 355 | * @dad: Parent device node |
| 361 | * @mynodes: The device_node tree created by the call | 356 | * @mynodes: The device_node tree created by the call |
| @@ -363,7 +358,11 @@ static int unflatten_dt_nodes(const void *blob, · 1 unmodified line | |||
| 363 | * for the resulting tree | 358 | * for the resulting tree |
| 364 | * @detached: if true set OF_DETACHED on @mynodes | 359 | * @detached: if true set OF_DETACHED on @mynodes |
| 365 | * | 360 | * |
| 366 | * Returns NULL on failure or the memory chunk containing the unflattened | 361 | * unflattens a device-tree, creating the tree of struct device_node. It also |
| 362 | * fills the "name" and "type" pointers of the nodes so the normal device-tree | ||
| 363 | * walking functions can be used. | ||
| 364 | * | ||
| 365 | * Return: NULL on failure or the memory chunk containing the unflattened | ||
| 367 | * device tree on success. | 366 | * device tree on success. |
| 368 | */ | 367 | */ |
| 369 | void *__unflatten_device_tree(const void *blob, | 368 | void *__unflatten_device_tree(const void *blob, |
| @@ -452,7 +451,7 @@ static DEFINE_MUTEX(of_fdt_unflatten_mutex); · 82 unmodified lines | |||
| 452 | * pointers of the nodes so the normal device-tree walking functions | 451 | * pointers of the nodes so the normal device-tree walking functions |
| 453 | * can be used. | 452 | * can be used. |
| 454 | * | 453 | * |
| 455 | * Returns NULL on failure or the memory chunk containing the unflattened | 454 | * Return: NULL on failure or the memory chunk containing the unflattened |
| 456 | * device tree on success. | 455 | * device tree on success. |
| 457 | */ | 456 | */ |
| 458 | void *of_fdt_unflatten_tree(const unsigned long *blob, | 457 | void *of_fdt_unflatten_tree(const unsigned long *blob, |
| @@ -480,7 +479,7 @@ void *initial_boot_params __ro_after_init; · 21 unmodified lines | |||
| 480 | 479 | ||
| 481 | static u32 of_fdt_crc32; | 480 | static u32 of_fdt_crc32; |
| 482 | 481 | ||
| 483 | /** | 482 | /* |
| 484 | * __reserved_mem_reserve_reg() - reserve all memory described in 'reg' property | 483 | * __reserved_mem_reserve_reg() - reserve all memory described in 'reg' property |
| 485 | */ | 484 | */ |
| 486 | static int __init __reserved_mem_reserve_reg(unsigned long node, | 485 | static int __init __reserved_mem_reserve_reg(unsigned long node, |
| @@ -526,7 +525,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, · 39 unmodified lines | |||
| 526 | return 0; | 525 | return 0; |
| 527 | } | 526 | } |
| 528 | 527 | ||
| 529 | /** | 528 | /* |
| 530 | * __reserved_mem_check_root() - check if #size-cells, #address-cells provided | 529 | * __reserved_mem_check_root() - check if #size-cells, #address-cells provided |
| 531 | * in /reserved-memory matches the values supported by the current implementation, | 530 | * in /reserved-memory matches the values supported by the current implementation, |
| 532 | * also check if ranges property has been provided | 531 | * also check if ranges property has been provided |
| @@ -549,8 +548,8 @@ static int __init __reserved_mem_check_root(unsigned long node) · 16 unmodified lines | |||
| 549 | return 0; | 548 | return 0; |
| 550 | } | 549 | } |
| 551 | 550 | ||
| 552 | /** | 551 | /* |
| 553 | * fdt_scan_reserved_mem() - scan a single FDT node for reserved memory | 552 | * __fdt_scan_reserved_mem() - scan a single FDT node for reserved memory |
| 554 | */ | 553 | */ |
| 555 | static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname, | 554 | static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname, |
| 556 | int depth, void *data) | 555 | int depth, void *data) |
| @@ -660,6 +659,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, · 103 unmodified lines | |||
| 660 | 659 | ||
| 661 | /** | 660 | /** |
| 662 | * of_scan_flat_dt_subnodes - scan sub-nodes of a node call callback on each. | 661 | * of_scan_flat_dt_subnodes - scan sub-nodes of a node call callback on each. |
| 662 | * @parent: parent node | ||
| 663 | * @it: callback function | 663 | * @it: callback function |
| 664 | * @data: context data pointer | 664 | * @data: context data pointer |
| 665 | * | 665 | * |
| @@ -699,7 +699,7 @@ int __init of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) · 33 unmodified lines | |||
| 699 | return fdt_subnode_offset(initial_boot_params, node, uname); | 699 | return fdt_subnode_offset(initial_boot_params, node, uname); |
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | /** | 702 | /* |
| 703 | * of_get_flat_dt_root - find the root node in the flat blob | 703 | * of_get_flat_dt_root - find the root node in the flat blob |
| 704 | */ | 704 | */ |
| 705 | unsigned long __init of_get_flat_dt_root(void) | 705 | unsigned long __init of_get_flat_dt_root(void) |
| @@ -707,7 +707,7 @@ unsigned long __init of_get_flat_dt_root(void) · 1 unmodified line | |||
| 707 | return 0; | 707 | return 0; |
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | /** | 710 | /* |
| 711 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr | 711 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr |
| 712 | * | 712 | * |
| 713 | * This function can be used within scan_flattened_dt callback to get | 713 | * This function can be used within scan_flattened_dt callback to get |
| @@ -726,7 +726,7 @@ const void *__init of_get_flat_dt_prop(unsigned long node, const char *name, · 12 unmodified lines | |||
| 726 | * @node: node to test | 726 | * @node: node to test |
| 727 | * @compat: compatible string to compare with compatible list. | 727 | * @compat: compatible string to compare with compatible list. |
| 728 | * | 728 | * |
| 729 | * On match, returns a non-zero value with smaller values returned for more | 729 | * Return: a non-zero value on match with smaller values returned for more |
| 730 | * specific compatible values. | 730 | * specific compatible values. |
| 731 | */ | 731 | */ |
| 732 | static int of_fdt_is_compatible(const void *blob, | 732 | static int of_fdt_is_compatible(const void *blob, |
| @@ -761,7 +761,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) · 28 unmodified lines | |||
| 761 | return of_fdt_is_compatible(initial_boot_params, node, compat); | 761 | return of_fdt_is_compatible(initial_boot_params, node, compat); |
| 762 | } | 762 | } |
| 763 | 763 | ||
| 764 | /** | 764 | /* |
| 765 | * of_flat_dt_match - Return true if node matches a list of compatible values | 765 | * of_flat_dt_match - Return true if node matches a list of compatible values |
| 766 | */ | 766 | */ |
| 767 | static int __init of_flat_dt_match(unsigned long node, const char *const *compat) | 767 | static int __init of_flat_dt_match(unsigned long node, const char *const *compat) |
| @@ -781,8 +781,8 @@ static int __init of_flat_dt_match(unsigned long node, const char *const *compat · 13 unmodified lines | |||
| 781 | return score; | 781 | return score; |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | /** | 784 | /* |
| 785 | * of_get_flat_dt_prop - Given a node in the flat blob, return the phandle | 785 | * of_get_flat_dt_phandle - Given a node in the flat blob, return the phandle |
| 786 | */ | 786 | */ |
| 787 | uint32_t __init of_get_flat_dt_phandle(unsigned long node) | 787 | uint32_t __init of_get_flat_dt_phandle(unsigned long node) |
| 788 | { | 788 | { |
| @@ -957,7 +957,7 @@ int __init early_init_dt_scan_chosen_stdout(void) · 168 unmodified lines | |||
| 957 | } | 957 | } |
| 958 | #endif | 958 | #endif |
| 959 | 959 | ||
| 960 | /** | 960 | /* |
| 961 | * early_init_dt_scan_root - fetch the top level address and size cells | 961 | * early_init_dt_scan_root - fetch the top level address and size cells |
| 962 | */ | 962 | */ |
| 963 | int __init early_init_dt_scan_root(unsigned long node, const char *uname, | 963 | int __init early_init_dt_scan_root(unsigned long node, const char *uname, |
| @@ -993,7 +993,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp) · 29 unmodified lines | |||
| 993 | return of_read_number(p, s); | 993 | return of_read_number(p, s); |
| 994 | } | 994 | } |
| 995 | 995 | ||
| 996 | /** | 996 | /* |
| 997 | * early_init_dt_scan_memory - Look for and parse memory nodes | 997 | * early_init_dt_scan_memory - Look for and parse memory nodes |
| 998 | */ | 998 | */ |
| 999 | int __init early_init_dt_scan_memory(unsigned long node, const char *uname, | 999 | int __init early_init_dt_scan_memory(unsigned long node, const char *uname, |
| @@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); · 47 unmodified lines | |||
| 48 | * of_irq_find_parent - Given a device node, find its interrupt parent node | 48 | * of_irq_find_parent - Given a device node, find its interrupt parent node |
| 49 | * @child: pointer to device node | 49 | * @child: pointer to device node |
| 50 | * | 50 | * |
| 51 | * Returns a pointer to the interrupt parent node, or NULL if the interrupt | 51 | * Return: A pointer to the interrupt parent node, or NULL if the interrupt |
| 52 | * parent could not be determined. | 52 | * parent could not be determined. |
| 53 | */ | 53 | */ |
| 54 | struct device_node *of_irq_find_parent(struct device_node *child) | 54 | struct device_node *of_irq_find_parent(struct device_node *child) |
| @@ -81,14 +81,14 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); · 26 unmodified lines | |||
| 81 | * @addr: address specifier (start of "reg" property of the device) in be32 format | 81 | * @addr: address specifier (start of "reg" property of the device) in be32 format |
| 82 | * @out_irq: structure of_phandle_args updated by this function | 82 | * @out_irq: structure of_phandle_args updated by this function |
| 83 | * | 83 | * |
| 84 | * Returns 0 on success and a negative number on error | ||
| 85 | * | ||
| 86 | * This function is a low-level interrupt tree walking function. It | 84 | * This function is a low-level interrupt tree walking function. It |
| 87 | * can be used to do a partial walk with synthetized reg and interrupts | 85 | * can be used to do a partial walk with synthetized reg and interrupts |
| 88 | * properties, for example when resolving PCI interrupts when no device | 86 | * properties, for example when resolving PCI interrupts when no device |
| 89 | * node exist for the parent. It takes an interrupt specifier structure as | 87 | * node exist for the parent. It takes an interrupt specifier structure as |
| 90 | * input, walks the tree looking for any interrupt-map properties, translates | 88 | * input, walks the tree looking for any interrupt-map properties, translates |
| 91 | * the specifier for each map, and then returns the translated map. | 89 | * the specifier for each map, and then returns the translated map. |
| 90 | * | ||
| 91 | * Return: 0 on success and a negative number on error | ||
| 92 | */ | 92 | */ |
| 93 | int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) | 93 | int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) |
| 94 | { | 94 | { |
| @@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource); · 285 unmodified lines | |||
| 380 | * @dev: pointer to device tree node | 380 | * @dev: pointer to device tree node |
| 381 | * @index: zero-based index of the IRQ | 381 | * @index: zero-based index of the IRQ |
| 382 | * | 382 | * |
| 383 | * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or | 383 | * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or |
| 384 | * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case | 384 | * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case |
| 385 | * of any other failure. | 385 | * of any other failure. |
| 386 | */ | 386 | */ |
| @@ -407,7 +407,7 @@ EXPORT_SYMBOL_GPL(of_irq_get); · 20 unmodified lines | |||
| 407 | * @dev: pointer to device tree node | 407 | * @dev: pointer to device tree node |
| 408 | * @name: IRQ name | 408 | * @name: IRQ name |
| 409 | * | 409 | * |
| 410 | * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or | 410 | * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or |
| 411 | * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case | 411 | * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case |
| 412 | * of any other failure. | 412 | * of any other failure. |
| 413 | */ | 413 | */ |
| @@ -447,7 +447,7 @@ int of_irq_count(struct device_node *dev) · 33 unmodified lines | |||
| 447 | * @res: array of resources to fill in | 447 | * @res: array of resources to fill in |
| 448 | * @nr_irqs: the number of IRQs (and upper bound for num of @res elements) | 448 | * @nr_irqs: the number of IRQs (and upper bound for num of @res elements) |
| 449 | * | 449 | * |
| 450 | * Returns the size of the filled in table (up to @nr_irqs). | 450 | * Return: The size of the filled in table (up to @nr_irqs). |
| 451 | */ | 451 | */ |
| 452 | int of_irq_to_resource_table(struct device_node *dev, struct resource *res, | 452 | int of_irq_to_resource_table(struct device_node *dev, struct resource *res, |
| 453 | int nr_irqs) | 453 | int nr_irqs) |
| @@ -602,7 +602,7 @@ static u32 __of_msi_map_id(struct device *dev, struct device_node **np, · 148 unmodified lines | |||
| 602 | * Walk up the device hierarchy looking for devices with a "msi-map" | 602 | * Walk up the device hierarchy looking for devices with a "msi-map" |
| 603 | * property. If found, apply the mapping to @id_in. | 603 | * property. If found, apply the mapping to @id_in. |
| 604 | * | 604 | * |
| 605 | * Returns the mapped MSI ID. | 605 | * Return: The mapped MSI ID. |
| 606 | */ | 606 | */ |
| 607 | u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in) | 607 | u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in) |
| 608 | { | 608 | { |
| @@ -0,0 +1,458 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2020 Arm Limited | ||
| 4 | * | ||
| 5 | * Based on arch/arm64/kernel/machine_kexec_file.c: | ||
| 6 | * Copyright (C) 2018 Linaro Limited | ||
| 7 | * | ||
| 8 | * And arch/powerpc/kexec/file_load.c: | ||
| 9 | * Copyright (C) 2016 IBM Corporation | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/kernel.h> | ||
| 13 | #include <linux/kexec.h> | ||
| 14 | #include <linux/memblock.h> | ||
| 15 | #include <linux/libfdt.h> | ||
| 16 | #include <linux/of.h> | ||
| 17 | #include <linux/of_fdt.h> | ||
| 18 | #include <linux/random.h> | ||
| 19 | #include <linux/types.h> | ||
| 20 | |||
| 21 | /* relevant device tree properties */ | ||
| 22 | #define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr" | ||
| 23 | #define FDT_PROP_MEM_RANGE "linux,usable-memory-range" | ||
| 24 | #define FDT_PROP_INITRD_START "linux,initrd-start" | ||
| 25 | #define FDT_PROP_INITRD_END "linux,initrd-end" | ||
| 26 | #define FDT_PROP_BOOTARGS "bootargs" | ||
| 27 | #define FDT_PROP_KASLR_SEED "kaslr-seed" | ||
| 28 | #define FDT_PROP_RNG_SEED "rng-seed" | ||
| 29 | #define RNG_SEED_SIZE 128 | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Additional space needed for the FDT buffer so that we can add initrd, | ||
| 33 | * bootargs, kaslr-seed, rng-seed, useable-memory-range and elfcorehdr. | ||
| 34 | */ | ||
| 35 | #define FDT_EXTRA_SPACE 0x1000 | ||
| 36 | |||
| 37 | /** | ||
| 38 | * fdt_find_and_del_mem_rsv - delete memory reservation with given address and size | ||
| 39 | * | ||
| 40 | * @fdt: Flattened device tree for the current kernel. | ||
| 41 | * @start: Starting address of the reserved memory. | ||
| 42 | * @size: Size of the reserved memory. | ||
| 43 | * | ||
| 44 | * Return: 0 on success, or negative errno on error. | ||
| 45 | */ | ||
| 46 | static int fdt_find_and_del_mem_rsv(void *fdt, unsigned long start, unsigned long size) | ||
| 47 | { | ||
| 48 | int i, ret, num_rsvs = fdt_num_mem_rsv(fdt); | ||
| 49 | |||
| 50 | for (i = 0; i < num_rsvs; i++) { | ||
| 51 | u64 rsv_start, rsv_size; | ||
| 52 | |||
| 53 | ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size); | ||
| 54 | if (ret) { | ||
| 55 | pr_err("Malformed device tree.\n"); | ||
| 56 | return -EINVAL; | ||
| 57 | } | ||
| 58 | |||
| 59 | if (rsv_start == start && rsv_size == size) { | ||
| 60 | ret = fdt_del_mem_rsv(fdt, i); | ||
| 61 | if (ret) { | ||
| 62 | pr_err("Error deleting device tree reservation.\n"); | ||
| 63 | return -EINVAL; | ||
| 64 | } | ||
| 65 | |||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | return -ENOENT; | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * get_addr_size_cells - Get address and size of root node | ||
| 75 | * | ||
| 76 | * @addr_cells: Return address of the root node | ||
| 77 | * @size_cells: Return size of the root node | ||
| 78 | * | ||
| 79 | * Return: 0 on success, or negative errno on error. | ||
| 80 | */ | ||
| 81 | static int get_addr_size_cells(int *addr_cells, int *size_cells) | ||
| 82 | { | ||
| 83 | struct device_node *root; | ||
| 84 | |||
| 85 | root = of_find_node_by_path("/"); | ||
| 86 | if (!root) | ||
| 87 | return -EINVAL; | ||
| 88 | |||
| 89 | *addr_cells = of_n_addr_cells(root); | ||
| 90 | *size_cells = of_n_size_cells(root); | ||
| 91 | |||
| 92 | of_node_put(root); | ||
| 93 | |||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | /** | ||
| 98 | * do_get_kexec_buffer - Get address and size of device tree property | ||
| 99 | * | ||
| 100 | * @prop: Device tree property | ||
| 101 | * @len: Size of @prop | ||
| 102 | * @addr: Return address of the node | ||
| 103 | * @size: Return size of the node | ||
| 104 | * | ||
| 105 | * Return: 0 on success, or negative errno on error. | ||
| 106 | */ | ||
| 107 | static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr, | ||
| 108 | size_t *size) | ||
| 109 | { | ||
| 110 | int ret, addr_cells, size_cells; | ||
| 111 | |||
| 112 | ret = get_addr_size_cells(&addr_cells, &size_cells); | ||
| 113 | if (ret) | ||
| 114 | return ret; | ||
| 115 | |||
| 116 | if (len < 4 * (addr_cells + size_cells)) | ||
| 117 | return -ENOENT; | ||
| 118 | |||
| 119 | *addr = of_read_number(prop, addr_cells); | ||
| 120 | *size = of_read_number(prop + 4 * addr_cells, size_cells); | ||
| 121 | |||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | |||
| 125 | /** | ||
| 126 | * ima_get_kexec_buffer - get IMA buffer from the previous kernel | ||
| 127 | * @addr: On successful return, set to point to the buffer contents. | ||
| 128 | * @size: On successful return, set to the buffer size. | ||
| 129 | * | ||
| 130 | * Return: 0 on success, negative errno on error. | ||
| 131 | */ | ||
| 132 | int ima_get_kexec_buffer(void **addr, size_t *size) | ||
| 133 | { | ||
| 134 | int ret, len; | ||
| 135 | unsigned long tmp_addr; | ||
| 136 | size_t tmp_size; | ||
| 137 | const void *prop; | ||
| 138 | |||
| 139 | if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC)) | ||
| 140 | return -ENOTSUPP; | ||
| 141 | |||
| 142 | prop = of_get_property(of_chosen, "linux,ima-kexec-buffer", &len); | ||
| 143 | if (!prop) | ||
| 144 | return -ENOENT; | ||
| 145 | |||
| 146 | ret = do_get_kexec_buffer(prop, len, &tmp_addr, &tmp_size); | ||
| 147 | if (ret) | ||
| 148 | return ret; | ||
| 149 | |||
| 150 | *addr = __va(tmp_addr); | ||
| 151 | *size = tmp_size; | ||
| 152 | |||
| 153 | return 0; | ||
| 154 | } | ||
| 155 | |||
| 156 | /** | ||
| 157 | * ima_free_kexec_buffer - free memory used by the IMA buffer | ||
| 158 | */ | ||
| 159 | int ima_free_kexec_buffer(void) | ||
| 160 | { | ||
| 161 | int ret; | ||
| 162 | unsigned long addr; | ||
| 163 | size_t size; | ||
| 164 | struct property *prop; | ||
| 165 | |||
| 166 | if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC)) | ||
| 167 | return -ENOTSUPP; | ||
| 168 | |||
| 169 | prop = of_find_property(of_chosen, "linux,ima-kexec-buffer", NULL); | ||
| 170 | if (!prop) | ||
| 171 | return -ENOENT; | ||
| 172 | |||
| 173 | ret = do_get_kexec_buffer(prop->value, prop->length, &addr, &size); | ||
| 174 | if (ret) | ||
| 175 | return ret; | ||
| 176 | |||
| 177 | ret = of_remove_property(of_chosen, prop); | ||
| 178 | if (ret) | ||
| 179 | return ret; | ||
| 180 | |||
| 181 | return memblock_free(addr, size); | ||
| 182 | |||
| 183 | } | ||
| 184 | |||
| 185 | /** | ||
| 186 | * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt | ||
| 187 | * | ||
| 188 | * @fdt: Flattened Device Tree to update | ||
| 189 | * @chosen_node: Offset to the chosen node in the device tree | ||
| 190 | * | ||
| 191 | * The IMA measurement buffer is of no use to a subsequent kernel, so we always | ||
| 192 | * remove it from the device tree. | ||
| 193 | */ | ||
| 194 | static void remove_ima_buffer(void *fdt, int chosen_node) | ||
| 195 | { | ||
| 196 | int ret, len; | ||
| 197 | unsigned long addr; | ||
| 198 | size_t size; | ||
| 199 | const void *prop; | ||
| 200 | |||
| 201 | if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC)) | ||
| 202 | return; | ||
| 203 | |||
| 204 | prop = fdt_getprop(fdt, chosen_node, "linux,ima-kexec-buffer", &len); | ||
| 205 | if (!prop) | ||
| 206 | return; | ||
| 207 | |||
| 208 | ret = do_get_kexec_buffer(prop, len, &addr, &size); | ||
| 209 | fdt_delprop(fdt, chosen_node, "linux,ima-kexec-buffer"); | ||
| 210 | if (ret) | ||
| 211 | return; | ||
| 212 | |||
| 213 | ret = fdt_find_and_del_mem_rsv(fdt, addr, size); | ||
| 214 | if (!ret) | ||
| 215 | pr_debug("Removed old IMA buffer reservation.\n"); | ||
| 216 | } | ||
| 217 | |||
| 218 | #ifdef CONFIG_IMA_KEXEC | ||
| 219 | /** | ||
| 220 | * setup_ima_buffer - add IMA buffer information to the fdt | ||
| 221 | * @image: kexec image being loaded. | ||
| 222 | * @fdt: Flattened device tree for the next kernel. | ||
| 223 | * @chosen_node: Offset to the chosen node. | ||
| 224 | * | ||
| 225 | * Return: 0 on success, or negative errno on error. | ||
| 226 | */ | ||
| 227 | static int setup_ima_buffer(const struct kimage *image, void *fdt, | ||
| 228 | int chosen_node) | ||
| 229 | { | ||
| 230 | int ret; | ||
| 231 | |||
| 232 | if (!image->ima_buffer_size) | ||
| 233 | return 0; | ||
| 234 | |||
| 235 | ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, | ||
| 236 | "linux,ima-kexec-buffer", | ||
| 237 | image->ima_buffer_addr, | ||
| 238 | image->ima_buffer_size); | ||
| 239 | if (ret < 0) | ||
| 240 | return -EINVAL; | ||
| 241 | |||
| 242 | ret = fdt_add_mem_rsv(fdt, image->ima_buffer_addr, | ||
| 243 | image->ima_buffer_size); | ||
| 244 | if (ret) | ||
| 245 | return -EINVAL; | ||
| 246 | |||
| 247 | pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n", | ||
| 248 | image->ima_buffer_addr, image->ima_buffer_size); | ||
| 249 | |||
| 250 | return 0; | ||
| 251 | } | ||
| 252 | #else /* CONFIG_IMA_KEXEC */ | ||
| 253 | static inline int setup_ima_buffer(const struct kimage *image, void *fdt, | ||
| 254 | int chosen_node) | ||
| 255 | { | ||
| 256 | return 0; | ||
| 257 | } | ||
| 258 | #endif /* CONFIG_IMA_KEXEC */ | ||
| 259 | |||
| 260 | /* | ||
| 261 | * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree | ||
| 262 | * | ||
| 263 | * @image: kexec image being loaded. | ||
| 264 | * @initrd_load_addr: Address where the next initrd will be loaded. | ||
| 265 | * @initrd_len: Size of the next initrd, or 0 if there will be none. | ||
| 266 | * @cmdline: Command line for the next kernel, or NULL if there will | ||
| 267 | * be none. | ||
| 268 | * @extra_fdt_size: Additional size for the new FDT buffer. | ||
| 269 | * | ||
| 270 | * Return: fdt on success, or NULL errno on error. | ||
| 271 | */ | ||
| 272 | void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, | ||
| 273 | unsigned long initrd_load_addr, | ||
| 274 | unsigned long initrd_len, | ||
| 275 | const char *cmdline, size_t extra_fdt_size) | ||
| 276 | { | ||
| 277 | void *fdt; | ||
| 278 | int ret, chosen_node; | ||
| 279 | const void *prop; | ||
| 280 | size_t fdt_size; | ||
| 281 | |||
| 282 | fdt_size = fdt_totalsize(initial_boot_params) + | ||
| 283 | (cmdline ? strlen(cmdline) : 0) + | ||
| 284 | FDT_EXTRA_SPACE + | ||
| 285 | extra_fdt_size; | ||
| 286 | fdt = kvmalloc(fdt_size, GFP_KERNEL); | ||
| 287 | if (!fdt) | ||
| 288 | return NULL; | ||
| 289 | |||
| 290 | ret = fdt_open_into(initial_boot_params, fdt, fdt_size); | ||
| 291 | if (ret < 0) { | ||
| 292 | pr_err("Error %d setting up the new device tree.\n", ret); | ||
| 293 | goto out; | ||
| 294 | } | ||
| 295 | |||
| 296 | /* Remove memory reservation for the current device tree. */ | ||
| 297 | ret = fdt_find_and_del_mem_rsv(fdt, __pa(initial_boot_params), | ||
| 298 | fdt_totalsize(initial_boot_params)); | ||
| 299 | if (ret == -EINVAL) { | ||
| 300 | pr_err("Error removing memory reservation.\n"); | ||
| 301 | goto out; | ||
| 302 | } | ||
| 303 | |||
| 304 | chosen_node = fdt_path_offset(fdt, "/chosen"); | ||
| 305 | if (chosen_node == -FDT_ERR_NOTFOUND) | ||
| 306 | chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"), | ||
| 307 | "chosen"); | ||
| 308 | if (chosen_node < 0) { | ||
| 309 | ret = chosen_node; | ||
| 310 | goto out; | ||
| 311 | } | ||
| 312 | |||
| 313 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KEXEC_ELFHDR); | ||
| 314 | if (ret && ret != -FDT_ERR_NOTFOUND) | ||
| 315 | goto out; | ||
| 316 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_MEM_RANGE); | ||
| 317 | if (ret && ret != -FDT_ERR_NOTFOUND) | ||
| 318 | goto out; | ||
| 319 | |||
| 320 | /* Did we boot using an initrd? */ | ||
| 321 | prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", NULL); | ||
| 322 | if (prop) { | ||
| 323 | u64 tmp_start, tmp_end, tmp_size; | ||
| 324 | |||
| 325 | tmp_start = fdt64_to_cpu(*((const fdt64_t *) prop)); | ||
| 326 | |||
| 327 | prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", NULL); | ||
| 328 | if (!prop) { | ||
| 329 | ret = -EINVAL; | ||
| 330 | goto out; | ||
| 331 | } | ||
| 332 | |||
| 333 | tmp_end = fdt64_to_cpu(*((const fdt64_t *) prop)); | ||
| 334 | |||
| 335 | /* | ||
| 336 | * kexec reserves exact initrd size, while firmware may | ||
| 337 | * reserve a multiple of PAGE_SIZE, so check for both. | ||
| 338 | */ | ||
| 339 | tmp_size = tmp_end - tmp_start; | ||
| 340 | ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size); | ||
| 341 | if (ret == -ENOENT) | ||
| 342 | ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, | ||
| 343 | round_up(tmp_size, PAGE_SIZE)); | ||
| 344 | if (ret == -EINVAL) | ||
| 345 | goto out; | ||
| 346 | } | ||
| 347 | |||
| 348 | /* add initrd-* */ | ||
| 349 | if (initrd_load_addr) { | ||
| 350 | ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_START, | ||
| 351 | initrd_load_addr); | ||
| 352 | if (ret) | ||
| 353 | goto out; | ||
| 354 | |||
| 355 | ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_END, | ||
| 356 | initrd_load_addr + initrd_len); | ||
| 357 | if (ret) | ||
| 358 | goto out; | ||
| 359 | |||
| 360 | ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len); | ||
| 361 | if (ret) | ||
| 362 | goto out; | ||
| 363 | |||
| 364 | } else { | ||
| 365 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_START); | ||
| 366 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 367 | goto out; | ||
| 368 | |||
| 369 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_END); | ||
| 370 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 371 | goto out; | ||
| 372 | } | ||
| 373 | |||
| 374 | if (image->type == KEXEC_TYPE_CRASH) { | ||
| 375 | /* add linux,elfcorehdr */ | ||
| 376 | ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, | ||
| 377 | FDT_PROP_KEXEC_ELFHDR, | ||
| 378 | image->elf_load_addr, | ||
| 379 | image->elf_headers_sz); | ||
| 380 | if (ret) | ||
| 381 | goto out; | ||
| 382 | |||
| 383 | /* | ||
| 384 | * Avoid elfcorehdr from being stomped on in kdump kernel by | ||
| 385 | * setting up memory reserve map. | ||
| 386 | */ | ||
| 387 | ret = fdt_add_mem_rsv(fdt, image->elf_load_addr, | ||
| 388 | image->elf_headers_sz); | ||
| 389 | if (ret) | ||
| 390 | goto out; | ||
| 391 | |||
| 392 | /* add linux,usable-memory-range */ | ||
| 393 | ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, | ||
| 394 | FDT_PROP_MEM_RANGE, | ||
| 395 | crashk_res.start, | ||
| 396 | crashk_res.end - crashk_res.start + 1); | ||
| 397 | if (ret) | ||
| 398 | goto out; | ||
| 399 | } | ||
| 400 | |||
| 401 | /* add bootargs */ | ||
| 402 | if (cmdline) { | ||
| 403 | ret = fdt_setprop_string(fdt, chosen_node, FDT_PROP_BOOTARGS, cmdline); | ||
| 404 | if (ret) | ||
| 405 | goto out; | ||
| 406 | } else { | ||
| 407 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_BOOTARGS); | ||
| 408 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | ||
| 409 | goto out; | ||
| 410 | } | ||
| 411 | |||
| 412 | /* add kaslr-seed */ | ||
| 413 | ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KASLR_SEED); | ||
| 414 | if (ret == -FDT_ERR_NOTFOUND) | ||
| 415 | ret = 0; | ||
| 416 | else if (ret) | ||
| 417 | goto out; | ||
| 418 | |||
| 419 | if (rng_is_initialized()) { | ||
| 420 | u64 seed = get_random_u64(); | ||
| 421 | |||
| 422 | ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_KASLR_SEED, seed); | ||
| 423 | if (ret) | ||
| 424 | goto out; | ||
| 425 | } else { | ||
| 426 | pr_notice("RNG is not initialised: omitting \"%s\" property\n", | ||
| 427 | FDT_PROP_KASLR_SEED); | ||
| 428 | } | ||
| 429 | |||
| 430 | /* add rng-seed */ | ||
| 431 | if (rng_is_initialized()) { | ||
| 432 | void *rng_seed; | ||
| 433 | |||
| 434 | ret = fdt_setprop_placeholder(fdt, chosen_node, FDT_PROP_RNG_SEED, | ||
| 435 | RNG_SEED_SIZE, &rng_seed); | ||
| 436 | if (ret) | ||
| 437 | goto out; | ||
| 438 | get_random_bytes(rng_seed, RNG_SEED_SIZE); | ||
| 439 | } else { | ||
| 440 | pr_notice("RNG is not initialised: omitting \"%s\" property\n", | ||
| 441 | FDT_PROP_RNG_SEED); | ||
| 442 | } | ||
| 443 | |||
| 444 | ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0); | ||
| 445 | if (ret) | ||
| 446 | goto out; | ||
| 447 | |||
| 448 | remove_ima_buffer(fdt, chosen_node); | ||
| 449 | ret = setup_ima_buffer(image, fdt, fdt_path_offset(fdt, "/chosen")); | ||
| 450 | |||
| 451 | out: | ||
| 452 | if (ret) { | ||
| 453 | kvfree(fdt); | ||
| 454 | fdt = NULL; | ||
| 455 | } | ||
| 456 | |||
| 457 | return fdt; | ||
| 458 | } | ||
| @@ -79,6 +79,9 @@ static const void *of_get_mac_addr_nvmem(struct device_node *np) · 78 unmodified lines | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /** | 81 | /** |
| 82 | * of_get_mac_address() | ||
| 83 | * @np: Caller's Device Node | ||
| 84 | * | ||
| 82 | * Search the device tree for the best MAC address to use. 'mac-address' is | 85 | * Search the device tree for the best MAC address to use. 'mac-address' is |
| 83 | * checked first, because that is supposed to contain to "most recent" MAC | 86 | * checked first, because that is supposed to contain to "most recent" MAC |
| 84 | * address. If that isn't set, then 'local-mac-address' is checked next, | 87 | * address. If that isn't set, then 'local-mac-address' is checked next, |
| @@ -45,7 +45,7 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, · 44 unmodified lines | |||
| 45 | return memblock_reserve(base, size); | 45 | return memblock_reserve(base, size); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /** | 48 | /* |
| 49 | * fdt_reserved_mem_save_node() - save fdt node for second pass initialization | 49 | * fdt_reserved_mem_save_node() - save fdt node for second pass initialization |
| 50 | */ | 50 | */ |
| 51 | void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, | 51 | void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, |
| @@ -67,7 +67,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, · 15 unmodified lines | |||
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /** | 70 | /* |
| 71 | * __reserved_mem_alloc_size() - allocate reserved memory described by | 71 | * __reserved_mem_alloc_size() - allocate reserved memory described by |
| 72 | * 'size', 'alignment' and 'alloc-ranges' properties. | 72 | * 'size', 'alignment' and 'alloc-ranges' properties. |
| 73 | */ | 73 | */ |
| @@ -164,7 +164,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, · 90 unmodified lines | |||
| 164 | static const struct of_device_id __rmem_of_table_sentinel | 164 | static const struct of_device_id __rmem_of_table_sentinel |
| 165 | __used __section("__reservedmem_of_table_end"); | 165 | __used __section("__reservedmem_of_table_end"); |
| 166 | 166 | ||
| 167 | /** | 167 | /* |
| 168 | * __reserved_mem_init_node() - call region specific reserved memory init code | 168 | * __reserved_mem_init_node() - call region specific reserved memory init code |
| 169 | */ | 169 | */ |
| 170 | static int __init __reserved_mem_init_node(struct reserved_mem *rmem) | 170 | static int __init __reserved_mem_init_node(struct reserved_mem *rmem) |
| @@ -140,7 +140,7 @@ int of_overlay_notifier_register(struct notifier_block *nb) · 139 unmodified lines | |||
| 140 | EXPORT_SYMBOL_GPL(of_overlay_notifier_register); | 140 | EXPORT_SYMBOL_GPL(of_overlay_notifier_register); |
| 141 | 141 | ||
| 142 | /** | 142 | /** |
| 143 | * of_overlay_notifier_register() - Unregister notifier for overlay operations | 143 | * of_overlay_notifier_unregister() - Unregister notifier for overlay operations |
| 144 | * @nb: Notifier block to unregister | 144 | * @nb: Notifier block to unregister |
| 145 | */ | 145 | */ |
| 146 | int of_overlay_notifier_unregister(struct notifier_block *nb) | 146 | int of_overlay_notifier_unregister(struct notifier_block *nb) |
| @@ -298,7 +298,7 @@ err_free_target_path: · 151 unmodified lines | |||
| 298 | * | 298 | * |
| 299 | * Update of property in symbols node is not allowed. | 299 | * Update of property in symbols node is not allowed. |
| 300 | * | 300 | * |
| 301 | * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if | 301 | * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if |
| 302 | * invalid @overlay. | 302 | * invalid @overlay. |
| 303 | */ | 303 | */ |
| 304 | static int add_changeset_property(struct overlay_changeset *ovcs, | 304 | static int add_changeset_property(struct overlay_changeset *ovcs, |
| @@ -403,7 +403,7 @@ static int add_changeset_property(struct overlay_changeset *ovcs, · 98 unmodified lines | |||
| 403 | * | 403 | * |
| 404 | * NOTE_2: Multiple mods of created nodes not supported. | 404 | * NOTE_2: Multiple mods of created nodes not supported. |
| 405 | * | 405 | * |
| 406 | * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if | 406 | * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if |
| 407 | * invalid @overlay. | 407 | * invalid @overlay. |
| 408 | */ | 408 | */ |
| 409 | static int add_changeset_node(struct overlay_changeset *ovcs, | 409 | static int add_changeset_node(struct overlay_changeset *ovcs, |
| @@ -475,7 +475,7 @@ static int add_changeset_node(struct overlay_changeset *ovcs, · 65 unmodified lines | |||
| 475 | * | 475 | * |
| 476 | * Do not allow symbols node to have any children. | 476 | * Do not allow symbols node to have any children. |
| 477 | * | 477 | * |
| 478 | * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if | 478 | * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if |
| 479 | * invalid @overlay_node. | 479 | * invalid @overlay_node. |
| 480 | */ | 480 | */ |
| 481 | static int build_changeset_next_level(struct overlay_changeset *ovcs, | 481 | static int build_changeset_next_level(struct overlay_changeset *ovcs, |
| @@ -606,7 +606,7 @@ static int find_dup_cset_prop(struct overlay_changeset *ovcs, · 124 unmodified lines | |||
| 606 | * the same node or duplicate {add, delete, or update} properties entries | 606 | * the same node or duplicate {add, delete, or update} properties entries |
| 607 | * for the same property. | 607 | * for the same property. |
| 608 | * | 608 | * |
| 609 | * Returns 0 on success, or -EINVAL if duplicate changeset entry found. | 609 | * Return: 0 on success, or -EINVAL if duplicate changeset entry found. |
| 610 | */ | 610 | */ |
| 611 | static int changeset_dup_entry_check(struct overlay_changeset *ovcs) | 611 | static int changeset_dup_entry_check(struct overlay_changeset *ovcs) |
| 612 | { | 612 | { |
| @@ -630,7 +630,7 @@ static int changeset_dup_entry_check(struct overlay_changeset *ovcs) · 17 unmodified lines | |||
| 630 | * any portions of the changeset that were successfully created will remain | 630 | * any portions of the changeset that were successfully created will remain |
| 631 | * in @ovcs->cset. | 631 | * in @ovcs->cset. |
| 632 | * | 632 | * |
| 633 | * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if | 633 | * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if |
| 634 | * invalid overlay in @ovcs->fragments[]. | 634 | * invalid overlay in @ovcs->fragments[]. |
| 635 | */ | 635 | */ |
| 636 | static int build_changeset(struct overlay_changeset *ovcs) | 636 | static int build_changeset(struct overlay_changeset *ovcs) |
| @@ -726,7 +726,7 @@ static struct device_node *find_target(struct device_node *info_node) · 89 unmodified lines | |||
| 726 | * the top level of @tree. The relevant top level nodes are the fragment | 726 | * the top level of @tree. The relevant top level nodes are the fragment |
| 727 | * nodes and the __symbols__ node. Any other top level node will be ignored. | 727 | * nodes and the __symbols__ node. Any other top level node will be ignored. |
| 728 | * | 728 | * |
| 729 | * Returns 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error | 729 | * Return: 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error |
| 730 | * detected in @tree, or -ENOSPC if idr_alloc() error. | 730 | * detected in @tree, or -ENOSPC if idr_alloc() error. |
| 731 | */ | 731 | */ |
| 732 | static int init_overlay_changeset(struct overlay_changeset *ovcs, | 732 | static int init_overlay_changeset(struct overlay_changeset *ovcs, |
| @@ -796,6 +796,7 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs, · 63 unmodified lines | |||
| 796 | if (!fragment->target) { | 796 | if (!fragment->target) { |
| 797 | of_node_put(fragment->overlay); | 797 | of_node_put(fragment->overlay); |
| 798 | ret = -EINVAL; | 798 | ret = -EINVAL; |
| 799 | of_node_put(node); | ||
| 799 | goto err_free_fragments; | 800 | goto err_free_fragments; |
| 800 | } | 801 | } |
| 801 | 802 | ||
| @@ -1186,7 +1187,7 @@ static int overlay_removal_is_ok(struct overlay_changeset *remove_ovcs) · 384 unmodified lines | |||
| 1186 | * If an error is returned by an overlay changeset post-remove notifier | 1187 | * If an error is returned by an overlay changeset post-remove notifier |
| 1187 | * then no further overlay changeset post-remove notifier will be called. | 1188 | * then no further overlay changeset post-remove notifier will be called. |
| 1188 | * | 1189 | * |
| 1189 | * Returns 0 on success, or a negative error number. *ovcs_id is set to | 1190 | * Return: 0 on success, or a negative error number. *@ovcs_id is set to |
| 1190 | * zero after reverting the changeset, even if a subsequent error occurs. | 1191 | * zero after reverting the changeset, even if a subsequent error occurs. |
| 1191 | */ | 1192 | */ |
| 1192 | int of_overlay_remove(int *ovcs_id) | 1193 | int of_overlay_remove(int *ovcs_id) |
| @@ -1264,7 +1265,7 @@ EXPORT_SYMBOL_GPL(of_overlay_remove); · 71 unmodified lines | |||
| 1264 | * | 1265 | * |
| 1265 | * Removes all overlays from the system in the correct order. | 1266 | * Removes all overlays from the system in the correct order. |
| 1266 | * | 1267 | * |
| 1267 | * Returns 0 on success, or a negative error number | 1268 | * Return: 0 on success, or a negative error number |
| 1268 | */ | 1269 | */ |
| 1269 | int of_overlay_remove_all(void) | 1270 | int of_overlay_remove_all(void) |
| 1270 | { | 1271 | { |
| @@ -44,7 +44,7 @@ static const struct of_device_id of_skipped_node_table[] = { · 43 unmodified lines | |||
| 44 | * Takes a reference to the embedded struct device which needs to be dropped | 44 | * Takes a reference to the embedded struct device which needs to be dropped |
| 45 | * after use. | 45 | * after use. |
| 46 | * | 46 | * |
| 47 | * Returns platform_device pointer, or NULL if not found | 47 | * Return: platform_device pointer, or NULL if not found |
| 48 | */ | 48 | */ |
| 49 | struct platform_device *of_find_device_by_node(struct device_node *np) | 49 | struct platform_device *of_find_device_by_node(struct device_node *np) |
| 50 | { | 50 | { |
| @@ -160,7 +160,7 @@ EXPORT_SYMBOL(of_device_alloc); · 109 unmodified lines | |||
| 160 | * @platform_data: pointer to populate platform_data pointer with | 160 | * @platform_data: pointer to populate platform_data pointer with |
| 161 | * @parent: Linux device model parent device. | 161 | * @parent: Linux device model parent device. |
| 162 | * | 162 | * |
| 163 | * Returns pointer to created platform device, or NULL if a device was not | 163 | * Return: Pointer to created platform device, or NULL if a device was not |
| 164 | * registered. Unavailable devices will not get registered. | 164 | * registered. Unavailable devices will not get registered. |
| 165 | */ | 165 | */ |
| 166 | static struct platform_device *of_platform_device_create_pdata( | 166 | static struct platform_device *of_platform_device_create_pdata( |
| @@ -204,7 +204,7 @@ err_clear_flag: · 37 unmodified lines | |||
| 204 | * @bus_id: name to assign device | 204 | * @bus_id: name to assign device |
| 205 | * @parent: Linux device model parent device. | 205 | * @parent: Linux device model parent device. |
| 206 | * | 206 | * |
| 207 | * Returns pointer to created platform device, or NULL if a device was not | 207 | * Return: Pointer to created platform device, or NULL if a device was not |
| 208 | * registered. Unavailable devices will not get registered. | 208 | * registered. Unavailable devices will not get registered. |
| 209 | */ | 209 | */ |
| 210 | struct platform_device *of_platform_device_create(struct device_node *np, | 210 | struct platform_device *of_platform_device_create(struct device_node *np, |
| @@ -290,7 +290,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, · 79 unmodified lines | |||
| 290 | } | 290 | } |
| 291 | #endif /* CONFIG_ARM_AMBA */ | 291 | #endif /* CONFIG_ARM_AMBA */ |
| 292 | 292 | ||
| 293 | /** | 293 | /* |
| 294 | * of_dev_lookup() - Given a device node, lookup the preferred Linux name | 294 | * of_dev_lookup() - Given a device node, lookup the preferred Linux name |
| 295 | */ | 295 | */ |
| 296 | static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup, | 296 | static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup, |
| @@ -463,7 +463,7 @@ EXPORT_SYMBOL(of_platform_bus_probe); · 166 unmodified lines | |||
| 463 | * New board support should be using this function instead of | 463 | * New board support should be using this function instead of |
| 464 | * of_platform_bus_probe(). | 464 | * of_platform_bus_probe(). |
| 465 | * | 465 | * |
| 466 | * Returns 0 on success, < 0 on failure. | 466 | * Return: 0 on success, < 0 on failure. |
| 467 | */ | 467 | */ |
| 468 | int of_platform_populate(struct device_node *root, | 468 | int of_platform_populate(struct device_node *root, |
| 469 | const struct of_device_id *matches, | 469 | const struct of_device_id *matches, |
| @@ -607,7 +607,7 @@ static void devm_of_platform_populate_release(struct device *dev, void *res) · 137 unmodified lines | |||
| 607 | * Similar to of_platform_populate(), but will automatically call | 607 | * Similar to of_platform_populate(), but will automatically call |
| 608 | * of_platform_depopulate() when the device is unbound from the bus. | 608 | * of_platform_depopulate() when the device is unbound from the bus. |
| 609 | * | 609 | * |
| 610 | * Returns 0 on success, < 0 on failure. | 610 | * Return: 0 on success, < 0 on failure. |
| 611 | */ | 611 | */ |
| 612 | int devm_of_platform_populate(struct device *dev) | 612 | int devm_of_platform_populate(struct device *dev) |
| 613 | { | 613 | { |
| @@ -61,9 +61,11 @@ EXPORT_SYMBOL(of_graph_is_present); · 60 unmodified lines | |||
| 61 | * @elem_size: size of the individual element | 61 | * @elem_size: size of the individual element |
| 62 | * | 62 | * |
| 63 | * Search for a property in a device node and count the number of elements of | 63 | * Search for a property in a device node and count the number of elements of |
| 64 | * size elem_size in it. Returns number of elements on sucess, -EINVAL if the | 64 | * size elem_size in it. |
| 65 | * property does not exist or its length does not match a multiple of elem_size | 65 | * |
| 66 | * and -ENODATA if the property does not have a value. | 66 | * Return: The number of elements on sucess, -EINVAL if the property does not |
| 67 | * exist or its length does not match a multiple of elem_size and -ENODATA if | ||
| 68 | * the property does not have a value. | ||
| 67 | */ | 69 | */ |
| 68 | int of_property_count_elems_of_size(const struct device_node *np, | 70 | int of_property_count_elems_of_size(const struct device_node *np, |
| 69 | const char *propname, int elem_size) | 71 | const char *propname, int elem_size) |
| @@ -95,8 +97,9 @@ EXPORT_SYMBOL_GPL(of_property_count_elems_of_size); · 25 unmodified lines | |||
| 95 | * @len: if !=NULL, actual length is written to here | 97 | * @len: if !=NULL, actual length is written to here |
| 96 | * | 98 | * |
| 97 | * Search for a property in a device node and valid the requested size. | 99 | * Search for a property in a device node and valid the requested size. |
| 98 | * Returns the property value on success, -EINVAL if the property does not | 100 | * |
| 99 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | 101 | * Return: The property value on success, -EINVAL if the property does not |
| 102 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
| 100 | * property data is too small or too large. | 103 | * property data is too small or too large. |
| 101 | * | 104 | * |
| 102 | */ | 105 | */ |
| @@ -129,7 +132,9 @@ static void *of_find_property_value_of_size(const struct device_node *np, · 26 unmodified lines | |||
| 129 | * @out_value: pointer to return value, modified only if no error. | 132 | * @out_value: pointer to return value, modified only if no error. |
| 130 | * | 133 | * |
| 131 | * Search for a property in a device node and read nth 32-bit value from | 134 | * Search for a property in a device node and read nth 32-bit value from |
| 132 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 135 | * it. |
| 136 | * | ||
| 137 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 133 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 138 | * -ENODATA if property does not have a value, and -EOVERFLOW if the |
| 134 | * property data isn't large enough. | 139 | * property data isn't large enough. |
| 135 | * | 140 | * |
| @@ -161,7 +166,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_index); · 25 unmodified lines | |||
| 161 | * @out_value: pointer to return value, modified only if no error. | 166 | * @out_value: pointer to return value, modified only if no error. |
| 162 | * | 167 | * |
| 163 | * Search for a property in a device node and read nth 64-bit value from | 168 | * Search for a property in a device node and read nth 64-bit value from |
| 164 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 169 | * it. |
| 170 | * | ||
| 171 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 165 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 172 | * -ENODATA if property does not have a value, and -EOVERFLOW if the |
| 166 | * property data isn't large enough. | 173 | * property data isn't large enough. |
| 167 | * | 174 | * |
| @@ -196,12 +203,14 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_index); · 28 unmodified lines | |||
| 196 | * sz_min will be read. | 203 | * sz_min will be read. |
| 197 | * | 204 | * |
| 198 | * Search for a property in a device node and read 8-bit value(s) from | 205 | * Search for a property in a device node and read 8-bit value(s) from |
| 199 | * it. Returns number of elements read on success, -EINVAL if the property | 206 | * it. |
| 200 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | ||
| 201 | * if the property data is smaller than sz_min or longer than sz_max. | ||
| 202 | * | 207 | * |
| 203 | * dts entry of array should be like: | 208 | * dts entry of array should be like: |
| 204 | * property = /bits/ 8 <0x50 0x60 0x70>; | 209 | * ``property = /bits/ 8 <0x50 0x60 0x70>;`` |
| 210 | * | ||
| 211 | * Return: The number of elements read on success, -EINVAL if the property | ||
| 212 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | ||
| 213 | * if the property data is smaller than sz_min or longer than sz_max. | ||
| 205 | * | 214 | * |
| 206 | * The out_values is modified only if a valid u8 value can be decoded. | 215 | * The out_values is modified only if a valid u8 value can be decoded. |
| 207 | */ | 216 | */ |
| @@ -244,12 +253,14 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u8_array); · 36 unmodified lines | |||
| 244 | * sz_min will be read. | 253 | * sz_min will be read. |
| 245 | * | 254 | * |
| 246 | * Search for a property in a device node and read 16-bit value(s) from | 255 | * Search for a property in a device node and read 16-bit value(s) from |
| 247 | * it. Returns number of elements read on success, -EINVAL if the property | 256 | * it. |
| 248 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | ||
| 249 | * if the property data is smaller than sz_min or longer than sz_max. | ||
| 250 | * | 257 | * |
| 251 | * dts entry of array should be like: | 258 | * dts entry of array should be like: |
| 252 | * property = /bits/ 16 <0x5000 0x6000 0x7000>; | 259 | * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` |
| 260 | * | ||
| 261 | * Return: The number of elements read on success, -EINVAL if the property | ||
| 262 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | ||
| 263 | * if the property data is smaller than sz_min or longer than sz_max. | ||
| 253 | * | 264 | * |
| 254 | * The out_values is modified only if a valid u16 value can be decoded. | 265 | * The out_values is modified only if a valid u16 value can be decoded. |
| 255 | */ | 266 | */ |
| @@ -292,7 +303,9 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u16_array); · 36 unmodified lines | |||
| 292 | * sz_min will be read. | 303 | * sz_min will be read. |
| 293 | * | 304 | * |
| 294 | * Search for a property in a device node and read 32-bit value(s) from | 305 | * Search for a property in a device node and read 32-bit value(s) from |
| 295 | * it. Returns number of elements read on success, -EINVAL if the property | 306 | * it. |
| 307 | * | ||
| 308 | * Return: The number of elements read on success, -EINVAL if the property | ||
| 296 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | 309 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
| 297 | * if the property data is smaller than sz_min or longer than sz_max. | 310 | * if the property data is smaller than sz_min or longer than sz_max. |
| 298 | * | 311 | * |
| @@ -331,7 +344,9 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u32_array); · 32 unmodified lines | |||
| 331 | * @out_value: pointer to return value, modified only if return value is 0. | 344 | * @out_value: pointer to return value, modified only if return value is 0. |
| 332 | * | 345 | * |
| 333 | * Search for a property in a device node and read a 64-bit value from | 346 | * Search for a property in a device node and read a 64-bit value from |
| 334 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 347 | * it. |
| 348 | * | ||
| 349 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 335 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 350 | * -ENODATA if property does not have a value, and -EOVERFLOW if the |
| 336 | * property data isn't large enough. | 351 | * property data isn't large enough. |
| 337 | * | 352 | * |
| @@ -366,7 +381,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u64); · 28 unmodified lines | |||
| 366 | * sz_min will be read. | 381 | * sz_min will be read. |
| 367 | * | 382 | * |
| 368 | * Search for a property in a device node and read 64-bit value(s) from | 383 | * Search for a property in a device node and read 64-bit value(s) from |
| 369 | * it. Returns number of elements read on success, -EINVAL if the property | 384 | * it. |
| 385 | * | ||
| 386 | * Return: The number of elements read on success, -EINVAL if the property | ||
| 370 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW | 387 | * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW |
| 371 | * if the property data is smaller than sz_min or longer than sz_max. | 388 | * if the property data is smaller than sz_min or longer than sz_max. |
| 372 | * | 389 | * |
| @@ -408,10 +425,11 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u64_array); · 35 unmodified lines | |||
| 408 | * return value is 0. | 425 | * return value is 0. |
| 409 | * | 426 | * |
| 410 | * Search for a property in a device tree node and retrieve a null | 427 | * Search for a property in a device tree node and retrieve a null |
| 411 | * terminated string value (pointer to data, not a copy). Returns 0 on | 428 | * terminated string value (pointer to data, not a copy). |
| 412 | * success, -EINVAL if the property does not exist, -ENODATA if property | 429 | * |
| 413 | * does not have a value, and -EILSEQ if the string is not null-terminated | 430 | * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if |
| 414 | * within the length of the property data. | 431 | * property does not have a value, and -EILSEQ if the string is not |
| 432 | * null-terminated within the length of the property data. | ||
| 415 | * | 433 | * |
| 416 | * The out_string pointer is modified only if a valid string can be decoded. | 434 | * The out_string pointer is modified only if a valid string can be decoded. |
| 417 | */ | 435 | */ |
| @@ -775,7 +793,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port_parent); · 357 unmodified lines | |||
| 775 | * @node: pointer to a local endpoint device_node | 793 | * @node: pointer to a local endpoint device_node |
| 776 | * | 794 | * |
| 777 | * Return: Remote port node associated with remote endpoint node linked | 795 | * Return: Remote port node associated with remote endpoint node linked |
| 778 | * to @node. Use of_node_put() on it when done. | 796 | * to @node. Use of_node_put() on it when done. |
| 779 | */ | 797 | */ |
| 780 | struct device_node *of_graph_get_remote_port(const struct device_node *node) | 798 | struct device_node *of_graph_get_remote_port(const struct device_node *node) |
| 781 | { | 799 | { |
| @@ -808,7 +826,7 @@ EXPORT_SYMBOL(of_graph_get_endpoint_count); · 26 unmodified lines | |||
| 808 | * @endpoint: identifier (value of reg property) of the endpoint node | 826 | * @endpoint: identifier (value of reg property) of the endpoint node |
| 809 | * | 827 | * |
| 810 | * Return: Remote device node associated with remote endpoint node linked | 828 | * Return: Remote device node associated with remote endpoint node linked |
| 811 | * to @node. Use of_node_put() on it when done. | 829 | * to @node. Use of_node_put() on it when done. |
| 812 | */ | 830 | */ |
| 813 | struct device_node *of_graph_get_remote_node(const struct device_node *node, | 831 | struct device_node *of_graph_get_remote_node(const struct device_node *node, |
| 814 | u32 port, u32 endpoint) | 832 | u32 port, u32 endpoint) |
| @@ -1230,7 +1248,7 @@ static struct device_node *parse_##fname(struct device_node *np, \ · 415 unmodified lines | |||
| 1230 | * @parse_prop.prop_name: Name of property holding a phandle value | 1248 | * @parse_prop.prop_name: Name of property holding a phandle value |
| 1231 | * @parse_prop.index: For properties holding a list of phandles, this is the | 1249 | * @parse_prop.index: For properties holding a list of phandles, this is the |
| 1232 | * index into the list | 1250 | * index into the list |
| 1233 | * @optional: The property can be an optional dependency. | 1251 | * @optional: Describes whether a supplier is mandatory or not |
| 1234 | * @node_not_dev: The consumer node containing the property is never a device. | 1252 | * @node_not_dev: The consumer node containing the property is never a device. |
| 1235 | * | 1253 | * |
| 1236 | * Returns: | 1254 | * Returns: |
| @@ -1363,7 +1381,6 @@ static const struct supplier_bindings of_supplier_bindings[] = { · 126 unmodified lines | |||
| 1363 | 1381 | ||
| 1364 | /** | 1382 | /** |
| 1365 | * of_link_property - Create device links to suppliers listed in a property | 1383 | * of_link_property - Create device links to suppliers listed in a property |
| 1366 | * @dev: Consumer device | ||
| 1367 | * @con_np: The consumer device tree node which contains the property | 1384 | * @con_np: The consumer device tree node which contains the property |
| 1368 | * @prop_name: Name of property to be parsed | 1385 | * @prop_name: Name of property to be parsed |
| 1369 | * | 1386 | * |
| @@ -1387,7 +1404,6 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) · 17 unmodified lines | |||
| 1387 | const struct supplier_bindings *s = of_supplier_bindings; | 1404 | const struct supplier_bindings *s = of_supplier_bindings; |
| 1388 | unsigned int i = 0; | 1405 | unsigned int i = 0; |
| 1389 | bool matched = false; | 1406 | bool matched = false; |
| 1390 | int ret = 0; | ||
| 1391 | 1407 | ||
| 1392 | /* Do not stop at first failed link, link all available suppliers. */ | 1408 | /* Do not stop at first failed link, link all available suppliers. */ |
| 1393 | while (!matched && s->parse_prop) { | 1409 | while (!matched && s->parse_prop) { |
| @@ -1410,7 +1426,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) · 16 unmodified lines | |||
| 1410 | } | 1426 | } |
| 1411 | s++; | 1427 | s++; |
| 1412 | } | 1428 | } |
| 1413 | return ret; | 1429 | return 0; |
| 1414 | } | 1430 | } |
| 1415 | 1431 | ||
| 1416 | static int of_fwnode_add_links(struct fwnode_handle *fwnode) | 1432 | static int of_fwnode_add_links(struct fwnode_handle *fwnode) |
| @@ -38,3 +38,51 @@ DTC_FLAGS_testcases += -@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | # suppress warnings about intentional errors | 39 | # suppress warnings about intentional errors |
| 40 | DTC_FLAGS_testcases += -Wno-interrupts_property | 40 | DTC_FLAGS_testcases += -Wno-interrupts_property |
| 41 | |||
| 42 | # Apply overlays statically with fdtoverlay. This is a build time test that | ||
| 43 | # the overlays can be applied successfully by fdtoverlay. This does not | ||
| 44 | # guarantee that the overlays can be applied successfully at run time by | ||
| 45 | # unittest, but it provides a bit of build time test coverage for those | ||
| 46 | # who do not execute unittest. | ||
| 47 | # | ||
| 48 | # The overlays are applied on top of static_base_1.dtb and static_base_2.dtb to | ||
| 49 | # create static_test_1.dtb and static_test_2.dtb. If fdtoverlay detects an | ||
| 50 | # error than the kernel build will fail. static_test_1.dtb and | ||
| 51 | # static_test_2.dtb are not consumed by unittest. | ||
| 52 | # | ||
| 53 | # Some unittest overlays deliberately contain errors that unittest checks for. | ||
| 54 | # These overlays will cause fdtoverlay to fail, and are thus not included | ||
| 55 | # in the static test: | ||
| 56 | # overlay_bad_add_dup_node.dtbo \ | ||
| 57 | # overlay_bad_add_dup_prop.dtbo \ | ||
| 58 | # overlay_bad_phandle.dtbo \ | ||
| 59 | # overlay_bad_symbol.dtbo \ | ||
| 60 | |||
| 61 | apply_static_overlay_1 := overlay_0.dtbo \ | ||
| 62 | overlay_1.dtbo \ | ||
| 63 | overlay_2.dtbo \ | ||
| 64 | overlay_3.dtbo \ | ||
| 65 | overlay_4.dtbo \ | ||
| 66 | overlay_5.dtbo \ | ||
| 67 | overlay_6.dtbo \ | ||
| 68 | overlay_7.dtbo \ | ||
| 69 | overlay_8.dtbo \ | ||
| 70 | overlay_9.dtbo \ | ||
| 71 | overlay_10.dtbo \ | ||
| 72 | overlay_11.dtbo \ | ||
| 73 | overlay_12.dtbo \ | ||
| 74 | overlay_13.dtbo \ | ||
| 75 | overlay_15.dtbo \ | ||
| 76 | overlay_gpio_01.dtbo \ | ||
| 77 | overlay_gpio_02a.dtbo \ | ||
| 78 | overlay_gpio_02b.dtbo \ | ||
| 79 | overlay_gpio_03.dtbo \ | ||
| 80 | overlay_gpio_04a.dtbo \ | ||
| 81 | overlay_gpio_04b.dtbo | ||
| 82 | |||
| 83 | apply_static_overlay_2 := overlay.dtbo | ||
| 84 | |||
| 85 | static_test_1-dtbs := static_base_1.dtb $(apply_static_overlay_1) | ||
| 86 | static_test_2-dtbs := static_base_2.dtb $(apply_static_overlay_2) | ||
| 87 | |||
| 88 | dtb-$(CONFIG_OF_OVERLAY) += static_test_1.dtb static_test_2.dtb | ||
| @@ -2,92 +2,4 @@ · 1 unmodified line | |||
| 2 | /dts-v1/; | 2 | /dts-v1/; |
| 3 | /plugin/; | 3 | /plugin/; |
| 4 | 4 | ||
| 5 | /* | 5 | #include "overlay_common.dtsi" |
| 6 | * Base device tree that overlays will be applied against. | ||
| 7 | * | ||
| 8 | * Do not add any properties in node "/". | ||
| 9 | * Do not add any nodes other than "/testcase-data-2" in node "/". | ||
| 10 | * Do not add anything that would result in dtc creating node "/__fixups__". | ||
| 11 | * dtc will create nodes "/__symbols__" and "/__local_fixups__". | ||
| 12 | */ | ||
| 13 | |||
| 14 | / { | ||
| 15 | testcase-data-2 { | ||
| 16 | #address-cells = <1>; | ||
| 17 | #size-cells = <1>; | ||
| 18 | |||
| 19 | electric_1: substation@100 { | ||
| 20 | compatible = "ot,big-volts-control"; | ||
| 21 | reg = < 0x00000100 0x100 >; | ||
| 22 | status = "disabled"; | ||
| 23 | |||
| 24 | hvac_1: hvac-medium-1 { | ||
| 25 | compatible = "ot,hvac-medium"; | ||
| 26 | heat-range = < 50 75 >; | ||
| 27 | cool-range = < 60 80 >; | ||
| 28 | }; | ||
| 29 | |||
| 30 | spin_ctrl_1: motor-1 { | ||
| 31 | compatible = "ot,ferris-wheel-motor"; | ||
| 32 | spin = "clockwise"; | ||
| 33 | rpm_avail = < 50 >; | ||
| 34 | }; | ||
| 35 | |||
| 36 | spin_ctrl_2: motor-8 { | ||
| 37 | compatible = "ot,roller-coaster-motor"; | ||
| 38 | }; | ||
| 39 | }; | ||
| 40 | |||
| 41 | rides_1: fairway-1 { | ||
| 42 | #address-cells = <1>; | ||
| 43 | #size-cells = <1>; | ||
| 44 | compatible = "ot,rides"; | ||
| 45 | status = "disabled"; | ||
| 46 | orientation = < 127 >; | ||
| 47 | |||
| 48 | ride@100 { | ||
| 49 | #address-cells = <1>; | ||
| 50 | #size-cells = <1>; | ||
| 51 | compatible = "ot,roller-coaster"; | ||
| 52 | reg = < 0x00000100 0x100 >; | ||
| 53 | hvac-provider = < &hvac_1 >; | ||
| 54 | hvac-thermostat = < 29 > ; | ||
| 55 | hvac-zones = < 14 >; | ||
| 56 | hvac-zone-names = "operator"; | ||
| 57 | spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >; | ||
| 58 | spin-controller-names = "track_1", "track_2"; | ||
| 59 | queues = < 2 >; | ||
| 60 | |||
| 61 | track@30 { | ||
| 62 | reg = < 0x00000030 0x10 >; | ||
| 63 | }; | ||
| 64 | |||
| 65 | track@40 { | ||
| 66 | reg = < 0x00000040 0x10 >; | ||
| 67 | }; | ||
| 68 | |||
| 69 | }; | ||
| 70 | }; | ||
| 71 | |||
| 72 | lights_1: lights@30000 { | ||
| 73 | compatible = "ot,work-lights"; | ||
| 74 | reg = < 0x00030000 0x1000 >; | ||
| 75 | status = "disabled"; | ||
| 76 | }; | ||
| 77 | |||
| 78 | lights_2: lights@40000 { | ||
| 79 | compatible = "ot,show-lights"; | ||
| 80 | reg = < 0x00040000 0x1000 >; | ||
| 81 | status = "disabled"; | ||
| 82 | rate = < 13 138 >; | ||
| 83 | }; | ||
| 84 | |||
| 85 | retail_1: vending@50000 { | ||
| 86 | reg = < 0x00050000 0x1000 >; | ||
| 87 | compatible = "ot,tickets"; | ||
| 88 | status = "disabled"; | ||
| 89 | }; | ||
| 90 | |||
| 91 | }; | ||
| 92 | }; | ||
| 93 | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Base device tree that overlays will be applied against. | ||
| 5 | * | ||
| 6 | * Do not add any properties in node "/". | ||
| 7 | * Do not add any nodes other than "/testcase-data-2" in node "/". | ||
| 8 | * Do not add anything that would result in dtc creating node "/__fixups__". | ||
| 9 | * dtc will create nodes "/__symbols__" and "/__local_fixups__". | ||
| 10 | */ | ||
| 11 | |||
| 12 | / { | ||
| 13 | testcase-data-2 { | ||
| 14 | #address-cells = <1>; | ||
| 15 | #size-cells = <1>; | ||
| 16 | |||
| 17 | electric_1: substation@100 { | ||
| 18 | compatible = "ot,big-volts-control"; | ||
| 19 | reg = < 0x00000100 0x100 >; | ||
| 20 | status = "disabled"; | ||
| 21 | |||
| 22 | hvac_1: hvac-medium-1 { | ||
| 23 | compatible = "ot,hvac-medium"; | ||
| 24 | heat-range = < 50 75 >; | ||
| 25 | cool-range = < 60 80 >; | ||
| 26 | }; | ||
| 27 | |||
| 28 | spin_ctrl_1: motor-1 { | ||
| 29 | compatible = "ot,ferris-wheel-motor"; | ||
| 30 | spin = "clockwise"; | ||
| 31 | rpm_avail = < 50 >; | ||
| 32 | }; | ||
| 33 | |||
| 34 | spin_ctrl_2: motor-8 { | ||
| 35 | compatible = "ot,roller-coaster-motor"; | ||
| 36 | }; | ||
| 37 | }; | ||
| 38 | |||
| 39 | rides_1: fairway-1 { | ||
| 40 | #address-cells = <1>; | ||
| 41 | #size-cells = <1>; | ||
| 42 | compatible = "ot,rides"; | ||
| 43 | status = "disabled"; | ||
| 44 | orientation = < 127 >; | ||
| 45 | |||
| 46 | ride@100 { | ||
| 47 | #address-cells = <1>; | ||
| 48 | #size-cells = <1>; | ||
| 49 | compatible = "ot,roller-coaster"; | ||
| 50 | reg = < 0x00000100 0x100 >; | ||
| 51 | hvac-provider = < &hvac_1 >; | ||
| 52 | hvac-thermostat = < 29 > ; | ||
| 53 | hvac-zones = < 14 >; | ||
| 54 | hvac-zone-names = "operator"; | ||
| 55 | spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >; | ||
| 56 | spin-controller-names = "track_1", "track_2"; | ||
| 57 | queues = < 2 >; | ||
| 58 | |||
| 59 | track@30 { | ||
| 60 | reg = < 0x00000030 0x10 >; | ||
| 61 | }; | ||
| 62 | |||
| 63 | track@40 { | ||
| 64 | reg = < 0x00000040 0x10 >; | ||
| 65 | }; | ||
| 66 | |||
| 67 | }; | ||
| 68 | }; | ||
| 69 | |||
| 70 | lights_1: lights@30000 { | ||
| 71 | compatible = "ot,work-lights"; | ||
| 72 | reg = < 0x00030000 0x1000 >; | ||
| 73 | status = "disabled"; | ||
| 74 | }; | ||
| 75 | |||
| 76 | lights_2: lights@40000 { | ||
| 77 | compatible = "ot,show-lights"; | ||
| 78 | reg = < 0x00040000 0x1000 >; | ||
| 79 | status = "disabled"; | ||
| 80 | rate = < 13 138 >; | ||
| 81 | }; | ||
| 82 | |||
| 83 | retail_1: vending@50000 { | ||
| 84 | reg = < 0x00050000 0x1000 >; | ||
| 85 | compatible = "ot,tickets"; | ||
| 86 | status = "disabled"; | ||
| 87 | }; | ||
| 88 | |||
| 89 | }; | ||
| 90 | }; | ||
| 91 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /dts-v1/; | ||
| 3 | |||
| 4 | #include "testcases_common.dtsi" | ||
| @@ -0,0 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /dts-v1/; | ||
| 3 | |||
| 4 | #include "overlay_common.dtsi" | ||
| @@ -2,19 +2,20 @@ · 1 unmodified line | |||
| 2 | /dts-v1/; | 2 | /dts-v1/; |
| 3 | /plugin/; | 3 | /plugin/; |
| 4 | 4 | ||
| 5 | #include "testcases_common.dtsi" | ||
| 6 | |||
| 5 | / { | 7 | / { |
| 8 | /* | ||
| 9 | * testcase data that intentionally results in an error is located here | ||
| 10 | * instead of in testcases_common.dtsi so that the static overlay apply | ||
| 11 | * tests will not include the error. | ||
| 12 | */ | ||
| 6 | testcase-data { | 13 | testcase-data { |
| 7 | changeset { | 14 | testcase-device2 { |
| 8 | prop-update = "hello"; | 15 | compatible = "testcase-device"; |
| 9 | prop-remove = "world"; | 16 | interrupt-parent = <&test_intc2>; |
| 10 | node-remove { | 17 | interrupts = <1>; /* invalid specifier - too short */ |
| 11 | }; | ||
| 12 | }; | 18 | }; |
| 13 | }; | 19 | }; |
| 20 | |||
| 14 | }; | 21 | }; |
| 15 | #include "tests-phandle.dtsi" | ||
| 16 | #include "tests-interrupts.dtsi" | ||
| 17 | #include "tests-match.dtsi" | ||
| 18 | #include "tests-address.dtsi" | ||
| 19 | #include "tests-platform.dtsi" | ||
| 20 | #include "tests-overlay.dtsi" | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | / { | ||
| 4 | testcase-data { | ||
| 5 | changeset { | ||
| 6 | prop-update = "hello"; | ||
| 7 | prop-remove = "world"; | ||
| 8 | node-remove { | ||
| 9 | }; | ||
| 10 | }; | ||
| 11 | }; | ||
| 12 | }; | ||
| 13 | |||
| 14 | #include "tests-phandle.dtsi" | ||
| 15 | #include "tests-interrupts.dtsi" | ||
| 16 | #include "tests-match.dtsi" | ||
| 17 | #include "tests-address.dtsi" | ||
| 18 | #include "tests-platform.dtsi" | ||
| 19 | #include "tests-overlay.dtsi" | ||
| @@ -62,11 +62,10 @@ · 61 unmodified lines | |||
| 62 | interrupts = <1>; | 62 | interrupts = <1>; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | testcase-device2 { | 65 | /* |
| 66 | compatible = "testcase-device"; | 66 | * testcase data that intentionally results in an error is |
| 67 | interrupt-parent = <&test_intc2>; | 67 | * located in testcases.dts instead of in this file so that the |
| 68 | interrupts = <1>; /* invalid specifier - too short */ | 68 | * static overlay apply tests will not include the error. |
| 69 | }; | 69 | */ |
| 70 | }; | 70 | }; |
| 71 | |||
| 72 | }; | 71 | }; |
| @@ -304,7 +304,15 @@ struct kimage { · 303 unmodified lines | |||
| 304 | #ifdef CONFIG_IMA_KEXEC | 304 | #ifdef CONFIG_IMA_KEXEC |
| 305 | /* Virtual address of IMA measurement buffer for kexec syscall */ | 305 | /* Virtual address of IMA measurement buffer for kexec syscall */ |
| 306 | void *ima_buffer; | 306 | void *ima_buffer; |
| 307 | |||
| 308 | phys_addr_t ima_buffer_addr; | ||
| 309 | size_t ima_buffer_size; | ||
| 307 | #endif | 310 | #endif |
| 311 | |||
| 312 | /* Core ELF header buffer */ | ||
| 313 | void *elf_headers; | ||
| 314 | unsigned long elf_headers_sz; | ||
| 315 | unsigned long elf_load_addr; | ||
| 308 | }; | 316 | }; |
| 309 | 317 | ||
| 310 | /* kexec interface functions */ | 318 | /* kexec interface functions */ |
| @@ -424,12 +424,14 @@ extern int of_detach_node(struct device_node *); · 423 unmodified lines | |||
| 424 | * @sz: number of array elements to read | 424 | * @sz: number of array elements to read |
| 425 | * | 425 | * |
| 426 | * Search for a property in a device node and read 8-bit value(s) from | 426 | * Search for a property in a device node and read 8-bit value(s) from |
| 427 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 427 | * it. |
| 428 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
| 429 | * property data isn't large enough. | ||
| 430 | * | 428 | * |
| 431 | * dts entry of array should be like: | 429 | * dts entry of array should be like: |
| 432 | * property = /bits/ 8 <0x50 0x60 0x70>; | 430 | * ``property = /bits/ 8 <0x50 0x60 0x70>;`` |
| 431 | * | ||
| 432 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 433 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
| 434 | * property data isn't large enough. | ||
| 433 | * | 435 | * |
| 434 | * The out_values is modified only if a valid u8 value can be decoded. | 436 | * The out_values is modified only if a valid u8 value can be decoded. |
| 435 | */ | 437 | */ |
| @@ -454,12 +456,14 @@ static inline int of_property_read_u8_array(const struct device_node *np, · 18 unmodified lines | |||
| 454 | * @sz: number of array elements to read | 456 | * @sz: number of array elements to read |
| 455 | * | 457 | * |
| 456 | * Search for a property in a device node and read 16-bit value(s) from | 458 | * Search for a property in a device node and read 16-bit value(s) from |
| 457 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 459 | * it. |
| 458 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
| 459 | * property data isn't large enough. | ||
| 460 | * | 460 | * |
| 461 | * dts entry of array should be like: | 461 | * dts entry of array should be like: |
| 462 | * property = /bits/ 16 <0x5000 0x6000 0x7000>; | 462 | * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` |
| 463 | * | ||
| 464 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 465 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
| 466 | * property data isn't large enough. | ||
| 463 | * | 467 | * |
| 464 | * The out_values is modified only if a valid u16 value can be decoded. | 468 | * The out_values is modified only if a valid u16 value can be decoded. |
| 465 | */ | 469 | */ |
| @@ -485,7 +489,9 @@ static inline int of_property_read_u16_array(const struct device_node *np, · 19 unmodified lines | |||
| 485 | * @sz: number of array elements to read | 489 | * @sz: number of array elements to read |
| 486 | * | 490 | * |
| 487 | * Search for a property in a device node and read 32-bit value(s) from | 491 | * Search for a property in a device node and read 32-bit value(s) from |
| 488 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 492 | * it. |
| 493 | * | ||
| 494 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 489 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 495 | * -ENODATA if property does not have a value, and -EOVERFLOW if the |
| 490 | * property data isn't large enough. | 496 | * property data isn't large enough. |
| 491 | * | 497 | * |
| @@ -513,7 +519,9 @@ static inline int of_property_read_u32_array(const struct device_node *np, · 21 unmodified lines | |||
| 513 | * @sz: number of array elements to read | 519 | * @sz: number of array elements to read |
| 514 | * | 520 | * |
| 515 | * Search for a property in a device node and read 64-bit value(s) from | 521 | * Search for a property in a device node and read 64-bit value(s) from |
| 516 | * it. Returns 0 on success, -EINVAL if the property does not exist, | 522 | * it. |
| 523 | * | ||
| 524 | * Return: 0 on success, -EINVAL if the property does not exist, | ||
| 517 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | 525 | * -ENODATA if property does not have a value, and -EOVERFLOW if the |
| 518 | * property data isn't large enough. | 526 | * property data isn't large enough. |
| 519 | * | 527 | * |
| @@ -560,6 +568,13 @@ int of_map_id(struct device_node *np, u32 id, · 40 unmodified lines | |||
| 560 | 568 | ||
| 561 | phys_addr_t of_dma_get_max_cpu_address(struct device_node *np); | 569 | phys_addr_t of_dma_get_max_cpu_address(struct device_node *np); |
| 562 | 570 | ||
| 571 | struct kimage; | ||
| 572 | void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, | ||
| 573 | unsigned long initrd_load_addr, | ||
| 574 | unsigned long initrd_len, | ||
| 575 | const char *cmdline, size_t extra_fdt_size); | ||
| 576 | int ima_get_kexec_buffer(void **addr, size_t *size); | ||
| 577 | int ima_free_kexec_buffer(void); | ||
| 563 | #else /* CONFIG_OF */ | 578 | #else /* CONFIG_OF */ |
| 564 | 579 | ||
| 565 | static inline void of_core_init(void) | 580 | static inline void of_core_init(void) |
| @@ -1063,7 +1078,9 @@ static inline bool of_node_is_type(const struct device_node *np, const char *typ · 497 unmodified lines | |||
| 1063 | * @propname: name of the property to be searched. | 1078 | * @propname: name of the property to be searched. |
| 1064 | * | 1079 | * |
| 1065 | * Search for a property in a device node and count the number of u8 elements | 1080 | * Search for a property in a device node and count the number of u8 elements |
| 1066 | * in it. Returns number of elements on sucess, -EINVAL if the property does | 1081 | * in it. |
| 1082 | * | ||
| 1083 | * Return: The number of elements on sucess, -EINVAL if the property does | ||
| 1067 | * not exist or its length does not match a multiple of u8 and -ENODATA if the | 1084 | * not exist or its length does not match a multiple of u8 and -ENODATA if the |
| 1068 | * property does not have a value. | 1085 | * property does not have a value. |
| 1069 | */ | 1086 | */ |
| @@ -1080,7 +1097,9 @@ static inline int of_property_count_u8_elems(const struct device_node *np, · 10 unmodified lines | |||
| 1080 | * @propname: name of the property to be searched. | 1097 | * @propname: name of the property to be searched. |
| 1081 | * | 1098 | * |
| 1082 | * Search for a property in a device node and count the number of u16 elements | 1099 | * Search for a property in a device node and count the number of u16 elements |
| 1083 | * in it. Returns number of elements on sucess, -EINVAL if the property does | 1100 | * in it. |
| 1101 | * | ||
| 1102 | * Return: The number of elements on sucess, -EINVAL if the property does | ||
| 1084 | * not exist or its length does not match a multiple of u16 and -ENODATA if the | 1103 | * not exist or its length does not match a multiple of u16 and -ENODATA if the |
| 1085 | * property does not have a value. | 1104 | * property does not have a value. |
| 1086 | */ | 1105 | */ |
| @@ -1097,7 +1116,9 @@ static inline int of_property_count_u16_elems(const struct device_node *np, · 10 unmodified lines | |||
| 1097 | * @propname: name of the property to be searched. | 1116 | * @propname: name of the property to be searched. |
| 1098 | * | 1117 | * |
| 1099 | * Search for a property in a device node and count the number of u32 elements | 1118 | * Search for a property in a device node and count the number of u32 elements |
| 1100 | * in it. Returns number of elements on sucess, -EINVAL if the property does | 1119 | * in it. |
| 1120 | * | ||
| 1121 | * Return: The number of elements on sucess, -EINVAL if the property does | ||
| 1101 | * not exist or its length does not match a multiple of u32 and -ENODATA if the | 1122 | * not exist or its length does not match a multiple of u32 and -ENODATA if the |
| 1102 | * property does not have a value. | 1123 | * property does not have a value. |
| 1103 | */ | 1124 | */ |
| @@ -1114,7 +1135,9 @@ static inline int of_property_count_u32_elems(const struct device_node *np, · 10 unmodified lines | |||
| 1114 | * @propname: name of the property to be searched. | 1135 | * @propname: name of the property to be searched. |
| 1115 | * | 1136 | * |
| 1116 | * Search for a property in a device node and count the number of u64 elements | 1137 | * Search for a property in a device node and count the number of u64 elements |
| 1117 | * in it. Returns number of elements on sucess, -EINVAL if the property does | 1138 | * in it. |
| 1139 | * | ||
| 1140 | * Return: The number of elements on sucess, -EINVAL if the property does | ||
| 1118 | * not exist or its length does not match a multiple of u64 and -ENODATA if the | 1141 | * not exist or its length does not match a multiple of u64 and -ENODATA if the |
| 1119 | * property does not have a value. | 1142 | * property does not have a value. |
| 1120 | */ | 1143 | */ |
| @@ -1135,7 +1158,7 @@ static inline int of_property_count_u64_elems(const struct device_node *np, · 14 unmodified lines | |||
| 1135 | * Search for a property in a device tree node and retrieve a list of | 1158 | * Search for a property in a device tree node and retrieve a list of |
| 1136 | * terminated string values (pointer to data, not a copy) in that property. | 1159 | * terminated string values (pointer to data, not a copy) in that property. |
| 1137 | * | 1160 | * |
| 1138 | * If @out_strs is NULL, the number of strings in the property is returned. | 1161 | * Return: If @out_strs is NULL, the number of strings in the property is returned. |
| 1139 | */ | 1162 | */ |
| 1140 | static inline int of_property_read_string_array(const struct device_node *np, | 1163 | static inline int of_property_read_string_array(const struct device_node *np, |
| 1141 | const char *propname, const char **out_strs, | 1164 | const char *propname, const char **out_strs, |
| @@ -1151,10 +1174,11 @@ static inline int of_property_read_string_array(const struct device_node *np, · 9 unmodified lines | |||
| 1151 | * @propname: name of the property to be searched. | 1174 | * @propname: name of the property to be searched. |
| 1152 | * | 1175 | * |
| 1153 | * Search for a property in a device tree node and retrieve the number of null | 1176 | * Search for a property in a device tree node and retrieve the number of null |
| 1154 | * terminated string contain in it. Returns the number of strings on | 1177 | * terminated string contain in it. |
| 1155 | * success, -EINVAL if the property does not exist, -ENODATA if property | 1178 | * |
| 1156 | * does not have a value, and -EILSEQ if the string is not null-terminated | 1179 | * Return: The number of strings on success, -EINVAL if the property does not |
| 1157 | * within the length of the property data. | 1180 | * exist, -ENODATA if property does not have a value, and -EILSEQ if the string |
| 1181 | * is not null-terminated within the length of the property data. | ||
| 1158 | */ | 1182 | */ |
| 1159 | static inline int of_property_count_strings(const struct device_node *np, | 1183 | static inline int of_property_count_strings(const struct device_node *np, |
| 1160 | const char *propname) | 1184 | const char *propname) |
| @@ -1168,13 +1192,14 @@ static inline int of_property_count_strings(const struct device_node *np, · 7 unmodified lines | |||
| 1168 | * @np: device node from which the property value is to be read. | 1192 | * @np: device node from which the property value is to be read. |
| 1169 | * @propname: name of the property to be searched. | 1193 | * @propname: name of the property to be searched. |
| 1170 | * @index: index of the string in the list of strings | 1194 | * @index: index of the string in the list of strings |
| 1171 | * @out_string: pointer to null terminated return string, modified only if | 1195 | * @output: pointer to null terminated return string, modified only if |
| 1172 | * return value is 0. | 1196 | * return value is 0. |
| 1173 | * | 1197 | * |
| 1174 | * Search for a property in a device tree node and retrieve a null | 1198 | * Search for a property in a device tree node and retrieve a null |
| 1175 | * terminated string value (pointer to data, not a copy) in the list of strings | 1199 | * terminated string value (pointer to data, not a copy) in the list of strings |
| 1176 | * contained in that property. | 1200 | * contained in that property. |
| 1177 | * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if | 1201 | * |
| 1202 | * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if | ||
| 1178 | * property does not have a value, and -EILSEQ if the string is not | 1203 | * property does not have a value, and -EILSEQ if the string is not |
| 1179 | * null-terminated within the length of the property data. | 1204 | * null-terminated within the length of the property data. |
| 1180 | * | 1205 | * |
| @@ -1194,7 +1219,8 @@ static inline int of_property_read_string_index(const struct device_node *np, · 13 unmodified lines | |||
| 1194 | * @propname: name of the property to be searched. | 1219 | * @propname: name of the property to be searched. |
| 1195 | * | 1220 | * |
| 1196 | * Search for a property in a device node. | 1221 | * Search for a property in a device node. |
| 1197 | * Returns true if the property exists false otherwise. | 1222 | * |
| 1223 | * Return: true if the property exists false otherwise. | ||
| 1198 | */ | 1224 | */ |
| 1199 | static inline bool of_property_read_bool(const struct device_node *np, | 1225 | static inline bool of_property_read_bool(const struct device_node *np, |
| 1200 | const char *propname) | 1226 | const char *propname) |
| @@ -1440,14 +1466,14 @@ static inline int of_reconfig_get_state_change(unsigned long action, · 239 unmodified lines | |||
| 1440 | * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node | 1466 | * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node |
| 1441 | * @np: Pointer to the given device_node | 1467 | * @np: Pointer to the given device_node |
| 1442 | * | 1468 | * |
| 1443 | * return true if present false otherwise | 1469 | * Return: true if present false otherwise |
| 1444 | */ | 1470 | */ |
| 1445 | static inline bool of_device_is_system_power_controller(const struct device_node *np) | 1471 | static inline bool of_device_is_system_power_controller(const struct device_node *np) |
| 1446 | { | 1472 | { |
| 1447 | return of_property_read_bool(np, "system-power-controller"); | 1473 | return of_property_read_bool(np, "system-power-controller"); |
| 1448 | } | 1474 | } |
| 1449 | 1475 | ||
| 1450 | /** | 1476 | /* |
| 1451 | * Overlay support | 1477 | * Overlay support |
| 1452 | */ | 1478 | */ |
| 1453 | 1479 | ||
| @@ -73,14 +73,26 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) · 72 unmodified lines | |||
| 73 | 73 | ||
| 74 | # DTB | 74 | # DTB |
| 75 | # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built | 75 | # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built |
| 76 | dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-) | ||
| 77 | |||
| 78 | # List all dtbs to be generated by fdtoverlay | ||
| 79 | overlay-y := $(foreach m,$(dtb-y), $(if $(strip $($(m:.dtb=-dtbs))),$(m),)) | ||
| 80 | |||
| 81 | # Generate symbols for the base files so overlays can be applied to them. | ||
| 82 | $(foreach m,$(overlay-y), $(eval DTC_FLAGS_$(basename $(firstword $($(m:.dtb=-dtbs)))) += -@)) | ||
| 83 | |||
| 84 | # Add base dtb and overlay dtbo | ||
| 85 | dtb-y += $(foreach m,$(overlay-y), $($(m:.dtb=-dtbs))) | ||
| 86 | |||
| 76 | always-y += $(dtb-y) | 87 | always-y += $(dtb-y) |
| 77 | always-$(CONFIG_OF_ALL_DTBS) += $(dtb-) | ||
| 78 | 88 | ||
| 79 | ifneq ($(CHECK_DTBS),) | 89 | ifneq ($(CHECK_DTBS),) |
| 80 | always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) | 90 | # Don't run schema checks for dtbs created by fdtoverlay as they don't |
| 81 | always-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y)) | 91 | # have corresponding dts files. |
| 82 | always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) | 92 | dt-yaml-y := $(filter-out $(overlay-y),$(dtb-y)) |
| 83 | always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-)) | 93 | |
| 94 | always-y += $(patsubst %.dtb,%.dt.yaml, $(dt-yaml-y)) | ||
| 95 | always-y += $(patsubst %.dtbo,%.dt.yaml, $(dt-yaml-y)) | ||
| 84 | endif | 96 | endif |
| 85 | 97 | ||
| 86 | # Add subdir path | 98 | # Add subdir path |
| @@ -338,13 +350,23 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE · 251 unmodified lines | |||
| 338 | $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE | 350 | $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE |
| 339 | $(call if_changed_dep,dtc) | 351 | $(call if_changed_dep,dtc) |
| 340 | 352 | ||
| 353 | overlay-y := $(addprefix $(obj)/, $(overlay-y)) | ||
| 354 | |||
| 355 | quiet_cmd_fdtoverlay = DTOVL $@ | ||
| 356 | cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) | ||
| 357 | |||
| 358 | $(overlay-y): FORCE | ||
| 359 | $(call if_changed,fdtoverlay) | ||
| 360 | $(call multi_depend, $(overlay-y), .dtb, -dtbs) | ||
| 361 | |||
| 341 | DT_CHECKER ?= dt-validate | 362 | DT_CHECKER ?= dt-validate |
| 363 | DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m) | ||
| 342 | DT_BINDING_DIR := Documentation/devicetree/bindings | 364 | DT_BINDING_DIR := Documentation/devicetree/bindings |
| 343 | # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile | 365 | # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile |
| 344 | DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.json | 366 | DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.json |
| 345 | 367 | ||
| 346 | quiet_cmd_dtb_check = CHECK $@ | 368 | quiet_cmd_dtb_check = CHECK $@ |
| 347 | cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ | 369 | cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ |
| 348 | 370 | ||
| 349 | define rule_dtc | 371 | define rule_dtc |
| 350 | $(call cmd_and_fixdep,dtc) | 372 | $(call cmd_and_fixdep,dtc) |
| @@ -3245,7 +3245,7 @@ sub process { · 3244 unmodified lines | |||
| 3245 | ($line =~ /^new file mode\s*\d+\s*$/) && | 3245 | ($line =~ /^new file mode\s*\d+\s*$/) && |
| 3246 | ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) { | 3246 | ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) { |
| 3247 | WARN("DT_SCHEMA_BINDING_PATCH", | 3247 | WARN("DT_SCHEMA_BINDING_PATCH", |
| 3248 | "DT bindings should be in DT schema format. See: Documentation/devicetree/writing-schema.rst\n"); | 3248 | "DT bindings should be in DT schema format. See: Documentation/devicetree/bindings/writing-schema.rst\n"); |
| 3249 | } | 3249 | } |
| 3250 | 3250 | ||
| 3251 | # Check for wrappage within a valid hunk of the file | 3251 | # Check for wrappage within a valid hunk of the file |
| @@ -24,10 +24,6 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include "../integrity.h" | 25 | #include "../integrity.h" |
| 26 | 26 | ||
| 27 | #ifdef CONFIG_HAVE_IMA_KEXEC | ||
| 28 | #include <asm/ima.h> | ||
| 29 | #endif | ||
| 30 | |||
| 31 | enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN, | 27 | enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN, |
| 32 | IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII }; | 28 | IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII }; |
| 33 | enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8, TPM_PCR10 = 10 }; | 29 | enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8, TPM_PCR10 = 10 }; |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/vmalloc.h> | 11 | #include <linux/vmalloc.h> |
| 12 | #include <linux/kexec.h> | 12 | #include <linux/kexec.h> |
| 13 | #include <linux/of.h> | ||
| 13 | #include "ima.h" | 14 | #include "ima.h" |
| 14 | 15 | ||
| 15 | #ifdef CONFIG_IMA_KEXEC | 16 | #ifdef CONFIG_IMA_KEXEC |
| @@ -123,12 +124,8 @@ void ima_add_kexec_buffer(struct kimage *image) · 107 unmodified lines | |||
| 123 | return; | 124 | return; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | ret = arch_ima_add_kexec_buffer(image, kbuf.mem, kexec_segment_size); | 127 | image->ima_buffer_addr = kbuf.mem; |
| 127 | if (ret) { | 128 | image->ima_buffer_size = kexec_segment_size; |
| 128 | pr_err("Error passing over kexec measurement buffer.\n"); | ||
| 129 | return; | ||
| 130 | } | ||
| 131 | |||
| 132 | image->ima_buffer = kexec_buffer; | 129 | image->ima_buffer = kexec_buffer; |
| 133 | 130 | ||
| 134 | pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n", | 131 | pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n", |