diff options
83 files changed, 2890 insertions, 3404 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 0ef00bd6e54d..86e3cd0d26a0 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -1136,6 +1136,21 @@ When kbuild executes, the following steps are followed (roughly): | |||
1136 | resulting in the target file being recompiled for no | 1136 | resulting in the target file being recompiled for no |
1137 | obvious reason. | 1137 | obvious reason. |
1138 | 1138 | ||
1139 | dtc | ||
1140 | Create flattend device tree blob object suitable for linking | ||
1141 | into vmlinux. Device tree blobs linked into vmlinux are placed | ||
1142 | in an init section in the image. Platform code *must* copy the | ||
1143 | blob to non-init memory prior to calling unflatten_device_tree(). | ||
1144 | |||
1145 | Example: | ||
1146 | #arch/x86/platform/ce4100/Makefile | ||
1147 | clean-files := *dtb.S | ||
1148 | |||
1149 | DTC_FLAGS := -p 1024 | ||
1150 | obj-y += foo.dtb.o | ||
1151 | |||
1152 | $(obj)/%.dtb: $(src)/%.dts | ||
1153 | $(call cmd,dtc) | ||
1139 | 1154 | ||
1140 | --- 6.7 Custom kbuild commands | 1155 | --- 6.7 Custom kbuild commands |
1141 | 1156 | ||
diff --git a/Documentation/powerpc/dts-bindings/eeprom.txt b/Documentation/powerpc/dts-bindings/eeprom.txt new file mode 100644 index 000000000000..4342c10de1bf --- /dev/null +++ b/Documentation/powerpc/dts-bindings/eeprom.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | EEPROMs (I2C) | ||
2 | |||
3 | Required properties: | ||
4 | |||
5 | - compatible : should be "<manufacturer>,<type>" | ||
6 | If there is no specific driver for <manufacturer>, a generic | ||
7 | driver based on <type> is selected. Possible types are: | ||
8 | 24c00, 24c01, 24c02, 24c04, 24c08, 24c16, 24c32, 24c64, | ||
9 | 24c128, 24c256, 24c512, 24c1024, spd | ||
10 | |||
11 | - reg : the I2C address of the EEPROM | ||
12 | |||
13 | Optional properties: | ||
14 | |||
15 | - pagesize : the length of the pagesize for writing. Please consult the | ||
16 | manual of your device, that value varies a lot. A wrong value | ||
17 | may result in data loss! If not specified, a safety value of | ||
18 | '1' is used which will be very slow. | ||
19 | |||
20 | - read-only: this parameterless property disables writes to the eeprom | ||
21 | |||
22 | Example: | ||
23 | |||
24 | eeprom@52 { | ||
25 | compatible = "atmel,24c32"; | ||
26 | reg = <0x52>; | ||
27 | pagesize = <32>; | ||
28 | }; | ||
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 387d5ffdfd3a..5f5018a71a3d 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -14,7 +14,7 @@ config MICROBLAZE | |||
14 | select HAVE_DMA_API_DEBUG | 14 | select HAVE_DMA_API_DEBUG |
15 | select TRACING_SUPPORT | 15 | select TRACING_SUPPORT |
16 | select OF | 16 | select OF |
17 | select OF_FLATTREE | 17 | select OF_EARLY_FLATTREE |
18 | 18 | ||
19 | config SWAP | 19 | config SWAP |
20 | def_bool n | 20 | def_bool n |
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile index be01d78750d9..4c4e58ef0cb6 100644 --- a/arch/microblaze/boot/Makefile +++ b/arch/microblaze/boot/Makefile | |||
@@ -10,9 +10,6 @@ targets := linux.bin linux.bin.gz simpleImage.% | |||
10 | 10 | ||
11 | OBJCOPYFLAGS := -O binary | 11 | OBJCOPYFLAGS := -O binary |
12 | 12 | ||
13 | # Where the DTS files live | ||
14 | dtstree := $(srctree)/$(src)/dts | ||
15 | |||
16 | # Ensure system.dtb exists | 13 | # Ensure system.dtb exists |
17 | $(obj)/linked_dtb.o: $(obj)/system.dtb | 14 | $(obj)/linked_dtb.o: $(obj)/system.dtb |
18 | 15 | ||
@@ -51,14 +48,11 @@ $(obj)/simpleImage.%: vmlinux FORCE | |||
51 | $(call if_changed,strip) | 48 | $(call if_changed,strip) |
52 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | 49 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
53 | 50 | ||
54 | # Rule to build device tree blobs | ||
55 | DTC = $(objtree)/scripts/dtc/dtc | ||
56 | 51 | ||
57 | # Rule to build device tree blobs | 52 | # Rule to build device tree blobs |
58 | quiet_cmd_dtc = DTC $@ | 53 | DTC_FLAGS := -p 1024 |
59 | cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 -p 1024 $(dtstree)/$*.dts | ||
60 | 54 | ||
61 | $(obj)/%.dtb: $(dtstree)/%.dts FORCE | 55 | $(obj)/%.dtb: $(src)/dts/%.dts FORCE |
62 | $(call if_changed,dtc) | 56 | $(call cmd,dtc) |
63 | 57 | ||
64 | clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub | 58 | clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub |
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index bdc38312ae4a..2e72af078b05 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h | |||
@@ -64,9 +64,6 @@ extern void kdump_move_device_tree(void); | |||
64 | /* CPU OF node matching */ | 64 | /* CPU OF node matching */ |
65 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); | 65 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); |
66 | 66 | ||
67 | /* Get the MAC address */ | ||
68 | extern const void *of_get_mac_address(struct device_node *np); | ||
69 | |||
70 | /** | 67 | /** |
71 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 68 | * of_irq_map_pci - Resolve the interrupt for a PCI device |
72 | * @pdev: the device whose interrupt is to be resolved | 69 | * @pdev: the device whose interrupt is to be resolved |
diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c index 99d9b61cccb5..9ae24f4b882b 100644 --- a/arch/microblaze/kernel/prom_parse.c +++ b/arch/microblaze/kernel/prom_parse.c | |||
@@ -110,41 +110,3 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, | |||
110 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); | 110 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); |
111 | *size = of_read_number(dma_window, cells); | 111 | *size = of_read_number(dma_window, cells); |
112 | } | 112 | } |
113 | |||
114 | /** | ||
115 | * Search the device tree for the best MAC address to use. 'mac-address' is | ||
116 | * checked first, because that is supposed to contain to "most recent" MAC | ||
117 | * address. If that isn't set, then 'local-mac-address' is checked next, | ||
118 | * because that is the default address. If that isn't set, then the obsolete | ||
119 | * 'address' is checked, just in case we're using an old device tree. | ||
120 | * | ||
121 | * Note that the 'address' property is supposed to contain a virtual address of | ||
122 | * the register set, but some DTS files have redefined that property to be the | ||
123 | * MAC address. | ||
124 | * | ||
125 | * All-zero MAC addresses are rejected, because those could be properties that | ||
126 | * exist in the device tree, but were not set by U-Boot. For example, the | ||
127 | * DTS could define 'mac-address' and 'local-mac-address', with zero MAC | ||
128 | * addresses. Some older U-Boots only initialized 'local-mac-address'. In | ||
129 | * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists | ||
130 | * but is all zeros. | ||
131 | */ | ||
132 | const void *of_get_mac_address(struct device_node *np) | ||
133 | { | ||
134 | struct property *pp; | ||
135 | |||
136 | pp = of_find_property(np, "mac-address", NULL); | ||
137 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
138 | return pp->value; | ||
139 | |||
140 | pp = of_find_property(np, "local-mac-address", NULL); | ||
141 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
142 | return pp->value; | ||
143 | |||
144 | pp = of_find_property(np, "address", NULL); | ||
145 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
146 | return pp->value; | ||
147 | |||
148 | return NULL; | ||
149 | } | ||
150 | EXPORT_SYMBOL(of_get_mac_address); | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0a9b5b8b2a19..f489ec30e071 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2218,7 +2218,7 @@ config SECCOMP | |||
2218 | config USE_OF | 2218 | config USE_OF |
2219 | bool "Flattened Device Tree support" | 2219 | bool "Flattened Device Tree support" |
2220 | select OF | 2220 | select OF |
2221 | select OF_FLATTREE | 2221 | select OF_EARLY_FLATTREE |
2222 | help | 2222 | help |
2223 | Include support for flattened device tree machine descriptions. | 2223 | Include support for flattened device tree machine descriptions. |
2224 | 2224 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e625e9e034ae..48fb4790bfec 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -116,7 +116,7 @@ config PPC | |||
116 | bool | 116 | bool |
117 | default y | 117 | default y |
118 | select OF | 118 | select OF |
119 | select OF_FLATTREE | 119 | select OF_EARLY_FLATTREE |
120 | select HAVE_FTRACE_MCOUNT_RECORD | 120 | select HAVE_FTRACE_MCOUNT_RECORD |
121 | select HAVE_DYNAMIC_FTRACE | 121 | select HAVE_DYNAMIC_FTRACE |
122 | select HAVE_FUNCTION_TRACER | 122 | select HAVE_FUNCTION_TRACER |
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index fae8192c8fcc..96deec63bcf3 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -35,7 +35,7 @@ endif | |||
35 | 35 | ||
36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | 36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) |
37 | 37 | ||
38 | DTS_FLAGS ?= -p 1024 | 38 | DTC_FLAGS ?= -p 1024 |
39 | 39 | ||
40 | $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 | 40 | $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 |
41 | $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 | 41 | $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 |
@@ -332,10 +332,8 @@ $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) | |||
332 | $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) | 332 | $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) |
333 | 333 | ||
334 | # Rule to build device tree blobs | 334 | # Rule to build device tree blobs |
335 | DTC = $(objtree)/scripts/dtc/dtc | 335 | $(obj)/%.dtb: $(src)/dts/%.dts |
336 | 336 | $(call cmd,dtc) | |
337 | $(obj)/%.dtb: $(dtstree)/%.dts | ||
338 | $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts | ||
339 | 337 | ||
340 | # If there isn't a platform selected then just strip the vmlinux. | 338 | # If there isn't a platform selected then just strip the vmlinux. |
341 | ifeq (,$(image-y)) | 339 | ifeq (,$(image-y)) |
diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts index 9bb3d72c0e5a..2a56a0dbd1f7 100644 --- a/arch/powerpc/boot/dts/bluestone.dts +++ b/arch/powerpc/boot/dts/bluestone.dts | |||
@@ -33,7 +33,7 @@ | |||
33 | aliases { | 33 | aliases { |
34 | ethernet0 = &EMAC0; | 34 | ethernet0 = &EMAC0; |
35 | serial0 = &UART0; | 35 | serial0 = &UART0; |
36 | serial1 = &UART1; | 36 | //serial1 = &UART1; --gcl missing UART1 label |
37 | }; | 37 | }; |
38 | 38 | ||
39 | cpus { | 39 | cpus { |
@@ -52,7 +52,7 @@ | |||
52 | d-cache-size = <32768>; | 52 | d-cache-size = <32768>; |
53 | dcr-controller; | 53 | dcr-controller; |
54 | dcr-access-method = "native"; | 54 | dcr-access-method = "native"; |
55 | next-level-cache = <&L2C0>; | 55 | //next-level-cache = <&L2C0>; --gcl missing L2C0 label |
56 | }; | 56 | }; |
57 | }; | 57 | }; |
58 | 58 | ||
@@ -142,7 +142,7 @@ | |||
142 | /*RXEOB*/ 0x7 0x4 | 142 | /*RXEOB*/ 0x7 0x4 |
143 | /*SERR*/ 0x3 0x4 | 143 | /*SERR*/ 0x3 0x4 |
144 | /*TXDE*/ 0x4 0x4 | 144 | /*TXDE*/ 0x4 0x4 |
145 | /*RXDE*/ 0x5 0x4 | 145 | /*RXDE*/ 0x5 0x4>; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | POB0: opb { | 148 | POB0: opb { |
@@ -182,7 +182,7 @@ | |||
182 | reg = <0x001a0000 0x00060000>; | 182 | reg = <0x001a0000 0x00060000>; |
183 | }; | 183 | }; |
184 | }; | 184 | }; |
185 | } | 185 | }; |
186 | 186 | ||
187 | UART0: serial@ef600300 { | 187 | UART0: serial@ef600300 { |
188 | device_type = "serial"; | 188 | device_type = "serial"; |
diff --git a/arch/powerpc/boot/dts/cm5200.dts b/arch/powerpc/boot/dts/cm5200.dts index dd3860846f15..ad3a4f4a2b04 100644 --- a/arch/powerpc/boot/dts/cm5200.dts +++ b/arch/powerpc/boot/dts/cm5200.dts | |||
@@ -10,220 +10,74 @@ | |||
10 | * option) any later version. | 10 | * option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /dts-v1/; | 13 | /include/ "mpc5200b.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "schindler,cm5200"; | 16 | model = "schindler,cm5200"; |
17 | compatible = "schindler,cm5200"; | 17 | compatible = "schindler,cm5200"; |
18 | #address-cells = <1>; | ||
19 | #size-cells = <1>; | ||
20 | interrupt-parent = <&mpc5200_pic>; | ||
21 | |||
22 | cpus { | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <0>; | ||
25 | |||
26 | PowerPC,5200@0 { | ||
27 | device_type = "cpu"; | ||
28 | reg = <0>; | ||
29 | d-cache-line-size = <32>; | ||
30 | i-cache-line-size = <32>; | ||
31 | d-cache-size = <0x4000>; // L1, 16K | ||
32 | i-cache-size = <0x4000>; // L1, 16K | ||
33 | timebase-frequency = <0>; // from bootloader | ||
34 | bus-frequency = <0>; // from bootloader | ||
35 | clock-frequency = <0>; // from bootloader | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | memory { | ||
40 | device_type = "memory"; | ||
41 | reg = <0x00000000 0x04000000>; // 64MB | ||
42 | }; | ||
43 | 18 | ||
44 | soc5200@f0000000 { | 19 | soc5200@f0000000 { |
45 | #address-cells = <1>; | ||
46 | #size-cells = <1>; | ||
47 | compatible = "fsl,mpc5200b-immr"; | ||
48 | ranges = <0 0xf0000000 0x0000c000>; | ||
49 | reg = <0xf0000000 0x00000100>; | ||
50 | bus-frequency = <0>; // from bootloader | ||
51 | system-frequency = <0>; // from bootloader | ||
52 | |||
53 | cdm@200 { | ||
54 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
55 | reg = <0x200 0x38>; | ||
56 | }; | ||
57 | |||
58 | mpc5200_pic: interrupt-controller@500 { | ||
59 | // 5200 interrupts are encoded into two levels; | ||
60 | interrupt-controller; | ||
61 | #interrupt-cells = <3>; | ||
62 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
63 | reg = <0x500 0x80>; | ||
64 | }; | ||
65 | |||
66 | timer@600 { // General Purpose Timer | 20 | timer@600 { // General Purpose Timer |
67 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
68 | reg = <0x600 0x10>; | ||
69 | interrupts = <1 9 0>; | ||
70 | fsl,has-wdt; | 21 | fsl,has-wdt; |
71 | }; | 22 | }; |
72 | 23 | ||
73 | timer@610 { // General Purpose Timer | 24 | can@900 { |
74 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 25 | status = "disabled"; |
75 | reg = <0x610 0x10>; | ||
76 | interrupts = <1 10 0>; | ||
77 | }; | ||
78 | |||
79 | timer@620 { // General Purpose Timer | ||
80 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
81 | reg = <0x620 0x10>; | ||
82 | interrupts = <1 11 0>; | ||
83 | }; | ||
84 | |||
85 | timer@630 { // General Purpose Timer | ||
86 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
87 | reg = <0x630 0x10>; | ||
88 | interrupts = <1 12 0>; | ||
89 | }; | ||
90 | |||
91 | timer@640 { // General Purpose Timer | ||
92 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
93 | reg = <0x640 0x10>; | ||
94 | interrupts = <1 13 0>; | ||
95 | }; | ||
96 | |||
97 | timer@650 { // General Purpose Timer | ||
98 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
99 | reg = <0x650 0x10>; | ||
100 | interrupts = <1 14 0>; | ||
101 | }; | ||
102 | |||
103 | timer@660 { // General Purpose Timer | ||
104 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
105 | reg = <0x660 0x10>; | ||
106 | interrupts = <1 15 0>; | ||
107 | }; | ||
108 | |||
109 | timer@670 { // General Purpose Timer | ||
110 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
111 | reg = <0x670 0x10>; | ||
112 | interrupts = <1 16 0>; | ||
113 | }; | 26 | }; |
114 | 27 | ||
115 | rtc@800 { // Real time clock | 28 | can@980 { |
116 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | 29 | status = "disabled"; |
117 | reg = <0x800 0x100>; | ||
118 | interrupts = <1 5 0 1 6 0>; | ||
119 | }; | 30 | }; |
120 | 31 | ||
121 | gpio_simple: gpio@b00 { | 32 | psc@2000 { // PSC1 |
122 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 33 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
123 | reg = <0xb00 0x40>; | ||
124 | interrupts = <1 7 0>; | ||
125 | gpio-controller; | ||
126 | #gpio-cells = <2>; | ||
127 | }; | ||
128 | |||
129 | gpio_wkup: gpio@c00 { | ||
130 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | ||
131 | reg = <0xc00 0x40>; | ||
132 | interrupts = <1 8 0 0 3 0>; | ||
133 | gpio-controller; | ||
134 | #gpio-cells = <2>; | ||
135 | }; | ||
136 | |||
137 | spi@f00 { | ||
138 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
139 | reg = <0xf00 0x20>; | ||
140 | interrupts = <2 13 0 2 14 0>; | ||
141 | }; | ||
142 | |||
143 | usb@1000 { | ||
144 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | ||
145 | reg = <0x1000 0xff>; | ||
146 | interrupts = <2 6 0>; | ||
147 | }; | ||
148 | |||
149 | dma-controller@1200 { | ||
150 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
151 | reg = <0x1200 0x80>; | ||
152 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
153 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
154 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
155 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
156 | }; | 34 | }; |
157 | 35 | ||
158 | xlb@1f00 { | 36 | psc@2200 { // PSC2 |
159 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | 37 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
160 | reg = <0x1f00 0x100>; | ||
161 | }; | 38 | }; |
162 | 39 | ||
163 | serial@2000 { // PSC1 | 40 | psc@2400 { // PSC3 |
164 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 41 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
165 | reg = <0x2000 0x100>; | ||
166 | interrupts = <2 1 0>; | ||
167 | }; | 42 | }; |
168 | 43 | ||
169 | serial@2200 { // PSC2 | 44 | psc@2600 { // PSC4 |
170 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 45 | status = "disabled"; |
171 | reg = <0x2200 0x100>; | ||
172 | interrupts = <2 2 0>; | ||
173 | }; | 46 | }; |
174 | 47 | ||
175 | serial@2400 { // PSC3 | 48 | psc@2800 { // PSC5 |
176 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 49 | status = "disabled"; |
177 | reg = <0x2400 0x100>; | ||
178 | interrupts = <2 3 0>; | ||
179 | }; | 50 | }; |
180 | 51 | ||
181 | serial@2c00 { // PSC6 | 52 | psc@2c00 { // PSC6 |
182 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 53 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
183 | reg = <0x2c00 0x100>; | ||
184 | interrupts = <2 4 0>; | ||
185 | }; | 54 | }; |
186 | 55 | ||
187 | ethernet@3000 { | 56 | ethernet@3000 { |
188 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
189 | reg = <0x3000 0x400>; | ||
190 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
191 | interrupts = <2 5 0>; | ||
192 | phy-handle = <&phy0>; | 57 | phy-handle = <&phy0>; |
193 | }; | 58 | }; |
194 | 59 | ||
195 | mdio@3000 { | 60 | mdio@3000 { |
196 | #address-cells = <1>; | ||
197 | #size-cells = <0>; | ||
198 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
199 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
200 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
201 | |||
202 | phy0: ethernet-phy@0 { | 61 | phy0: ethernet-phy@0 { |
203 | reg = <0>; | 62 | reg = <0>; |
204 | }; | 63 | }; |
205 | }; | 64 | }; |
206 | 65 | ||
207 | i2c@3d40 { | 66 | ata@3a00 { |
208 | #address-cells = <1>; | 67 | status = "disabled"; |
209 | #size-cells = <0>; | ||
210 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
211 | reg = <0x3d40 0x40>; | ||
212 | interrupts = <2 16 0>; | ||
213 | }; | 68 | }; |
214 | 69 | ||
215 | sram@8000 { | 70 | i2c@3d00 { |
216 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | 71 | status = "disabled"; |
217 | reg = <0x8000 0x4000>; | ||
218 | }; | 72 | }; |
73 | |||
219 | }; | 74 | }; |
220 | 75 | ||
221 | localbus { | 76 | pci@f0000d00 { |
222 | compatible = "fsl,mpc5200b-lpb","simple-bus"; | 77 | status = "disabled"; |
223 | #address-cells = <2>; | 78 | }; |
224 | #size-cells = <1>; | ||
225 | ranges = <0 0 0xfc000000 0x2000000>; | ||
226 | 79 | ||
80 | localbus { | ||
227 | // 16-bit flash device at LocalPlus Bus CS0 | 81 | // 16-bit flash device at LocalPlus Bus CS0 |
228 | flash@0,0 { | 82 | flash@0,0 { |
229 | compatible = "cfi-flash"; | 83 | compatible = "cfi-flash"; |
diff --git a/arch/powerpc/boot/dts/digsy_mtc.dts b/arch/powerpc/boot/dts/digsy_mtc.dts index 8e9be6bfe23e..27bd267d631c 100644 --- a/arch/powerpc/boot/dts/digsy_mtc.dts +++ b/arch/powerpc/boot/dts/digsy_mtc.dts | |||
@@ -11,195 +11,68 @@ | |||
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /dts-v1/; | 14 | /include/ "mpc5200b.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "intercontrol,digsy-mtc"; | 17 | model = "intercontrol,digsy-mtc"; |
18 | compatible = "intercontrol,digsy-mtc"; | 18 | compatible = "intercontrol,digsy-mtc"; |
19 | #address-cells = <1>; | ||
20 | #size-cells = <1>; | ||
21 | interrupt-parent = <&mpc5200_pic>; | ||
22 | |||
23 | cpus { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | |||
27 | PowerPC,5200@0 { | ||
28 | device_type = "cpu"; | ||
29 | reg = <0>; | ||
30 | d-cache-line-size = <32>; | ||
31 | i-cache-line-size = <32>; | ||
32 | d-cache-size = <0x4000>; // L1, 16K | ||
33 | i-cache-size = <0x4000>; // L1, 16K | ||
34 | timebase-frequency = <0>; // from bootloader | ||
35 | bus-frequency = <0>; // from bootloader | ||
36 | clock-frequency = <0>; // from bootloader | ||
37 | }; | ||
38 | }; | ||
39 | 19 | ||
40 | memory { | 20 | memory { |
41 | device_type = "memory"; | ||
42 | reg = <0x00000000 0x02000000>; // 32MB | 21 | reg = <0x00000000 0x02000000>; // 32MB |
43 | }; | 22 | }; |
44 | 23 | ||
45 | soc5200@f0000000 { | 24 | soc5200@f0000000 { |
46 | #address-cells = <1>; | ||
47 | #size-cells = <1>; | ||
48 | compatible = "fsl,mpc5200b-immr"; | ||
49 | ranges = <0 0xf0000000 0x0000c000>; | ||
50 | reg = <0xf0000000 0x00000100>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | timer@600 { // General Purpose Timer | 25 | timer@600 { // General Purpose Timer |
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | fsl,has-wdt; | 26 | fsl,has-wdt; |
72 | }; | 27 | }; |
73 | 28 | ||
74 | timer@610 { // General Purpose Timer | 29 | rtc@800 { |
75 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 30 | status = "disabled"; |
76 | reg = <0x610 0x10>; | ||
77 | interrupts = <1 10 0>; | ||
78 | }; | ||
79 | |||
80 | timer@620 { // General Purpose Timer | ||
81 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
82 | reg = <0x620 0x10>; | ||
83 | interrupts = <1 11 0>; | ||
84 | }; | ||
85 | |||
86 | timer@630 { // General Purpose Timer | ||
87 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
88 | reg = <0x630 0x10>; | ||
89 | interrupts = <1 12 0>; | ||
90 | }; | ||
91 | |||
92 | timer@640 { // General Purpose Timer | ||
93 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
94 | reg = <0x640 0x10>; | ||
95 | interrupts = <1 13 0>; | ||
96 | }; | ||
97 | |||
98 | timer@650 { // General Purpose Timer | ||
99 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
100 | reg = <0x650 0x10>; | ||
101 | interrupts = <1 14 0>; | ||
102 | }; | 31 | }; |
103 | 32 | ||
104 | timer@660 { // General Purpose Timer | 33 | can@900 { |
105 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 34 | status = "disabled"; |
106 | reg = <0x660 0x10>; | ||
107 | interrupts = <1 15 0>; | ||
108 | }; | 35 | }; |
109 | 36 | ||
110 | timer@670 { // General Purpose Timer | 37 | can@980 { |
111 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 38 | status = "disabled"; |
112 | reg = <0x670 0x10>; | ||
113 | interrupts = <1 16 0>; | ||
114 | }; | 39 | }; |
115 | 40 | ||
116 | gpio_simple: gpio@b00 { | 41 | psc@2000 { // PSC1 |
117 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 42 | status = "disabled"; |
118 | reg = <0xb00 0x40>; | ||
119 | interrupts = <1 7 0>; | ||
120 | gpio-controller; | ||
121 | #gpio-cells = <2>; | ||
122 | }; | 43 | }; |
123 | 44 | ||
124 | gpio_wkup: gpio@c00 { | 45 | psc@2200 { // PSC2 |
125 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | 46 | status = "disabled"; |
126 | reg = <0xc00 0x40>; | ||
127 | interrupts = <1 8 0 0 3 0>; | ||
128 | gpio-controller; | ||
129 | #gpio-cells = <2>; | ||
130 | }; | 47 | }; |
131 | 48 | ||
132 | spi@f00 { | 49 | psc@2400 { // PSC3 |
133 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | 50 | status = "disabled"; |
134 | reg = <0xf00 0x20>; | ||
135 | interrupts = <2 13 0 2 14 0>; | ||
136 | }; | 51 | }; |
137 | 52 | ||
138 | usb@1000 { | 53 | psc@2600 { // PSC4 |
139 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | 54 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
140 | reg = <0x1000 0xff>; | ||
141 | interrupts = <2 6 0>; | ||
142 | }; | ||
143 | |||
144 | dma-controller@1200 { | ||
145 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
146 | reg = <0x1200 0x80>; | ||
147 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
148 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
149 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
150 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
151 | }; | ||
152 | |||
153 | xlb@1f00 { | ||
154 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | ||
155 | reg = <0x1f00 0x100>; | ||
156 | }; | 55 | }; |
157 | 56 | ||
158 | serial@2600 { // PSC4 | 57 | psc@2800 { // PSC5 |
159 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 58 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
160 | reg = <0x2600 0x100>; | ||
161 | interrupts = <2 11 0>; | ||
162 | }; | 59 | }; |
163 | 60 | ||
164 | serial@2800 { // PSC5 | 61 | psc@2c00 { // PSC6 |
165 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 62 | status = "disabled"; |
166 | reg = <0x2800 0x100>; | ||
167 | interrupts = <2 12 0>; | ||
168 | }; | 63 | }; |
169 | 64 | ||
170 | ethernet@3000 { | 65 | ethernet@3000 { |
171 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
172 | reg = <0x3000 0x400>; | ||
173 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
174 | interrupts = <2 5 0>; | ||
175 | phy-handle = <&phy0>; | 66 | phy-handle = <&phy0>; |
176 | }; | 67 | }; |
177 | 68 | ||
178 | mdio@3000 { | 69 | mdio@3000 { |
179 | #address-cells = <1>; | ||
180 | #size-cells = <0>; | ||
181 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
182 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
183 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
184 | |||
185 | phy0: ethernet-phy@0 { | 70 | phy0: ethernet-phy@0 { |
186 | reg = <0>; | 71 | reg = <0>; |
187 | }; | 72 | }; |
188 | }; | 73 | }; |
189 | 74 | ||
190 | ata@3a00 { | ||
191 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | ||
192 | reg = <0x3a00 0x100>; | ||
193 | interrupts = <2 7 0>; | ||
194 | }; | ||
195 | |||
196 | i2c@3d00 { | 75 | i2c@3d00 { |
197 | #address-cells = <1>; | ||
198 | #size-cells = <0>; | ||
199 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
200 | reg = <0x3d00 0x40>; | ||
201 | interrupts = <2 15 0>; | ||
202 | |||
203 | rtc@50 { | 76 | rtc@50 { |
204 | compatible = "at,24c08"; | 77 | compatible = "at,24c08"; |
205 | reg = <0x50>; | 78 | reg = <0x50>; |
@@ -211,16 +84,16 @@ | |||
211 | }; | 84 | }; |
212 | }; | 85 | }; |
213 | 86 | ||
214 | sram@8000 { | 87 | i2c@3d40 { |
215 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | 88 | status = "disabled"; |
216 | reg = <0x8000 0x4000>; | ||
217 | }; | 89 | }; |
218 | }; | 90 | }; |
219 | 91 | ||
220 | lpb { | 92 | pci@f0000d00 { |
221 | compatible = "fsl,mpc5200b-lpb","simple-bus"; | 93 | status = "disabled"; |
222 | #address-cells = <2>; | 94 | }; |
223 | #size-cells = <1>; | 95 | |
96 | localbus { | ||
224 | ranges = <0 0 0xff000000 0x1000000>; | 97 | ranges = <0 0 0xff000000 0x1000000>; |
225 | 98 | ||
226 | // 16-bit flash device at LocalPlus Bus CS0 | 99 | // 16-bit flash device at LocalPlus Bus CS0 |
diff --git a/arch/powerpc/boot/dts/hotfoot.dts b/arch/powerpc/boot/dts/hotfoot.dts index cad9c3840afc..71d3bb4931dc 100644 --- a/arch/powerpc/boot/dts/hotfoot.dts +++ b/arch/powerpc/boot/dts/hotfoot.dts | |||
@@ -117,6 +117,8 @@ | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | IIC: i2c@ef600500 { | 119 | IIC: i2c@ef600500 { |
120 | #address-cells = <1>; | ||
121 | #size-cells = <0>; | ||
120 | compatible = "ibm,iic-405ep", "ibm,iic"; | 122 | compatible = "ibm,iic-405ep", "ibm,iic"; |
121 | reg = <0xef600500 0x00000011>; | 123 | reg = <0xef600500 0x00000011>; |
122 | interrupt-parent = <&UIC0>; | 124 | interrupt-parent = <&UIC0>; |
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts index 59702ace900f..fb288bb882b6 100644 --- a/arch/powerpc/boot/dts/lite5200b.dts +++ b/arch/powerpc/boot/dts/lite5200b.dts | |||
@@ -10,256 +10,75 @@ | |||
10 | * option) any later version. | 10 | * option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /dts-v1/; | 13 | /include/ "mpc5200b.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "fsl,lite5200b"; | 16 | model = "fsl,lite5200b"; |
17 | compatible = "fsl,lite5200b"; | 17 | compatible = "fsl,lite5200b"; |
18 | #address-cells = <1>; | ||
19 | #size-cells = <1>; | ||
20 | interrupt-parent = <&mpc5200_pic>; | ||
21 | |||
22 | cpus { | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <0>; | ||
25 | |||
26 | PowerPC,5200@0 { | ||
27 | device_type = "cpu"; | ||
28 | reg = <0>; | ||
29 | d-cache-line-size = <32>; | ||
30 | i-cache-line-size = <32>; | ||
31 | d-cache-size = <0x4000>; // L1, 16K | ||
32 | i-cache-size = <0x4000>; // L1, 16K | ||
33 | timebase-frequency = <0>; // from bootloader | ||
34 | bus-frequency = <0>; // from bootloader | ||
35 | clock-frequency = <0>; // from bootloader | ||
36 | }; | ||
37 | }; | ||
38 | 18 | ||
39 | memory { | 19 | memory { |
40 | device_type = "memory"; | ||
41 | reg = <0x00000000 0x10000000>; // 256MB | 20 | reg = <0x00000000 0x10000000>; // 256MB |
42 | }; | 21 | }; |
43 | 22 | ||
44 | soc5200@f0000000 { | 23 | soc5200@f0000000 { |
45 | #address-cells = <1>; | ||
46 | #size-cells = <1>; | ||
47 | compatible = "fsl,mpc5200b-immr"; | ||
48 | ranges = <0 0xf0000000 0x0000c000>; | ||
49 | reg = <0xf0000000 0x00000100>; | ||
50 | bus-frequency = <0>; // from bootloader | ||
51 | system-frequency = <0>; // from bootloader | ||
52 | |||
53 | cdm@200 { | ||
54 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
55 | reg = <0x200 0x38>; | ||
56 | }; | ||
57 | |||
58 | mpc5200_pic: interrupt-controller@500 { | ||
59 | // 5200 interrupts are encoded into two levels; | ||
60 | interrupt-controller; | ||
61 | #interrupt-cells = <3>; | ||
62 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
63 | reg = <0x500 0x80>; | ||
64 | }; | ||
65 | |||
66 | timer@600 { // General Purpose Timer | 24 | timer@600 { // General Purpose Timer |
67 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
68 | reg = <0x600 0x10>; | ||
69 | interrupts = <1 9 0>; | ||
70 | fsl,has-wdt; | 25 | fsl,has-wdt; |
71 | }; | 26 | }; |
72 | 27 | ||
73 | timer@610 { // General Purpose Timer | 28 | psc@2000 { // PSC1 |
74 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 29 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
75 | reg = <0x610 0x10>; | 30 | cell-index = <0>; |
76 | interrupts = <1 10 0>; | ||
77 | }; | ||
78 | |||
79 | timer@620 { // General Purpose Timer | ||
80 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
81 | reg = <0x620 0x10>; | ||
82 | interrupts = <1 11 0>; | ||
83 | }; | ||
84 | |||
85 | timer@630 { // General Purpose Timer | ||
86 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
87 | reg = <0x630 0x10>; | ||
88 | interrupts = <1 12 0>; | ||
89 | }; | ||
90 | |||
91 | timer@640 { // General Purpose Timer | ||
92 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
93 | reg = <0x640 0x10>; | ||
94 | interrupts = <1 13 0>; | ||
95 | }; | ||
96 | |||
97 | timer@650 { // General Purpose Timer | ||
98 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
99 | reg = <0x650 0x10>; | ||
100 | interrupts = <1 14 0>; | ||
101 | }; | ||
102 | |||
103 | timer@660 { // General Purpose Timer | ||
104 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
105 | reg = <0x660 0x10>; | ||
106 | interrupts = <1 15 0>; | ||
107 | }; | ||
108 | |||
109 | timer@670 { // General Purpose Timer | ||
110 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
111 | reg = <0x670 0x10>; | ||
112 | interrupts = <1 16 0>; | ||
113 | }; | ||
114 | |||
115 | rtc@800 { // Real time clock | ||
116 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
117 | reg = <0x800 0x100>; | ||
118 | interrupts = <1 5 0 1 6 0>; | ||
119 | }; | ||
120 | |||
121 | can@900 { | ||
122 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
123 | interrupts = <2 17 0>; | ||
124 | reg = <0x900 0x80>; | ||
125 | }; | ||
126 | |||
127 | can@980 { | ||
128 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
129 | interrupts = <2 18 0>; | ||
130 | reg = <0x980 0x80>; | ||
131 | }; | ||
132 | |||
133 | gpio_simple: gpio@b00 { | ||
134 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | ||
135 | reg = <0xb00 0x40>; | ||
136 | interrupts = <1 7 0>; | ||
137 | gpio-controller; | ||
138 | #gpio-cells = <2>; | ||
139 | }; | ||
140 | |||
141 | gpio_wkup: gpio@c00 { | ||
142 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | ||
143 | reg = <0xc00 0x40>; | ||
144 | interrupts = <1 8 0 0 3 0>; | ||
145 | gpio-controller; | ||
146 | #gpio-cells = <2>; | ||
147 | }; | 31 | }; |
148 | 32 | ||
149 | spi@f00 { | 33 | psc@2200 { // PSC2 |
150 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | 34 | status = "disabled"; |
151 | reg = <0xf00 0x20>; | ||
152 | interrupts = <2 13 0 2 14 0>; | ||
153 | }; | 35 | }; |
154 | 36 | ||
155 | usb@1000 { | 37 | psc@2400 { // PSC3 |
156 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | 38 | status = "disabled"; |
157 | reg = <0x1000 0xff>; | ||
158 | interrupts = <2 6 0>; | ||
159 | }; | 39 | }; |
160 | 40 | ||
161 | dma-controller@1200 { | 41 | psc@2600 { // PSC4 |
162 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | 42 | status = "disabled"; |
163 | reg = <0x1200 0x80>; | ||
164 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
165 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
166 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
167 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
168 | }; | 43 | }; |
169 | 44 | ||
170 | xlb@1f00 { | 45 | psc@2800 { // PSC5 |
171 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | 46 | status = "disabled"; |
172 | reg = <0x1f00 0x100>; | ||
173 | }; | 47 | }; |
174 | 48 | ||
175 | serial@2000 { // PSC1 | 49 | psc@2c00 { // PSC6 |
176 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 50 | status = "disabled"; |
177 | cell-index = <0>; | ||
178 | reg = <0x2000 0x100>; | ||
179 | interrupts = <2 1 0>; | ||
180 | }; | 51 | }; |
181 | 52 | ||
182 | // PSC2 in ac97 mode example | 53 | // PSC2 in ac97 mode example |
183 | //ac97@2200 { // PSC2 | 54 | //ac97@2200 { // PSC2 |
184 | // compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97"; | 55 | // compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97"; |
185 | // cell-index = <1>; | 56 | // cell-index = <1>; |
186 | // reg = <0x2200 0x100>; | ||
187 | // interrupts = <2 2 0>; | ||
188 | //}; | 57 | //}; |
189 | 58 | ||
190 | // PSC3 in CODEC mode example | 59 | // PSC3 in CODEC mode example |
191 | //i2s@2400 { // PSC3 | 60 | //i2s@2400 { // PSC3 |
192 | // compatible = "fsl,mpc5200b-psc-i2s"; //not 5200 compatible | 61 | // compatible = "fsl,mpc5200b-psc-i2s"; //not 5200 compatible |
193 | // cell-index = <2>; | 62 | // cell-index = <2>; |
194 | // reg = <0x2400 0x100>; | ||
195 | // interrupts = <2 3 0>; | ||
196 | //}; | ||
197 | |||
198 | // PSC4 in uart mode example | ||
199 | //serial@2600 { // PSC4 | ||
200 | // compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | ||
201 | // cell-index = <3>; | ||
202 | // reg = <0x2600 0x100>; | ||
203 | // interrupts = <2 11 0>; | ||
204 | //}; | ||
205 | |||
206 | // PSC5 in uart mode example | ||
207 | //serial@2800 { // PSC5 | ||
208 | // compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | ||
209 | // cell-index = <4>; | ||
210 | // reg = <0x2800 0x100>; | ||
211 | // interrupts = <2 12 0>; | ||
212 | //}; | 63 | //}; |
213 | 64 | ||
214 | // PSC6 in spi mode example | 65 | // PSC6 in spi mode example |
215 | //spi@2c00 { // PSC6 | 66 | //spi@2c00 { // PSC6 |
216 | // compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi"; | 67 | // compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi"; |
217 | // cell-index = <5>; | 68 | // cell-index = <5>; |
218 | // reg = <0x2c00 0x100>; | ||
219 | // interrupts = <2 4 0>; | ||
220 | //}; | 69 | //}; |
221 | 70 | ||
222 | ethernet@3000 { | 71 | ethernet@3000 { |
223 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
224 | reg = <0x3000 0x400>; | ||
225 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
226 | interrupts = <2 5 0>; | ||
227 | phy-handle = <&phy0>; | 72 | phy-handle = <&phy0>; |
228 | }; | 73 | }; |
229 | 74 | ||
230 | mdio@3000 { | 75 | mdio@3000 { |
231 | #address-cells = <1>; | ||
232 | #size-cells = <0>; | ||
233 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
234 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
235 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
236 | |||
237 | phy0: ethernet-phy@0 { | 76 | phy0: ethernet-phy@0 { |
238 | reg = <0>; | 77 | reg = <0>; |
239 | }; | 78 | }; |
240 | }; | 79 | }; |
241 | 80 | ||
242 | ata@3a00 { | ||
243 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | ||
244 | reg = <0x3a00 0x100>; | ||
245 | interrupts = <2 7 0>; | ||
246 | }; | ||
247 | |||
248 | i2c@3d00 { | ||
249 | #address-cells = <1>; | ||
250 | #size-cells = <0>; | ||
251 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
252 | reg = <0x3d00 0x40>; | ||
253 | interrupts = <2 15 0>; | ||
254 | }; | ||
255 | |||
256 | i2c@3d40 { | 81 | i2c@3d40 { |
257 | #address-cells = <1>; | ||
258 | #size-cells = <0>; | ||
259 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
260 | reg = <0x3d40 0x40>; | ||
261 | interrupts = <2 16 0>; | ||
262 | |||
263 | eeprom@50 { | 82 | eeprom@50 { |
264 | compatible = "atmel,24c02"; | 83 | compatible = "atmel,24c02"; |
265 | reg = <0x50>; | 84 | reg = <0x50>; |
@@ -273,12 +92,6 @@ | |||
273 | }; | 92 | }; |
274 | 93 | ||
275 | pci@f0000d00 { | 94 | pci@f0000d00 { |
276 | #interrupt-cells = <1>; | ||
277 | #size-cells = <2>; | ||
278 | #address-cells = <3>; | ||
279 | device_type = "pci"; | ||
280 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
281 | reg = <0xf0000d00 0x100>; | ||
282 | interrupt-map-mask = <0xf800 0 0 7>; | 95 | interrupt-map-mask = <0xf800 0 0 7>; |
283 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot | 96 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot |
284 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 | 97 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 |
@@ -298,11 +111,6 @@ | |||
298 | }; | 111 | }; |
299 | 112 | ||
300 | localbus { | 113 | localbus { |
301 | compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus"; | ||
302 | |||
303 | #address-cells = <2>; | ||
304 | #size-cells = <1>; | ||
305 | |||
306 | ranges = <0 0 0xfe000000 0x02000000>; | 114 | ranges = <0 0 0xfe000000 0x02000000>; |
307 | 115 | ||
308 | flash@0,0 { | 116 | flash@0,0 { |
diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts index 0c3902bc5b6a..48d72f38e5ed 100644 --- a/arch/powerpc/boot/dts/media5200.dts +++ b/arch/powerpc/boot/dts/media5200.dts | |||
@@ -11,14 +11,11 @@ | |||
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /dts-v1/; | 14 | /include/ "mpc5200b.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "fsl,media5200"; | 17 | model = "fsl,media5200"; |
18 | compatible = "fsl,media5200"; | 18 | compatible = "fsl,media5200"; |
19 | #address-cells = <1>; | ||
20 | #size-cells = <1>; | ||
21 | interrupt-parent = <&mpc5200_pic>; | ||
22 | 19 | ||
23 | aliases { | 20 | aliases { |
24 | console = &console; | 21 | console = &console; |
@@ -30,16 +27,7 @@ | |||
30 | }; | 27 | }; |
31 | 28 | ||
32 | cpus { | 29 | cpus { |
33 | #address-cells = <1>; | ||
34 | #size-cells = <0>; | ||
35 | |||
36 | PowerPC,5200@0 { | 30 | PowerPC,5200@0 { |
37 | device_type = "cpu"; | ||
38 | reg = <0>; | ||
39 | d-cache-line-size = <32>; | ||
40 | i-cache-line-size = <32>; | ||
41 | d-cache-size = <0x4000>; // L1, 16K | ||
42 | i-cache-size = <0x4000>; // L1, 16K | ||
43 | timebase-frequency = <33000000>; // 33 MHz, these were configured by U-Boot | 31 | timebase-frequency = <33000000>; // 33 MHz, these were configured by U-Boot |
44 | bus-frequency = <132000000>; // 132 MHz | 32 | bus-frequency = <132000000>; // 132 MHz |
45 | clock-frequency = <396000000>; // 396 MHz | 33 | clock-frequency = <396000000>; // 396 MHz |
@@ -47,205 +35,57 @@ | |||
47 | }; | 35 | }; |
48 | 36 | ||
49 | memory { | 37 | memory { |
50 | device_type = "memory"; | ||
51 | reg = <0x00000000 0x08000000>; // 128MB RAM | 38 | reg = <0x00000000 0x08000000>; // 128MB RAM |
52 | }; | 39 | }; |
53 | 40 | ||
54 | soc@f0000000 { | 41 | soc5200@f0000000 { |
55 | #address-cells = <1>; | ||
56 | #size-cells = <1>; | ||
57 | compatible = "fsl,mpc5200b-immr"; | ||
58 | ranges = <0 0xf0000000 0x0000c000>; | ||
59 | reg = <0xf0000000 0x00000100>; | ||
60 | bus-frequency = <132000000>;// 132 MHz | 42 | bus-frequency = <132000000>;// 132 MHz |
61 | system-frequency = <0>; // from bootloader | ||
62 | |||
63 | cdm@200 { | ||
64 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
65 | reg = <0x200 0x38>; | ||
66 | }; | ||
67 | |||
68 | mpc5200_pic: interrupt-controller@500 { | ||
69 | // 5200 interrupts are encoded into two levels; | ||
70 | interrupt-controller; | ||
71 | #interrupt-cells = <3>; | ||
72 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
73 | reg = <0x500 0x80>; | ||
74 | }; | ||
75 | 43 | ||
76 | timer@600 { // General Purpose Timer | 44 | timer@600 { // General Purpose Timer |
77 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
78 | reg = <0x600 0x10>; | ||
79 | interrupts = <1 9 0>; | ||
80 | fsl,has-wdt; | 45 | fsl,has-wdt; |
81 | }; | 46 | }; |
82 | 47 | ||
83 | timer@610 { // General Purpose Timer | 48 | psc@2000 { // PSC1 |
84 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | 49 | status = "disabled"; |
85 | reg = <0x610 0x10>; | ||
86 | interrupts = <1 10 0>; | ||
87 | }; | ||
88 | |||
89 | timer@620 { // General Purpose Timer | ||
90 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
91 | reg = <0x620 0x10>; | ||
92 | interrupts = <1 11 0>; | ||
93 | }; | ||
94 | |||
95 | timer@630 { // General Purpose Timer | ||
96 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
97 | reg = <0x630 0x10>; | ||
98 | interrupts = <1 12 0>; | ||
99 | }; | ||
100 | |||
101 | timer@640 { // General Purpose Timer | ||
102 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
103 | reg = <0x640 0x10>; | ||
104 | interrupts = <1 13 0>; | ||
105 | }; | ||
106 | |||
107 | timer@650 { // General Purpose Timer | ||
108 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
109 | reg = <0x650 0x10>; | ||
110 | interrupts = <1 14 0>; | ||
111 | }; | ||
112 | |||
113 | timer@660 { // General Purpose Timer | ||
114 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
115 | reg = <0x660 0x10>; | ||
116 | interrupts = <1 15 0>; | ||
117 | }; | ||
118 | |||
119 | timer@670 { // General Purpose Timer | ||
120 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
121 | reg = <0x670 0x10>; | ||
122 | interrupts = <1 16 0>; | ||
123 | }; | ||
124 | |||
125 | rtc@800 { // Real time clock | ||
126 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
127 | reg = <0x800 0x100>; | ||
128 | interrupts = <1 5 0 1 6 0>; | ||
129 | }; | ||
130 | |||
131 | can@900 { | ||
132 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
133 | interrupts = <2 17 0>; | ||
134 | reg = <0x900 0x80>; | ||
135 | }; | 50 | }; |
136 | 51 | ||
137 | can@980 { | 52 | psc@2200 { // PSC2 |
138 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | 53 | status = "disabled"; |
139 | interrupts = <2 18 0>; | ||
140 | reg = <0x980 0x80>; | ||
141 | }; | 54 | }; |
142 | 55 | ||
143 | gpio_simple: gpio@b00 { | 56 | psc@2400 { // PSC3 |
144 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 57 | status = "disabled"; |
145 | reg = <0xb00 0x40>; | ||
146 | interrupts = <1 7 0>; | ||
147 | gpio-controller; | ||
148 | #gpio-cells = <2>; | ||
149 | }; | 58 | }; |
150 | 59 | ||
151 | gpio_wkup: gpio@c00 { | 60 | psc@2600 { // PSC4 |
152 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | 61 | status = "disabled"; |
153 | reg = <0xc00 0x40>; | ||
154 | interrupts = <1 8 0 0 3 0>; | ||
155 | gpio-controller; | ||
156 | #gpio-cells = <2>; | ||
157 | }; | 62 | }; |
158 | 63 | ||
159 | spi@f00 { | 64 | psc@2800 { // PSC5 |
160 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | 65 | status = "disabled"; |
161 | reg = <0xf00 0x20>; | ||
162 | interrupts = <2 13 0 2 14 0>; | ||
163 | }; | ||
164 | |||
165 | usb@1000 { | ||
166 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | ||
167 | reg = <0x1000 0x100>; | ||
168 | interrupts = <2 6 0>; | ||
169 | }; | ||
170 | |||
171 | dma-controller@1200 { | ||
172 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
173 | reg = <0x1200 0x80>; | ||
174 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
175 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
176 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
177 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
178 | }; | ||
179 | |||
180 | xlb@1f00 { | ||
181 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | ||
182 | reg = <0x1f00 0x100>; | ||
183 | }; | 66 | }; |
184 | 67 | ||
185 | // PSC6 in uart mode | 68 | // PSC6 in uart mode |
186 | console: serial@2c00 { // PSC6 | 69 | console: psc@2c00 { // PSC6 |
187 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 70 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
188 | cell-index = <5>; | ||
189 | port-number = <0>; // Logical port assignment | ||
190 | reg = <0x2c00 0x100>; | ||
191 | interrupts = <2 4 0>; | ||
192 | }; | 71 | }; |
193 | 72 | ||
194 | eth0: ethernet@3000 { | 73 | ethernet@3000 { |
195 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
196 | reg = <0x3000 0x400>; | ||
197 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
198 | interrupts = <2 5 0>; | ||
199 | phy-handle = <&phy0>; | 74 | phy-handle = <&phy0>; |
200 | }; | 75 | }; |
201 | 76 | ||
202 | mdio@3000 { | 77 | mdio@3000 { |
203 | #address-cells = <1>; | ||
204 | #size-cells = <0>; | ||
205 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
206 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
207 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
208 | |||
209 | phy0: ethernet-phy@0 { | 78 | phy0: ethernet-phy@0 { |
210 | reg = <0>; | 79 | reg = <0>; |
211 | }; | 80 | }; |
212 | }; | 81 | }; |
213 | 82 | ||
214 | ata@3a00 { | 83 | usb@1000 { |
215 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | 84 | reg = <0x1000 0x100>; |
216 | reg = <0x3a00 0x100>; | ||
217 | interrupts = <2 7 0>; | ||
218 | }; | ||
219 | |||
220 | i2c@3d00 { | ||
221 | #address-cells = <1>; | ||
222 | #size-cells = <0>; | ||
223 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
224 | reg = <0x3d00 0x40>; | ||
225 | interrupts = <2 15 0>; | ||
226 | }; | ||
227 | |||
228 | i2c@3d40 { | ||
229 | #address-cells = <1>; | ||
230 | #size-cells = <0>; | ||
231 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
232 | reg = <0x3d40 0x40>; | ||
233 | interrupts = <2 16 0>; | ||
234 | }; | ||
235 | |||
236 | sram@8000 { | ||
237 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | ||
238 | reg = <0x8000 0x4000>; | ||
239 | }; | 85 | }; |
240 | }; | 86 | }; |
241 | 87 | ||
242 | pci@f0000d00 { | 88 | pci@f0000d00 { |
243 | #interrupt-cells = <1>; | ||
244 | #size-cells = <2>; | ||
245 | #address-cells = <3>; | ||
246 | device_type = "pci"; | ||
247 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
248 | reg = <0xf0000d00 0x100>; | ||
249 | interrupt-map-mask = <0xf800 0 0 7>; | 89 | interrupt-map-mask = <0xf800 0 0 7>; |
250 | interrupt-map = <0xc000 0 0 1 &media5200_fpga 0 2 // 1st slot | 90 | interrupt-map = <0xc000 0 0 1 &media5200_fpga 0 2 // 1st slot |
251 | 0xc000 0 0 2 &media5200_fpga 0 3 | 91 | 0xc000 0 0 2 &media5200_fpga 0 3 |
@@ -262,37 +102,29 @@ | |||
262 | 102 | ||
263 | 0xe000 0 0 1 &media5200_fpga 0 5 // CoralIP | 103 | 0xe000 0 0 1 &media5200_fpga 0 5 // CoralIP |
264 | >; | 104 | >; |
265 | clock-frequency = <0>; // From boot loader | ||
266 | interrupts = <2 8 0 2 9 0 2 10 0>; | ||
267 | interrupt-parent = <&mpc5200_pic>; | ||
268 | bus-range = <0 0>; | ||
269 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 | 105 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 |
270 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 | 106 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 |
271 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; | 107 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; |
108 | interrupt-parent = <&mpc5200_pic>; | ||
272 | }; | 109 | }; |
273 | 110 | ||
274 | localbus { | 111 | localbus { |
275 | compatible = "fsl,mpc5200b-lpb","simple-bus"; | ||
276 | #address-cells = <2>; | ||
277 | #size-cells = <1>; | ||
278 | |||
279 | ranges = < 0 0 0xfc000000 0x02000000 | 112 | ranges = < 0 0 0xfc000000 0x02000000 |
280 | 1 0 0xfe000000 0x02000000 | 113 | 1 0 0xfe000000 0x02000000 |
281 | 2 0 0xf0010000 0x00010000 | 114 | 2 0 0xf0010000 0x00010000 |
282 | 3 0 0xf0020000 0x00010000 >; | 115 | 3 0 0xf0020000 0x00010000 >; |
283 | |||
284 | flash@0,0 { | 116 | flash@0,0 { |
285 | compatible = "amd,am29lv28ml", "cfi-flash"; | 117 | compatible = "amd,am29lv28ml", "cfi-flash"; |
286 | reg = <0 0x0 0x2000000>; // 32 MB | 118 | reg = <0 0x0 0x2000000>; // 32 MB |
287 | bank-width = <4>; // Width in bytes of the flash bank | 119 | bank-width = <4>; // Width in bytes of the flash bank |
288 | device-width = <2>; // Two devices on each bank | 120 | device-width = <2>; // Two devices on each bank |
289 | }; | 121 | }; |
290 | 122 | ||
291 | flash@1,0 { | 123 | flash@1,0 { |
292 | compatible = "amd,am29lv28ml", "cfi-flash"; | 124 | compatible = "amd,am29lv28ml", "cfi-flash"; |
293 | reg = <1 0 0x2000000>; // 32 MB | 125 | reg = <1 0 0x2000000>; // 32 MB |
294 | bank-width = <4>; // Width in bytes of the flash bank | 126 | bank-width = <4>; // Width in bytes of the flash bank |
295 | device-width = <2>; // Two devices on each bank | 127 | device-width = <2>; // Two devices on each bank |
296 | }; | 128 | }; |
297 | 129 | ||
298 | media5200_fpga: fpga@2,0 { | 130 | media5200_fpga: fpga@2,0 { |
diff --git a/arch/powerpc/boot/dts/motionpro.dts b/arch/powerpc/boot/dts/motionpro.dts index 6ca4fc144a33..0b78e89ac69b 100644 --- a/arch/powerpc/boot/dts/motionpro.dts +++ b/arch/powerpc/boot/dts/motionpro.dts | |||
@@ -10,219 +10,73 @@ | |||
10 | * option) any later version. | 10 | * option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /dts-v1/; | 13 | /include/ "mpc5200b.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "promess,motionpro"; | 16 | model = "promess,motionpro"; |
17 | compatible = "promess,motionpro"; | 17 | compatible = "promess,motionpro"; |
18 | #address-cells = <1>; | ||
19 | #size-cells = <1>; | ||
20 | interrupt-parent = <&mpc5200_pic>; | ||
21 | |||
22 | cpus { | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <0>; | ||
25 | |||
26 | PowerPC,5200@0 { | ||
27 | device_type = "cpu"; | ||
28 | reg = <0>; | ||
29 | d-cache-line-size = <32>; | ||
30 | i-cache-line-size = <32>; | ||
31 | d-cache-size = <0x4000>; // L1, 16K | ||
32 | i-cache-size = <0x4000>; // L1, 16K | ||
33 | timebase-frequency = <0>; // from bootloader | ||
34 | bus-frequency = <0>; // from bootloader | ||
35 | clock-frequency = <0>; // from bootloader | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | memory { | ||
40 | device_type = "memory"; | ||
41 | reg = <0x00000000 0x04000000>; // 64MB | ||
42 | }; | ||
43 | 18 | ||
44 | soc5200@f0000000 { | 19 | soc5200@f0000000 { |
45 | #address-cells = <1>; | ||
46 | #size-cells = <1>; | ||
47 | compatible = "fsl,mpc5200b-immr"; | ||
48 | ranges = <0 0xf0000000 0x0000c000>; | ||
49 | reg = <0xf0000000 0x00000100>; | ||
50 | bus-frequency = <0>; // from bootloader | ||
51 | system-frequency = <0>; // from bootloader | ||
52 | |||
53 | cdm@200 { | ||
54 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
55 | reg = <0x200 0x38>; | ||
56 | }; | ||
57 | |||
58 | mpc5200_pic: interrupt-controller@500 { | ||
59 | // 5200 interrupts are encoded into two levels; | ||
60 | interrupt-controller; | ||
61 | #interrupt-cells = <3>; | ||
62 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
63 | reg = <0x500 0x80>; | ||
64 | }; | ||
65 | |||
66 | timer@600 { // General Purpose Timer | 20 | timer@600 { // General Purpose Timer |
67 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
68 | reg = <0x600 0x10>; | ||
69 | interrupts = <1 9 0>; | ||
70 | fsl,has-wdt; | 21 | fsl,has-wdt; |
71 | }; | 22 | }; |
72 | 23 | ||
73 | timer@610 { // General Purpose Timer | 24 | timer@660 { // Motion-PRO status LED |
74 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
75 | reg = <0x610 0x10>; | ||
76 | interrupts = <1 10 0>; | ||
77 | }; | ||
78 | |||
79 | timer@620 { // General Purpose Timer | ||
80 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
81 | reg = <0x620 0x10>; | ||
82 | interrupts = <1 11 0>; | ||
83 | }; | ||
84 | |||
85 | timer@630 { // General Purpose Timer | ||
86 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
87 | reg = <0x630 0x10>; | ||
88 | interrupts = <1 12 0>; | ||
89 | }; | ||
90 | |||
91 | timer@640 { // General Purpose Timer | ||
92 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
93 | reg = <0x640 0x10>; | ||
94 | interrupts = <1 13 0>; | ||
95 | }; | ||
96 | |||
97 | timer@650 { // General Purpose Timer | ||
98 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
99 | reg = <0x650 0x10>; | ||
100 | interrupts = <1 14 0>; | ||
101 | }; | ||
102 | |||
103 | motionpro-led@660 { // Motion-PRO status LED | ||
104 | compatible = "promess,motionpro-led"; | 25 | compatible = "promess,motionpro-led"; |
105 | label = "motionpro-statusled"; | 26 | label = "motionpro-statusled"; |
106 | reg = <0x660 0x10>; | ||
107 | interrupts = <1 15 0>; | ||
108 | blink-delay = <100>; // 100 msec | 27 | blink-delay = <100>; // 100 msec |
109 | }; | 28 | }; |
110 | 29 | ||
111 | motionpro-led@670 { // Motion-PRO ready LED | 30 | timer@670 { // Motion-PRO ready LED |
112 | compatible = "promess,motionpro-led"; | 31 | compatible = "promess,motionpro-led"; |
113 | label = "motionpro-readyled"; | 32 | label = "motionpro-readyled"; |
114 | reg = <0x670 0x10>; | ||
115 | interrupts = <1 16 0>; | ||
116 | }; | ||
117 | |||
118 | rtc@800 { // Real time clock | ||
119 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
120 | reg = <0x800 0x100>; | ||
121 | interrupts = <1 5 0 1 6 0>; | ||
122 | }; | ||
123 | |||
124 | can@980 { | ||
125 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
126 | interrupts = <2 18 0>; | ||
127 | reg = <0x980 0x80>; | ||
128 | }; | 33 | }; |
129 | 34 | ||
130 | gpio_simple: gpio@b00 { | 35 | can@900 { |
131 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 36 | status = "disabled"; |
132 | reg = <0xb00 0x40>; | ||
133 | interrupts = <1 7 0>; | ||
134 | gpio-controller; | ||
135 | #gpio-cells = <2>; | ||
136 | }; | 37 | }; |
137 | 38 | ||
138 | gpio_wkup: gpio@c00 { | 39 | psc@2000 { // PSC1 |
139 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | 40 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
140 | reg = <0xc00 0x40>; | ||
141 | interrupts = <1 8 0 0 3 0>; | ||
142 | gpio-controller; | ||
143 | #gpio-cells = <2>; | ||
144 | }; | ||
145 | |||
146 | spi@f00 { | ||
147 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
148 | reg = <0xf00 0x20>; | ||
149 | interrupts = <2 13 0 2 14 0>; | ||
150 | }; | 41 | }; |
151 | 42 | ||
152 | usb@1000 { | 43 | // PSC2 in spi master mode |
153 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | 44 | psc@2200 { // PSC2 |
154 | reg = <0x1000 0xff>; | 45 | compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi"; |
155 | interrupts = <2 6 0>; | 46 | cell-index = <1>; |
156 | }; | 47 | }; |
157 | 48 | ||
158 | dma-controller@1200 { | 49 | psc@2400 { // PSC3 |
159 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | 50 | status = "disabled"; |
160 | reg = <0x1200 0x80>; | ||
161 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
162 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
163 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
164 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
165 | }; | 51 | }; |
166 | 52 | ||
167 | xlb@1f00 { | 53 | psc@2600 { // PSC4 |
168 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | 54 | status = "disabled"; |
169 | reg = <0x1f00 0x100>; | ||
170 | }; | 55 | }; |
171 | 56 | ||
172 | serial@2000 { // PSC1 | 57 | psc@2800 { // PSC5 |
173 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 58 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
174 | reg = <0x2000 0x100>; | ||
175 | interrupts = <2 1 0>; | ||
176 | }; | ||
177 | |||
178 | // PSC2 in spi master mode | ||
179 | spi@2200 { // PSC2 | ||
180 | compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi"; | ||
181 | cell-index = <1>; | ||
182 | reg = <0x2200 0x100>; | ||
183 | interrupts = <2 2 0>; | ||
184 | }; | 59 | }; |
185 | 60 | ||
186 | // PSC5 in uart mode | 61 | psc@2c00 { // PSC6 |
187 | serial@2800 { // PSC5 | 62 | status = "disabled"; |
188 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | ||
189 | reg = <0x2800 0x100>; | ||
190 | interrupts = <2 12 0>; | ||
191 | }; | 63 | }; |
192 | 64 | ||
193 | ethernet@3000 { | 65 | ethernet@3000 { |
194 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
195 | reg = <0x3000 0x400>; | ||
196 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
197 | interrupts = <2 5 0>; | ||
198 | phy-handle = <&phy0>; | 66 | phy-handle = <&phy0>; |
199 | }; | 67 | }; |
200 | 68 | ||
201 | mdio@3000 { | 69 | mdio@3000 { |
202 | #address-cells = <1>; | ||
203 | #size-cells = <0>; | ||
204 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
205 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
206 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
207 | |||
208 | phy0: ethernet-phy@2 { | 70 | phy0: ethernet-phy@2 { |
209 | reg = <2>; | 71 | reg = <2>; |
210 | }; | 72 | }; |
211 | }; | 73 | }; |
212 | 74 | ||
213 | ata@3a00 { | 75 | i2c@3d00 { |
214 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | 76 | status = "disabled"; |
215 | reg = <0x3a00 0x100>; | ||
216 | interrupts = <2 7 0>; | ||
217 | }; | 77 | }; |
218 | 78 | ||
219 | i2c@3d40 { | 79 | i2c@3d40 { |
220 | #address-cells = <1>; | ||
221 | #size-cells = <0>; | ||
222 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
223 | reg = <0x3d40 0x40>; | ||
224 | interrupts = <2 16 0>; | ||
225 | |||
226 | rtc@68 { | 80 | rtc@68 { |
227 | compatible = "dallas,ds1339"; | 81 | compatible = "dallas,ds1339"; |
228 | reg = <0x68>; | 82 | reg = <0x68>; |
@@ -235,10 +89,11 @@ | |||
235 | }; | 89 | }; |
236 | }; | 90 | }; |
237 | 91 | ||
92 | pci@f0000d00 { | ||
93 | status = "disabled"; | ||
94 | }; | ||
95 | |||
238 | localbus { | 96 | localbus { |
239 | compatible = "fsl,mpc5200b-lpb","simple-bus"; | ||
240 | #address-cells = <2>; | ||
241 | #size-cells = <1>; | ||
242 | ranges = <0 0 0xff000000 0x01000000 | 97 | ranges = <0 0 0xff000000 0x01000000 |
243 | 1 0 0x50000000 0x00010000 | 98 | 1 0 0x50000000 0x00010000 |
244 | 2 0 0x50010000 0x00010000 | 99 | 2 0 0x50010000 0x00010000 |
@@ -280,5 +135,6 @@ | |||
280 | #size-cells = <1>; | 135 | #size-cells = <1>; |
281 | #address-cells = <1>; | 136 | #address-cells = <1>; |
282 | }; | 137 | }; |
138 | |||
283 | }; | 139 | }; |
284 | }; | 140 | }; |
diff --git a/arch/powerpc/boot/dts/mpc5200b.dtsi b/arch/powerpc/boot/dts/mpc5200b.dtsi new file mode 100644 index 000000000000..bc27548e895d --- /dev/null +++ b/arch/powerpc/boot/dts/mpc5200b.dtsi | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * base MPC5200b Device Tree Source | ||
3 | * | ||
4 | * Copyright (C) 2010 SecretLab | ||
5 | * Grant Likely <grant@secretlab.ca> | ||
6 | * John Bonesio <bones@secretlab.ca> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | /dts-v1/; | ||
15 | |||
16 | / { | ||
17 | model = "fsl,mpc5200b"; | ||
18 | compatible = "fsl,mpc5200b"; | ||
19 | #address-cells = <1>; | ||
20 | #size-cells = <1>; | ||
21 | interrupt-parent = <&mpc5200_pic>; | ||
22 | |||
23 | cpus { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | |||
27 | powerpc: PowerPC,5200@0 { | ||
28 | device_type = "cpu"; | ||
29 | reg = <0>; | ||
30 | d-cache-line-size = <32>; | ||
31 | i-cache-line-size = <32>; | ||
32 | d-cache-size = <0x4000>; // L1, 16K | ||
33 | i-cache-size = <0x4000>; // L1, 16K | ||
34 | timebase-frequency = <0>; // from bootloader | ||
35 | bus-frequency = <0>; // from bootloader | ||
36 | clock-frequency = <0>; // from bootloader | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | memory: memory { | ||
41 | device_type = "memory"; | ||
42 | reg = <0x00000000 0x04000000>; // 64MB | ||
43 | }; | ||
44 | |||
45 | soc: soc5200@f0000000 { | ||
46 | #address-cells = <1>; | ||
47 | #size-cells = <1>; | ||
48 | compatible = "fsl,mpc5200b-immr"; | ||
49 | ranges = <0 0xf0000000 0x0000c000>; | ||
50 | reg = <0xf0000000 0x00000100>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | timer@600 { // General Purpose Timer | ||
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | }; | ||
72 | |||
73 | timer@610 { // General Purpose Timer | ||
74 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
75 | reg = <0x610 0x10>; | ||
76 | interrupts = <1 10 0>; | ||
77 | }; | ||
78 | |||
79 | timer@620 { // General Purpose Timer | ||
80 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
81 | reg = <0x620 0x10>; | ||
82 | interrupts = <1 11 0>; | ||
83 | }; | ||
84 | |||
85 | timer@630 { // General Purpose Timer | ||
86 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
87 | reg = <0x630 0x10>; | ||
88 | interrupts = <1 12 0>; | ||
89 | }; | ||
90 | |||
91 | timer@640 { // General Purpose Timer | ||
92 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
93 | reg = <0x640 0x10>; | ||
94 | interrupts = <1 13 0>; | ||
95 | }; | ||
96 | |||
97 | timer@650 { // General Purpose Timer | ||
98 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
99 | reg = <0x650 0x10>; | ||
100 | interrupts = <1 14 0>; | ||
101 | }; | ||
102 | |||
103 | timer@660 { // General Purpose Timer | ||
104 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
105 | reg = <0x660 0x10>; | ||
106 | interrupts = <1 15 0>; | ||
107 | }; | ||
108 | |||
109 | timer@670 { // General Purpose Timer | ||
110 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
111 | reg = <0x670 0x10>; | ||
112 | interrupts = <1 16 0>; | ||
113 | }; | ||
114 | |||
115 | rtc@800 { // Real time clock | ||
116 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
117 | reg = <0x800 0x100>; | ||
118 | interrupts = <1 5 0 1 6 0>; | ||
119 | }; | ||
120 | |||
121 | can@900 { | ||
122 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
123 | interrupts = <2 17 0>; | ||
124 | reg = <0x900 0x80>; | ||
125 | }; | ||
126 | |||
127 | can@980 { | ||
128 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
129 | interrupts = <2 18 0>; | ||
130 | reg = <0x980 0x80>; | ||
131 | }; | ||
132 | |||
133 | gpio_simple: gpio@b00 { | ||
134 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | ||
135 | reg = <0xb00 0x40>; | ||
136 | interrupts = <1 7 0>; | ||
137 | gpio-controller; | ||
138 | #gpio-cells = <2>; | ||
139 | }; | ||
140 | |||
141 | gpio_wkup: gpio@c00 { | ||
142 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | ||
143 | reg = <0xc00 0x40>; | ||
144 | interrupts = <1 8 0 0 3 0>; | ||
145 | gpio-controller; | ||
146 | #gpio-cells = <2>; | ||
147 | }; | ||
148 | |||
149 | spi@f00 { | ||
150 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
151 | reg = <0xf00 0x20>; | ||
152 | interrupts = <2 13 0 2 14 0>; | ||
153 | }; | ||
154 | |||
155 | usb: usb@1000 { | ||
156 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | ||
157 | reg = <0x1000 0xff>; | ||
158 | interrupts = <2 6 0>; | ||
159 | }; | ||
160 | |||
161 | dma-controller@1200 { | ||
162 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
163 | reg = <0x1200 0x80>; | ||
164 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
165 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
166 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
167 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
168 | }; | ||
169 | |||
170 | xlb@1f00 { | ||
171 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | ||
172 | reg = <0x1f00 0x100>; | ||
173 | }; | ||
174 | |||
175 | psc1: psc@2000 { // PSC1 | ||
176 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
177 | reg = <0x2000 0x100>; | ||
178 | interrupts = <2 1 0>; | ||
179 | }; | ||
180 | |||
181 | psc2: psc@2200 { // PSC2 | ||
182 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
183 | reg = <0x2200 0x100>; | ||
184 | interrupts = <2 2 0>; | ||
185 | }; | ||
186 | |||
187 | psc3: psc@2400 { // PSC3 | ||
188 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
189 | reg = <0x2400 0x100>; | ||
190 | interrupts = <2 3 0>; | ||
191 | }; | ||
192 | |||
193 | psc4: psc@2600 { // PSC4 | ||
194 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
195 | reg = <0x2600 0x100>; | ||
196 | interrupts = <2 11 0>; | ||
197 | }; | ||
198 | |||
199 | psc5: psc@2800 { // PSC5 | ||
200 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
201 | reg = <0x2800 0x100>; | ||
202 | interrupts = <2 12 0>; | ||
203 | }; | ||
204 | |||
205 | psc6: psc@2c00 { // PSC6 | ||
206 | compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc"; | ||
207 | reg = <0x2c00 0x100>; | ||
208 | interrupts = <2 4 0>; | ||
209 | }; | ||
210 | |||
211 | eth0: ethernet@3000 { | ||
212 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
213 | reg = <0x3000 0x400>; | ||
214 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
215 | interrupts = <2 5 0>; | ||
216 | }; | ||
217 | |||
218 | mdio@3000 { | ||
219 | #address-cells = <1>; | ||
220 | #size-cells = <0>; | ||
221 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
222 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
223 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
224 | }; | ||
225 | |||
226 | ata@3a00 { | ||
227 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | ||
228 | reg = <0x3a00 0x100>; | ||
229 | interrupts = <2 7 0>; | ||
230 | }; | ||
231 | |||
232 | i2c@3d00 { | ||
233 | #address-cells = <1>; | ||
234 | #size-cells = <0>; | ||
235 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
236 | reg = <0x3d00 0x40>; | ||
237 | interrupts = <2 15 0>; | ||
238 | }; | ||
239 | |||
240 | i2c@3d40 { | ||
241 | #address-cells = <1>; | ||
242 | #size-cells = <0>; | ||
243 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
244 | reg = <0x3d40 0x40>; | ||
245 | interrupts = <2 16 0>; | ||
246 | }; | ||
247 | |||
248 | sram@8000 { | ||
249 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | ||
250 | reg = <0x8000 0x4000>; | ||
251 | }; | ||
252 | }; | ||
253 | |||
254 | pci: pci@f0000d00 { | ||
255 | #interrupt-cells = <1>; | ||
256 | #size-cells = <2>; | ||
257 | #address-cells = <3>; | ||
258 | device_type = "pci"; | ||
259 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
260 | reg = <0xf0000d00 0x100>; | ||
261 | // interrupt-map-mask = need to add | ||
262 | // interrupt-map = need to add | ||
263 | clock-frequency = <0>; // From boot loader | ||
264 | interrupts = <2 8 0 2 9 0 2 10 0>; | ||
265 | bus-range = <0 0>; | ||
266 | // ranges = need to add | ||
267 | }; | ||
268 | |||
269 | localbus: localbus { | ||
270 | compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus"; | ||
271 | #address-cells = <2>; | ||
272 | #size-cells = <1>; | ||
273 | ranges = <0 0 0xfc000000 0x2000000>; | ||
274 | }; | ||
275 | }; | ||
diff --git a/arch/powerpc/boot/dts/mucmc52.dts b/arch/powerpc/boot/dts/mucmc52.dts index b72a7581d798..21d34720fcc9 100644 --- a/arch/powerpc/boot/dts/mucmc52.dts +++ b/arch/powerpc/boot/dts/mucmc52.dts | |||
@@ -11,172 +11,109 @@ | |||
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /dts-v1/; | 14 | /include/ "mpc5200b.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "manroland,mucmc52"; | 17 | model = "manroland,mucmc52"; |
18 | compatible = "manroland,mucmc52"; | 18 | compatible = "manroland,mucmc52"; |
19 | #address-cells = <1>; | ||
20 | #size-cells = <1>; | ||
21 | interrupt-parent = <&mpc5200_pic>; | ||
22 | |||
23 | cpus { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | |||
27 | PowerPC,5200@0 { | ||
28 | device_type = "cpu"; | ||
29 | reg = <0>; | ||
30 | d-cache-line-size = <32>; | ||
31 | i-cache-line-size = <32>; | ||
32 | d-cache-size = <0x4000>; // L1, 16K | ||
33 | i-cache-size = <0x4000>; // L1, 16K | ||
34 | timebase-frequency = <0>; // from bootloader | ||
35 | bus-frequency = <0>; // from bootloader | ||
36 | clock-frequency = <0>; // from bootloader | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | reg = <0x00000000 0x04000000>; // 64MB | ||
43 | }; | ||
44 | 19 | ||
45 | soc5200@f0000000 { | 20 | soc5200@f0000000 { |
46 | #address-cells = <1>; | ||
47 | #size-cells = <1>; | ||
48 | compatible = "fsl,mpc5200b-immr"; | ||
49 | ranges = <0 0xf0000000 0x0000c000>; | ||
50 | reg = <0xf0000000 0x00000100>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | gpt0: timer@600 { // GPT 0 in GPIO mode | 21 | gpt0: timer@600 { // GPT 0 in GPIO mode |
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | gpio-controller; | 22 | gpio-controller; |
72 | #gpio-cells = <2>; | 23 | #gpio-cells = <2>; |
73 | }; | 24 | }; |
74 | 25 | ||
75 | gpt1: timer@610 { // General Purpose Timer in GPIO mode | 26 | gpt1: timer@610 { // General Purpose Timer in GPIO mode |
76 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
77 | reg = <0x610 0x10>; | ||
78 | interrupts = <1 10 0>; | ||
79 | gpio-controller; | 27 | gpio-controller; |
80 | #gpio-cells = <2>; | 28 | #gpio-cells = <2>; |
81 | }; | 29 | }; |
82 | 30 | ||
83 | gpt2: timer@620 { // General Purpose Timer in GPIO mode | 31 | gpt2: timer@620 { // General Purpose Timer in GPIO mode |
84 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
85 | reg = <0x620 0x10>; | ||
86 | interrupts = <1 11 0>; | ||
87 | gpio-controller; | 32 | gpio-controller; |
88 | #gpio-cells = <2>; | 33 | #gpio-cells = <2>; |
89 | }; | 34 | }; |
90 | 35 | ||
91 | gpt3: timer@630 { // General Purpose Timer in GPIO mode | 36 | gpt3: timer@630 { // General Purpose Timer in GPIO mode |
92 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
93 | reg = <0x630 0x10>; | ||
94 | interrupts = <1 12 0>; | ||
95 | gpio-controller; | 37 | gpio-controller; |
96 | #gpio-cells = <2>; | 38 | #gpio-cells = <2>; |
97 | }; | 39 | }; |
98 | 40 | ||
99 | gpio_simple: gpio@b00 { | 41 | timer@640 { |
100 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 42 | status = "disabled"; |
101 | reg = <0xb00 0x40>; | ||
102 | interrupts = <1 7 0>; | ||
103 | gpio-controller; | ||
104 | #gpio-cells = <2>; | ||
105 | }; | 43 | }; |
106 | 44 | ||
107 | gpio_wkup: gpio@c00 { | 45 | timer@650 { |
108 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | 46 | status = "disabled"; |
109 | reg = <0xc00 0x40>; | 47 | }; |
110 | interrupts = <1 8 0 0 3 0>; | 48 | |
111 | gpio-controller; | 49 | timer@660 { |
112 | #gpio-cells = <2>; | 50 | status = "disabled"; |
51 | }; | ||
52 | |||
53 | timer@670 { | ||
54 | status = "disabled"; | ||
113 | }; | 55 | }; |
114 | 56 | ||
115 | dma-controller@1200 { | 57 | rtc@800 { |
116 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | 58 | status = "disabled"; |
117 | reg = <0x1200 0x80>; | ||
118 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
119 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
120 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
121 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
122 | }; | 59 | }; |
123 | 60 | ||
124 | xlb@1f00 { | 61 | can@900 { |
125 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | 62 | status = "disabled"; |
126 | reg = <0x1f00 0x100>; | ||
127 | }; | 63 | }; |
128 | 64 | ||
129 | serial@2000 { /* PSC1 in UART mode */ | 65 | can@980 { |
66 | status = "disabled"; | ||
67 | }; | ||
68 | |||
69 | spi@f00 { | ||
70 | status = "disabled"; | ||
71 | }; | ||
72 | |||
73 | usb@1000 { | ||
74 | status = "disabled"; | ||
75 | }; | ||
76 | |||
77 | psc@2000 { // PSC1 | ||
130 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 78 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
131 | reg = <0x2000 0x100>; | ||
132 | interrupts = <2 1 0>; | ||
133 | }; | 79 | }; |
134 | 80 | ||
135 | serial@2200 { /* PSC2 in UART mode */ | 81 | psc@2200 { // PSC2 |
136 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 82 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
137 | reg = <0x2200 0x100>; | ||
138 | interrupts = <2 2 0>; | ||
139 | }; | 83 | }; |
140 | 84 | ||
141 | serial@2c00 { /* PSC6 in UART mode */ | 85 | psc@2400 { // PSC3 |
86 | status = "disabled"; | ||
87 | }; | ||
88 | |||
89 | psc@2600 { // PSC4 | ||
90 | status = "disabled"; | ||
91 | }; | ||
92 | |||
93 | psc@2800 { // PSC5 | ||
94 | status = "disabled"; | ||
95 | }; | ||
96 | |||
97 | psc@2c00 { // PSC6 | ||
142 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 98 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
143 | reg = <0x2c00 0x100>; | ||
144 | interrupts = <2 4 0>; | ||
145 | }; | 99 | }; |
146 | 100 | ||
147 | ethernet@3000 { | 101 | ethernet@3000 { |
148 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
149 | reg = <0x3000 0x400>; | ||
150 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
151 | interrupts = <2 5 0>; | ||
152 | phy-handle = <&phy0>; | 102 | phy-handle = <&phy0>; |
153 | }; | 103 | }; |
154 | 104 | ||
155 | mdio@3000 { | 105 | mdio@3000 { |
156 | #address-cells = <1>; | ||
157 | #size-cells = <0>; | ||
158 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
159 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
160 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
161 | |||
162 | phy0: ethernet-phy@0 { | 106 | phy0: ethernet-phy@0 { |
163 | compatible = "intel,lxt971"; | 107 | compatible = "intel,lxt971"; |
164 | reg = <0>; | 108 | reg = <0>; |
165 | }; | 109 | }; |
166 | }; | 110 | }; |
167 | 111 | ||
168 | ata@3a00 { | 112 | i2c@3d00 { |
169 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | 113 | status = "disabled"; |
170 | reg = <0x3a00 0x100>; | ||
171 | interrupts = <2 7 0>; | ||
172 | }; | 114 | }; |
173 | 115 | ||
174 | i2c@3d40 { | 116 | i2c@3d40 { |
175 | #address-cells = <1>; | ||
176 | #size-cells = <0>; | ||
177 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
178 | reg = <0x3d40 0x40>; | ||
179 | interrupts = <2 16 0>; | ||
180 | hwmon@2c { | 117 | hwmon@2c { |
181 | compatible = "ad,adm9240"; | 118 | compatible = "ad,adm9240"; |
182 | reg = <0x2c>; | 119 | reg = <0x2c>; |
@@ -186,20 +123,9 @@ | |||
186 | reg = <0x51>; | 123 | reg = <0x51>; |
187 | }; | 124 | }; |
188 | }; | 125 | }; |
189 | |||
190 | sram@8000 { | ||
191 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | ||
192 | reg = <0x8000 0x4000>; | ||
193 | }; | ||
194 | }; | 126 | }; |
195 | 127 | ||
196 | pci@f0000d00 { | 128 | pci@f0000d00 { |
197 | #interrupt-cells = <1>; | ||
198 | #size-cells = <2>; | ||
199 | #address-cells = <3>; | ||
200 | device_type = "pci"; | ||
201 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
202 | reg = <0xf0000d00 0x100>; | ||
203 | interrupt-map-mask = <0xf800 0 0 7>; | 129 | interrupt-map-mask = <0xf800 0 0 7>; |
204 | interrupt-map = < | 130 | interrupt-map = < |
205 | /* IDSEL 0x10 */ | 131 | /* IDSEL 0x10 */ |
@@ -208,20 +134,12 @@ | |||
208 | 0x8000 0 0 3 &mpc5200_pic 0 2 3 | 134 | 0x8000 0 0 3 &mpc5200_pic 0 2 3 |
209 | 0x8000 0 0 4 &mpc5200_pic 0 1 3 | 135 | 0x8000 0 0 4 &mpc5200_pic 0 1 3 |
210 | >; | 136 | >; |
211 | clock-frequency = <0>; // From boot loader | ||
212 | interrupts = <2 8 0 2 9 0 2 10 0>; | ||
213 | bus-range = <0 0>; | ||
214 | ranges = <0x42000000 0 0x60000000 0x60000000 0 0x10000000 | 137 | ranges = <0x42000000 0 0x60000000 0x60000000 0 0x10000000 |
215 | 0x02000000 0 0x90000000 0x90000000 0 0x10000000 | 138 | 0x02000000 0 0x90000000 0x90000000 0 0x10000000 |
216 | 0x01000000 0 0x00000000 0xa0000000 0 0x01000000>; | 139 | 0x01000000 0 0x00000000 0xa0000000 0 0x01000000>; |
217 | }; | 140 | }; |
218 | 141 | ||
219 | localbus { | 142 | localbus { |
220 | compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus"; | ||
221 | |||
222 | #address-cells = <2>; | ||
223 | #size-cells = <1>; | ||
224 | |||
225 | ranges = <0 0 0xff800000 0x00800000 | 143 | ranges = <0 0 0xff800000 0x00800000 |
226 | 1 0 0x80000000 0x00800000 | 144 | 1 0 0x80000000 0x00800000 |
227 | 3 0 0x80000000 0x00800000>; | 145 | 3 0 0x80000000 0x00800000>; |
diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts index 8a4ec30b21ae..9e354997eb7e 100644 --- a/arch/powerpc/boot/dts/pcm030.dts +++ b/arch/powerpc/boot/dts/pcm030.dts | |||
@@ -12,246 +12,92 @@ | |||
12 | * option) any later version. | 12 | * option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /dts-v1/; | 15 | /include/ "mpc5200b.dtsi" |
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "phytec,pcm030"; | 18 | model = "phytec,pcm030"; |
19 | compatible = "phytec,pcm030"; | 19 | compatible = "phytec,pcm030"; |
20 | #address-cells = <1>; | ||
21 | #size-cells = <1>; | ||
22 | interrupt-parent = <&mpc5200_pic>; | ||
23 | |||
24 | cpus { | ||
25 | #address-cells = <1>; | ||
26 | #size-cells = <0>; | ||
27 | |||
28 | PowerPC,5200@0 { | ||
29 | device_type = "cpu"; | ||
30 | reg = <0>; | ||
31 | d-cache-line-size = <32>; | ||
32 | i-cache-line-size = <32>; | ||
33 | d-cache-size = <0x4000>; // L1, 16K | ||
34 | i-cache-size = <0x4000>; // L1, 16K | ||
35 | timebase-frequency = <0>; // from bootloader | ||
36 | bus-frequency = <0>; // from bootloader | ||
37 | clock-frequency = <0>; // from bootloader | ||
38 | }; | ||
39 | }; | ||
40 | |||
41 | memory { | ||
42 | device_type = "memory"; | ||
43 | reg = <0x00000000 0x04000000>; // 64MB | ||
44 | }; | ||
45 | 20 | ||
46 | soc5200@f0000000 { | 21 | soc5200@f0000000 { |
47 | #address-cells = <1>; | 22 | timer@600 { // General Purpose Timer |
48 | #size-cells = <1>; | ||
49 | compatible = "fsl,mpc5200b-immr"; | ||
50 | ranges = <0 0xf0000000 0x0000c000>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | timer@600 { // General Purpose Timer | ||
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | fsl,has-wdt; | 23 | fsl,has-wdt; |
72 | }; | 24 | }; |
73 | 25 | ||
74 | timer@610 { // General Purpose Timer | ||
75 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
76 | reg = <0x610 0x10>; | ||
77 | interrupts = <1 10 0>; | ||
78 | }; | ||
79 | |||
80 | gpt2: timer@620 { // General Purpose Timer in GPIO mode | 26 | gpt2: timer@620 { // General Purpose Timer in GPIO mode |
81 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 27 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
82 | reg = <0x620 0x10>; | ||
83 | interrupts = <1 11 0>; | ||
84 | gpio-controller; | 28 | gpio-controller; |
85 | #gpio-cells = <2>; | 29 | #gpio-cells = <2>; |
86 | }; | 30 | }; |
87 | 31 | ||
88 | gpt3: timer@630 { // General Purpose Timer in GPIO mode | 32 | gpt3: timer@630 { // General Purpose Timer in GPIO mode |
89 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 33 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
90 | reg = <0x630 0x10>; | ||
91 | interrupts = <1 12 0>; | ||
92 | gpio-controller; | 34 | gpio-controller; |
93 | #gpio-cells = <2>; | 35 | #gpio-cells = <2>; |
94 | }; | 36 | }; |
95 | 37 | ||
96 | gpt4: timer@640 { // General Purpose Timer in GPIO mode | 38 | gpt4: timer@640 { // General Purpose Timer in GPIO mode |
97 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 39 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
98 | reg = <0x640 0x10>; | ||
99 | interrupts = <1 13 0>; | ||
100 | gpio-controller; | 40 | gpio-controller; |
101 | #gpio-cells = <2>; | 41 | #gpio-cells = <2>; |
102 | }; | 42 | }; |
103 | 43 | ||
104 | gpt5: timer@650 { // General Purpose Timer in GPIO mode | 44 | gpt5: timer@650 { // General Purpose Timer in GPIO mode |
105 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 45 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
106 | reg = <0x650 0x10>; | ||
107 | interrupts = <1 14 0>; | ||
108 | gpio-controller; | 46 | gpio-controller; |
109 | #gpio-cells = <2>; | 47 | #gpio-cells = <2>; |
110 | }; | 48 | }; |
111 | 49 | ||
112 | gpt6: timer@660 { // General Purpose Timer in GPIO mode | 50 | gpt6: timer@660 { // General Purpose Timer in GPIO mode |
113 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 51 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
114 | reg = <0x660 0x10>; | ||
115 | interrupts = <1 15 0>; | ||
116 | gpio-controller; | 52 | gpio-controller; |
117 | #gpio-cells = <2>; | 53 | #gpio-cells = <2>; |
118 | }; | 54 | }; |
119 | 55 | ||
120 | gpt7: timer@670 { // General Purpose Timer in GPIO mode | 56 | gpt7: timer@670 { // General Purpose Timer in GPIO mode |
121 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; | 57 | compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio"; |
122 | reg = <0x670 0x10>; | ||
123 | interrupts = <1 16 0>; | ||
124 | gpio-controller; | ||
125 | #gpio-cells = <2>; | ||
126 | }; | ||
127 | |||
128 | rtc@800 { // Real time clock | ||
129 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
130 | reg = <0x800 0x100>; | ||
131 | interrupts = <1 5 0 1 6 0>; | ||
132 | }; | ||
133 | |||
134 | can@900 { | ||
135 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
136 | interrupts = <2 17 0>; | ||
137 | reg = <0x900 0x80>; | ||
138 | }; | ||
139 | |||
140 | can@980 { | ||
141 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
142 | interrupts = <2 18 0>; | ||
143 | reg = <0x980 0x80>; | ||
144 | }; | ||
145 | |||
146 | gpio_simple: gpio@b00 { | ||
147 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | ||
148 | reg = <0xb00 0x40>; | ||
149 | interrupts = <1 7 0>; | ||
150 | gpio-controller; | 58 | gpio-controller; |
151 | #gpio-cells = <2>; | 59 | #gpio-cells = <2>; |
152 | }; | 60 | }; |
153 | 61 | ||
154 | gpio_wkup: gpio@c00 { | 62 | psc@2000 { /* PSC1 in ac97 mode */ |
155 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | ||
156 | reg = <0xc00 0x40>; | ||
157 | interrupts = <1 8 0 0 3 0>; | ||
158 | gpio-controller; | ||
159 | #gpio-cells = <2>; | ||
160 | }; | ||
161 | |||
162 | spi@f00 { | ||
163 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
164 | reg = <0xf00 0x20>; | ||
165 | interrupts = <2 13 0 2 14 0>; | ||
166 | }; | ||
167 | |||
168 | usb@1000 { | ||
169 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | ||
170 | reg = <0x1000 0xff>; | ||
171 | interrupts = <2 6 0>; | ||
172 | }; | ||
173 | |||
174 | dma-controller@1200 { | ||
175 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
176 | reg = <0x1200 0x80>; | ||
177 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
178 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
179 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
180 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
181 | }; | ||
182 | |||
183 | xlb@1f00 { | ||
184 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | ||
185 | reg = <0x1f00 0x100>; | ||
186 | }; | ||
187 | |||
188 | ac97@2000 { /* PSC1 in ac97 mode */ | ||
189 | compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97"; | 63 | compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97"; |
190 | cell-index = <0>; | 64 | cell-index = <0>; |
191 | reg = <0x2000 0x100>; | ||
192 | interrupts = <2 1 0>; | ||
193 | }; | 65 | }; |
194 | 66 | ||
195 | /* PSC2 port is used by CAN1/2 */ | 67 | /* PSC2 port is used by CAN1/2 */ |
68 | psc@2200 { | ||
69 | status = "disabled"; | ||
70 | }; | ||
196 | 71 | ||
197 | serial@2400 { /* PSC3 in UART mode */ | 72 | psc@2400 { /* PSC3 in UART mode */ |
198 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 73 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
199 | cell-index = <2>; | ||
200 | reg = <0x2400 0x100>; | ||
201 | interrupts = <2 3 0>; | ||
202 | }; | 74 | }; |
203 | 75 | ||
204 | /* PSC4 is ??? */ | 76 | /* PSC4 is ??? */ |
77 | psc@2600 { | ||
78 | status = "disabled"; | ||
79 | }; | ||
205 | 80 | ||
206 | /* PSC5 is ??? */ | 81 | /* PSC5 is ??? */ |
82 | psc@2800 { | ||
83 | status = "disabled"; | ||
84 | }; | ||
207 | 85 | ||
208 | serial@2c00 { /* PSC6 in UART mode */ | 86 | psc@2c00 { /* PSC6 in UART mode */ |
209 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 87 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
210 | cell-index = <5>; | ||
211 | reg = <0x2c00 0x100>; | ||
212 | interrupts = <2 4 0>; | ||
213 | }; | 88 | }; |
214 | 89 | ||
215 | ethernet@3000 { | 90 | ethernet@3000 { |
216 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
217 | reg = <0x3000 0x400>; | ||
218 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
219 | interrupts = <2 5 0>; | ||
220 | phy-handle = <&phy0>; | 91 | phy-handle = <&phy0>; |
221 | }; | 92 | }; |
222 | 93 | ||
223 | mdio@3000 { | 94 | mdio@3000 { |
224 | #address-cells = <1>; | ||
225 | #size-cells = <0>; | ||
226 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
227 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
228 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
229 | |||
230 | phy0: ethernet-phy@0 { | 95 | phy0: ethernet-phy@0 { |
231 | reg = <0>; | 96 | reg = <0>; |
232 | }; | 97 | }; |
233 | }; | 98 | }; |
234 | 99 | ||
235 | ata@3a00 { | ||
236 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | ||
237 | reg = <0x3a00 0x100>; | ||
238 | interrupts = <2 7 0>; | ||
239 | }; | ||
240 | |||
241 | i2c@3d00 { | ||
242 | #address-cells = <1>; | ||
243 | #size-cells = <0>; | ||
244 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
245 | reg = <0x3d00 0x40>; | ||
246 | interrupts = <2 15 0>; | ||
247 | }; | ||
248 | |||
249 | i2c@3d40 { | 100 | i2c@3d40 { |
250 | #address-cells = <1>; | ||
251 | #size-cells = <0>; | ||
252 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
253 | reg = <0x3d40 0x40>; | ||
254 | interrupts = <2 16 0>; | ||
255 | rtc@51 { | 101 | rtc@51 { |
256 | compatible = "nxp,pcf8563"; | 102 | compatible = "nxp,pcf8563"; |
257 | reg = <0x51>; | 103 | reg = <0x51>; |
@@ -259,6 +105,7 @@ | |||
259 | eeprom@52 { | 105 | eeprom@52 { |
260 | compatible = "catalyst,24c32"; | 106 | compatible = "catalyst,24c32"; |
261 | reg = <0x52>; | 107 | reg = <0x52>; |
108 | pagesize = <32>; | ||
262 | }; | 109 | }; |
263 | }; | 110 | }; |
264 | 111 | ||
@@ -269,12 +116,6 @@ | |||
269 | }; | 116 | }; |
270 | 117 | ||
271 | pci@f0000d00 { | 118 | pci@f0000d00 { |
272 | #interrupt-cells = <1>; | ||
273 | #size-cells = <2>; | ||
274 | #address-cells = <3>; | ||
275 | device_type = "pci"; | ||
276 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
277 | reg = <0xf0000d00 0x100>; | ||
278 | interrupt-map-mask = <0xf800 0 0 7>; | 119 | interrupt-map-mask = <0xf800 0 0 7>; |
279 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot | 120 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot |
280 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 | 121 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 |
@@ -285,11 +126,12 @@ | |||
285 | 0xc800 0 0 2 &mpc5200_pic 1 2 3 | 126 | 0xc800 0 0 2 &mpc5200_pic 1 2 3 |
286 | 0xc800 0 0 3 &mpc5200_pic 1 3 3 | 127 | 0xc800 0 0 3 &mpc5200_pic 1 3 3 |
287 | 0xc800 0 0 4 &mpc5200_pic 0 0 3>; | 128 | 0xc800 0 0 4 &mpc5200_pic 0 0 3>; |
288 | clock-frequency = <0>; // From boot loader | ||
289 | interrupts = <2 8 0 2 9 0 2 10 0>; | ||
290 | bus-range = <0 0>; | ||
291 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 | 129 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 |
292 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 | 130 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 |
293 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; | 131 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; |
294 | }; | 132 | }; |
133 | |||
134 | localbus { | ||
135 | status = "disabled"; | ||
136 | }; | ||
295 | }; | 137 | }; |
diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts index 85d857a5d46e..1dd478bfff96 100644 --- a/arch/powerpc/boot/dts/pcm032.dts +++ b/arch/powerpc/boot/dts/pcm032.dts | |||
@@ -12,99 +12,37 @@ | |||
12 | * option) any later version. | 12 | * option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /dts-v1/; | 15 | /include/ "mpc5200b.dtsi" |
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "phytec,pcm032"; | 18 | model = "phytec,pcm032"; |
19 | compatible = "phytec,pcm032"; | 19 | compatible = "phytec,pcm032"; |
20 | #address-cells = <1>; | ||
21 | #size-cells = <1>; | ||
22 | interrupt-parent = <&mpc5200_pic>; | ||
23 | |||
24 | cpus { | ||
25 | #address-cells = <1>; | ||
26 | #size-cells = <0>; | ||
27 | |||
28 | PowerPC,5200@0 { | ||
29 | device_type = "cpu"; | ||
30 | reg = <0>; | ||
31 | d-cache-line-size = <32>; | ||
32 | i-cache-line-size = <32>; | ||
33 | d-cache-size = <0x4000>; // L1, 16K | ||
34 | i-cache-size = <0x4000>; // L1, 16K | ||
35 | timebase-frequency = <0>; // from bootloader | ||
36 | bus-frequency = <0>; // from bootloader | ||
37 | clock-frequency = <0>; // from bootloader | ||
38 | }; | ||
39 | }; | ||
40 | 20 | ||
41 | memory { | 21 | memory { |
42 | device_type = "memory"; | ||
43 | reg = <0x00000000 0x08000000>; // 128MB | 22 | reg = <0x00000000 0x08000000>; // 128MB |
44 | }; | 23 | }; |
45 | 24 | ||
46 | soc5200@f0000000 { | 25 | soc5200@f0000000 { |
47 | #address-cells = <1>; | 26 | timer@600 { // General Purpose Timer |
48 | #size-cells = <1>; | ||
49 | compatible = "fsl,mpc5200b-immr"; | ||
50 | ranges = <0 0xf0000000 0x0000c000>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | timer@600 { // General Purpose Timer | ||
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | fsl,has-wdt; | 27 | fsl,has-wdt; |
72 | }; | 28 | }; |
73 | 29 | ||
74 | timer@610 { // General Purpose Timer | ||
75 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
76 | reg = <0x610 0x10>; | ||
77 | interrupts = <1 10 0>; | ||
78 | }; | ||
79 | |||
80 | gpt2: timer@620 { // General Purpose Timer in GPIO mode | 30 | gpt2: timer@620 { // General Purpose Timer in GPIO mode |
81 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
82 | reg = <0x620 0x10>; | ||
83 | interrupts = <1 11 0>; | ||
84 | gpio-controller; | 31 | gpio-controller; |
85 | #gpio-cells = <2>; | 32 | #gpio-cells = <2>; |
86 | }; | 33 | }; |
87 | 34 | ||
88 | gpt3: timer@630 { // General Purpose Timer in GPIO mode | 35 | gpt3: timer@630 { // General Purpose Timer in GPIO mode |
89 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
90 | reg = <0x630 0x10>; | ||
91 | interrupts = <1 12 0>; | ||
92 | gpio-controller; | 36 | gpio-controller; |
93 | #gpio-cells = <2>; | 37 | #gpio-cells = <2>; |
94 | }; | 38 | }; |
95 | 39 | ||
96 | gpt4: timer@640 { // General Purpose Timer in GPIO mode | 40 | gpt4: timer@640 { // General Purpose Timer in GPIO mode |
97 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
98 | reg = <0x640 0x10>; | ||
99 | interrupts = <1 13 0>; | ||
100 | gpio-controller; | 41 | gpio-controller; |
101 | #gpio-cells = <2>; | 42 | #gpio-cells = <2>; |
102 | }; | 43 | }; |
103 | 44 | ||
104 | gpt5: timer@650 { // General Purpose Timer in GPIO mode | 45 | gpt5: timer@650 { // General Purpose Timer in GPIO mode |
105 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
106 | reg = <0x650 0x10>; | ||
107 | interrupts = <1 14 0>; | ||
108 | gpio-controller; | 46 | gpio-controller; |
109 | #gpio-cells = <2>; | 47 | #gpio-cells = <2>; |
110 | }; | 48 | }; |
@@ -118,163 +56,62 @@ | |||
118 | }; | 56 | }; |
119 | 57 | ||
120 | gpt7: timer@670 { // General Purpose Timer in GPIO mode | 58 | gpt7: timer@670 { // General Purpose Timer in GPIO mode |
121 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
122 | reg = <0x670 0x10>; | ||
123 | interrupts = <1 16 0>; | ||
124 | gpio-controller; | 59 | gpio-controller; |
125 | #gpio-cells = <2>; | 60 | #gpio-cells = <2>; |
126 | }; | 61 | }; |
127 | 62 | ||
128 | rtc@800 { // Real time clock | 63 | psc@2000 { /* PSC1 is ac97 */ |
129 | compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc"; | ||
130 | reg = <0x800 0x100>; | ||
131 | interrupts = <1 5 0 1 6 0>; | ||
132 | }; | ||
133 | |||
134 | can@900 { | ||
135 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
136 | interrupts = <2 17 0>; | ||
137 | reg = <0x900 0x80>; | ||
138 | }; | ||
139 | |||
140 | can@980 { | ||
141 | compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan"; | ||
142 | interrupts = <2 18 0>; | ||
143 | reg = <0x980 0x80>; | ||
144 | }; | ||
145 | |||
146 | gpio_simple: gpio@b00 { | ||
147 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | ||
148 | reg = <0xb00 0x40>; | ||
149 | interrupts = <1 7 0>; | ||
150 | gpio-controller; | ||
151 | #gpio-cells = <2>; | ||
152 | }; | ||
153 | |||
154 | gpio_wkup: gpio@c00 { | ||
155 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | ||
156 | reg = <0xc00 0x40>; | ||
157 | interrupts = <1 8 0 0 3 0>; | ||
158 | gpio-controller; | ||
159 | #gpio-cells = <2>; | ||
160 | }; | ||
161 | |||
162 | spi@f00 { | ||
163 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
164 | reg = <0xf00 0x20>; | ||
165 | interrupts = <2 13 0 2 14 0>; | ||
166 | }; | ||
167 | |||
168 | usb@1000 { | ||
169 | compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be"; | ||
170 | reg = <0x1000 0xff>; | ||
171 | interrupts = <2 6 0>; | ||
172 | }; | ||
173 | |||
174 | dma-controller@1200 { | ||
175 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | ||
176 | reg = <0x1200 0x80>; | ||
177 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
178 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
179 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
180 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
181 | }; | ||
182 | |||
183 | xlb@1f00 { | ||
184 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | ||
185 | reg = <0x1f00 0x100>; | ||
186 | }; | ||
187 | |||
188 | ac97@2000 { /* PSC1 is ac97 */ | ||
189 | compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97"; | 64 | compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97"; |
190 | cell-index = <0>; | 65 | cell-index = <0>; |
191 | reg = <0x2000 0x100>; | ||
192 | interrupts = <2 1 0>; | ||
193 | }; | 66 | }; |
194 | 67 | ||
195 | /* PSC2 port is used by CAN1/2 */ | 68 | /* PSC2 port is used by CAN1/2 */ |
69 | psc@2200 { | ||
70 | status = "disabled"; | ||
71 | }; | ||
196 | 72 | ||
197 | serial@2400 { /* PSC3 in UART mode */ | 73 | psc@2400 { /* PSC3 in UART mode */ |
198 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 74 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
199 | cell-index = <2>; | ||
200 | reg = <0x2400 0x100>; | ||
201 | interrupts = <2 3 0>; | ||
202 | }; | 75 | }; |
203 | 76 | ||
204 | /* PSC4 is ??? */ | 77 | /* PSC4 is ??? */ |
78 | psc@2600 { | ||
79 | status = "disabled"; | ||
80 | }; | ||
205 | 81 | ||
206 | /* PSC5 is ??? */ | 82 | /* PSC5 is ??? */ |
83 | psc@2800 { | ||
84 | status = "disabled"; | ||
85 | }; | ||
207 | 86 | ||
208 | serial@2c00 { /* PSC6 in UART mode */ | 87 | psc@2c00 { /* PSC6 in UART mode */ |
209 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 88 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
210 | cell-index = <5>; | ||
211 | reg = <0x2c00 0x100>; | ||
212 | interrupts = <2 4 0>; | ||
213 | }; | 89 | }; |
214 | 90 | ||
215 | ethernet@3000 { | 91 | ethernet@3000 { |
216 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
217 | reg = <0x3000 0x400>; | ||
218 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
219 | interrupts = <2 5 0>; | ||
220 | phy-handle = <&phy0>; | 92 | phy-handle = <&phy0>; |
221 | }; | 93 | }; |
222 | 94 | ||
223 | mdio@3000 { | 95 | mdio@3000 { |
224 | #address-cells = <1>; | ||
225 | #size-cells = <0>; | ||
226 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
227 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
228 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
229 | |||
230 | phy0: ethernet-phy@0 { | 96 | phy0: ethernet-phy@0 { |
231 | reg = <0>; | 97 | reg = <0>; |
232 | }; | 98 | }; |
233 | }; | 99 | }; |
234 | 100 | ||
235 | ata@3a00 { | ||
236 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | ||
237 | reg = <0x3a00 0x100>; | ||
238 | interrupts = <2 7 0>; | ||
239 | }; | ||
240 | |||
241 | i2c@3d00 { | ||
242 | #address-cells = <1>; | ||
243 | #size-cells = <0>; | ||
244 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
245 | reg = <0x3d00 0x40>; | ||
246 | interrupts = <2 15 0>; | ||
247 | }; | ||
248 | |||
249 | i2c@3d40 { | 101 | i2c@3d40 { |
250 | #address-cells = <1>; | ||
251 | #size-cells = <0>; | ||
252 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
253 | reg = <0x3d40 0x40>; | ||
254 | interrupts = <2 16 0>; | ||
255 | rtc@51 { | 102 | rtc@51 { |
256 | compatible = "nxp,pcf8563"; | 103 | compatible = "nxp,pcf8563"; |
257 | reg = <0x51>; | 104 | reg = <0x51>; |
258 | }; | 105 | }; |
259 | eeprom@52 { | 106 | eeprom@52 { |
260 | compatible = "at24,24c32"; | 107 | compatible = "catalyst,24c32"; |
261 | reg = <0x52>; | 108 | reg = <0x52>; |
109 | pagesize = <32>; | ||
262 | }; | 110 | }; |
263 | }; | 111 | }; |
264 | |||
265 | sram@8000 { | ||
266 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | ||
267 | reg = <0x8000 0x4000>; | ||
268 | }; | ||
269 | }; | 112 | }; |
270 | 113 | ||
271 | pci@f0000d00 { | 114 | pci@f0000d00 { |
272 | #interrupt-cells = <1>; | ||
273 | #size-cells = <2>; | ||
274 | #address-cells = <3>; | ||
275 | device_type = "pci"; | ||
276 | compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci"; | ||
277 | reg = <0xf0000d00 0x100>; | ||
278 | interrupt-map-mask = <0xf800 0 0 7>; | 115 | interrupt-map-mask = <0xf800 0 0 7>; |
279 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot | 116 | interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot |
280 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 | 117 | 0xc000 0 0 2 &mpc5200_pic 1 1 3 |
@@ -285,20 +122,12 @@ | |||
285 | 0xc800 0 0 2 &mpc5200_pic 1 2 3 | 122 | 0xc800 0 0 2 &mpc5200_pic 1 2 3 |
286 | 0xc800 0 0 3 &mpc5200_pic 1 3 3 | 123 | 0xc800 0 0 3 &mpc5200_pic 1 3 3 |
287 | 0xc800 0 0 4 &mpc5200_pic 0 0 3>; | 124 | 0xc800 0 0 4 &mpc5200_pic 0 0 3>; |
288 | clock-frequency = <0>; // From boot loader | ||
289 | interrupts = <2 8 0 2 9 0 2 10 0>; | ||
290 | bus-range = <0 0>; | ||
291 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 | 125 | ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000 |
292 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 | 126 | 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 |
293 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; | 127 | 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; |
294 | }; | 128 | }; |
295 | 129 | ||
296 | localbus { | 130 | localbus { |
297 | compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus"; | ||
298 | |||
299 | #address-cells = <2>; | ||
300 | #size-cells = <1>; | ||
301 | |||
302 | ranges = <0 0 0xfe000000 0x02000000 | 131 | ranges = <0 0 0xfe000000 0x02000000 |
303 | 1 0 0xfc000000 0x02000000 | 132 | 1 0 0xfc000000 0x02000000 |
304 | 2 0 0xfbe00000 0x00200000 | 133 | 2 0 0xfbe00000 0x00200000 |
@@ -351,40 +180,39 @@ | |||
351 | bank-width = <2>; | 180 | bank-width = <2>; |
352 | }; | 181 | }; |
353 | 182 | ||
354 | /* | 183 | /* |
355 | * example snippets for FPGA | 184 | * example snippets for FPGA |
356 | * | 185 | * |
357 | * fpga@3,0 { | 186 | * fpga@3,0 { |
358 | * compatible = "fpga_driver"; | 187 | * compatible = "fpga_driver"; |
359 | * reg = <3 0 0x02000000>; | 188 | * reg = <3 0 0x02000000>; |
360 | * bank-width = <4>; | 189 | * bank-width = <4>; |
361 | * }; | 190 | * }; |
362 | * | 191 | * |
363 | * fpga@4,0 { | 192 | * fpga@4,0 { |
364 | * compatible = "fpga_driver"; | 193 | * compatible = "fpga_driver"; |
365 | * reg = <4 0 0x02000000>; | 194 | * reg = <4 0 0x02000000>; |
366 | * bank-width = <4>; | 195 | * bank-width = <4>; |
367 | * }; | 196 | * }; |
368 | */ | 197 | */ |
369 | 198 | ||
370 | /* | 199 | /* |
371 | * example snippets for free chipselects | 200 | * example snippets for free chipselects |
372 | * | 201 | * |
373 | * device@5,0 { | 202 | * device@5,0 { |
374 | * compatible = "custom_driver"; | 203 | * compatible = "custom_driver"; |
375 | * reg = <5 0 0x02000000>; | 204 | * reg = <5 0 0x02000000>; |
376 | * }; | 205 | * }; |
377 | * | 206 | * |
378 | * device@6,0 { | 207 | * device@6,0 { |
379 | * compatible = "custom_driver"; | 208 | * compatible = "custom_driver"; |
380 | * reg = <6 0 0x02000000>; | 209 | * reg = <6 0 0x02000000>; |
381 | * }; | 210 | * }; |
382 | * | 211 | * |
383 | * device@7,0 { | 212 | * device@7,0 { |
384 | * compatible = "custom_driver"; | 213 | * compatible = "custom_driver"; |
385 | * reg = <7 0 0x02000000>; | 214 | * reg = <7 0 0x02000000>; |
386 | * }; | 215 | * }; |
387 | */ | 216 | */ |
388 | }; | 217 | }; |
389 | }; | 218 | }; |
390 | |||
diff --git a/arch/powerpc/boot/dts/uc101.dts b/arch/powerpc/boot/dts/uc101.dts index 019264c62904..ba83d5488ec6 100644 --- a/arch/powerpc/boot/dts/uc101.dts +++ b/arch/powerpc/boot/dts/uc101.dts | |||
@@ -11,79 +11,24 @@ | |||
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /dts-v1/; | 14 | /include/ "mpc5200b.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "manroland,uc101"; | 17 | model = "manroland,uc101"; |
18 | compatible = "manroland,uc101"; | 18 | compatible = "manroland,uc101"; |
19 | #address-cells = <1>; | ||
20 | #size-cells = <1>; | ||
21 | interrupt-parent = <&mpc5200_pic>; | ||
22 | |||
23 | cpus { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | |||
27 | PowerPC,5200@0 { | ||
28 | device_type = "cpu"; | ||
29 | reg = <0>; | ||
30 | d-cache-line-size = <32>; | ||
31 | i-cache-line-size = <32>; | ||
32 | d-cache-size = <0x4000>; // L1, 16K | ||
33 | i-cache-size = <0x4000>; // L1, 16K | ||
34 | timebase-frequency = <0>; // from bootloader | ||
35 | bus-frequency = <0>; // from bootloader | ||
36 | clock-frequency = <0>; // from bootloader | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | reg = <0x00000000 0x04000000>; // 64MB | ||
43 | }; | ||
44 | 19 | ||
45 | soc5200@f0000000 { | 20 | soc5200@f0000000 { |
46 | #address-cells = <1>; | ||
47 | #size-cells = <1>; | ||
48 | compatible = "fsl,mpc5200b-immr"; | ||
49 | ranges = <0 0xf0000000 0x0000c000>; | ||
50 | reg = <0xf0000000 0x00000100>; | ||
51 | bus-frequency = <0>; // from bootloader | ||
52 | system-frequency = <0>; // from bootloader | ||
53 | |||
54 | cdm@200 { | ||
55 | compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm"; | ||
56 | reg = <0x200 0x38>; | ||
57 | }; | ||
58 | |||
59 | mpc5200_pic: interrupt-controller@500 { | ||
60 | // 5200 interrupts are encoded into two levels; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <3>; | ||
63 | compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic"; | ||
64 | reg = <0x500 0x80>; | ||
65 | }; | ||
66 | |||
67 | gpt0: timer@600 { // General Purpose Timer in GPIO mode | 21 | gpt0: timer@600 { // General Purpose Timer in GPIO mode |
68 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
69 | reg = <0x600 0x10>; | ||
70 | interrupts = <1 9 0>; | ||
71 | gpio-controller; | 22 | gpio-controller; |
72 | #gpio-cells = <2>; | 23 | #gpio-cells = <2>; |
73 | }; | 24 | }; |
74 | 25 | ||
75 | gpt1: timer@610 { // General Purpose Timer in GPIO mode | 26 | gpt1: timer@610 { // General Purpose Timer in GPIO mode |
76 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
77 | reg = <0x610 0x10>; | ||
78 | interrupts = <1 10 0>; | ||
79 | gpio-controller; | 27 | gpio-controller; |
80 | #gpio-cells = <2>; | 28 | #gpio-cells = <2>; |
81 | }; | 29 | }; |
82 | 30 | ||
83 | gpt2: timer@620 { // General Purpose Timer in GPIO mode | 31 | gpt2: timer@620 { // General Purpose Timer in GPIO mode |
84 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
85 | reg = <0x620 0x10>; | ||
86 | interrupts = <1 11 0>; | ||
87 | gpio-controller; | 32 | gpio-controller; |
88 | #gpio-cells = <2>; | 33 | #gpio-cells = <2>; |
89 | }; | 34 | }; |
@@ -97,118 +42,85 @@ | |||
97 | }; | 42 | }; |
98 | 43 | ||
99 | gpt4: timer@640 { // General Purpose Timer in GPIO mode | 44 | gpt4: timer@640 { // General Purpose Timer in GPIO mode |
100 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
101 | reg = <0x640 0x10>; | ||
102 | interrupts = <1 13 0>; | ||
103 | gpio-controller; | 45 | gpio-controller; |
104 | #gpio-cells = <2>; | 46 | #gpio-cells = <2>; |
105 | }; | 47 | }; |
106 | 48 | ||
107 | gpt5: timer@650 { // General Purpose Timer in GPIO mode | 49 | gpt5: timer@650 { // General Purpose Timer in GPIO mode |
108 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
109 | reg = <0x650 0x10>; | ||
110 | interrupts = <1 14 0>; | ||
111 | gpio-controller; | 50 | gpio-controller; |
112 | #gpio-cells = <2>; | 51 | #gpio-cells = <2>; |
113 | }; | 52 | }; |
114 | 53 | ||
115 | gpt6: timer@660 { // General Purpose Timer in GPIO mode | 54 | gpt6: timer@660 { // General Purpose Timer in GPIO mode |
116 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
117 | reg = <0x660 0x10>; | ||
118 | interrupts = <1 15 0>; | ||
119 | gpio-controller; | 55 | gpio-controller; |
120 | #gpio-cells = <2>; | 56 | #gpio-cells = <2>; |
121 | }; | 57 | }; |
122 | 58 | ||
123 | gpt7: timer@670 { // General Purpose Timer in GPIO mode | 59 | gpt7: timer@670 { // General Purpose Timer in GPIO mode |
124 | compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt"; | ||
125 | reg = <0x670 0x10>; | ||
126 | interrupts = <1 16 0>; | ||
127 | gpio-controller; | 60 | gpio-controller; |
128 | #gpio-cells = <2>; | 61 | #gpio-cells = <2>; |
129 | }; | 62 | }; |
130 | 63 | ||
131 | gpio_simple: gpio@b00 { | 64 | rtc@800 { |
132 | compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio"; | 65 | status = "disabled"; |
133 | reg = <0xb00 0x40>; | ||
134 | interrupts = <1 7 0>; | ||
135 | gpio-controller; | ||
136 | #gpio-cells = <2>; | ||
137 | }; | 66 | }; |
138 | 67 | ||
139 | gpio_wkup: gpio@c00 { | 68 | can@900 { |
140 | compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup"; | 69 | status = "disabled"; |
141 | reg = <0xc00 0x40>; | 70 | }; |
142 | interrupts = <1 8 0 0 3 0>; | 71 | |
143 | gpio-controller; | 72 | can@980 { |
144 | #gpio-cells = <2>; | 73 | status = "disabled"; |
145 | }; | 74 | }; |
146 | 75 | ||
147 | dma-controller@1200 { | 76 | spi@f00 { |
148 | compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm"; | 77 | status = "disabled"; |
149 | reg = <0x1200 0x80>; | ||
150 | interrupts = <3 0 0 3 1 0 3 2 0 3 3 0 | ||
151 | 3 4 0 3 5 0 3 6 0 3 7 0 | ||
152 | 3 8 0 3 9 0 3 10 0 3 11 0 | ||
153 | 3 12 0 3 13 0 3 14 0 3 15 0>; | ||
154 | }; | 78 | }; |
155 | 79 | ||
156 | xlb@1f00 { | 80 | usb@1000 { |
157 | compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb"; | 81 | status = "disabled"; |
158 | reg = <0x1f00 0x100>; | ||
159 | }; | 82 | }; |
160 | 83 | ||
161 | serial@2000 { /* PSC1 in UART mode */ | 84 | psc@2000 { // PSC1 |
162 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 85 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
163 | reg = <0x2000 0x100>; | ||
164 | interrupts = <2 1 0>; | ||
165 | }; | 86 | }; |
166 | 87 | ||
167 | serial@2200 { /* PSC2 in UART mode */ | 88 | psc@2200 { // PSC2 |
168 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 89 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
169 | reg = <0x2200 0x100>; | ||
170 | interrupts = <2 2 0>; | ||
171 | }; | 90 | }; |
172 | 91 | ||
173 | serial@2c00 { /* PSC6 in UART mode */ | 92 | psc@2400 { // PSC3 |
93 | status = "disabled"; | ||
94 | }; | ||
95 | |||
96 | psc@2600 { // PSC4 | ||
97 | status = "disabled"; | ||
98 | }; | ||
99 | |||
100 | psc@2800 { // PSC5 | ||
101 | status = "disabled"; | ||
102 | }; | ||
103 | |||
104 | psc@2c00 { // PSC6 | ||
174 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; | 105 | compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; |
175 | reg = <0x2c00 0x100>; | ||
176 | interrupts = <2 4 0>; | ||
177 | }; | 106 | }; |
178 | 107 | ||
179 | ethernet@3000 { | 108 | ethernet@3000 { |
180 | compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec"; | ||
181 | reg = <0x3000 0x400>; | ||
182 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
183 | interrupts = <2 5 0>; | ||
184 | phy-handle = <&phy0>; | 109 | phy-handle = <&phy0>; |
185 | }; | 110 | }; |
186 | 111 | ||
187 | mdio@3000 { | 112 | mdio@3000 { |
188 | #address-cells = <1>; | ||
189 | #size-cells = <0>; | ||
190 | compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio"; | ||
191 | reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts | ||
192 | interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. | ||
193 | |||
194 | phy0: ethernet-phy@0 { | 113 | phy0: ethernet-phy@0 { |
195 | compatible = "intel,lxt971"; | 114 | compatible = "intel,lxt971"; |
196 | reg = <0>; | 115 | reg = <0>; |
197 | }; | 116 | }; |
198 | }; | 117 | }; |
199 | 118 | ||
200 | ata@3a00 { | 119 | i2c@3d00 { |
201 | compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata"; | 120 | status = "disabled"; |
202 | reg = <0x3a00 0x100>; | ||
203 | interrupts = <2 7 0>; | ||
204 | }; | 121 | }; |
205 | 122 | ||
206 | i2c@3d40 { | 123 | i2c@3d40 { |
207 | #address-cells = <1>; | ||
208 | #size-cells = <0>; | ||
209 | compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; | ||
210 | reg = <0x3d40 0x40>; | ||
211 | interrupts = <2 16 0>; | ||
212 | fsl,preserve-clocking; | 124 | fsl,preserve-clocking; |
213 | clock-frequency = <400000>; | 125 | clock-frequency = <400000>; |
214 | 126 | ||
@@ -221,19 +133,13 @@ | |||
221 | reg = <0x51>; | 133 | reg = <0x51>; |
222 | }; | 134 | }; |
223 | }; | 135 | }; |
136 | }; | ||
224 | 137 | ||
225 | sram@8000 { | 138 | pci@f0000d00 { |
226 | compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram"; | 139 | status = "disabled"; |
227 | reg = <0x8000 0x4000>; | ||
228 | }; | ||
229 | }; | 140 | }; |
230 | 141 | ||
231 | localbus { | 142 | localbus { |
232 | compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus"; | ||
233 | |||
234 | #address-cells = <2>; | ||
235 | #size-cells = <1>; | ||
236 | |||
237 | ranges = <0 0 0xff800000 0x00800000 | 143 | ranges = <0 0 0xff800000 0x00800000 |
238 | 1 0 0x80000000 0x00800000 | 144 | 1 0 0x80000000 0x00800000 |
239 | 3 0 0x80000000 0x00800000>; | 145 | 3 0 0x80000000 0x00800000>; |
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index ae26f2efd089..d72757585595 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h | |||
@@ -42,7 +42,7 @@ extern void pci_create_OF_bus_map(void); | |||
42 | 42 | ||
43 | /* Translate a DMA address from device space to CPU space */ | 43 | /* Translate a DMA address from device space to CPU space */ |
44 | extern u64 of_translate_dma_address(struct device_node *dev, | 44 | extern u64 of_translate_dma_address(struct device_node *dev, |
45 | const u32 *in_addr); | 45 | const __be32 *in_addr); |
46 | 46 | ||
47 | #ifdef CONFIG_PCI | 47 | #ifdef CONFIG_PCI |
48 | extern unsigned long pci_address_to_pio(phys_addr_t address); | 48 | extern unsigned long pci_address_to_pio(phys_addr_t address); |
@@ -63,9 +63,6 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); | |||
63 | /* cache lookup */ | 63 | /* cache lookup */ |
64 | struct device_node *of_find_next_cache_node(struct device_node *np); | 64 | struct device_node *of_find_next_cache_node(struct device_node *np); |
65 | 65 | ||
66 | /* Get the MAC address */ | ||
67 | extern const void *of_get_mac_address(struct device_node *np); | ||
68 | |||
69 | #ifdef CONFIG_NUMA | 66 | #ifdef CONFIG_NUMA |
70 | extern int of_node_to_nid(struct device_node *device); | 67 | extern int of_node_to_nid(struct device_node *device); |
71 | #else | 68 | #else |
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 88334af038e5..c2b7a07cc3d3 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -117,41 +117,3 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, | |||
117 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); | 117 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); |
118 | *size = of_read_number(dma_window, cells); | 118 | *size = of_read_number(dma_window, cells); |
119 | } | 119 | } |
120 | |||
121 | /** | ||
122 | * Search the device tree for the best MAC address to use. 'mac-address' is | ||
123 | * checked first, because that is supposed to contain to "most recent" MAC | ||
124 | * address. If that isn't set, then 'local-mac-address' is checked next, | ||
125 | * because that is the default address. If that isn't set, then the obsolete | ||
126 | * 'address' is checked, just in case we're using an old device tree. | ||
127 | * | ||
128 | * Note that the 'address' property is supposed to contain a virtual address of | ||
129 | * the register set, but some DTS files have redefined that property to be the | ||
130 | * MAC address. | ||
131 | * | ||
132 | * All-zero MAC addresses are rejected, because those could be properties that | ||
133 | * exist in the device tree, but were not set by U-Boot. For example, the | ||
134 | * DTS could define 'mac-address' and 'local-mac-address', with zero MAC | ||
135 | * addresses. Some older U-Boots only initialized 'local-mac-address'. In | ||
136 | * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists | ||
137 | * but is all zeros. | ||
138 | */ | ||
139 | const void *of_get_mac_address(struct device_node *np) | ||
140 | { | ||
141 | struct property *pp; | ||
142 | |||
143 | pp = of_find_property(np, "mac-address", NULL); | ||
144 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
145 | return pp->value; | ||
146 | |||
147 | pp = of_find_property(np, "local-mac-address", NULL); | ||
148 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
149 | return pp->value; | ||
150 | |||
151 | pp = of_find_property(np, "address", NULL); | ||
152 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
153 | return pp->value; | ||
154 | |||
155 | return NULL; | ||
156 | } | ||
157 | EXPORT_SYMBOL(of_get_mac_address); | ||
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c index 546bbc229d19..2521d93ef136 100644 --- a/arch/powerpc/platforms/40x/ppc40x_simple.c +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c | |||
@@ -50,7 +50,7 @@ machine_device_initcall(ppc40x_simple, ppc40x_device_probe); | |||
50 | * Again, if your board needs to do things differently then create a | 50 | * Again, if your board needs to do things differently then create a |
51 | * board.c file for it rather than adding it to this list. | 51 | * board.c file for it rather than adding it to this list. |
52 | */ | 52 | */ |
53 | static char *board[] __initdata = { | 53 | static const char *board[] __initdata = { |
54 | "amcc,acadia", | 54 | "amcc,acadia", |
55 | "amcc,haleakala", | 55 | "amcc,haleakala", |
56 | "amcc,kilauea", | 56 | "amcc,kilauea", |
@@ -60,14 +60,9 @@ static char *board[] __initdata = { | |||
60 | 60 | ||
61 | static int __init ppc40x_probe(void) | 61 | static int __init ppc40x_probe(void) |
62 | { | 62 | { |
63 | unsigned long root = of_get_flat_dt_root(); | 63 | if (of_flat_dt_match(of_get_flat_dt_root(), board)) { |
64 | int i = 0; | 64 | ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); |
65 | 65 | return 1; | |
66 | for (i = 0; i < ARRAY_SIZE(board); i++) { | ||
67 | if (of_flat_dt_is_compatible(root, board[i])) { | ||
68 | ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); | ||
69 | return 1; | ||
70 | } | ||
71 | } | 66 | } |
72 | 67 | ||
73 | return 0; | 68 | return 0; |
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c index e487eb06ec6b..926731f1ff01 100644 --- a/arch/powerpc/platforms/512x/mpc5121_generic.c +++ b/arch/powerpc/platforms/512x/mpc5121_generic.c | |||
@@ -26,7 +26,7 @@ | |||
26 | /* | 26 | /* |
27 | * list of supported boards | 27 | * list of supported boards |
28 | */ | 28 | */ |
29 | static char *board[] __initdata = { | 29 | static const char *board[] __initdata = { |
30 | "prt,prtlvt", | 30 | "prt,prtlvt", |
31 | NULL | 31 | NULL |
32 | }; | 32 | }; |
@@ -36,16 +36,7 @@ static char *board[] __initdata = { | |||
36 | */ | 36 | */ |
37 | static int __init mpc5121_generic_probe(void) | 37 | static int __init mpc5121_generic_probe(void) |
38 | { | 38 | { |
39 | unsigned long node = of_get_flat_dt_root(); | 39 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
40 | int i = 0; | ||
41 | |||
42 | while (board[i]) { | ||
43 | if (of_flat_dt_is_compatible(node, board[i])) | ||
44 | break; | ||
45 | i++; | ||
46 | } | ||
47 | |||
48 | return board[i] != NULL; | ||
49 | } | 40 | } |
50 | 41 | ||
51 | define_machine(mpc5121_generic) { | 42 | define_machine(mpc5121_generic) { |
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index de55bc0584b5..01ffa64d2aa7 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c | |||
@@ -172,20 +172,18 @@ static void __init lite5200_setup_arch(void) | |||
172 | mpc52xx_setup_pci(); | 172 | mpc52xx_setup_pci(); |
173 | } | 173 | } |
174 | 174 | ||
175 | static const char *board[] __initdata = { | ||
176 | "fsl,lite5200", | ||
177 | "fsl,lite5200b", | ||
178 | NULL, | ||
179 | }; | ||
180 | |||
175 | /* | 181 | /* |
176 | * Called very early, MMU is off, device-tree isn't unflattened | 182 | * Called very early, MMU is off, device-tree isn't unflattened |
177 | */ | 183 | */ |
178 | static int __init lite5200_probe(void) | 184 | static int __init lite5200_probe(void) |
179 | { | 185 | { |
180 | unsigned long node = of_get_flat_dt_root(); | 186 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
181 | const char *model = of_get_flat_dt_prop(node, "model", NULL); | ||
182 | |||
183 | if (!of_flat_dt_is_compatible(node, "fsl,lite5200") && | ||
184 | !of_flat_dt_is_compatible(node, "fsl,lite5200b")) | ||
185 | return 0; | ||
186 | pr_debug("%s board found\n", model ? model : "unknown"); | ||
187 | |||
188 | return 1; | ||
189 | } | 187 | } |
190 | 188 | ||
191 | define_machine(lite5200) { | 189 | define_machine(lite5200) { |
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c index 0bac3a3dbecf..2c7780cb68e5 100644 --- a/arch/powerpc/platforms/52xx/media5200.c +++ b/arch/powerpc/platforms/52xx/media5200.c | |||
@@ -239,7 +239,7 @@ static void __init media5200_setup_arch(void) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | /* list of the supported boards */ | 241 | /* list of the supported boards */ |
242 | static char *board[] __initdata = { | 242 | static const char *board[] __initdata = { |
243 | "fsl,media5200", | 243 | "fsl,media5200", |
244 | NULL | 244 | NULL |
245 | }; | 245 | }; |
@@ -249,16 +249,7 @@ static char *board[] __initdata = { | |||
249 | */ | 249 | */ |
250 | static int __init media5200_probe(void) | 250 | static int __init media5200_probe(void) |
251 | { | 251 | { |
252 | unsigned long node = of_get_flat_dt_root(); | 252 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
253 | int i = 0; | ||
254 | |||
255 | while (board[i]) { | ||
256 | if (of_flat_dt_is_compatible(node, board[i])) | ||
257 | break; | ||
258 | i++; | ||
259 | } | ||
260 | |||
261 | return (board[i] != NULL); | ||
262 | } | 253 | } |
263 | 254 | ||
264 | define_machine(media5200_platform) { | 255 | define_machine(media5200_platform) { |
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c index d45be5b5ad49..e36d6e232ae6 100644 --- a/arch/powerpc/platforms/52xx/mpc5200_simple.c +++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c | |||
@@ -49,7 +49,7 @@ static void __init mpc5200_simple_setup_arch(void) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | /* list of the supported boards */ | 51 | /* list of the supported boards */ |
52 | static char *board[] __initdata = { | 52 | static const char *board[] __initdata = { |
53 | "intercontrol,digsy-mtc", | 53 | "intercontrol,digsy-mtc", |
54 | "manroland,mucmc52", | 54 | "manroland,mucmc52", |
55 | "manroland,uc101", | 55 | "manroland,uc101", |
@@ -66,16 +66,7 @@ static char *board[] __initdata = { | |||
66 | */ | 66 | */ |
67 | static int __init mpc5200_simple_probe(void) | 67 | static int __init mpc5200_simple_probe(void) |
68 | { | 68 | { |
69 | unsigned long node = of_get_flat_dt_root(); | 69 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
70 | int i = 0; | ||
71 | |||
72 | while (board[i]) { | ||
73 | if (of_flat_dt_is_compatible(node, board[i])) | ||
74 | break; | ||
75 | i++; | ||
76 | } | ||
77 | |||
78 | return (board[i] != NULL); | ||
79 | } | 70 | } |
80 | 71 | ||
81 | define_machine(mpc5200_simple_platform) { | 72 | define_machine(mpc5200_simple_platform) { |
diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c index 846831d495b5..661d354e4ff2 100644 --- a/arch/powerpc/platforms/83xx/mpc830x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c | |||
@@ -57,16 +57,19 @@ static void __init mpc830x_rdb_init_IRQ(void) | |||
57 | ipic_set_default_priority(); | 57 | ipic_set_default_priority(); |
58 | } | 58 | } |
59 | 59 | ||
60 | struct const char *board[] __initdata = { | ||
61 | "MPC8308RDB", | ||
62 | "fsl,mpc8308rdb", | ||
63 | "denx,mpc8308_p1m", | ||
64 | NULL | ||
65 | } | ||
66 | |||
60 | /* | 67 | /* |
61 | * Called very early, MMU is off, device-tree isn't unflattened | 68 | * Called very early, MMU is off, device-tree isn't unflattened |
62 | */ | 69 | */ |
63 | static int __init mpc830x_rdb_probe(void) | 70 | static int __init mpc830x_rdb_probe(void) |
64 | { | 71 | { |
65 | unsigned long root = of_get_flat_dt_root(); | 72 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
66 | |||
67 | return of_flat_dt_is_compatible(root, "MPC8308RDB") || | ||
68 | of_flat_dt_is_compatible(root, "fsl,mpc8308rdb") || | ||
69 | of_flat_dt_is_compatible(root, "denx,mpc8308_p1m"); | ||
70 | } | 73 | } |
71 | 74 | ||
72 | static struct of_device_id __initdata of_bus_ids[] = { | 75 | static struct of_device_id __initdata of_bus_ids[] = { |
diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c index ae525e4745d2..b54cd736a895 100644 --- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c | |||
@@ -60,15 +60,18 @@ static void __init mpc831x_rdb_init_IRQ(void) | |||
60 | ipic_set_default_priority(); | 60 | ipic_set_default_priority(); |
61 | } | 61 | } |
62 | 62 | ||
63 | struct const char *board[] __initdata = { | ||
64 | "MPC8313ERDB", | ||
65 | "fsl,mpc8315erdb", | ||
66 | NULL | ||
67 | } | ||
68 | |||
63 | /* | 69 | /* |
64 | * Called very early, MMU is off, device-tree isn't unflattened | 70 | * Called very early, MMU is off, device-tree isn't unflattened |
65 | */ | 71 | */ |
66 | static int __init mpc831x_rdb_probe(void) | 72 | static int __init mpc831x_rdb_probe(void) |
67 | { | 73 | { |
68 | unsigned long root = of_get_flat_dt_root(); | 74 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
69 | |||
70 | return of_flat_dt_is_compatible(root, "MPC8313ERDB") || | ||
71 | of_flat_dt_is_compatible(root, "fsl,mpc8315erdb"); | ||
72 | } | 75 | } |
73 | 76 | ||
74 | static struct of_device_id __initdata of_bus_ids[] = { | 77 | static struct of_device_id __initdata of_bus_ids[] = { |
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c index 910caa6b5810..7bafbf2ec0f9 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c | |||
@@ -101,17 +101,20 @@ static void __init mpc837x_rdb_init_IRQ(void) | |||
101 | ipic_set_default_priority(); | 101 | ipic_set_default_priority(); |
102 | } | 102 | } |
103 | 103 | ||
104 | static const char *board[] __initdata = { | ||
105 | "fsl,mpc8377rdb", | ||
106 | "fsl,mpc8378rdb", | ||
107 | "fsl,mpc8379rdb", | ||
108 | "fsl,mpc8377wlan", | ||
109 | NULL | ||
110 | }; | ||
111 | |||
104 | /* | 112 | /* |
105 | * Called very early, MMU is off, device-tree isn't unflattened | 113 | * Called very early, MMU is off, device-tree isn't unflattened |
106 | */ | 114 | */ |
107 | static int __init mpc837x_rdb_probe(void) | 115 | static int __init mpc837x_rdb_probe(void) |
108 | { | 116 | { |
109 | unsigned long root = of_get_flat_dt_root(); | 117 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
110 | |||
111 | return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") || | ||
112 | of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") || | ||
113 | of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") || | ||
114 | of_flat_dt_is_compatible(root, "fsl,mpc8377wlan"); | ||
115 | } | 118 | } |
116 | 119 | ||
117 | define_machine(mpc837x_rdb) { | 120 | define_machine(mpc837x_rdb) { |
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c index 8f29bbce5360..5e847d0b47c8 100644 --- a/arch/powerpc/platforms/85xx/tqm85xx.c +++ b/arch/powerpc/platforms/85xx/tqm85xx.c | |||
@@ -186,21 +186,21 @@ static int __init declare_of_platform_devices(void) | |||
186 | } | 186 | } |
187 | machine_device_initcall(tqm85xx, declare_of_platform_devices); | 187 | machine_device_initcall(tqm85xx, declare_of_platform_devices); |
188 | 188 | ||
189 | static const char *board[] __initdata = { | ||
190 | "tqc,tqm8540", | ||
191 | "tqc,tqm8541", | ||
192 | "tqc,tqm8548", | ||
193 | "tqc,tqm8555", | ||
194 | "tqc,tqm8560", | ||
195 | NULL | ||
196 | }; | ||
197 | |||
189 | /* | 198 | /* |
190 | * Called very early, device-tree isn't unflattened | 199 | * Called very early, device-tree isn't unflattened |
191 | */ | 200 | */ |
192 | static int __init tqm85xx_probe(void) | 201 | static int __init tqm85xx_probe(void) |
193 | { | 202 | { |
194 | unsigned long root = of_get_flat_dt_root(); | 203 | return of_flat_dt_match(of_get_flat_dt_root(), board); |
195 | |||
196 | if ((of_flat_dt_is_compatible(root, "tqc,tqm8540")) || | ||
197 | (of_flat_dt_is_compatible(root, "tqc,tqm8541")) || | ||
198 | (of_flat_dt_is_compatible(root, "tqc,tqm8548")) || | ||
199 | (of_flat_dt_is_compatible(root, "tqc,tqm8555")) || | ||
200 | (of_flat_dt_is_compatible(root, "tqc,tqm8560"))) | ||
201 | return 1; | ||
202 | |||
203 | return 0; | ||
204 | } | 204 | } |
205 | 205 | ||
206 | define_machine(tqm85xx) { | 206 | define_machine(tqm85xx) { |
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index 1398bc454999..feaee402e2d6 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mv643xx.h> | 16 | #include <linux/mv643xx.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
19 | #include <linux/of_net.h> | ||
19 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
20 | 21 | ||
21 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c index d4d15aaf18fa..c2d675b6392c 100644 --- a/arch/powerpc/sysdev/tsi108_dev.c +++ b/arch/powerpc/sysdev/tsi108_dev.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/of_net.h> | ||
22 | #include <asm/tsi108.h> | 23 | #include <asm/tsi108.h> |
23 | 24 | ||
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c index 35f48837871a..8505e0ac78ba 100644 --- a/arch/sparc/kernel/auxio_32.c +++ b/arch/sparc/kernel/auxio_32.c | |||
@@ -121,7 +121,7 @@ void __init auxio_power_probe(void) | |||
121 | node = prom_searchsiblings(node, "obio"); | 121 | node = prom_searchsiblings(node, "obio"); |
122 | node = prom_getchild(node); | 122 | node = prom_getchild(node); |
123 | node = prom_searchsiblings(node, "power"); | 123 | node = prom_searchsiblings(node, "power"); |
124 | if (node == 0 || node == -1) | 124 | if (node == 0 || (s32)node == -1) |
125 | return; | 125 | return; |
126 | 126 | ||
127 | /* Map the power control register. */ | 127 | /* Map the power control register. */ |
diff --git a/arch/sparc/kernel/starfire.c b/arch/sparc/kernel/starfire.c index a4446c0fb7a1..82281a566bb8 100644 --- a/arch/sparc/kernel/starfire.c +++ b/arch/sparc/kernel/starfire.c | |||
@@ -24,7 +24,7 @@ int this_is_starfire = 0; | |||
24 | void check_if_starfire(void) | 24 | void check_if_starfire(void) |
25 | { | 25 | { |
26 | phandle ssnode = prom_finddevice("/ssp-serial"); | 26 | phandle ssnode = prom_finddevice("/ssp-serial"); |
27 | if (ssnode != 0 && ssnode != -1) | 27 | if (ssnode != 0 && (s32)ssnode != -1) |
28 | this_is_starfire = 1; | 28 | this_is_starfire = 1; |
29 | } | 29 | } |
30 | 30 | ||
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c index d342dba4dd54..0a601b300639 100644 --- a/arch/sparc/prom/init_32.c +++ b/arch/sparc/prom/init_32.c | |||
@@ -60,7 +60,7 @@ void __init prom_init(struct linux_romvec *rp) | |||
60 | prom_nodeops = romvec->pv_nodeops; | 60 | prom_nodeops = romvec->pv_nodeops; |
61 | 61 | ||
62 | prom_root_node = prom_getsibling(0); | 62 | prom_root_node = prom_getsibling(0); |
63 | if((prom_root_node == 0) || (prom_root_node == -1)) | 63 | if ((prom_root_node == 0) || ((s32)prom_root_node == -1)) |
64 | prom_halt(); | 64 | prom_halt(); |
65 | 65 | ||
66 | if((((unsigned long) prom_nodeops) == 0) || | 66 | if((((unsigned long) prom_nodeops) == 0) || |
diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c index 9c6ac4b81ded..5016c5e20575 100644 --- a/arch/sparc/prom/init_64.c +++ b/arch/sparc/prom/init_64.c | |||
@@ -35,13 +35,13 @@ void __init prom_init(void *cif_handler, void *cif_stack) | |||
35 | prom_cif_init(cif_handler, cif_stack); | 35 | prom_cif_init(cif_handler, cif_stack); |
36 | 36 | ||
37 | prom_chosen_node = prom_finddevice(prom_chosen_path); | 37 | prom_chosen_node = prom_finddevice(prom_chosen_path); |
38 | if (!prom_chosen_node || prom_chosen_node == -1) | 38 | if (!prom_chosen_node || (s32)prom_chosen_node == -1) |
39 | prom_halt(); | 39 | prom_halt(); |
40 | 40 | ||
41 | prom_stdout = prom_getint(prom_chosen_node, "stdout"); | 41 | prom_stdout = prom_getint(prom_chosen_node, "stdout"); |
42 | 42 | ||
43 | node = prom_finddevice("/openprom"); | 43 | node = prom_finddevice("/openprom"); |
44 | if (!node || node == -1) | 44 | if (!node || (s32)node == -1) |
45 | prom_halt(); | 45 | prom_halt(); |
46 | 46 | ||
47 | prom_getstring(node, "version", prom_version, sizeof(prom_version)); | 47 | prom_getstring(node, "version", prom_version, sizeof(prom_version)); |
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c index bc8e4cb87a68..f30e8d038f01 100644 --- a/arch/sparc/prom/tree_32.c +++ b/arch/sparc/prom/tree_32.c | |||
@@ -40,11 +40,11 @@ phandle prom_getchild(phandle node) | |||
40 | { | 40 | { |
41 | phandle cnode; | 41 | phandle cnode; |
42 | 42 | ||
43 | if (node == -1) | 43 | if ((s32)node == -1) |
44 | return 0; | 44 | return 0; |
45 | 45 | ||
46 | cnode = __prom_getchild(node); | 46 | cnode = __prom_getchild(node); |
47 | if (cnode == 0 || cnode == -1) | 47 | if (cnode == 0 || (s32)cnode == -1) |
48 | return 0; | 48 | return 0; |
49 | 49 | ||
50 | return cnode; | 50 | return cnode; |
@@ -72,11 +72,11 @@ phandle prom_getsibling(phandle node) | |||
72 | { | 72 | { |
73 | phandle sibnode; | 73 | phandle sibnode; |
74 | 74 | ||
75 | if (node == -1) | 75 | if ((s32)node == -1) |
76 | return 0; | 76 | return 0; |
77 | 77 | ||
78 | sibnode = __prom_getsibling(node); | 78 | sibnode = __prom_getsibling(node); |
79 | if (sibnode == 0 || sibnode == -1) | 79 | if (sibnode == 0 || (s32)sibnode == -1) |
80 | return 0; | 80 | return 0; |
81 | 81 | ||
82 | return sibnode; | 82 | return sibnode; |
@@ -219,7 +219,7 @@ static char *__prom_nextprop(phandle node, char * oprop) | |||
219 | */ | 219 | */ |
220 | char *prom_nextprop(phandle node, char *oprop, char *buffer) | 220 | char *prom_nextprop(phandle node, char *oprop, char *buffer) |
221 | { | 221 | { |
222 | if (node == 0 || node == -1) | 222 | if (node == 0 || (s32)node == -1) |
223 | return ""; | 223 | return ""; |
224 | 224 | ||
225 | return __prom_nextprop(node, oprop); | 225 | return __prom_nextprop(node, oprop); |
@@ -253,7 +253,7 @@ phandle prom_finddevice(char *name) | |||
253 | if (d != s + 3 && (!*d || *d == '/') | 253 | if (d != s + 3 && (!*d || *d == '/') |
254 | && d <= s + 3 + 8) { | 254 | && d <= s + 3 + 8) { |
255 | node2 = node; | 255 | node2 = node; |
256 | while (node2 && node2 != -1) { | 256 | while (node2 && (s32)node2 != -1) { |
257 | if (prom_getproperty (node2, "reg", (char *)reg, sizeof (reg)) > 0) { | 257 | if (prom_getproperty (node2, "reg", (char *)reg, sizeof (reg)) > 0) { |
258 | if (which_io == reg[0].which_io && phys_addr == reg[0].phys_addr) { | 258 | if (which_io == reg[0].which_io && phys_addr == reg[0].phys_addr) { |
259 | node = node2; | 259 | node = node2; |
@@ -261,7 +261,7 @@ phandle prom_finddevice(char *name) | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | node2 = prom_getsibling(node2); | 263 | node2 = prom_getsibling(node2); |
264 | if (!node2 || node2 == -1) | 264 | if (!node2 || (s32)node2 == -1) |
265 | break; | 265 | break; |
266 | node2 = prom_searchsiblings(prom_getsibling(node2), nbuf); | 266 | node2 = prom_searchsiblings(prom_getsibling(node2), nbuf); |
267 | } | 267 | } |
@@ -303,6 +303,7 @@ phandle prom_inst2pkg(int inst) | |||
303 | node = (*romvec->pv_v2devops.v2_inst2pkg)(inst); | 303 | node = (*romvec->pv_v2devops.v2_inst2pkg)(inst); |
304 | restore_current(); | 304 | restore_current(); |
305 | spin_unlock_irqrestore(&prom_lock, flags); | 305 | spin_unlock_irqrestore(&prom_lock, flags); |
306 | if (node == -1) return 0; | 306 | if ((s32)node == -1) |
307 | return 0; | ||
307 | return node; | 308 | return node; |
308 | } | 309 | } |
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c index d93660048376..92204c3800b5 100644 --- a/arch/sparc/prom/tree_64.c +++ b/arch/sparc/prom/tree_64.c | |||
@@ -43,10 +43,10 @@ inline phandle prom_getchild(phandle node) | |||
43 | { | 43 | { |
44 | phandle cnode; | 44 | phandle cnode; |
45 | 45 | ||
46 | if (node == -1) | 46 | if ((s32)node == -1) |
47 | return 0; | 47 | return 0; |
48 | cnode = __prom_getchild(node); | 48 | cnode = __prom_getchild(node); |
49 | if (cnode == -1) | 49 | if ((s32)cnode == -1) |
50 | return 0; | 50 | return 0; |
51 | return cnode; | 51 | return cnode; |
52 | } | 52 | } |
@@ -56,10 +56,10 @@ inline phandle prom_getparent(phandle node) | |||
56 | { | 56 | { |
57 | phandle cnode; | 57 | phandle cnode; |
58 | 58 | ||
59 | if (node == -1) | 59 | if ((s32)node == -1) |
60 | return 0; | 60 | return 0; |
61 | cnode = prom_node_to_node("parent", node); | 61 | cnode = prom_node_to_node("parent", node); |
62 | if (cnode == -1) | 62 | if ((s32)cnode == -1) |
63 | return 0; | 63 | return 0; |
64 | return cnode; | 64 | return cnode; |
65 | } | 65 | } |
@@ -76,10 +76,10 @@ inline phandle prom_getsibling(phandle node) | |||
76 | { | 76 | { |
77 | phandle sibnode; | 77 | phandle sibnode; |
78 | 78 | ||
79 | if (node == -1) | 79 | if ((s32)node == -1) |
80 | return 0; | 80 | return 0; |
81 | sibnode = __prom_getsibling(node); | 81 | sibnode = __prom_getsibling(node); |
82 | if (sibnode == -1) | 82 | if ((s32)sibnode == -1) |
83 | return 0; | 83 | return 0; |
84 | 84 | ||
85 | return sibnode; | 85 | return sibnode; |
@@ -240,7 +240,7 @@ inline char *prom_firstprop(phandle node, char *buffer) | |||
240 | unsigned long args[7]; | 240 | unsigned long args[7]; |
241 | 241 | ||
242 | *buffer = 0; | 242 | *buffer = 0; |
243 | if (node == -1) | 243 | if ((s32)node == -1) |
244 | return buffer; | 244 | return buffer; |
245 | 245 | ||
246 | args[0] = (unsigned long) prom_nextprop_name; | 246 | args[0] = (unsigned long) prom_nextprop_name; |
@@ -266,7 +266,7 @@ inline char *prom_nextprop(phandle node, const char *oprop, char *buffer) | |||
266 | unsigned long args[7]; | 266 | unsigned long args[7]; |
267 | char buf[32]; | 267 | char buf[32]; |
268 | 268 | ||
269 | if (node == -1) { | 269 | if ((s32)node == -1) { |
270 | *buffer = 0; | 270 | *buffer = 0; |
271 | return buffer; | 271 | return buffer; |
272 | } | 272 | } |
@@ -369,7 +369,7 @@ inline phandle prom_inst2pkg(int inst) | |||
369 | p1275_cmd_direct(args); | 369 | p1275_cmd_direct(args); |
370 | 370 | ||
371 | node = (int) args[4]; | 371 | node = (int) args[4]; |
372 | if (node == -1) | 372 | if ((s32)node == -1) |
373 | return 0; | 373 | return 0; |
374 | return node; | 374 | return node; |
375 | } | 375 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 035da9e64a17..f27c04e18aaa 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -69,6 +69,8 @@ | |||
69 | #ifdef CONFIG_PPC_OF | 69 | #ifdef CONFIG_PPC_OF |
70 | #include <linux/of_device.h> | 70 | #include <linux/of_device.h> |
71 | #include <linux/of_platform.h> | 71 | #include <linux/of_platform.h> |
72 | #include <linux/of_address.h> | ||
73 | #include <linux/of_irq.h> | ||
72 | #endif | 74 | #endif |
73 | 75 | ||
74 | #define PFX "ipmi_si: " | 76 | #define PFX "ipmi_si: " |
@@ -2546,7 +2548,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev, | |||
2546 | { | 2548 | { |
2547 | struct smi_info *info; | 2549 | struct smi_info *info; |
2548 | struct resource resource; | 2550 | struct resource resource; |
2549 | const int *regsize, *regspacing, *regshift; | 2551 | const __be32 *regsize, *regspacing, *regshift; |
2550 | struct device_node *np = dev->dev.of_node; | 2552 | struct device_node *np = dev->dev.of_node; |
2551 | int ret; | 2553 | int ret; |
2552 | int proplen; | 2554 | int proplen; |
@@ -2599,9 +2601,9 @@ static int __devinit ipmi_of_probe(struct platform_device *dev, | |||
2599 | 2601 | ||
2600 | info->io.addr_data = resource.start; | 2602 | info->io.addr_data = resource.start; |
2601 | 2603 | ||
2602 | info->io.regsize = regsize ? *regsize : DEFAULT_REGSIZE; | 2604 | info->io.regsize = regsize ? be32_to_cpup(regsize) : DEFAULT_REGSIZE; |
2603 | info->io.regspacing = regspacing ? *regspacing : DEFAULT_REGSPACING; | 2605 | info->io.regspacing = regspacing ? be32_to_cpup(regspacing) : DEFAULT_REGSPACING; |
2604 | info->io.regshift = regshift ? *regshift : 0; | 2606 | info->io.regshift = regshift ? be32_to_cpup(regshift) : 0; |
2605 | 2607 | ||
2606 | info->irq = irq_of_parse_and_map(dev->dev.of_node, 0); | 2608 | info->irq = irq_of_parse_and_map(dev->dev.of_node, 0); |
2607 | info->dev = &dev->dev; | 2609 | info->dev = &dev->dev; |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 559b0b3c16c3..ab1ad41786d1 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
22 | #include <linux/jiffies.h> | 22 | #include <linux/jiffies.h> |
23 | #include <linux/of.h> | ||
23 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
24 | #include <linux/i2c/at24.h> | 25 | #include <linux/i2c/at24.h> |
25 | 26 | ||
@@ -457,6 +458,27 @@ static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, | |||
457 | 458 | ||
458 | /*-------------------------------------------------------------------------*/ | 459 | /*-------------------------------------------------------------------------*/ |
459 | 460 | ||
461 | #ifdef CONFIG_OF | ||
462 | static void at24_get_ofdata(struct i2c_client *client, | ||
463 | struct at24_platform_data *chip) | ||
464 | { | ||
465 | const __be32 *val; | ||
466 | struct device_node *node = client->dev.of_node; | ||
467 | |||
468 | if (node) { | ||
469 | if (of_get_property(node, "read-only", NULL)) | ||
470 | chip->flags |= AT24_FLAG_READONLY; | ||
471 | val = of_get_property(node, "pagesize", NULL); | ||
472 | if (val) | ||
473 | chip->page_size = be32_to_cpup(val); | ||
474 | } | ||
475 | } | ||
476 | #else | ||
477 | static void at24_get_ofdata(struct i2c_client *client, | ||
478 | struct at24_platform_data *chip) | ||
479 | { } | ||
480 | #endif /* CONFIG_OF */ | ||
481 | |||
460 | static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | 482 | static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) |
461 | { | 483 | { |
462 | struct at24_platform_data chip; | 484 | struct at24_platform_data chip; |
@@ -485,6 +507,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
485 | */ | 507 | */ |
486 | chip.page_size = 1; | 508 | chip.page_size = 1; |
487 | 509 | ||
510 | /* update chipdata if OF is present */ | ||
511 | at24_get_ofdata(client, &chip); | ||
512 | |||
488 | chip.setup = NULL; | 513 | chip.setup = NULL; |
489 | chip.context = NULL; | 514 | chip.context = NULL; |
490 | } | 515 | } |
@@ -492,6 +517,11 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
492 | if (!is_power_of_2(chip.byte_len)) | 517 | if (!is_power_of_2(chip.byte_len)) |
493 | dev_warn(&client->dev, | 518 | dev_warn(&client->dev, |
494 | "byte_len looks suspicious (no power of 2)!\n"); | 519 | "byte_len looks suspicious (no power of 2)!\n"); |
520 | if (!chip.page_size) { | ||
521 | dev_err(&client->dev, "page_size must not be 0!\n"); | ||
522 | err = -EINVAL; | ||
523 | goto err_out; | ||
524 | } | ||
495 | if (!is_power_of_2(chip.page_size)) | 525 | if (!is_power_of_2(chip.page_size)) |
496 | dev_warn(&client->dev, | 526 | dev_warn(&client->dev, |
497 | "page_size looks suspicious (no power of 2)!\n"); | 527 | "page_size looks suspicious (no power of 2)!\n"); |
@@ -597,19 +627,15 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
597 | 627 | ||
598 | i2c_set_clientdata(client, at24); | 628 | i2c_set_clientdata(client, at24); |
599 | 629 | ||
600 | dev_info(&client->dev, "%zu byte %s EEPROM %s\n", | 630 | dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", |
601 | at24->bin.size, client->name, | 631 | at24->bin.size, client->name, |
602 | writable ? "(writable)" : "(read-only)"); | 632 | writable ? "writable" : "read-only", at24->write_max); |
603 | if (use_smbus == I2C_SMBUS_WORD_DATA || | 633 | if (use_smbus == I2C_SMBUS_WORD_DATA || |
604 | use_smbus == I2C_SMBUS_BYTE_DATA) { | 634 | use_smbus == I2C_SMBUS_BYTE_DATA) { |
605 | dev_notice(&client->dev, "Falling back to %s reads, " | 635 | dev_notice(&client->dev, "Falling back to %s reads, " |
606 | "performance will suffer\n", use_smbus == | 636 | "performance will suffer\n", use_smbus == |
607 | I2C_SMBUS_WORD_DATA ? "word" : "byte"); | 637 | I2C_SMBUS_WORD_DATA ? "word" : "byte"); |
608 | } | 638 | } |
609 | dev_dbg(&client->dev, | ||
610 | "page_size %d, num_addresses %d, write_max %d, use_smbus %d\n", | ||
611 | chip.page_size, num_addresses, | ||
612 | at24->write_max, use_smbus); | ||
613 | 639 | ||
614 | /* export data to kernel code */ | 640 | /* export data to kernel code */ |
615 | if (chip.setup) | 641 | if (chip.setup) |
@@ -660,6 +686,11 @@ static struct i2c_driver at24_driver = { | |||
660 | 686 | ||
661 | static int __init at24_init(void) | 687 | static int __init at24_init(void) |
662 | { | 688 | { |
689 | if (!io_limit) { | ||
690 | pr_err("at24: io_limit must not be 0!\n"); | ||
691 | return -EINVAL; | ||
692 | } | ||
693 | |||
663 | io_limit = rounddown_pow_of_two(io_limit); | 694 | io_limit = rounddown_pow_of_two(io_limit); |
664 | return i2c_add_driver(&at24_driver); | 695 | return i2c_add_driver(&at24_driver); |
665 | } | 696 | } |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index d618e8673996..e960a9300eb2 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -83,7 +83,7 @@ config MMC_RICOH_MMC | |||
83 | 83 | ||
84 | config MMC_SDHCI_OF | 84 | config MMC_SDHCI_OF |
85 | tristate "SDHCI support on OpenFirmware platforms" | 85 | tristate "SDHCI support on OpenFirmware platforms" |
86 | depends on MMC_SDHCI && PPC_OF | 86 | depends on MMC_SDHCI && OF |
87 | help | 87 | help |
88 | This selects the OF support for Secure Digital Host Controller | 88 | This selects the OF support for Secure Digital Host Controller |
89 | Interfaces. | 89 | Interfaces. |
@@ -93,6 +93,7 @@ config MMC_SDHCI_OF | |||
93 | config MMC_SDHCI_OF_ESDHC | 93 | config MMC_SDHCI_OF_ESDHC |
94 | bool "SDHCI OF support for the Freescale eSDHC controller" | 94 | bool "SDHCI OF support for the Freescale eSDHC controller" |
95 | depends on MMC_SDHCI_OF | 95 | depends on MMC_SDHCI_OF |
96 | depends on PPC_OF | ||
96 | select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER | 97 | select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER |
97 | help | 98 | help |
98 | This selects the Freescale eSDHC controller support. | 99 | This selects the Freescale eSDHC controller support. |
@@ -102,6 +103,7 @@ config MMC_SDHCI_OF_ESDHC | |||
102 | config MMC_SDHCI_OF_HLWD | 103 | config MMC_SDHCI_OF_HLWD |
103 | bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" | 104 | bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" |
104 | depends on MMC_SDHCI_OF | 105 | depends on MMC_SDHCI_OF |
106 | depends on PPC_OF | ||
105 | select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER | 107 | select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER |
106 | help | 108 | help |
107 | This selects the Secure Digital Host Controller Interface (SDHCI) | 109 | This selects the Secure Digital Host Controller Interface (SDHCI) |
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index c51b71174c1d..fa19d849a920 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c | |||
@@ -122,7 +122,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, | |||
122 | struct sdhci_of_data *sdhci_of_data = match->data; | 122 | struct sdhci_of_data *sdhci_of_data = match->data; |
123 | struct sdhci_host *host; | 123 | struct sdhci_host *host; |
124 | struct sdhci_of_host *of_host; | 124 | struct sdhci_of_host *of_host; |
125 | const u32 *clk; | 125 | const __be32 *clk; |
126 | int size; | 126 | int size; |
127 | int ret; | 127 | int ret; |
128 | 128 | ||
@@ -166,7 +166,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, | |||
166 | 166 | ||
167 | clk = of_get_property(np, "clock-frequency", &size); | 167 | clk = of_get_property(np, "clock-frequency", &size); |
168 | if (clk && size == sizeof(*clk) && *clk) | 168 | if (clk && size == sizeof(*clk) && *clk) |
169 | of_host->clock = *clk; | 169 | of_host->clock = be32_to_cpup(clk); |
170 | 170 | ||
171 | ret = sdhci_add_host(host); | 171 | ret = sdhci_add_host(host); |
172 | if (ret) | 172 | if (ret) |
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 1e2cbf5d9aa1..b1f768917395 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig | |||
@@ -159,7 +159,7 @@ config MTD_AFS_PARTS | |||
159 | 159 | ||
160 | config MTD_OF_PARTS | 160 | config MTD_OF_PARTS |
161 | tristate "Flash partition map based on OF description" | 161 | tristate "Flash partition map based on OF description" |
162 | depends on (MICROBLAZE || PPC_OF) && MTD_PARTITIONS | 162 | depends on OF && MTD_PARTITIONS |
163 | help | 163 | help |
164 | This provides a partition parsing function which derives | 164 | This provides a partition parsing function which derives |
165 | the partition map from the children of the flash node, | 165 | the partition map from the children of the flash node, |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index a0dd7bba9481..5d37d315fa98 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -72,7 +72,7 @@ config MTD_PHYSMAP_BANKWIDTH | |||
72 | 72 | ||
73 | config MTD_PHYSMAP_OF | 73 | config MTD_PHYSMAP_OF |
74 | tristate "Flash device in physical memory map based on OF description" | 74 | tristate "Flash device in physical memory map based on OF description" |
75 | depends on (MICROBLAZE || PPC_OF) && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) | 75 | depends on OF && (MTD_CFI || MTD_JEDECPROBE || MTD_ROM) |
76 | help | 76 | help |
77 | This provides a 'mapping' driver which allows the NOR Flash and | 77 | This provides a 'mapping' driver which allows the NOR Flash and |
78 | ROM driver code to communicate with chips which are mapped | 78 | ROM driver code to communicate with chips which are mapped |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index d684f187de57..7a1f3d0ffa78 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/of_mdio.h> | 40 | #include <linux/of_mdio.h> |
41 | #include <linux/of_platform.h> | 41 | #include <linux/of_platform.h> |
42 | #include <linux/of_gpio.h> | 42 | #include <linux/of_gpio.h> |
43 | #include <linux/of_net.h> | ||
43 | 44 | ||
44 | #include <linux/vmalloc.h> | 45 | #include <linux/vmalloc.h> |
45 | #include <asm/pgtable.h> | 46 | #include <asm/pgtable.h> |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 45c4b7bfcf39..6de4675016b5 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -95,6 +95,7 @@ | |||
95 | #include <linux/phy.h> | 95 | #include <linux/phy.h> |
96 | #include <linux/phy_fixed.h> | 96 | #include <linux/phy_fixed.h> |
97 | #include <linux/of.h> | 97 | #include <linux/of.h> |
98 | #include <linux/of_net.h> | ||
98 | 99 | ||
99 | #include "gianfar.h" | 100 | #include "gianfar.h" |
100 | #include "fsl_pq_mdio.h" | 101 | #include "fsl_pq_mdio.h" |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index acbdab3d66ca..73a3e0d93237 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/phy.h> | 28 | #include <linux/phy.h> |
29 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
30 | #include <linux/of_mdio.h> | 30 | #include <linux/of_mdio.h> |
31 | #include <linux/of_net.h> | ||
31 | #include <linux/of_platform.h> | 32 | #include <linux/of_platform.h> |
32 | 33 | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index de6c3086d232..cad66ce1640b 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/of_device.h> | 24 | #include <linux/of_device.h> |
25 | #include <linux/of_platform.h> | 25 | #include <linux/of_platform.h> |
26 | #include <linux/of_mdio.h> | 26 | #include <linux/of_mdio.h> |
27 | #include <linux/of_net.h> | ||
27 | #include <linux/phy.h> | 28 | #include <linux/phy.h> |
28 | 29 | ||
29 | #define DRIVER_NAME "xilinx_emaclite" | 30 | #define DRIVER_NAME "xilinx_emaclite" |
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index aa675ebd8eb3..3c6e100a3ad0 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
@@ -19,6 +19,10 @@ config OF_FLATTREE | |||
19 | bool | 19 | bool |
20 | select DTC | 20 | select DTC |
21 | 21 | ||
22 | config OF_EARLY_FLATTREE | ||
23 | bool | ||
24 | select OF_FLATTREE | ||
25 | |||
22 | config OF_PROMTREE | 26 | config OF_PROMTREE |
23 | bool | 27 | bool |
24 | 28 | ||
@@ -49,6 +53,10 @@ config OF_I2C | |||
49 | help | 53 | help |
50 | OpenFirmware I2C accessors | 54 | OpenFirmware I2C accessors |
51 | 55 | ||
56 | config OF_NET | ||
57 | depends on NETDEVICES | ||
58 | def_bool y | ||
59 | |||
52 | config OF_SPI | 60 | config OF_SPI |
53 | def_tristate SPI | 61 | def_tristate SPI |
54 | depends on SPI && !SPARC | 62 | depends on SPI && !SPARC |
diff --git a/drivers/of/Makefile b/drivers/of/Makefile index 7888155bea08..3ab21a0a4907 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile | |||
@@ -6,5 +6,6 @@ obj-$(CONFIG_OF_IRQ) += irq.o | |||
6 | obj-$(CONFIG_OF_DEVICE) += device.o platform.o | 6 | obj-$(CONFIG_OF_DEVICE) += device.o platform.o |
7 | obj-$(CONFIG_OF_GPIO) += gpio.o | 7 | obj-$(CONFIG_OF_GPIO) += gpio.o |
8 | obj-$(CONFIG_OF_I2C) += of_i2c.o | 8 | obj-$(CONFIG_OF_I2C) += of_i2c.o |
9 | obj-$(CONFIG_OF_NET) += of_net.o | ||
9 | obj-$(CONFIG_OF_SPI) += of_spi.o | 10 | obj-$(CONFIG_OF_SPI) += of_spi.o |
10 | obj-$(CONFIG_OF_MDIO) += of_mdio.o | 11 | obj-$(CONFIG_OF_MDIO) += of_mdio.o |
diff --git a/drivers/of/address.c b/drivers/of/address.c index 3a1c7e70b192..b4559c58c095 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -12,13 +12,13 @@ | |||
12 | (ns) > 0) | 12 | (ns) > 0) |
13 | 13 | ||
14 | static struct of_bus *of_match_bus(struct device_node *np); | 14 | static struct of_bus *of_match_bus(struct device_node *np); |
15 | static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, | 15 | static int __of_address_to_resource(struct device_node *dev, |
16 | u64 size, unsigned int flags, | 16 | const __be32 *addrp, u64 size, unsigned int flags, |
17 | struct resource *r); | 17 | struct resource *r); |
18 | 18 | ||
19 | /* Debug utility */ | 19 | /* Debug utility */ |
20 | #ifdef DEBUG | 20 | #ifdef DEBUG |
21 | static void of_dump_addr(const char *s, const u32 *addr, int na) | 21 | static void of_dump_addr(const char *s, const __be32 *addr, int na) |
22 | { | 22 | { |
23 | printk(KERN_DEBUG "%s", s); | 23 | printk(KERN_DEBUG "%s", s); |
24 | while (na--) | 24 | while (na--) |
@@ -26,7 +26,7 @@ static void of_dump_addr(const char *s, const u32 *addr, int na) | |||
26 | printk("\n"); | 26 | printk("\n"); |
27 | } | 27 | } |
28 | #else | 28 | #else |
29 | static void of_dump_addr(const char *s, const u32 *addr, int na) { } | 29 | static void of_dump_addr(const char *s, const __be32 *addr, int na) { } |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | /* Callbacks for bus specific translators */ | 32 | /* Callbacks for bus specific translators */ |
@@ -36,10 +36,10 @@ struct of_bus { | |||
36 | int (*match)(struct device_node *parent); | 36 | int (*match)(struct device_node *parent); |
37 | void (*count_cells)(struct device_node *child, | 37 | void (*count_cells)(struct device_node *child, |
38 | int *addrc, int *sizec); | 38 | int *addrc, int *sizec); |
39 | u64 (*map)(u32 *addr, const u32 *range, | 39 | u64 (*map)(u32 *addr, const __be32 *range, |
40 | int na, int ns, int pna); | 40 | int na, int ns, int pna); |
41 | int (*translate)(u32 *addr, u64 offset, int na); | 41 | int (*translate)(u32 *addr, u64 offset, int na); |
42 | unsigned int (*get_flags)(const u32 *addr); | 42 | unsigned int (*get_flags)(const __be32 *addr); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* | 45 | /* |
@@ -55,7 +55,7 @@ static void of_bus_default_count_cells(struct device_node *dev, | |||
55 | *sizec = of_n_size_cells(dev); | 55 | *sizec = of_n_size_cells(dev); |
56 | } | 56 | } |
57 | 57 | ||
58 | static u64 of_bus_default_map(u32 *addr, const u32 *range, | 58 | static u64 of_bus_default_map(u32 *addr, const __be32 *range, |
59 | int na, int ns, int pna) | 59 | int na, int ns, int pna) |
60 | { | 60 | { |
61 | u64 cp, s, da; | 61 | u64 cp, s, da; |
@@ -85,7 +85,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na) | |||
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | static unsigned int of_bus_default_get_flags(const u32 *addr) | 88 | static unsigned int of_bus_default_get_flags(const __be32 *addr) |
89 | { | 89 | { |
90 | return IORESOURCE_MEM; | 90 | return IORESOURCE_MEM; |
91 | } | 91 | } |
@@ -110,10 +110,10 @@ static void of_bus_pci_count_cells(struct device_node *np, | |||
110 | *sizec = 2; | 110 | *sizec = 2; |
111 | } | 111 | } |
112 | 112 | ||
113 | static unsigned int of_bus_pci_get_flags(const u32 *addr) | 113 | static unsigned int of_bus_pci_get_flags(const __be32 *addr) |
114 | { | 114 | { |
115 | unsigned int flags = 0; | 115 | unsigned int flags = 0; |
116 | u32 w = addr[0]; | 116 | u32 w = be32_to_cpup(addr); |
117 | 117 | ||
118 | switch((w >> 24) & 0x03) { | 118 | switch((w >> 24) & 0x03) { |
119 | case 0x01: | 119 | case 0x01: |
@@ -129,7 +129,8 @@ static unsigned int of_bus_pci_get_flags(const u32 *addr) | |||
129 | return flags; | 129 | return flags; |
130 | } | 130 | } |
131 | 131 | ||
132 | static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna) | 132 | static u64 of_bus_pci_map(u32 *addr, const __be32 *range, int na, int ns, |
133 | int pna) | ||
133 | { | 134 | { |
134 | u64 cp, s, da; | 135 | u64 cp, s, da; |
135 | unsigned int af, rf; | 136 | unsigned int af, rf; |
@@ -160,7 +161,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na) | |||
160 | return of_bus_default_translate(addr + 1, offset, na - 1); | 161 | return of_bus_default_translate(addr + 1, offset, na - 1); |
161 | } | 162 | } |
162 | 163 | ||
163 | const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | 164 | const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, |
164 | unsigned int *flags) | 165 | unsigned int *flags) |
165 | { | 166 | { |
166 | const __be32 *prop; | 167 | const __be32 *prop; |
@@ -207,7 +208,7 @@ EXPORT_SYMBOL(of_get_pci_address); | |||
207 | int of_pci_address_to_resource(struct device_node *dev, int bar, | 208 | int of_pci_address_to_resource(struct device_node *dev, int bar, |
208 | struct resource *r) | 209 | struct resource *r) |
209 | { | 210 | { |
210 | const u32 *addrp; | 211 | const __be32 *addrp; |
211 | u64 size; | 212 | u64 size; |
212 | unsigned int flags; | 213 | unsigned int flags; |
213 | 214 | ||
@@ -237,12 +238,13 @@ static void of_bus_isa_count_cells(struct device_node *child, | |||
237 | *sizec = 1; | 238 | *sizec = 1; |
238 | } | 239 | } |
239 | 240 | ||
240 | static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna) | 241 | static u64 of_bus_isa_map(u32 *addr, const __be32 *range, int na, int ns, |
242 | int pna) | ||
241 | { | 243 | { |
242 | u64 cp, s, da; | 244 | u64 cp, s, da; |
243 | 245 | ||
244 | /* Check address type match */ | 246 | /* Check address type match */ |
245 | if ((addr[0] ^ range[0]) & 0x00000001) | 247 | if ((addr[0] ^ range[0]) & cpu_to_be32(1)) |
246 | return OF_BAD_ADDR; | 248 | return OF_BAD_ADDR; |
247 | 249 | ||
248 | /* Read address values, skipping high cell */ | 250 | /* Read address values, skipping high cell */ |
@@ -264,10 +266,10 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na) | |||
264 | return of_bus_default_translate(addr + 1, offset, na - 1); | 266 | return of_bus_default_translate(addr + 1, offset, na - 1); |
265 | } | 267 | } |
266 | 268 | ||
267 | static unsigned int of_bus_isa_get_flags(const u32 *addr) | 269 | static unsigned int of_bus_isa_get_flags(const __be32 *addr) |
268 | { | 270 | { |
269 | unsigned int flags = 0; | 271 | unsigned int flags = 0; |
270 | u32 w = addr[0]; | 272 | u32 w = be32_to_cpup(addr); |
271 | 273 | ||
272 | if (w & 1) | 274 | if (w & 1) |
273 | flags |= IORESOURCE_IO; | 275 | flags |= IORESOURCE_IO; |
@@ -330,7 +332,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
330 | struct of_bus *pbus, u32 *addr, | 332 | struct of_bus *pbus, u32 *addr, |
331 | int na, int ns, int pna, const char *rprop) | 333 | int na, int ns, int pna, const char *rprop) |
332 | { | 334 | { |
333 | const u32 *ranges; | 335 | const __be32 *ranges; |
334 | unsigned int rlen; | 336 | unsigned int rlen; |
335 | int rone; | 337 | int rone; |
336 | u64 offset = OF_BAD_ADDR; | 338 | u64 offset = OF_BAD_ADDR; |
@@ -398,7 +400,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
398 | * that can be mapped to a cpu physical address). This is not really specified | 400 | * that can be mapped to a cpu physical address). This is not really specified |
399 | * that way, but this is traditionally the way IBM at least do things | 401 | * that way, but this is traditionally the way IBM at least do things |
400 | */ | 402 | */ |
401 | u64 __of_translate_address(struct device_node *dev, const u32 *in_addr, | 403 | u64 __of_translate_address(struct device_node *dev, const __be32 *in_addr, |
402 | const char *rprop) | 404 | const char *rprop) |
403 | { | 405 | { |
404 | struct device_node *parent = NULL; | 406 | struct device_node *parent = NULL; |
@@ -475,22 +477,22 @@ u64 __of_translate_address(struct device_node *dev, const u32 *in_addr, | |||
475 | return result; | 477 | return result; |
476 | } | 478 | } |
477 | 479 | ||
478 | u64 of_translate_address(struct device_node *dev, const u32 *in_addr) | 480 | u64 of_translate_address(struct device_node *dev, const __be32 *in_addr) |
479 | { | 481 | { |
480 | return __of_translate_address(dev, in_addr, "ranges"); | 482 | return __of_translate_address(dev, in_addr, "ranges"); |
481 | } | 483 | } |
482 | EXPORT_SYMBOL(of_translate_address); | 484 | EXPORT_SYMBOL(of_translate_address); |
483 | 485 | ||
484 | u64 of_translate_dma_address(struct device_node *dev, const u32 *in_addr) | 486 | u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr) |
485 | { | 487 | { |
486 | return __of_translate_address(dev, in_addr, "dma-ranges"); | 488 | return __of_translate_address(dev, in_addr, "dma-ranges"); |
487 | } | 489 | } |
488 | EXPORT_SYMBOL(of_translate_dma_address); | 490 | EXPORT_SYMBOL(of_translate_dma_address); |
489 | 491 | ||
490 | const u32 *of_get_address(struct device_node *dev, int index, u64 *size, | 492 | const __be32 *of_get_address(struct device_node *dev, int index, u64 *size, |
491 | unsigned int *flags) | 493 | unsigned int *flags) |
492 | { | 494 | { |
493 | const u32 *prop; | 495 | const __be32 *prop; |
494 | unsigned int psize; | 496 | unsigned int psize; |
495 | struct device_node *parent; | 497 | struct device_node *parent; |
496 | struct of_bus *bus; | 498 | struct of_bus *bus; |
@@ -525,8 +527,8 @@ const u32 *of_get_address(struct device_node *dev, int index, u64 *size, | |||
525 | } | 527 | } |
526 | EXPORT_SYMBOL(of_get_address); | 528 | EXPORT_SYMBOL(of_get_address); |
527 | 529 | ||
528 | static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, | 530 | static int __of_address_to_resource(struct device_node *dev, |
529 | u64 size, unsigned int flags, | 531 | const __be32 *addrp, u64 size, unsigned int flags, |
530 | struct resource *r) | 532 | struct resource *r) |
531 | { | 533 | { |
532 | u64 taddr; | 534 | u64 taddr; |
@@ -564,7 +566,7 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, | |||
564 | int of_address_to_resource(struct device_node *dev, int index, | 566 | int of_address_to_resource(struct device_node *dev, int index, |
565 | struct resource *r) | 567 | struct resource *r) |
566 | { | 568 | { |
567 | const u32 *addrp; | 569 | const __be32 *addrp; |
568 | u64 size; | 570 | u64 size; |
569 | unsigned int flags; | 571 | unsigned int flags; |
570 | 572 | ||
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c1360e02f921..c787c3d95c60 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -11,10 +11,12 @@ | |||
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/initrd.h> | 13 | #include <linux/initrd.h> |
14 | #include <linux/module.h> | ||
14 | #include <linux/of.h> | 15 | #include <linux/of.h> |
15 | #include <linux/of_fdt.h> | 16 | #include <linux/of_fdt.h> |
16 | #include <linux/string.h> | 17 | #include <linux/string.h> |
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/slab.h> | ||
18 | 20 | ||
19 | #ifdef CONFIG_PPC | 21 | #ifdef CONFIG_PPC |
20 | #include <asm/machdep.h> | 22 | #include <asm/machdep.h> |
@@ -22,104 +24,19 @@ | |||
22 | 24 | ||
23 | #include <asm/page.h> | 25 | #include <asm/page.h> |
24 | 26 | ||
25 | int __initdata dt_root_addr_cells; | 27 | char *of_fdt_get_string(struct boot_param_header *blob, u32 offset) |
26 | int __initdata dt_root_size_cells; | ||
27 | |||
28 | struct boot_param_header *initial_boot_params; | ||
29 | |||
30 | char *find_flat_dt_string(u32 offset) | ||
31 | { | 28 | { |
32 | return ((char *)initial_boot_params) + | 29 | return ((char *)blob) + |
33 | be32_to_cpu(initial_boot_params->off_dt_strings) + offset; | 30 | be32_to_cpu(blob->off_dt_strings) + offset; |
34 | } | ||
35 | |||
36 | /** | ||
37 | * of_scan_flat_dt - scan flattened tree blob and call callback on each. | ||
38 | * @it: callback function | ||
39 | * @data: context data pointer | ||
40 | * | ||
41 | * This function is used to scan the flattened device-tree, it is | ||
42 | * used to extract the memory information at boot before we can | ||
43 | * unflatten the tree | ||
44 | */ | ||
45 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
46 | const char *uname, int depth, | ||
47 | void *data), | ||
48 | void *data) | ||
49 | { | ||
50 | unsigned long p = ((unsigned long)initial_boot_params) + | ||
51 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
52 | int rc = 0; | ||
53 | int depth = -1; | ||
54 | |||
55 | do { | ||
56 | u32 tag = be32_to_cpup((__be32 *)p); | ||
57 | char *pathp; | ||
58 | |||
59 | p += 4; | ||
60 | if (tag == OF_DT_END_NODE) { | ||
61 | depth--; | ||
62 | continue; | ||
63 | } | ||
64 | if (tag == OF_DT_NOP) | ||
65 | continue; | ||
66 | if (tag == OF_DT_END) | ||
67 | break; | ||
68 | if (tag == OF_DT_PROP) { | ||
69 | u32 sz = be32_to_cpup((__be32 *)p); | ||
70 | p += 8; | ||
71 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | ||
72 | p = ALIGN(p, sz >= 8 ? 8 : 4); | ||
73 | p += sz; | ||
74 | p = ALIGN(p, 4); | ||
75 | continue; | ||
76 | } | ||
77 | if (tag != OF_DT_BEGIN_NODE) { | ||
78 | pr_err("Invalid tag %x in flat device tree!\n", tag); | ||
79 | return -EINVAL; | ||
80 | } | ||
81 | depth++; | ||
82 | pathp = (char *)p; | ||
83 | p = ALIGN(p + strlen(pathp) + 1, 4); | ||
84 | if ((*pathp) == '/') { | ||
85 | char *lp, *np; | ||
86 | for (lp = NULL, np = pathp; *np; np++) | ||
87 | if ((*np) == '/') | ||
88 | lp = np+1; | ||
89 | if (lp != NULL) | ||
90 | pathp = lp; | ||
91 | } | ||
92 | rc = it(p, pathp, depth, data); | ||
93 | if (rc != 0) | ||
94 | break; | ||
95 | } while (1); | ||
96 | |||
97 | return rc; | ||
98 | } | 31 | } |
99 | 32 | ||
100 | /** | 33 | /** |
101 | * of_get_flat_dt_root - find the root node in the flat blob | 34 | * of_fdt_get_property - Given a node in the given flat blob, return |
35 | * the property ptr | ||
102 | */ | 36 | */ |
103 | unsigned long __init of_get_flat_dt_root(void) | 37 | void *of_fdt_get_property(struct boot_param_header *blob, |
104 | { | 38 | unsigned long node, const char *name, |
105 | unsigned long p = ((unsigned long)initial_boot_params) + | 39 | unsigned long *size) |
106 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
107 | |||
108 | while (be32_to_cpup((__be32 *)p) == OF_DT_NOP) | ||
109 | p += 4; | ||
110 | BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); | ||
111 | p += 4; | ||
112 | return ALIGN(p + strlen((char *)p) + 1, 4); | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr | ||
117 | * | ||
118 | * This function can be used within scan_flattened_dt callback to get | ||
119 | * access to properties | ||
120 | */ | ||
121 | void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
122 | unsigned long *size) | ||
123 | { | 40 | { |
124 | unsigned long p = node; | 41 | unsigned long p = node; |
125 | 42 | ||
@@ -137,10 +54,10 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | |||
137 | sz = be32_to_cpup((__be32 *)p); | 54 | sz = be32_to_cpup((__be32 *)p); |
138 | noff = be32_to_cpup((__be32 *)(p + 4)); | 55 | noff = be32_to_cpup((__be32 *)(p + 4)); |
139 | p += 8; | 56 | p += 8; |
140 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | 57 | if (be32_to_cpu(blob->version) < 0x10) |
141 | p = ALIGN(p, sz >= 8 ? 8 : 4); | 58 | p = ALIGN(p, sz >= 8 ? 8 : 4); |
142 | 59 | ||
143 | nstr = find_flat_dt_string(noff); | 60 | nstr = of_fdt_get_string(blob, noff); |
144 | if (nstr == NULL) { | 61 | if (nstr == NULL) { |
145 | pr_warning("Can't find property index name !\n"); | 62 | pr_warning("Can't find property index name !\n"); |
146 | return NULL; | 63 | return NULL; |
@@ -156,21 +73,28 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | |||
156 | } | 73 | } |
157 | 74 | ||
158 | /** | 75 | /** |
159 | * of_flat_dt_is_compatible - Return true if given node has compat in compatible list | 76 | * of_fdt_is_compatible - Return true if given node from the given blob has |
77 | * compat in its compatible list | ||
78 | * @blob: A device tree blob | ||
160 | * @node: node to test | 79 | * @node: node to test |
161 | * @compat: compatible string to compare with compatible list. | 80 | * @compat: compatible string to compare with compatible list. |
81 | * | ||
82 | * On match, returns a non-zero value with smaller values returned for more | ||
83 | * specific compatible values. | ||
162 | */ | 84 | */ |
163 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | 85 | int of_fdt_is_compatible(struct boot_param_header *blob, |
86 | unsigned long node, const char *compat) | ||
164 | { | 87 | { |
165 | const char *cp; | 88 | const char *cp; |
166 | unsigned long cplen, l; | 89 | unsigned long cplen, l, score = 0; |
167 | 90 | ||
168 | cp = of_get_flat_dt_prop(node, "compatible", &cplen); | 91 | cp = of_fdt_get_property(blob, node, "compatible", &cplen); |
169 | if (cp == NULL) | 92 | if (cp == NULL) |
170 | return 0; | 93 | return 0; |
171 | while (cplen > 0) { | 94 | while (cplen > 0) { |
95 | score++; | ||
172 | if (of_compat_cmp(cp, compat, strlen(compat)) == 0) | 96 | if (of_compat_cmp(cp, compat, strlen(compat)) == 0) |
173 | return 1; | 97 | return score; |
174 | l = strlen(cp) + 1; | 98 | l = strlen(cp) + 1; |
175 | cp += l; | 99 | cp += l; |
176 | cplen -= l; | 100 | cplen -= l; |
@@ -179,7 +103,28 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | |||
179 | return 0; | 103 | return 0; |
180 | } | 104 | } |
181 | 105 | ||
182 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | 106 | /** |
107 | * of_fdt_match - Return true if node matches a list of compatible values | ||
108 | */ | ||
109 | int of_fdt_match(struct boot_param_header *blob, unsigned long node, | ||
110 | const char **compat) | ||
111 | { | ||
112 | unsigned int tmp, score = 0; | ||
113 | |||
114 | if (!compat) | ||
115 | return 0; | ||
116 | |||
117 | while (*compat) { | ||
118 | tmp = of_fdt_is_compatible(blob, node, *compat); | ||
119 | if (tmp && (score == 0 || (tmp < score))) | ||
120 | score = tmp; | ||
121 | compat++; | ||
122 | } | ||
123 | |||
124 | return score; | ||
125 | } | ||
126 | |||
127 | static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size, | ||
183 | unsigned long align) | 128 | unsigned long align) |
184 | { | 129 | { |
185 | void *res; | 130 | void *res; |
@@ -193,16 +138,18 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | |||
193 | 138 | ||
194 | /** | 139 | /** |
195 | * unflatten_dt_node - Alloc and populate a device_node from the flat tree | 140 | * unflatten_dt_node - Alloc and populate a device_node from the flat tree |
141 | * @blob: The parent device tree blob | ||
196 | * @p: pointer to node in flat tree | 142 | * @p: pointer to node in flat tree |
197 | * @dad: Parent struct device_node | 143 | * @dad: Parent struct device_node |
198 | * @allnextpp: pointer to ->allnext from last allocated device_node | 144 | * @allnextpp: pointer to ->allnext from last allocated device_node |
199 | * @fpsize: Size of the node path up at the current depth. | 145 | * @fpsize: Size of the node path up at the current depth. |
200 | */ | 146 | */ |
201 | unsigned long __init unflatten_dt_node(unsigned long mem, | 147 | unsigned long unflatten_dt_node(struct boot_param_header *blob, |
202 | unsigned long *p, | 148 | unsigned long mem, |
203 | struct device_node *dad, | 149 | unsigned long *p, |
204 | struct device_node ***allnextpp, | 150 | struct device_node *dad, |
205 | unsigned long fpsize) | 151 | struct device_node ***allnextpp, |
152 | unsigned long fpsize) | ||
206 | { | 153 | { |
207 | struct device_node *np; | 154 | struct device_node *np; |
208 | struct property *pp, **prev_pp = NULL; | 155 | struct property *pp, **prev_pp = NULL; |
@@ -298,10 +245,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
298 | sz = be32_to_cpup((__be32 *)(*p)); | 245 | sz = be32_to_cpup((__be32 *)(*p)); |
299 | noff = be32_to_cpup((__be32 *)((*p) + 4)); | 246 | noff = be32_to_cpup((__be32 *)((*p) + 4)); |
300 | *p += 8; | 247 | *p += 8; |
301 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | 248 | if (be32_to_cpu(blob->version) < 0x10) |
302 | *p = ALIGN(*p, sz >= 8 ? 8 : 4); | 249 | *p = ALIGN(*p, sz >= 8 ? 8 : 4); |
303 | 250 | ||
304 | pname = find_flat_dt_string(noff); | 251 | pname = of_fdt_get_string(blob, noff); |
305 | if (pname == NULL) { | 252 | if (pname == NULL) { |
306 | pr_info("Can't find property name in list !\n"); | 253 | pr_info("Can't find property name in list !\n"); |
307 | break; | 254 | break; |
@@ -380,7 +327,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
380 | if (tag == OF_DT_NOP) | 327 | if (tag == OF_DT_NOP) |
381 | *p += 4; | 328 | *p += 4; |
382 | else | 329 | else |
383 | mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); | 330 | mem = unflatten_dt_node(blob, mem, p, np, allnextpp, |
331 | fpsize); | ||
384 | tag = be32_to_cpup((__be32 *)(*p)); | 332 | tag = be32_to_cpup((__be32 *)(*p)); |
385 | } | 333 | } |
386 | if (tag != OF_DT_END_NODE) { | 334 | if (tag != OF_DT_END_NODE) { |
@@ -391,6 +339,211 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
391 | return mem; | 339 | return mem; |
392 | } | 340 | } |
393 | 341 | ||
342 | /** | ||
343 | * __unflatten_device_tree - create tree of device_nodes from flat blob | ||
344 | * | ||
345 | * unflattens a device-tree, creating the | ||
346 | * tree of struct device_node. It also fills the "name" and "type" | ||
347 | * pointers of the nodes so the normal device-tree walking functions | ||
348 | * can be used. | ||
349 | * @blob: The blob to expand | ||
350 | * @mynodes: The device_node tree created by the call | ||
351 | * @dt_alloc: An allocator that provides a virtual address to memory | ||
352 | * for the resulting tree | ||
353 | */ | ||
354 | void __unflatten_device_tree(struct boot_param_header *blob, | ||
355 | struct device_node **mynodes, | ||
356 | void * (*dt_alloc)(u64 size, u64 align)) | ||
357 | { | ||
358 | unsigned long start, mem, size; | ||
359 | struct device_node **allnextp = mynodes; | ||
360 | |||
361 | pr_debug(" -> unflatten_device_tree()\n"); | ||
362 | |||
363 | if (!blob) { | ||
364 | pr_debug("No device tree pointer\n"); | ||
365 | return; | ||
366 | } | ||
367 | |||
368 | pr_debug("Unflattening device tree:\n"); | ||
369 | pr_debug("magic: %08x\n", be32_to_cpu(blob->magic)); | ||
370 | pr_debug("size: %08x\n", be32_to_cpu(blob->totalsize)); | ||
371 | pr_debug("version: %08x\n", be32_to_cpu(blob->version)); | ||
372 | |||
373 | if (be32_to_cpu(blob->magic) != OF_DT_HEADER) { | ||
374 | pr_err("Invalid device tree blob header\n"); | ||
375 | return; | ||
376 | } | ||
377 | |||
378 | /* First pass, scan for size */ | ||
379 | start = ((unsigned long)blob) + | ||
380 | be32_to_cpu(blob->off_dt_struct); | ||
381 | size = unflatten_dt_node(blob, 0, &start, NULL, NULL, 0); | ||
382 | size = (size | 3) + 1; | ||
383 | |||
384 | pr_debug(" size is %lx, allocating...\n", size); | ||
385 | |||
386 | /* Allocate memory for the expanded device tree */ | ||
387 | mem = (unsigned long) | ||
388 | dt_alloc(size + 4, __alignof__(struct device_node)); | ||
389 | |||
390 | ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); | ||
391 | |||
392 | pr_debug(" unflattening %lx...\n", mem); | ||
393 | |||
394 | /* Second pass, do actual unflattening */ | ||
395 | start = ((unsigned long)blob) + | ||
396 | be32_to_cpu(blob->off_dt_struct); | ||
397 | unflatten_dt_node(blob, mem, &start, NULL, &allnextp, 0); | ||
398 | if (be32_to_cpup((__be32 *)start) != OF_DT_END) | ||
399 | pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); | ||
400 | if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef) | ||
401 | pr_warning("End of tree marker overwritten: %08x\n", | ||
402 | be32_to_cpu(((__be32 *)mem)[size / 4])); | ||
403 | *allnextp = NULL; | ||
404 | |||
405 | pr_debug(" <- unflatten_device_tree()\n"); | ||
406 | } | ||
407 | |||
408 | static void *kernel_tree_alloc(u64 size, u64 align) | ||
409 | { | ||
410 | return kzalloc(size, GFP_KERNEL); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * of_fdt_unflatten_tree - create tree of device_nodes from flat blob | ||
415 | * | ||
416 | * unflattens the device-tree passed by the firmware, creating the | ||
417 | * tree of struct device_node. It also fills the "name" and "type" | ||
418 | * pointers of the nodes so the normal device-tree walking functions | ||
419 | * can be used. | ||
420 | */ | ||
421 | void of_fdt_unflatten_tree(unsigned long *blob, | ||
422 | struct device_node **mynodes) | ||
423 | { | ||
424 | struct boot_param_header *device_tree = | ||
425 | (struct boot_param_header *)blob; | ||
426 | __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc); | ||
427 | } | ||
428 | EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); | ||
429 | |||
430 | /* Everything below here references initial_boot_params directly. */ | ||
431 | int __initdata dt_root_addr_cells; | ||
432 | int __initdata dt_root_size_cells; | ||
433 | |||
434 | struct boot_param_header *initial_boot_params; | ||
435 | |||
436 | #ifdef CONFIG_OF_EARLY_FLATTREE | ||
437 | |||
438 | /** | ||
439 | * of_scan_flat_dt - scan flattened tree blob and call callback on each. | ||
440 | * @it: callback function | ||
441 | * @data: context data pointer | ||
442 | * | ||
443 | * This function is used to scan the flattened device-tree, it is | ||
444 | * used to extract the memory information at boot before we can | ||
445 | * unflatten the tree | ||
446 | */ | ||
447 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
448 | const char *uname, int depth, | ||
449 | void *data), | ||
450 | void *data) | ||
451 | { | ||
452 | unsigned long p = ((unsigned long)initial_boot_params) + | ||
453 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
454 | int rc = 0; | ||
455 | int depth = -1; | ||
456 | |||
457 | do { | ||
458 | u32 tag = be32_to_cpup((__be32 *)p); | ||
459 | char *pathp; | ||
460 | |||
461 | p += 4; | ||
462 | if (tag == OF_DT_END_NODE) { | ||
463 | depth--; | ||
464 | continue; | ||
465 | } | ||
466 | if (tag == OF_DT_NOP) | ||
467 | continue; | ||
468 | if (tag == OF_DT_END) | ||
469 | break; | ||
470 | if (tag == OF_DT_PROP) { | ||
471 | u32 sz = be32_to_cpup((__be32 *)p); | ||
472 | p += 8; | ||
473 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | ||
474 | p = ALIGN(p, sz >= 8 ? 8 : 4); | ||
475 | p += sz; | ||
476 | p = ALIGN(p, 4); | ||
477 | continue; | ||
478 | } | ||
479 | if (tag != OF_DT_BEGIN_NODE) { | ||
480 | pr_err("Invalid tag %x in flat device tree!\n", tag); | ||
481 | return -EINVAL; | ||
482 | } | ||
483 | depth++; | ||
484 | pathp = (char *)p; | ||
485 | p = ALIGN(p + strlen(pathp) + 1, 4); | ||
486 | if ((*pathp) == '/') { | ||
487 | char *lp, *np; | ||
488 | for (lp = NULL, np = pathp; *np; np++) | ||
489 | if ((*np) == '/') | ||
490 | lp = np+1; | ||
491 | if (lp != NULL) | ||
492 | pathp = lp; | ||
493 | } | ||
494 | rc = it(p, pathp, depth, data); | ||
495 | if (rc != 0) | ||
496 | break; | ||
497 | } while (1); | ||
498 | |||
499 | return rc; | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * of_get_flat_dt_root - find the root node in the flat blob | ||
504 | */ | ||
505 | unsigned long __init of_get_flat_dt_root(void) | ||
506 | { | ||
507 | unsigned long p = ((unsigned long)initial_boot_params) + | ||
508 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
509 | |||
510 | while (be32_to_cpup((__be32 *)p) == OF_DT_NOP) | ||
511 | p += 4; | ||
512 | BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); | ||
513 | p += 4; | ||
514 | return ALIGN(p + strlen((char *)p) + 1, 4); | ||
515 | } | ||
516 | |||
517 | /** | ||
518 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr | ||
519 | * | ||
520 | * This function can be used within scan_flattened_dt callback to get | ||
521 | * access to properties | ||
522 | */ | ||
523 | void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
524 | unsigned long *size) | ||
525 | { | ||
526 | return of_fdt_get_property(initial_boot_params, node, name, size); | ||
527 | } | ||
528 | |||
529 | /** | ||
530 | * of_flat_dt_is_compatible - Return true if given node has compat in compatible list | ||
531 | * @node: node to test | ||
532 | * @compat: compatible string to compare with compatible list. | ||
533 | */ | ||
534 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | ||
535 | { | ||
536 | return of_fdt_is_compatible(initial_boot_params, node, compat); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * of_flat_dt_match - Return true if node matches a list of compatible values | ||
541 | */ | ||
542 | int __init of_flat_dt_match(unsigned long node, const char **compat) | ||
543 | { | ||
544 | return of_fdt_match(initial_boot_params, node, compat); | ||
545 | } | ||
546 | |||
394 | #ifdef CONFIG_BLK_DEV_INITRD | 547 | #ifdef CONFIG_BLK_DEV_INITRD |
395 | /** | 548 | /** |
396 | * early_init_dt_check_for_initrd - Decode initrd location from flat tree | 549 | * early_init_dt_check_for_initrd - Decode initrd location from flat tree |
@@ -539,6 +692,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
539 | return 1; | 692 | return 1; |
540 | } | 693 | } |
541 | 694 | ||
695 | static void *__init early_device_tree_alloc(u64 size, u64 align) | ||
696 | { | ||
697 | unsigned long mem = early_init_dt_alloc_memory_arch(size, align); | ||
698 | return __va(mem); | ||
699 | } | ||
700 | |||
542 | /** | 701 | /** |
543 | * unflatten_device_tree - create tree of device_nodes from flat blob | 702 | * unflatten_device_tree - create tree of device_nodes from flat blob |
544 | * | 703 | * |
@@ -549,58 +708,13 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
549 | */ | 708 | */ |
550 | void __init unflatten_device_tree(void) | 709 | void __init unflatten_device_tree(void) |
551 | { | 710 | { |
552 | unsigned long start, mem, size; | 711 | __unflatten_device_tree(initial_boot_params, &allnodes, |
553 | struct device_node **allnextp = &allnodes; | 712 | early_device_tree_alloc); |
554 | |||
555 | pr_debug(" -> unflatten_device_tree()\n"); | ||
556 | |||
557 | if (!initial_boot_params) { | ||
558 | pr_debug("No device tree pointer\n"); | ||
559 | return; | ||
560 | } | ||
561 | |||
562 | pr_debug("Unflattening device tree:\n"); | ||
563 | pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic)); | ||
564 | pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize)); | ||
565 | pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version)); | ||
566 | |||
567 | if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { | ||
568 | pr_err("Invalid device tree blob header\n"); | ||
569 | return; | ||
570 | } | ||
571 | |||
572 | /* First pass, scan for size */ | ||
573 | start = ((unsigned long)initial_boot_params) + | ||
574 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
575 | size = unflatten_dt_node(0, &start, NULL, NULL, 0); | ||
576 | size = (size | 3) + 1; | ||
577 | |||
578 | pr_debug(" size is %lx, allocating...\n", size); | ||
579 | |||
580 | /* Allocate memory for the expanded device tree */ | ||
581 | mem = early_init_dt_alloc_memory_arch(size + 4, | ||
582 | __alignof__(struct device_node)); | ||
583 | mem = (unsigned long) __va(mem); | ||
584 | |||
585 | ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); | ||
586 | |||
587 | pr_debug(" unflattening %lx...\n", mem); | ||
588 | |||
589 | /* Second pass, do actual unflattening */ | ||
590 | start = ((unsigned long)initial_boot_params) + | ||
591 | be32_to_cpu(initial_boot_params->off_dt_struct); | ||
592 | unflatten_dt_node(mem, &start, NULL, &allnextp, 0); | ||
593 | if (be32_to_cpup((__be32 *)start) != OF_DT_END) | ||
594 | pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); | ||
595 | if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef) | ||
596 | pr_warning("End of tree marker overwritten: %08x\n", | ||
597 | be32_to_cpu(((__be32 *)mem)[size / 4])); | ||
598 | *allnextp = NULL; | ||
599 | 713 | ||
600 | /* Get pointer to OF "/chosen" node for use everywhere */ | 714 | /* Get pointer to OF "/chosen" node for use everywhere */ |
601 | of_chosen = of_find_node_by_path("/chosen"); | 715 | of_chosen = of_find_node_by_path("/chosen"); |
602 | if (of_chosen == NULL) | 716 | if (of_chosen == NULL) |
603 | of_chosen = of_find_node_by_path("/chosen@0"); | 717 | of_chosen = of_find_node_by_path("/chosen@0"); |
604 | |||
605 | pr_debug(" <- unflatten_device_tree()\n"); | ||
606 | } | 718 | } |
719 | |||
720 | #endif /* CONFIG_OF_EARLY_FLATTREE */ | ||
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 1fce00eb421b..dcd7857784f2 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -52,27 +52,35 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
52 | 52 | ||
53 | /* Loop over the child nodes and register a phy_device for each one */ | 53 | /* Loop over the child nodes and register a phy_device for each one */ |
54 | for_each_child_of_node(np, child) { | 54 | for_each_child_of_node(np, child) { |
55 | const __be32 *addr; | 55 | const __be32 *paddr; |
56 | u32 addr; | ||
56 | int len; | 57 | int len; |
57 | 58 | ||
58 | /* A PHY must have a reg property in the range [0-31] */ | 59 | /* A PHY must have a reg property in the range [0-31] */ |
59 | addr = of_get_property(child, "reg", &len); | 60 | paddr = of_get_property(child, "reg", &len); |
60 | if (!addr || len < sizeof(*addr) || *addr >= 32 || *addr < 0) { | 61 | if (!paddr || len < sizeof(*paddr)) { |
61 | dev_err(&mdio->dev, "%s has invalid PHY address\n", | 62 | dev_err(&mdio->dev, "%s has invalid PHY address\n", |
62 | child->full_name); | 63 | child->full_name); |
63 | continue; | 64 | continue; |
64 | } | 65 | } |
65 | 66 | ||
67 | addr = be32_to_cpup(paddr); | ||
68 | if (addr >= 32) { | ||
69 | dev_err(&mdio->dev, "%s PHY address %i is too large\n", | ||
70 | child->full_name, addr); | ||
71 | continue; | ||
72 | } | ||
73 | |||
66 | if (mdio->irq) { | 74 | if (mdio->irq) { |
67 | mdio->irq[*addr] = irq_of_parse_and_map(child, 0); | 75 | mdio->irq[addr] = irq_of_parse_and_map(child, 0); |
68 | if (!mdio->irq[*addr]) | 76 | if (!mdio->irq[addr]) |
69 | mdio->irq[*addr] = PHY_POLL; | 77 | mdio->irq[addr] = PHY_POLL; |
70 | } | 78 | } |
71 | 79 | ||
72 | phy = get_phy_device(mdio, be32_to_cpup(addr)); | 80 | phy = get_phy_device(mdio, addr); |
73 | if (!phy || IS_ERR(phy)) { | 81 | if (!phy || IS_ERR(phy)) { |
74 | dev_err(&mdio->dev, "error probing PHY at address %i\n", | 82 | dev_err(&mdio->dev, "error probing PHY at address %i\n", |
75 | *addr); | 83 | addr); |
76 | continue; | 84 | continue; |
77 | } | 85 | } |
78 | phy_scan_fixups(phy); | 86 | phy_scan_fixups(phy); |
@@ -91,7 +99,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
91 | } | 99 | } |
92 | 100 | ||
93 | dev_dbg(&mdio->dev, "registered phy %s at address %i\n", | 101 | dev_dbg(&mdio->dev, "registered phy %s at address %i\n", |
94 | child->name, *addr); | 102 | child->name, addr); |
95 | } | 103 | } |
96 | 104 | ||
97 | return 0; | 105 | return 0; |
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c new file mode 100644 index 000000000000..86f334a2769c --- /dev/null +++ b/drivers/of/of_net.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * OF helpers for network devices. | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | * | ||
6 | * Initially copied out of arch/powerpc/kernel/prom_parse.c | ||
7 | */ | ||
8 | #include <linux/etherdevice.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/of_net.h> | ||
11 | |||
12 | /** | ||
13 | * Search the device tree for the best MAC address to use. 'mac-address' is | ||
14 | * checked first, because that is supposed to contain to "most recent" MAC | ||
15 | * address. If that isn't set, then 'local-mac-address' is checked next, | ||
16 | * because that is the default address. If that isn't set, then the obsolete | ||
17 | * 'address' is checked, just in case we're using an old device tree. | ||
18 | * | ||
19 | * Note that the 'address' property is supposed to contain a virtual address of | ||
20 | * the register set, but some DTS files have redefined that property to be the | ||
21 | * MAC address. | ||
22 | * | ||
23 | * All-zero MAC addresses are rejected, because those could be properties that | ||
24 | * exist in the device tree, but were not set by U-Boot. For example, the | ||
25 | * DTS could define 'mac-address' and 'local-mac-address', with zero MAC | ||
26 | * addresses. Some older U-Boots only initialized 'local-mac-address'. In | ||
27 | * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists | ||
28 | * but is all zeros. | ||
29 | */ | ||
30 | const void *of_get_mac_address(struct device_node *np) | ||
31 | { | ||
32 | struct property *pp; | ||
33 | |||
34 | pp = of_find_property(np, "mac-address", NULL); | ||
35 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
36 | return pp->value; | ||
37 | |||
38 | pp = of_find_property(np, "local-mac-address", NULL); | ||
39 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
40 | return pp->value; | ||
41 | |||
42 | pp = of_find_property(np, "address", NULL); | ||
43 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
44 | return pp->value; | ||
45 | |||
46 | return NULL; | ||
47 | } | ||
48 | EXPORT_SYMBOL(of_get_mac_address); | ||
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 5b4a07f1220e..c01cd1ac7617 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc); | |||
633 | * @np: pointer to node to create device for | 633 | * @np: pointer to node to create device for |
634 | * @bus_id: name to assign device | 634 | * @bus_id: name to assign device |
635 | * @parent: Linux device model parent device. | 635 | * @parent: Linux device model parent device. |
636 | * | ||
637 | * Returns pointer to created platform device, or NULL if a device was not | ||
638 | * registered. Unavailable devices will not get registered. | ||
636 | */ | 639 | */ |
637 | struct platform_device *of_platform_device_create(struct device_node *np, | 640 | struct platform_device *of_platform_device_create(struct device_node *np, |
638 | const char *bus_id, | 641 | const char *bus_id, |
@@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np, | |||
640 | { | 643 | { |
641 | struct platform_device *dev; | 644 | struct platform_device *dev; |
642 | 645 | ||
646 | if (!of_device_is_available(np)) | ||
647 | return NULL; | ||
648 | |||
643 | dev = of_device_alloc(np, bus_id, parent); | 649 | dev = of_device_alloc(np, bus_id, parent); |
644 | if (!dev) | 650 | if (!dev) |
645 | return NULL; | 651 | return NULL; |
@@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus, | |||
683 | pr_debug(" create child: %s\n", child->full_name); | 689 | pr_debug(" create child: %s\n", child->full_name); |
684 | dev = of_platform_device_create(child, NULL, parent); | 690 | dev = of_platform_device_create(child, NULL, parent); |
685 | if (dev == NULL) | 691 | if (dev == NULL) |
686 | rc = -ENOMEM; | 692 | continue; |
687 | else if (!of_match_node(matches, child)) | 693 | |
694 | if (!of_match_node(matches, child)) | ||
688 | continue; | 695 | continue; |
689 | if (rc == 0) { | 696 | if (rc == 0) { |
690 | pr_debug(" and sub busses\n"); | 697 | pr_debug(" and sub busses\n"); |
@@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root, | |||
733 | if (of_match_node(matches, root)) { | 740 | if (of_match_node(matches, root)) { |
734 | pr_debug(" root match, create all sub devices\n"); | 741 | pr_debug(" root match, create all sub devices\n"); |
735 | dev = of_platform_device_create(root, NULL, parent); | 742 | dev = of_platform_device_create(root, NULL, parent); |
736 | if (dev == NULL) { | 743 | if (dev == NULL) |
737 | rc = -ENOMEM; | ||
738 | goto bail; | 744 | goto bail; |
739 | } | 745 | |
740 | pr_debug(" create all sub busses\n"); | 746 | pr_debug(" create all sub busses\n"); |
741 | rc = of_platform_bus_create(root, matches, &dev->dev); | 747 | rc = of_platform_bus_create(root, matches, &dev->dev); |
742 | goto bail; | 748 | goto bail; |
@@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root, | |||
748 | pr_debug(" match: %s\n", child->full_name); | 754 | pr_debug(" match: %s\n", child->full_name); |
749 | dev = of_platform_device_create(child, NULL, parent); | 755 | dev = of_platform_device_create(child, NULL, parent); |
750 | if (dev == NULL) | 756 | if (dev == NULL) |
751 | rc = -ENOMEM; | 757 | continue; |
752 | else | 758 | |
753 | rc = of_platform_bus_create(child, matches, &dev->dev); | 759 | rc = of_platform_bus_create(child, matches, &dev->dev); |
754 | if (rc) { | 760 | if (rc) { |
755 | of_node_put(child); | 761 | of_node_put(child); |
756 | break; | 762 | break; |
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index a624f5af4320..e8566224fe4b 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c | |||
@@ -467,7 +467,7 @@ static int jsflash_init(void) | |||
467 | 467 | ||
468 | node = prom_getchild(prom_root_node); | 468 | node = prom_getchild(prom_root_node); |
469 | node = prom_searchsiblings(node, "flash-memory"); | 469 | node = prom_searchsiblings(node, "flash-memory"); |
470 | if (node != 0 && node != -1) { | 470 | if (node != 0 && (s32)node != -1) { |
471 | if (prom_getproperty(node, "reg", | 471 | if (prom_getproperty(node, "reg", |
472 | (char *)®0, sizeof(reg0)) == -1) { | 472 | (char *)®0, sizeof(reg0)) == -1) { |
473 | printk("jsflash: no \"reg\" property\n"); | 473 | printk("jsflash: no \"reg\" property\n"); |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ec3c214598d0..188aff6d263f 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -1412,7 +1412,7 @@ config SERIAL_NETX_CONSOLE | |||
1412 | 1412 | ||
1413 | config SERIAL_OF_PLATFORM | 1413 | config SERIAL_OF_PLATFORM |
1414 | tristate "Serial port on Open Firmware platform bus" | 1414 | tristate "Serial port on Open Firmware platform bus" |
1415 | depends on PPC_OF || MICROBLAZE | 1415 | depends on OF |
1416 | depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL | 1416 | depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL |
1417 | help | 1417 | help |
1418 | If you have a PowerPC based system that has serial ports | 1418 | If you have a PowerPC based system that has serial ports |
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index 17849dcb9adc..5c7abe4c94dd 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/serial_core.h> | 15 | #include <linux/serial_core.h> |
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
18 | #include <linux/of_irq.h> | ||
18 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
19 | #include <linux/nwpserial.h> | 20 | #include <linux/nwpserial.h> |
20 | 21 | ||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index bd69d79208de..05cbad03c5ab 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -67,7 +67,8 @@ | |||
67 | * Align to a 32 byte boundary equal to the | 67 | * Align to a 32 byte boundary equal to the |
68 | * alignment gcc 4.5 uses for a struct | 68 | * alignment gcc 4.5 uses for a struct |
69 | */ | 69 | */ |
70 | #define STRUCT_ALIGN() . = ALIGN(32) | 70 | #define STRUCT_ALIGNMENT 32 |
71 | #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT) | ||
71 | 72 | ||
72 | /* The actual configuration determine if the init/exit sections | 73 | /* The actual configuration determine if the init/exit sections |
73 | * are handled as text/data or they can be discarded (which | 74 | * are handled as text/data or they can be discarded (which |
@@ -146,6 +147,13 @@ | |||
146 | #define TRACE_SYSCALLS() | 147 | #define TRACE_SYSCALLS() |
147 | #endif | 148 | #endif |
148 | 149 | ||
150 | |||
151 | #define KERNEL_DTB() \ | ||
152 | STRUCT_ALIGN(); \ | ||
153 | VMLINUX_SYMBOL(__dtb_start) = .; \ | ||
154 | *(.dtb.init.rodata) \ | ||
155 | VMLINUX_SYMBOL(__dtb_end) = .; | ||
156 | |||
149 | /* .data section */ | 157 | /* .data section */ |
150 | #define DATA_DATA \ | 158 | #define DATA_DATA \ |
151 | *(.data) \ | 159 | *(.data) \ |
@@ -468,7 +476,8 @@ | |||
468 | MCOUNT_REC() \ | 476 | MCOUNT_REC() \ |
469 | DEV_DISCARD(init.rodata) \ | 477 | DEV_DISCARD(init.rodata) \ |
470 | CPU_DISCARD(init.rodata) \ | 478 | CPU_DISCARD(init.rodata) \ |
471 | MEM_DISCARD(init.rodata) | 479 | MEM_DISCARD(init.rodata) \ |
480 | KERNEL_DTB() | ||
472 | 481 | ||
473 | #define INIT_TEXT \ | 482 | #define INIT_TEXT \ |
474 | *(.init.text) \ | 483 | *(.init.text) \ |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 8aea06f0564c..2feda6ee6140 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <linux/ioport.h> | 3 | #include <linux/ioport.h> |
4 | #include <linux/of.h> | 4 | #include <linux/of.h> |
5 | 5 | ||
6 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | 6 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
7 | extern int of_address_to_resource(struct device_node *dev, int index, | 7 | extern int of_address_to_resource(struct device_node *dev, int index, |
8 | struct resource *r); | 8 | struct resource *r); |
9 | extern void __iomem *of_iomap(struct device_node *device, int index); | 9 | extern void __iomem *of_iomap(struct device_node *device, int index); |
@@ -21,7 +21,7 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } | |||
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef CONFIG_PCI | 23 | #ifdef CONFIG_PCI |
24 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, | 24 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
25 | u64 *size, unsigned int *flags); | 25 | u64 *size, unsigned int *flags); |
26 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 26 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
27 | struct resource *r); | 27 | struct resource *r); |
@@ -32,7 +32,7 @@ static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
32 | return -ENOSYS; | 32 | return -ENOSYS; |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline const u32 *of_get_pci_address(struct device_node *dev, | 35 | static inline const __be32 *of_get_pci_address(struct device_node *dev, |
36 | int bar_no, u64 *size, unsigned int *flags) | 36 | int bar_no, u64 *size, unsigned int *flags) |
37 | { | 37 | { |
38 | return NULL; | 38 | return NULL; |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 7bbf5b328438..0ef22a1f129e 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h | |||
@@ -58,6 +58,23 @@ struct boot_param_header { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | #if defined(CONFIG_OF_FLATTREE) | 60 | #if defined(CONFIG_OF_FLATTREE) |
61 | |||
62 | struct device_node; | ||
63 | |||
64 | /* For scanning an arbitrary device-tree at any time */ | ||
65 | extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset); | ||
66 | extern void *of_fdt_get_property(struct boot_param_header *blob, | ||
67 | unsigned long node, | ||
68 | const char *name, | ||
69 | unsigned long *size); | ||
70 | extern int of_fdt_is_compatible(struct boot_param_header *blob, | ||
71 | unsigned long node, | ||
72 | const char *compat); | ||
73 | extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, | ||
74 | const char **compat); | ||
75 | extern void of_fdt_unflatten_tree(unsigned long *blob, | ||
76 | struct device_node **mynodes); | ||
77 | |||
61 | /* TBD: Temporary export of fdt globals - remove when code fully merged */ | 78 | /* TBD: Temporary export of fdt globals - remove when code fully merged */ |
62 | extern int __initdata dt_root_addr_cells; | 79 | extern int __initdata dt_root_addr_cells; |
63 | extern int __initdata dt_root_size_cells; | 80 | extern int __initdata dt_root_size_cells; |
@@ -71,6 +88,7 @@ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, | |||
71 | extern void *of_get_flat_dt_prop(unsigned long node, const char *name, | 88 | extern void *of_get_flat_dt_prop(unsigned long node, const char *name, |
72 | unsigned long *size); | 89 | unsigned long *size); |
73 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | 90 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); |
91 | extern int of_flat_dt_match(unsigned long node, const char **matches); | ||
74 | extern unsigned long of_get_flat_dt_root(void); | 92 | extern unsigned long of_get_flat_dt_root(void); |
75 | 93 | ||
76 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, | 94 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, |
diff --git a/include/linux/of_net.h b/include/linux/of_net.h new file mode 100644 index 000000000000..e913081fb52a --- /dev/null +++ b/include/linux/of_net.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * OF helpers for network devices. | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | */ | ||
6 | |||
7 | #ifndef __LINUX_OF_NET_H | ||
8 | #define __LINUX_OF_NET_H | ||
9 | |||
10 | #ifdef CONFIG_OF_NET | ||
11 | #include <linux/of.h> | ||
12 | extern const void *of_get_mac_address(struct device_node *np); | ||
13 | #endif | ||
14 | |||
15 | #endif /* __LINUX_OF_NET_H */ | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4c72c1189479..396da16aabf8 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -200,6 +200,29 @@ quiet_cmd_gzip = GZIP $@ | |||
200 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | 200 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ |
201 | (rm -f $@ ; false) | 201 | (rm -f $@ ; false) |
202 | 202 | ||
203 | # DTC | ||
204 | # --------------------------------------------------------------------------- | ||
205 | |||
206 | # Generate an assembly file to wrap the output of the device tree compiler | ||
207 | quiet_cmd_dt_S_dtb= DTB $@ | ||
208 | cmd_dt_S_dtb= \ | ||
209 | ( \ | ||
210 | echo '\#include <asm-generic/vmlinux.lds.h>'; \ | ||
211 | echo '.section .dtb.init.rodata,"a"'; \ | ||
212 | echo '.balign STRUCT_ALIGNMENT'; \ | ||
213 | echo '.global __dtb_$(*F)_begin'; \ | ||
214 | echo '__dtb_$(*F)_begin:'; \ | ||
215 | echo '.incbin "$<" '; \ | ||
216 | echo '__dtb_$(*F)_end:'; \ | ||
217 | echo '.global __dtb_$(*F)_end'; \ | ||
218 | echo '.balign STRUCT_ALIGNMENT'; \ | ||
219 | ) > $@ | ||
220 | |||
221 | $(obj)/%.dtb.S: $(obj)/%.dtb | ||
222 | $(call cmd,dt_S_dtb) | ||
223 | |||
224 | quiet_cmd_dtc = DTC $@ | ||
225 | cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< | ||
203 | 226 | ||
204 | # Bzip2 | 227 | # Bzip2 |
205 | # --------------------------------------------------------------------------- | 228 | # --------------------------------------------------------------------------- |
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 01cdb36fc583..04a31c17639f 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile | |||
@@ -4,7 +4,7 @@ hostprogs-y := dtc | |||
4 | always := $(hostprogs-y) | 4 | always := $(hostprogs-y) |
5 | 5 | ||
6 | dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ | 6 | dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ |
7 | srcpos.o checks.o | 7 | srcpos.o checks.o util.o |
8 | dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o | 8 | dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o |
9 | 9 | ||
10 | # Source files need to get at the userspace version of libfdt_env.h to compile | 10 | # Source files need to get at the userspace version of libfdt_env.h to compile |
@@ -19,6 +19,7 @@ HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC) | |||
19 | HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC) | 19 | HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC) |
20 | HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC) | 20 | HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC) |
21 | HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC) | 21 | HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC) |
22 | HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC) | ||
22 | 23 | ||
23 | HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC) | 24 | HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC) |
24 | HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) | 25 | HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) |
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index 95485796f253..a662a0044798 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
@@ -278,32 +278,112 @@ static void check_property_name_chars(struct check *c, struct node *dt, | |||
278 | } | 278 | } |
279 | PROP_CHECK(property_name_chars, PROPNODECHARS, ERROR); | 279 | PROP_CHECK(property_name_chars, PROPNODECHARS, ERROR); |
280 | 280 | ||
281 | #define DESCLABEL_FMT "%s%s%s%s%s" | ||
282 | #define DESCLABEL_ARGS(node,prop,mark) \ | ||
283 | ((mark) ? "value of " : ""), \ | ||
284 | ((prop) ? "'" : ""), \ | ||
285 | ((prop) ? (prop)->name : ""), \ | ||
286 | ((prop) ? "' in " : ""), (node)->fullpath | ||
287 | |||
288 | static void check_duplicate_label(struct check *c, struct node *dt, | ||
289 | const char *label, struct node *node, | ||
290 | struct property *prop, struct marker *mark) | ||
291 | { | ||
292 | struct node *othernode = NULL; | ||
293 | struct property *otherprop = NULL; | ||
294 | struct marker *othermark = NULL; | ||
295 | |||
296 | othernode = get_node_by_label(dt, label); | ||
297 | |||
298 | if (!othernode) | ||
299 | otherprop = get_property_by_label(dt, label, &othernode); | ||
300 | if (!othernode) | ||
301 | othermark = get_marker_label(dt, label, &othernode, | ||
302 | &otherprop); | ||
303 | |||
304 | if (!othernode) | ||
305 | return; | ||
306 | |||
307 | if ((othernode != node) || (otherprop != prop) || (othermark != mark)) | ||
308 | FAIL(c, "Duplicate label '%s' on " DESCLABEL_FMT | ||
309 | " and " DESCLABEL_FMT, | ||
310 | label, DESCLABEL_ARGS(node, prop, mark), | ||
311 | DESCLABEL_ARGS(othernode, otherprop, othermark)); | ||
312 | } | ||
313 | |||
314 | static void check_duplicate_label_node(struct check *c, struct node *dt, | ||
315 | struct node *node) | ||
316 | { | ||
317 | struct label *l; | ||
318 | |||
319 | for_each_label(node->labels, l) | ||
320 | check_duplicate_label(c, dt, l->label, node, NULL, NULL); | ||
321 | } | ||
322 | static void check_duplicate_label_prop(struct check *c, struct node *dt, | ||
323 | struct node *node, struct property *prop) | ||
324 | { | ||
325 | struct marker *m = prop->val.markers; | ||
326 | struct label *l; | ||
327 | |||
328 | for_each_label(prop->labels, l) | ||
329 | check_duplicate_label(c, dt, l->label, node, prop, NULL); | ||
330 | |||
331 | for_each_marker_of_type(m, LABEL) | ||
332 | check_duplicate_label(c, dt, m->ref, node, prop, m); | ||
333 | } | ||
334 | CHECK(duplicate_label, NULL, check_duplicate_label_node, | ||
335 | check_duplicate_label_prop, NULL, ERROR); | ||
336 | |||
281 | static void check_explicit_phandles(struct check *c, struct node *root, | 337 | static void check_explicit_phandles(struct check *c, struct node *root, |
282 | struct node *node) | 338 | struct node *node, struct property *prop) |
283 | { | 339 | { |
284 | struct property *prop; | 340 | struct marker *m; |
285 | struct node *other; | 341 | struct node *other; |
286 | cell_t phandle; | 342 | cell_t phandle; |
287 | 343 | ||
288 | prop = get_property(node, "linux,phandle"); | 344 | if (!streq(prop->name, "phandle") |
289 | if (! prop) | 345 | && !streq(prop->name, "linux,phandle")) |
290 | return; /* No phandle, that's fine */ | 346 | return; |
291 | 347 | ||
292 | if (prop->val.len != sizeof(cell_t)) { | 348 | if (prop->val.len != sizeof(cell_t)) { |
293 | FAIL(c, "%s has bad length (%d) linux,phandle property", | 349 | FAIL(c, "%s has bad length (%d) %s property", |
294 | node->fullpath, prop->val.len); | 350 | node->fullpath, prop->val.len, prop->name); |
351 | return; | ||
352 | } | ||
353 | |||
354 | m = prop->val.markers; | ||
355 | for_each_marker_of_type(m, REF_PHANDLE) { | ||
356 | assert(m->offset == 0); | ||
357 | if (node != get_node_by_ref(root, m->ref)) | ||
358 | /* "Set this node's phandle equal to some | ||
359 | * other node's phandle". That's nonsensical | ||
360 | * by construction. */ { | ||
361 | FAIL(c, "%s in %s is a reference to another node", | ||
362 | prop->name, node->fullpath); | ||
363 | return; | ||
364 | } | ||
365 | /* But setting this node's phandle equal to its own | ||
366 | * phandle is allowed - that means allocate a unique | ||
367 | * phandle for this node, even if it's not otherwise | ||
368 | * referenced. The value will be filled in later, so | ||
369 | * no further checking for now. */ | ||
295 | return; | 370 | return; |
296 | } | 371 | } |
297 | 372 | ||
298 | phandle = propval_cell(prop); | 373 | phandle = propval_cell(prop); |
374 | |||
299 | if ((phandle == 0) || (phandle == -1)) { | 375 | if ((phandle == 0) || (phandle == -1)) { |
300 | FAIL(c, "%s has invalid linux,phandle value 0x%x", | 376 | FAIL(c, "%s has bad value (0x%x) in %s property", |
301 | node->fullpath, phandle); | 377 | node->fullpath, phandle, prop->name); |
302 | return; | 378 | return; |
303 | } | 379 | } |
304 | 380 | ||
381 | if (node->phandle && (node->phandle != phandle)) | ||
382 | FAIL(c, "%s has %s property which replaces existing phandle information", | ||
383 | node->fullpath, prop->name); | ||
384 | |||
305 | other = get_node_by_phandle(root, phandle); | 385 | other = get_node_by_phandle(root, phandle); |
306 | if (other) { | 386 | if (other && (other != node)) { |
307 | FAIL(c, "%s has duplicated phandle 0x%x (seen before at %s)", | 387 | FAIL(c, "%s has duplicated phandle 0x%x (seen before at %s)", |
308 | node->fullpath, phandle, other->fullpath); | 388 | node->fullpath, phandle, other->fullpath); |
309 | return; | 389 | return; |
@@ -311,7 +391,7 @@ static void check_explicit_phandles(struct check *c, struct node *root, | |||
311 | 391 | ||
312 | node->phandle = phandle; | 392 | node->phandle = phandle; |
313 | } | 393 | } |
314 | NODE_CHECK(explicit_phandles, NULL, ERROR); | 394 | PROP_CHECK(explicit_phandles, NULL, ERROR); |
315 | 395 | ||
316 | static void check_name_properties(struct check *c, struct node *root, | 396 | static void check_name_properties(struct check *c, struct node *root, |
317 | struct node *node) | 397 | struct node *node) |
@@ -549,6 +629,9 @@ static struct check *check_table[] = { | |||
549 | &duplicate_node_names, &duplicate_property_names, | 629 | &duplicate_node_names, &duplicate_property_names, |
550 | &node_name_chars, &node_name_format, &property_name_chars, | 630 | &node_name_chars, &node_name_format, &property_name_chars, |
551 | &name_is_string, &name_properties, | 631 | &name_is_string, &name_properties, |
632 | |||
633 | &duplicate_label, | ||
634 | |||
552 | &explicit_phandles, | 635 | &explicit_phandles, |
553 | &phandle_references, &path_references, | 636 | &phandle_references, &path_references, |
554 | 637 | ||
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index a627bbee91d4..e866ea5166ac 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -18,7 +18,7 @@ | |||
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | %option noyywrap noinput nounput yylineno | 21 | %option noyywrap nounput noinput never-interactive |
22 | 22 | ||
23 | %x INCLUDE | 23 | %x INCLUDE |
24 | %x BYTESTRING | 24 | %x BYTESTRING |
@@ -38,6 +38,13 @@ LINECOMMENT "//".*\n | |||
38 | #include "srcpos.h" | 38 | #include "srcpos.h" |
39 | #include "dtc-parser.tab.h" | 39 | #include "dtc-parser.tab.h" |
40 | 40 | ||
41 | YYLTYPE yylloc; | ||
42 | |||
43 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | ||
44 | #define YY_USER_ACTION \ | ||
45 | { \ | ||
46 | srcpos_update(&yylloc, yytext, yyleng); \ | ||
47 | } | ||
41 | 48 | ||
42 | /*#define LEXDEBUG 1*/ | 49 | /*#define LEXDEBUG 1*/ |
43 | 50 | ||
@@ -47,15 +54,10 @@ LINECOMMENT "//".*\n | |||
47 | #define DPRINT(fmt, ...) do { } while (0) | 54 | #define DPRINT(fmt, ...) do { } while (0) |
48 | #endif | 55 | #endif |
49 | 56 | ||
50 | static int dts_version; /* = 0 */ | 57 | static int dts_version = 1; |
51 | 58 | ||
52 | #define BEGIN_DEFAULT() if (dts_version == 0) { \ | 59 | #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ |
53 | DPRINT("<INITIAL>\n"); \ | ||
54 | BEGIN(INITIAL); \ | ||
55 | } else { \ | ||
56 | DPRINT("<V1>\n"); \ | ||
57 | BEGIN(V1); \ | 60 | BEGIN(V1); \ |
58 | } | ||
59 | 61 | ||
60 | static void push_input_file(const char *filename); | 62 | static void push_input_file(const char *filename); |
61 | static int pop_input_file(void); | 63 | static int pop_input_file(void); |
@@ -75,18 +77,13 @@ static int pop_input_file(void); | |||
75 | } | 77 | } |
76 | 78 | ||
77 | <*>{STRING} { | 79 | <*>{STRING} { |
78 | yylloc.file = srcpos_file; | ||
79 | yylloc.first_line = yylineno; | ||
80 | DPRINT("String: %s\n", yytext); | 80 | DPRINT("String: %s\n", yytext); |
81 | yylval.data = data_copy_escape_string(yytext+1, | 81 | yylval.data = data_copy_escape_string(yytext+1, |
82 | yyleng-2); | 82 | yyleng-2); |
83 | yylloc.first_line = yylineno; | ||
84 | return DT_STRING; | 83 | return DT_STRING; |
85 | } | 84 | } |
86 | 85 | ||
87 | <*>"/dts-v1/" { | 86 | <*>"/dts-v1/" { |
88 | yylloc.file = srcpos_file; | ||
89 | yylloc.first_line = yylineno; | ||
90 | DPRINT("Keyword: /dts-v1/\n"); | 87 | DPRINT("Keyword: /dts-v1/\n"); |
91 | dts_version = 1; | 88 | dts_version = 1; |
92 | BEGIN_DEFAULT(); | 89 | BEGIN_DEFAULT(); |
@@ -94,106 +91,57 @@ static int pop_input_file(void); | |||
94 | } | 91 | } |
95 | 92 | ||
96 | <*>"/memreserve/" { | 93 | <*>"/memreserve/" { |
97 | yylloc.file = srcpos_file; | ||
98 | yylloc.first_line = yylineno; | ||
99 | DPRINT("Keyword: /memreserve/\n"); | 94 | DPRINT("Keyword: /memreserve/\n"); |
100 | BEGIN_DEFAULT(); | 95 | BEGIN_DEFAULT(); |
101 | return DT_MEMRESERVE; | 96 | return DT_MEMRESERVE; |
102 | } | 97 | } |
103 | 98 | ||
104 | <*>{LABEL}: { | 99 | <*>{LABEL}: { |
105 | yylloc.file = srcpos_file; | ||
106 | yylloc.first_line = yylineno; | ||
107 | DPRINT("Label: %s\n", yytext); | 100 | DPRINT("Label: %s\n", yytext); |
108 | yylval.labelref = strdup(yytext); | 101 | yylval.labelref = xstrdup(yytext); |
109 | yylval.labelref[yyleng-1] = '\0'; | 102 | yylval.labelref[yyleng-1] = '\0'; |
110 | return DT_LABEL; | 103 | return DT_LABEL; |
111 | } | 104 | } |
112 | 105 | ||
113 | <INITIAL>[bodh]# { | ||
114 | yylloc.file = srcpos_file; | ||
115 | yylloc.first_line = yylineno; | ||
116 | if (*yytext == 'b') | ||
117 | yylval.cbase = 2; | ||
118 | else if (*yytext == 'o') | ||
119 | yylval.cbase = 8; | ||
120 | else if (*yytext == 'd') | ||
121 | yylval.cbase = 10; | ||
122 | else | ||
123 | yylval.cbase = 16; | ||
124 | DPRINT("Base: %d\n", yylval.cbase); | ||
125 | return DT_BASE; | ||
126 | } | ||
127 | |||
128 | <INITIAL>[0-9a-fA-F]+ { | ||
129 | yylloc.file = srcpos_file; | ||
130 | yylloc.first_line = yylineno; | ||
131 | yylval.literal = strdup(yytext); | ||
132 | DPRINT("Literal: '%s'\n", yylval.literal); | ||
133 | return DT_LEGACYLITERAL; | ||
134 | } | ||
135 | |||
136 | <V1>[0-9]+|0[xX][0-9a-fA-F]+ { | 106 | <V1>[0-9]+|0[xX][0-9a-fA-F]+ { |
137 | yylloc.file = srcpos_file; | 107 | yylval.literal = xstrdup(yytext); |
138 | yylloc.first_line = yylineno; | ||
139 | yylval.literal = strdup(yytext); | ||
140 | DPRINT("Literal: '%s'\n", yylval.literal); | 108 | DPRINT("Literal: '%s'\n", yylval.literal); |
141 | return DT_LITERAL; | 109 | return DT_LITERAL; |
142 | } | 110 | } |
143 | 111 | ||
144 | \&{LABEL} { /* label reference */ | 112 | <*>\&{LABEL} { /* label reference */ |
145 | yylloc.file = srcpos_file; | ||
146 | yylloc.first_line = yylineno; | ||
147 | DPRINT("Ref: %s\n", yytext+1); | 113 | DPRINT("Ref: %s\n", yytext+1); |
148 | yylval.labelref = strdup(yytext+1); | 114 | yylval.labelref = xstrdup(yytext+1); |
149 | return DT_REF; | 115 | return DT_REF; |
150 | } | 116 | } |
151 | 117 | ||
152 | "&{/"{PATHCHAR}+\} { /* new-style path reference */ | 118 | <*>"&{/"{PATHCHAR}+\} { /* new-style path reference */ |
153 | yylloc.file = srcpos_file; | ||
154 | yylloc.first_line = yylineno; | ||
155 | yytext[yyleng-1] = '\0'; | 119 | yytext[yyleng-1] = '\0'; |
156 | DPRINT("Ref: %s\n", yytext+2); | 120 | DPRINT("Ref: %s\n", yytext+2); |
157 | yylval.labelref = strdup(yytext+2); | 121 | yylval.labelref = xstrdup(yytext+2); |
158 | return DT_REF; | ||
159 | } | ||
160 | |||
161 | <INITIAL>"&/"{PATHCHAR}+ { /* old-style path reference */ | ||
162 | yylloc.file = srcpos_file; | ||
163 | yylloc.first_line = yylineno; | ||
164 | DPRINT("Ref: %s\n", yytext+1); | ||
165 | yylval.labelref = strdup(yytext+1); | ||
166 | return DT_REF; | 122 | return DT_REF; |
167 | } | 123 | } |
168 | 124 | ||
169 | <BYTESTRING>[0-9a-fA-F]{2} { | 125 | <BYTESTRING>[0-9a-fA-F]{2} { |
170 | yylloc.file = srcpos_file; | ||
171 | yylloc.first_line = yylineno; | ||
172 | yylval.byte = strtol(yytext, NULL, 16); | 126 | yylval.byte = strtol(yytext, NULL, 16); |
173 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 127 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
174 | return DT_BYTE; | 128 | return DT_BYTE; |
175 | } | 129 | } |
176 | 130 | ||
177 | <BYTESTRING>"]" { | 131 | <BYTESTRING>"]" { |
178 | yylloc.file = srcpos_file; | ||
179 | yylloc.first_line = yylineno; | ||
180 | DPRINT("/BYTESTRING\n"); | 132 | DPRINT("/BYTESTRING\n"); |
181 | BEGIN_DEFAULT(); | 133 | BEGIN_DEFAULT(); |
182 | return ']'; | 134 | return ']'; |
183 | } | 135 | } |
184 | 136 | ||
185 | <PROPNODENAME>{PROPNODECHAR}+ { | 137 | <PROPNODENAME>{PROPNODECHAR}+ { |
186 | yylloc.file = srcpos_file; | ||
187 | yylloc.first_line = yylineno; | ||
188 | DPRINT("PropNodeName: %s\n", yytext); | 138 | DPRINT("PropNodeName: %s\n", yytext); |
189 | yylval.propnodename = strdup(yytext); | 139 | yylval.propnodename = xstrdup(yytext); |
190 | BEGIN_DEFAULT(); | 140 | BEGIN_DEFAULT(); |
191 | return DT_PROPNODENAME; | 141 | return DT_PROPNODENAME; |
192 | } | 142 | } |
193 | 143 | ||
194 | "/incbin/" { | 144 | "/incbin/" { |
195 | yylloc.file = srcpos_file; | ||
196 | yylloc.first_line = yylineno; | ||
197 | DPRINT("Binary Include\n"); | 145 | DPRINT("Binary Include\n"); |
198 | return DT_INCBIN; | 146 | return DT_INCBIN; |
199 | } | 147 | } |
@@ -203,8 +151,6 @@ static int pop_input_file(void); | |||
203 | <*>{LINECOMMENT}+ /* eat C++-style comments */ | 151 | <*>{LINECOMMENT}+ /* eat C++-style comments */ |
204 | 152 | ||
205 | <*>. { | 153 | <*>. { |
206 | yylloc.file = srcpos_file; | ||
207 | yylloc.first_line = yylineno; | ||
208 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 154 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
209 | (unsigned)yytext[0]); | 155 | (unsigned)yytext[0]); |
210 | if (yytext[0] == '[') { | 156 | if (yytext[0] == '[') { |
@@ -221,100 +167,25 @@ static int pop_input_file(void); | |||
221 | 167 | ||
222 | %% | 168 | %% |
223 | 169 | ||
224 | |||
225 | /* | ||
226 | * Stack of nested include file contexts. | ||
227 | */ | ||
228 | |||
229 | struct incl_file { | ||
230 | struct dtc_file *file; | ||
231 | YY_BUFFER_STATE yy_prev_buf; | ||
232 | int yy_prev_lineno; | ||
233 | struct incl_file *prev; | ||
234 | }; | ||
235 | |||
236 | static struct incl_file *incl_file_stack; | ||
237 | |||
238 | |||
239 | /* | ||
240 | * Detect infinite include recursion. | ||
241 | */ | ||
242 | #define MAX_INCLUDE_DEPTH (100) | ||
243 | |||
244 | static int incl_depth = 0; | ||
245 | |||
246 | |||
247 | static void push_input_file(const char *filename) | 170 | static void push_input_file(const char *filename) |
248 | { | 171 | { |
249 | struct incl_file *incl_file; | ||
250 | struct dtc_file *newfile; | ||
251 | struct search_path search, *searchptr = NULL; | ||
252 | |||
253 | assert(filename); | 172 | assert(filename); |
254 | 173 | ||
255 | if (incl_depth++ >= MAX_INCLUDE_DEPTH) | 174 | srcfile_push(filename); |
256 | die("Includes nested too deeply"); | ||
257 | |||
258 | if (srcpos_file) { | ||
259 | search.dir = srcpos_file->dir; | ||
260 | search.next = NULL; | ||
261 | search.prev = NULL; | ||
262 | searchptr = &search; | ||
263 | } | ||
264 | |||
265 | newfile = dtc_open_file(filename, searchptr); | ||
266 | 175 | ||
267 | incl_file = xmalloc(sizeof(struct incl_file)); | 176 | yyin = current_srcfile->f; |
268 | 177 | ||
269 | /* | 178 | yypush_buffer_state(yy_create_buffer(yyin, YY_BUF_SIZE)); |
270 | * Save current context. | ||
271 | */ | ||
272 | incl_file->yy_prev_buf = YY_CURRENT_BUFFER; | ||
273 | incl_file->yy_prev_lineno = yylineno; | ||
274 | incl_file->file = srcpos_file; | ||
275 | incl_file->prev = incl_file_stack; | ||
276 | |||
277 | incl_file_stack = incl_file; | ||
278 | |||
279 | /* | ||
280 | * Establish new context. | ||
281 | */ | ||
282 | srcpos_file = newfile; | ||
283 | yylineno = 1; | ||
284 | yyin = newfile->file; | ||
285 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); | ||
286 | } | 179 | } |
287 | 180 | ||
288 | 181 | ||
289 | static int pop_input_file(void) | 182 | static int pop_input_file(void) |
290 | { | 183 | { |
291 | struct incl_file *incl_file; | 184 | if (srcfile_pop() == 0) |
292 | |||
293 | if (incl_file_stack == 0) | ||
294 | return 0; | 185 | return 0; |
295 | 186 | ||
296 | dtc_close_file(srcpos_file); | 187 | yypop_buffer_state(); |
297 | 188 | yyin = current_srcfile->f; | |
298 | /* | ||
299 | * Pop. | ||
300 | */ | ||
301 | --incl_depth; | ||
302 | incl_file = incl_file_stack; | ||
303 | incl_file_stack = incl_file->prev; | ||
304 | |||
305 | /* | ||
306 | * Recover old context. | ||
307 | */ | ||
308 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
309 | yy_switch_to_buffer(incl_file->yy_prev_buf); | ||
310 | yylineno = incl_file->yy_prev_lineno; | ||
311 | srcpos_file = incl_file->file; | ||
312 | yyin = incl_file->file ? incl_file->file->file : NULL; | ||
313 | |||
314 | /* | ||
315 | * Free old state. | ||
316 | */ | ||
317 | free(incl_file); | ||
318 | 189 | ||
319 | return 1; | 190 | return 1; |
320 | } | 191 | } |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index e27cc636e326..50c4420b4b2c 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -170,20 +170,7 @@ extern FILE *yyin, *yyout; | |||
170 | #define EOB_ACT_END_OF_FILE 1 | 170 | #define EOB_ACT_END_OF_FILE 1 |
171 | #define EOB_ACT_LAST_MATCH 2 | 171 | #define EOB_ACT_LAST_MATCH 2 |
172 | 172 | ||
173 | /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires | 173 | #define YY_LESS_LINENO(n) |
174 | * access to the local variable yy_act. Since yyless() is a macro, it would break | ||
175 | * existing scanners that call yyless() from OUTSIDE yylex. | ||
176 | * One obvious solution it to make yy_act a global. I tried that, and saw | ||
177 | * a 5% performance hit in a non-yylineno scanner, because yy_act is | ||
178 | * normally declared as a register variable-- so it is not worth it. | ||
179 | */ | ||
180 | #define YY_LESS_LINENO(n) \ | ||
181 | do { \ | ||
182 | int yyl;\ | ||
183 | for ( yyl = n; yyl < yyleng; ++yyl )\ | ||
184 | if ( yytext[yyl] == '\n' )\ | ||
185 | --yylineno;\ | ||
186 | }while(0) | ||
187 | 174 | ||
188 | /* Return all but the first "n" matched characters back to the input stream. */ | 175 | /* Return all but the first "n" matched characters back to the input stream. */ |
189 | #define yyless(n) \ | 176 | #define yyless(n) \ |
@@ -385,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); | |||
385 | *yy_cp = '\0'; \ | 372 | *yy_cp = '\0'; \ |
386 | (yy_c_buf_p) = yy_cp; | 373 | (yy_c_buf_p) = yy_cp; |
387 | 374 | ||
388 | #define YY_NUM_RULES 20 | 375 | #define YY_NUM_RULES 17 |
389 | #define YY_END_OF_BUFFER 21 | 376 | #define YY_END_OF_BUFFER 18 |
390 | /* This struct is not used in this scanner, | 377 | /* This struct is not used in this scanner, |
391 | but its presence is necessary. */ | 378 | but its presence is necessary. */ |
392 | struct yy_trans_info | 379 | struct yy_trans_info |
@@ -394,20 +381,19 @@ struct yy_trans_info | |||
394 | flex_int32_t yy_verify; | 381 | flex_int32_t yy_verify; |
395 | flex_int32_t yy_nxt; | 382 | flex_int32_t yy_nxt; |
396 | }; | 383 | }; |
397 | static yyconst flex_int16_t yy_accept[104] = | 384 | static yyconst flex_int16_t yy_accept[94] = |
398 | { 0, | 385 | { 0, |
399 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
400 | 21, 19, 16, 16, 19, 19, 19, 7, 7, 19, | 387 | 18, 16, 13, 13, 16, 16, 16, 16, 16, 16, |
401 | 7, 19, 19, 19, 19, 13, 14, 14, 19, 8, | 388 | 16, 10, 11, 11, 6, 6, 13, 0, 2, 0, |
402 | 8, 16, 0, 2, 0, 0, 9, 0, 0, 0, | 389 | 7, 0, 0, 0, 0, 0, 0, 0, 5, 0, |
403 | 0, 0, 0, 7, 7, 5, 0, 6, 0, 12, | 390 | 9, 9, 11, 11, 6, 0, 7, 0, 0, 0, |
404 | 12, 14, 14, 8, 0, 11, 9, 0, 0, 0, | 391 | 0, 15, 0, 0, 0, 0, 6, 0, 14, 0, |
405 | 0, 18, 0, 0, 0, 0, 8, 0, 17, 0, | 392 | 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, |
406 | 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, | 393 | 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, |
407 | 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, | ||
408 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, | 394 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, |
409 | |||
410 | 0, 4, 0 | 395 | 0, 4, 0 |
396 | |||
411 | } ; | 397 | } ; |
412 | 398 | ||
413 | static yyconst flex_int32_t yy_ec[256] = | 399 | static yyconst flex_int32_t yy_ec[256] = |
@@ -416,16 +402,16 @@ static yyconst flex_int32_t yy_ec[256] = | |||
416 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, | 402 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 403 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
418 | 1, 2, 1, 4, 5, 1, 1, 6, 1, 1, | 404 | 1, 2, 1, 4, 5, 1, 1, 6, 1, 1, |
419 | 1, 7, 8, 8, 9, 8, 10, 11, 12, 13, | 405 | 1, 7, 5, 5, 8, 5, 9, 10, 11, 12, |
420 | 13, 13, 13, 13, 13, 13, 13, 14, 1, 1, | 406 | 12, 12, 12, 12, 12, 12, 12, 13, 1, 1, |
421 | 1, 1, 8, 8, 15, 15, 15, 15, 15, 15, | 407 | 1, 1, 5, 5, 14, 14, 14, 14, 14, 14, |
422 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, | 408 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, |
423 | 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, | 409 | 15, 15, 15, 15, 15, 15, 15, 16, 15, 15, |
424 | 1, 18, 19, 1, 16, 1, 15, 20, 21, 22, | 410 | 1, 17, 18, 1, 15, 1, 14, 19, 20, 21, |
425 | 411 | ||
426 | 23, 15, 16, 24, 25, 16, 16, 26, 27, 28, | 412 | 22, 14, 15, 15, 23, 15, 15, 24, 25, 26, |
427 | 24, 16, 16, 29, 30, 31, 32, 33, 16, 17, | 413 | 15, 15, 15, 27, 28, 29, 30, 31, 15, 16, |
428 | 16, 16, 34, 1, 35, 1, 1, 1, 1, 1, | 414 | 15, 15, 32, 1, 33, 1, 1, 1, 1, 1, |
429 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
430 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
431 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
@@ -442,136 +428,114 @@ static yyconst flex_int32_t yy_ec[256] = | |||
442 | 1, 1, 1, 1, 1 | 428 | 1, 1, 1, 1, 1 |
443 | } ; | 429 | } ; |
444 | 430 | ||
445 | static yyconst flex_int32_t yy_meta[36] = | 431 | static yyconst flex_int32_t yy_meta[34] = |
446 | { 0, | 432 | { 0, |
447 | 1, 1, 1, 1, 2, 1, 2, 2, 2, 3, | 433 | 1, 1, 1, 1, 2, 1, 2, 2, 3, 4, |
448 | 4, 4, 4, 5, 6, 7, 7, 1, 1, 6, | 434 | 4, 4, 5, 6, 7, 7, 1, 1, 6, 6, |
449 | 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, | 435 | 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, |
450 | 7, 7, 7, 8, 1 | 436 | 7, 8, 1 |
451 | } ; | 437 | } ; |
452 | 438 | ||
453 | static yyconst flex_int16_t yy_base[117] = | 439 | static yyconst flex_int16_t yy_base[106] = |
454 | { 0, | 440 | { 0, |
455 | 0, 0, 30, 0, 44, 0, 67, 0, 97, 105, | 441 | 0, 0, 237, 236, 25, 0, 47, 0, 30, 71, |
456 | 302, 303, 35, 44, 40, 94, 112, 0, 129, 152, | 442 | 244, 247, 82, 84, 84, 211, 95, 229, 218, 0, |
457 | 296, 295, 159, 0, 176, 303, 0, 116, 95, 165, | 443 | 111, 247, 0, 84, 83, 95, 106, 86, 247, 237, |
458 | 49, 46, 102, 303, 296, 0, 0, 288, 290, 293, | 444 | 0, 230, 231, 234, 207, 209, 212, 220, 247, 206, |
459 | 264, 266, 270, 0, 0, 303, 0, 303, 264, 303, | 445 | 247, 218, 0, 106, 116, 0, 0, 0, 223, 89, |
460 | 0, 0, 195, 101, 0, 0, 0, 0, 284, 125, | 446 | 226, 219, 199, 206, 200, 204, 0, 190, 213, 212, |
461 | 277, 265, 225, 230, 216, 218, 0, 202, 224, 221, | 447 | 202, 91, 178, 161, 247, 172, 144, 150, 140, 130, |
462 | 217, 107, 196, 188, 303, 206, 179, 186, 178, 185, | 448 | 140, 124, 128, 120, 138, 137, 123, 122, 247, 247, |
463 | 183, 162, 161, 150, 169, 160, 145, 125, 303, 303, | 449 | 134, 114, 132, 86, 135, 125, 90, 136, 247, 97, |
464 | 137, 109, 190, 103, 203, 167, 108, 197, 303, 123, | 450 | 29, 247, 247, 153, 156, 161, 165, 170, 176, 180, |
465 | 451 | ||
466 | 29, 303, 303, 215, 221, 226, 229, 234, 240, 246, | 452 | 187, 195, 200, 205, 212 |
467 | 250, 257, 265, 270, 275, 282 | ||
468 | } ; | 453 | } ; |
469 | 454 | ||
470 | static yyconst flex_int16_t yy_def[117] = | 455 | static yyconst flex_int16_t yy_def[106] = |
471 | { 0, | 456 | { 0, |
472 | 103, 1, 1, 3, 3, 5, 103, 7, 3, 3, | 457 | 93, 1, 1, 1, 1, 5, 93, 7, 1, 1, |
473 | 103, 103, 103, 103, 104, 105, 103, 106, 103, 19, | 458 | 93, 93, 93, 93, 94, 95, 93, 96, 17, 97, |
474 | 19, 20, 103, 107, 20, 103, 108, 109, 105, 103, | 459 | 96, 93, 98, 99, 93, 93, 93, 94, 93, 94, |
475 | 103, 103, 104, 103, 104, 110, 111, 103, 112, 113, | 460 | 100, 93, 101, 102, 93, 93, 93, 96, 93, 93, |
476 | 103, 103, 103, 106, 19, 103, 20, 103, 103, 103, | 461 | 93, 96, 98, 99, 93, 103, 100, 104, 101, 101, |
477 | 20, 108, 109, 103, 114, 110, 111, 115, 112, 112, | 462 | 102, 93, 93, 93, 93, 93, 103, 104, 93, 93, |
478 | 113, 103, 103, 103, 103, 103, 114, 115, 103, 103, | 463 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
479 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | 464 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
480 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | 465 | 93, 93, 93, 93, 93, 105, 93, 105, 93, 105, |
481 | 103, 103, 103, 103, 103, 116, 103, 116, 103, 116, | 466 | 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, |
482 | 467 | ||
483 | 103, 103, 0, 103, 103, 103, 103, 103, 103, 103, | 468 | 93, 93, 93, 93, 93 |
484 | 103, 103, 103, 103, 103, 103 | ||
485 | } ; | 469 | } ; |
486 | 470 | ||
487 | static yyconst flex_int16_t yy_nxt[339] = | 471 | static yyconst flex_int16_t yy_nxt[281] = |
488 | { 0, | 472 | { 0, |
489 | 12, 13, 14, 15, 12, 16, 12, 12, 12, 17, | 473 | 12, 13, 14, 15, 12, 16, 12, 12, 17, 12, |
490 | 18, 18, 18, 12, 19, 20, 20, 12, 12, 21, | 474 | 12, 12, 12, 18, 18, 18, 12, 12, 18, 18, |
491 | 19, 21, 19, 22, 20, 20, 20, 20, 20, 20, | 475 | 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, |
492 | 20, 20, 20, 12, 12, 12, 32, 32, 102, 23, | 476 | 18, 12, 12, 19, 20, 20, 20, 92, 21, 25, |
493 | 12, 12, 12, 34, 20, 32, 32, 32, 32, 20, | 477 | 26, 26, 22, 21, 21, 21, 21, 12, 13, 14, |
494 | 20, 20, 20, 20, 24, 24, 24, 35, 25, 54, | 478 | 15, 23, 16, 23, 23, 19, 23, 23, 23, 12, |
495 | 54, 54, 26, 25, 25, 25, 25, 12, 13, 14, | 479 | 24, 24, 24, 12, 12, 24, 24, 24, 24, 24, |
496 | 15, 27, 12, 27, 27, 27, 23, 27, 27, 27, | 480 | 24, 24, 24, 24, 24, 24, 24, 24, 12, 12, |
497 | 12, 28, 28, 28, 12, 12, 28, 28, 28, 28, | 481 | 25, 26, 26, 27, 27, 27, 27, 29, 43, 29, |
498 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | 482 | 43, 43, 45, 45, 45, 50, 39, 59, 46, 93, |
499 | 483 | ||
500 | 12, 12, 29, 36, 103, 34, 17, 30, 31, 31, | 484 | 30, 33, 30, 34, 45, 45, 45, 27, 27, 68, |
501 | 29, 54, 54, 54, 17, 30, 31, 31, 39, 35, | 485 | 43, 91, 43, 43, 69, 35, 87, 36, 39, 37, |
502 | 52, 40, 52, 52, 52, 103, 78, 38, 38, 46, | 486 | 42, 42, 42, 39, 42, 45, 45, 45, 89, 42, |
503 | 101, 60, 79, 41, 69, 97, 42, 94, 43, 45, | 487 | 42, 42, 42, 85, 85, 86, 85, 85, 86, 89, |
504 | 45, 45, 46, 45, 47, 47, 93, 92, 45, 45, | 488 | 84, 90, 83, 82, 81, 80, 79, 78, 77, 76, |
505 | 45, 45, 47, 47, 47, 47, 47, 47, 47, 47, | 489 | 75, 74, 90, 28, 28, 28, 28, 28, 28, 28, |
506 | 47, 47, 47, 47, 47, 39, 47, 91, 40, 90, | 490 | 28, 31, 31, 31, 38, 38, 38, 38, 41, 73, |
507 | 99, 47, 47, 47, 47, 54, 54, 54, 89, 88, | 491 | 41, 43, 72, 43, 71, 43, 43, 44, 33, 44, |
508 | 41, 55, 87, 49, 100, 43, 51, 51, 51, 86, | 492 | 44, 44, 44, 47, 69, 47, 47, 49, 49, 49, |
509 | 51, 95, 95, 96, 85, 51, 51, 51, 51, 52, | 493 | 49, 49, 49, 49, 49, 51, 51, 51, 51, 51, |
510 | 494 | ||
511 | 99, 52, 52, 52, 95, 95, 96, 84, 46, 83, | 495 | 51, 51, 51, 57, 70, 57, 58, 58, 58, 67, |
512 | 82, 81, 39, 79, 100, 33, 33, 33, 33, 33, | 496 | 58, 58, 88, 88, 88, 88, 88, 88, 88, 88, |
513 | 33, 33, 33, 37, 80, 77, 37, 37, 37, 44, | 497 | 34, 66, 65, 64, 63, 62, 61, 60, 52, 50, |
514 | 40, 44, 50, 76, 50, 52, 75, 52, 74, 52, | 498 | 39, 56, 39, 55, 54, 53, 52, 50, 48, 93, |
515 | 52, 53, 73, 53, 53, 53, 53, 56, 56, 56, | 499 | 40, 39, 32, 93, 19, 19, 11, 93, 93, 93, |
516 | 72, 56, 56, 57, 71, 57, 57, 59, 59, 59, | 500 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
517 | 59, 59, 59, 59, 59, 61, 61, 61, 61, 61, | 501 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
518 | 61, 61, 61, 67, 70, 67, 68, 68, 68, 62, | 502 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 |
519 | 68, 68, 98, 98, 98, 98, 98, 98, 98, 98, | ||
520 | 60, 66, 65, 64, 63, 62, 60, 58, 103, 48, | ||
521 | |||
522 | 48, 103, 11, 103, 103, 103, 103, 103, 103, 103, | ||
523 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | ||
524 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | ||
525 | 103, 103, 103, 103, 103, 103, 103, 103 | ||
526 | } ; | 503 | } ; |
527 | 504 | ||
528 | static yyconst flex_int16_t yy_chk[339] = | 505 | static yyconst flex_int16_t yy_chk[281] = |
529 | { 0, | 506 | { 0, |
530 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 507 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
531 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 508 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
532 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 509 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
533 | 1, 1, 1, 1, 1, 3, 13, 13, 101, 3, | 510 | 1, 1, 1, 5, 5, 5, 5, 91, 5, 9, |
534 | 3, 3, 3, 15, 3, 14, 14, 32, 32, 3, | 511 | 9, 9, 5, 5, 5, 5, 5, 7, 7, 7, |
535 | 3, 3, 3, 3, 5, 5, 5, 15, 5, 31, | ||
536 | 31, 31, 5, 5, 5, 5, 5, 7, 7, 7, | ||
537 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 512 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
538 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 513 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
539 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 514 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
540 | 515 | 10, 10, 10, 13, 13, 14, 14, 15, 24, 28, | |
541 | 7, 7, 9, 16, 29, 33, 9, 9, 9, 9, | 516 | 24, 24, 25, 25, 25, 50, 24, 50, 25, 90, |
542 | 10, 54, 54, 54, 10, 10, 10, 10, 17, 33, | 517 | |
543 | 28, 17, 28, 28, 28, 100, 72, 16, 29, 28, | 518 | 15, 17, 28, 17, 26, 26, 26, 27, 27, 62, |
544 | 97, 60, 72, 17, 60, 94, 17, 92, 17, 19, | 519 | 44, 87, 44, 44, 62, 17, 84, 17, 44, 17, |
545 | 19, 19, 19, 19, 19, 19, 91, 88, 19, 19, | 520 | 21, 21, 21, 21, 21, 45, 45, 45, 86, 21, |
546 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | 521 | 21, 21, 21, 83, 83, 83, 85, 85, 85, 88, |
547 | 19, 19, 20, 20, 20, 23, 20, 87, 23, 86, | 522 | 82, 86, 81, 78, 77, 76, 75, 74, 73, 72, |
548 | 96, 20, 20, 20, 20, 30, 30, 30, 85, 84, | 523 | 71, 70, 88, 94, 94, 94, 94, 94, 94, 94, |
549 | 23, 30, 83, 23, 96, 23, 25, 25, 25, 82, | 524 | 94, 95, 95, 95, 96, 96, 96, 96, 97, 69, |
550 | 25, 93, 93, 93, 81, 25, 25, 25, 25, 53, | 525 | 97, 98, 68, 98, 67, 98, 98, 99, 66, 99, |
551 | 526 | 99, 99, 99, 100, 64, 100, 100, 101, 101, 101, | |
552 | 98, 53, 53, 53, 95, 95, 95, 80, 53, 79, | 527 | 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, |
553 | 78, 77, 76, 74, 98, 104, 104, 104, 104, 104, | 528 | |
554 | 104, 104, 104, 105, 73, 71, 105, 105, 105, 106, | 529 | 102, 102, 102, 103, 63, 103, 104, 104, 104, 61, |
555 | 70, 106, 107, 69, 107, 108, 68, 108, 66, 108, | 530 | 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, |
556 | 108, 109, 65, 109, 109, 109, 109, 110, 110, 110, | 531 | 60, 59, 58, 56, 55, 54, 53, 52, 51, 49, |
557 | 64, 110, 110, 111, 63, 111, 111, 112, 112, 112, | 532 | 42, 40, 38, 37, 36, 35, 34, 33, 32, 30, |
558 | 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, | 533 | 19, 18, 16, 11, 4, 3, 93, 93, 93, 93, |
559 | 113, 113, 113, 114, 62, 114, 115, 115, 115, 61, | 534 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
560 | 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, | 535 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
561 | 59, 49, 43, 42, 41, 40, 39, 38, 35, 22, | 536 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 |
562 | |||
563 | 21, 11, 103, 103, 103, 103, 103, 103, 103, 103, | ||
564 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | ||
565 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | ||
566 | 103, 103, 103, 103, 103, 103, 103, 103 | ||
567 | } ; | 537 | } ; |
568 | 538 | ||
569 | /* Table of booleans, true if rule could match eol. */ | ||
570 | static yyconst flex_int32_t yy_rule_can_match_eol[21] = | ||
571 | { 0, | ||
572 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, | ||
573 | 0, }; | ||
574 | |||
575 | static yy_state_type yy_last_accepting_state; | 539 | static yy_state_type yy_last_accepting_state; |
576 | static char *yy_last_accepting_cpos; | 540 | static char *yy_last_accepting_cpos; |
577 | 541 | ||
@@ -616,6 +580,13 @@ char *yytext; | |||
616 | #include "srcpos.h" | 580 | #include "srcpos.h" |
617 | #include "dtc-parser.tab.h" | 581 | #include "dtc-parser.tab.h" |
618 | 582 | ||
583 | YYLTYPE yylloc; | ||
584 | |||
585 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | ||
586 | #define YY_USER_ACTION \ | ||
587 | { \ | ||
588 | srcpos_update(&yylloc, yytext, yyleng); \ | ||
589 | } | ||
619 | 590 | ||
620 | /*#define LEXDEBUG 1*/ | 591 | /*#define LEXDEBUG 1*/ |
621 | 592 | ||
@@ -625,19 +596,14 @@ char *yytext; | |||
625 | #define DPRINT(fmt, ...) do { } while (0) | 596 | #define DPRINT(fmt, ...) do { } while (0) |
626 | #endif | 597 | #endif |
627 | 598 | ||
628 | static int dts_version; /* = 0 */ | 599 | static int dts_version = 1; |
629 | 600 | ||
630 | #define BEGIN_DEFAULT() if (dts_version == 0) { \ | 601 | #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ |
631 | DPRINT("<INITIAL>\n"); \ | ||
632 | BEGIN(INITIAL); \ | ||
633 | } else { \ | ||
634 | DPRINT("<V1>\n"); \ | ||
635 | BEGIN(V1); \ | 602 | BEGIN(V1); \ |
636 | } | ||
637 | 603 | ||
638 | static void push_input_file(const char *filename); | 604 | static void push_input_file(const char *filename); |
639 | static int pop_input_file(void); | 605 | static int pop_input_file(void); |
640 | #line 641 "dtc-lexer.lex.c" | 606 | #line 607 "dtc-lexer.lex.c" |
641 | 607 | ||
642 | #define INITIAL 0 | 608 | #define INITIAL 0 |
643 | #define INCLUDE 1 | 609 | #define INCLUDE 1 |
@@ -826,9 +792,9 @@ YY_DECL | |||
826 | register char *yy_cp, *yy_bp; | 792 | register char *yy_cp, *yy_bp; |
827 | register int yy_act; | 793 | register int yy_act; |
828 | 794 | ||
829 | #line 64 "dtc-lexer.l" | 795 | #line 66 "dtc-lexer.l" |
830 | 796 | ||
831 | #line 832 "dtc-lexer.lex.c" | 797 | #line 798 "dtc-lexer.lex.c" |
832 | 798 | ||
833 | if ( !(yy_init) ) | 799 | if ( !(yy_init) ) |
834 | { | 800 | { |
@@ -881,35 +847,21 @@ yy_match: | |||
881 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 847 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
882 | { | 848 | { |
883 | yy_current_state = (int) yy_def[yy_current_state]; | 849 | yy_current_state = (int) yy_def[yy_current_state]; |
884 | if ( yy_current_state >= 104 ) | 850 | if ( yy_current_state >= 94 ) |
885 | yy_c = yy_meta[(unsigned int) yy_c]; | 851 | yy_c = yy_meta[(unsigned int) yy_c]; |
886 | } | 852 | } |
887 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 853 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
888 | ++yy_cp; | 854 | ++yy_cp; |
889 | } | 855 | } |
890 | while ( yy_base[yy_current_state] != 303 ); | 856 | while ( yy_current_state != 93 ); |
857 | yy_cp = (yy_last_accepting_cpos); | ||
858 | yy_current_state = (yy_last_accepting_state); | ||
891 | 859 | ||
892 | yy_find_action: | 860 | yy_find_action: |
893 | yy_act = yy_accept[yy_current_state]; | 861 | yy_act = yy_accept[yy_current_state]; |
894 | if ( yy_act == 0 ) | ||
895 | { /* have to back up */ | ||
896 | yy_cp = (yy_last_accepting_cpos); | ||
897 | yy_current_state = (yy_last_accepting_state); | ||
898 | yy_act = yy_accept[yy_current_state]; | ||
899 | } | ||
900 | 862 | ||
901 | YY_DO_BEFORE_ACTION; | 863 | YY_DO_BEFORE_ACTION; |
902 | 864 | ||
903 | if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) | ||
904 | { | ||
905 | int yyl; | ||
906 | for ( yyl = 0; yyl < yyleng; ++yyl ) | ||
907 | if ( yytext[yyl] == '\n' ) | ||
908 | |||
909 | yylineno++; | ||
910 | ; | ||
911 | } | ||
912 | |||
913 | do_action: /* This label is used only to access EOF actions. */ | 865 | do_action: /* This label is used only to access EOF actions. */ |
914 | 866 | ||
915 | switch ( yy_act ) | 867 | switch ( yy_act ) |
@@ -924,7 +876,7 @@ do_action: /* This label is used only to access EOF actions. */ | |||
924 | case 1: | 876 | case 1: |
925 | /* rule 1 can match eol */ | 877 | /* rule 1 can match eol */ |
926 | YY_RULE_SETUP | 878 | YY_RULE_SETUP |
927 | #line 65 "dtc-lexer.l" | 879 | #line 67 "dtc-lexer.l" |
928 | { | 880 | { |
929 | char *name = strchr(yytext, '\"') + 1; | 881 | char *name = strchr(yytext, '\"') + 1; |
930 | yytext[yyleng-1] = '\0'; | 882 | yytext[yyleng-1] = '\0'; |
@@ -936,7 +888,7 @@ case YY_STATE_EOF(INCLUDE): | |||
936 | case YY_STATE_EOF(BYTESTRING): | 888 | case YY_STATE_EOF(BYTESTRING): |
937 | case YY_STATE_EOF(PROPNODENAME): | 889 | case YY_STATE_EOF(PROPNODENAME): |
938 | case YY_STATE_EOF(V1): | 890 | case YY_STATE_EOF(V1): |
939 | #line 71 "dtc-lexer.l" | 891 | #line 73 "dtc-lexer.l" |
940 | { | 892 | { |
941 | if (!pop_input_file()) { | 893 | if (!pop_input_file()) { |
942 | yyterminate(); | 894 | yyterminate(); |
@@ -946,23 +898,18 @@ case YY_STATE_EOF(V1): | |||
946 | case 2: | 898 | case 2: |
947 | /* rule 2 can match eol */ | 899 | /* rule 2 can match eol */ |
948 | YY_RULE_SETUP | 900 | YY_RULE_SETUP |
949 | #line 77 "dtc-lexer.l" | 901 | #line 79 "dtc-lexer.l" |
950 | { | 902 | { |
951 | yylloc.file = srcpos_file; | ||
952 | yylloc.first_line = yylineno; | ||
953 | DPRINT("String: %s\n", yytext); | 903 | DPRINT("String: %s\n", yytext); |
954 | yylval.data = data_copy_escape_string(yytext+1, | 904 | yylval.data = data_copy_escape_string(yytext+1, |
955 | yyleng-2); | 905 | yyleng-2); |
956 | yylloc.first_line = yylineno; | ||
957 | return DT_STRING; | 906 | return DT_STRING; |
958 | } | 907 | } |
959 | YY_BREAK | 908 | YY_BREAK |
960 | case 3: | 909 | case 3: |
961 | YY_RULE_SETUP | 910 | YY_RULE_SETUP |
962 | #line 87 "dtc-lexer.l" | 911 | #line 86 "dtc-lexer.l" |
963 | { | 912 | { |
964 | yylloc.file = srcpos_file; | ||
965 | yylloc.first_line = yylineno; | ||
966 | DPRINT("Keyword: /dts-v1/\n"); | 913 | DPRINT("Keyword: /dts-v1/\n"); |
967 | dts_version = 1; | 914 | dts_version = 1; |
968 | BEGIN_DEFAULT(); | 915 | BEGIN_DEFAULT(); |
@@ -971,10 +918,8 @@ YY_RULE_SETUP | |||
971 | YY_BREAK | 918 | YY_BREAK |
972 | case 4: | 919 | case 4: |
973 | YY_RULE_SETUP | 920 | YY_RULE_SETUP |
974 | #line 96 "dtc-lexer.l" | 921 | #line 93 "dtc-lexer.l" |
975 | { | 922 | { |
976 | yylloc.file = srcpos_file; | ||
977 | yylloc.first_line = yylineno; | ||
978 | DPRINT("Keyword: /memreserve/\n"); | 923 | DPRINT("Keyword: /memreserve/\n"); |
979 | BEGIN_DEFAULT(); | 924 | BEGIN_DEFAULT(); |
980 | return DT_MEMRESERVE; | 925 | return DT_MEMRESERVE; |
@@ -982,158 +927,100 @@ YY_RULE_SETUP | |||
982 | YY_BREAK | 927 | YY_BREAK |
983 | case 5: | 928 | case 5: |
984 | YY_RULE_SETUP | 929 | YY_RULE_SETUP |
985 | #line 104 "dtc-lexer.l" | 930 | #line 99 "dtc-lexer.l" |
986 | { | 931 | { |
987 | yylloc.file = srcpos_file; | ||
988 | yylloc.first_line = yylineno; | ||
989 | DPRINT("Label: %s\n", yytext); | 932 | DPRINT("Label: %s\n", yytext); |
990 | yylval.labelref = strdup(yytext); | 933 | yylval.labelref = xstrdup(yytext); |
991 | yylval.labelref[yyleng-1] = '\0'; | 934 | yylval.labelref[yyleng-1] = '\0'; |
992 | return DT_LABEL; | 935 | return DT_LABEL; |
993 | } | 936 | } |
994 | YY_BREAK | 937 | YY_BREAK |
995 | case 6: | 938 | case 6: |
996 | YY_RULE_SETUP | 939 | YY_RULE_SETUP |
997 | #line 113 "dtc-lexer.l" | 940 | #line 106 "dtc-lexer.l" |
998 | { | ||
999 | yylloc.file = srcpos_file; | ||
1000 | yylloc.first_line = yylineno; | ||
1001 | if (*yytext == 'b') | ||
1002 | yylval.cbase = 2; | ||
1003 | else if (*yytext == 'o') | ||
1004 | yylval.cbase = 8; | ||
1005 | else if (*yytext == 'd') | ||
1006 | yylval.cbase = 10; | ||
1007 | else | ||
1008 | yylval.cbase = 16; | ||
1009 | DPRINT("Base: %d\n", yylval.cbase); | ||
1010 | return DT_BASE; | ||
1011 | } | ||
1012 | YY_BREAK | ||
1013 | case 7: | ||
1014 | YY_RULE_SETUP | ||
1015 | #line 128 "dtc-lexer.l" | ||
1016 | { | 941 | { |
1017 | yylloc.file = srcpos_file; | 942 | yylval.literal = xstrdup(yytext); |
1018 | yylloc.first_line = yylineno; | ||
1019 | yylval.literal = strdup(yytext); | ||
1020 | DPRINT("Literal: '%s'\n", yylval.literal); | ||
1021 | return DT_LEGACYLITERAL; | ||
1022 | } | ||
1023 | YY_BREAK | ||
1024 | case 8: | ||
1025 | YY_RULE_SETUP | ||
1026 | #line 136 "dtc-lexer.l" | ||
1027 | { | ||
1028 | yylloc.file = srcpos_file; | ||
1029 | yylloc.first_line = yylineno; | ||
1030 | yylval.literal = strdup(yytext); | ||
1031 | DPRINT("Literal: '%s'\n", yylval.literal); | 943 | DPRINT("Literal: '%s'\n", yylval.literal); |
1032 | return DT_LITERAL; | 944 | return DT_LITERAL; |
1033 | } | 945 | } |
1034 | YY_BREAK | 946 | YY_BREAK |
1035 | case 9: | 947 | case 7: |
1036 | YY_RULE_SETUP | 948 | YY_RULE_SETUP |
1037 | #line 144 "dtc-lexer.l" | 949 | #line 112 "dtc-lexer.l" |
1038 | { /* label reference */ | 950 | { /* label reference */ |
1039 | yylloc.file = srcpos_file; | ||
1040 | yylloc.first_line = yylineno; | ||
1041 | DPRINT("Ref: %s\n", yytext+1); | 951 | DPRINT("Ref: %s\n", yytext+1); |
1042 | yylval.labelref = strdup(yytext+1); | 952 | yylval.labelref = xstrdup(yytext+1); |
1043 | return DT_REF; | 953 | return DT_REF; |
1044 | } | 954 | } |
1045 | YY_BREAK | 955 | YY_BREAK |
1046 | case 10: | 956 | case 8: |
1047 | YY_RULE_SETUP | 957 | YY_RULE_SETUP |
1048 | #line 152 "dtc-lexer.l" | 958 | #line 118 "dtc-lexer.l" |
1049 | { /* new-style path reference */ | 959 | { /* new-style path reference */ |
1050 | yylloc.file = srcpos_file; | ||
1051 | yylloc.first_line = yylineno; | ||
1052 | yytext[yyleng-1] = '\0'; | 960 | yytext[yyleng-1] = '\0'; |
1053 | DPRINT("Ref: %s\n", yytext+2); | 961 | DPRINT("Ref: %s\n", yytext+2); |
1054 | yylval.labelref = strdup(yytext+2); | 962 | yylval.labelref = xstrdup(yytext+2); |
1055 | return DT_REF; | 963 | return DT_REF; |
1056 | } | 964 | } |
1057 | YY_BREAK | 965 | YY_BREAK |
1058 | case 11: | 966 | case 9: |
1059 | YY_RULE_SETUP | ||
1060 | #line 161 "dtc-lexer.l" | ||
1061 | { /* old-style path reference */ | ||
1062 | yylloc.file = srcpos_file; | ||
1063 | yylloc.first_line = yylineno; | ||
1064 | DPRINT("Ref: %s\n", yytext+1); | ||
1065 | yylval.labelref = strdup(yytext+1); | ||
1066 | return DT_REF; | ||
1067 | } | ||
1068 | YY_BREAK | ||
1069 | case 12: | ||
1070 | YY_RULE_SETUP | 967 | YY_RULE_SETUP |
1071 | #line 169 "dtc-lexer.l" | 968 | #line 125 "dtc-lexer.l" |
1072 | { | 969 | { |
1073 | yylloc.file = srcpos_file; | ||
1074 | yylloc.first_line = yylineno; | ||
1075 | yylval.byte = strtol(yytext, NULL, 16); | 970 | yylval.byte = strtol(yytext, NULL, 16); |
1076 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 971 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
1077 | return DT_BYTE; | 972 | return DT_BYTE; |
1078 | } | 973 | } |
1079 | YY_BREAK | 974 | YY_BREAK |
1080 | case 13: | 975 | case 10: |
1081 | YY_RULE_SETUP | 976 | YY_RULE_SETUP |
1082 | #line 177 "dtc-lexer.l" | 977 | #line 131 "dtc-lexer.l" |
1083 | { | 978 | { |
1084 | yylloc.file = srcpos_file; | ||
1085 | yylloc.first_line = yylineno; | ||
1086 | DPRINT("/BYTESTRING\n"); | 979 | DPRINT("/BYTESTRING\n"); |
1087 | BEGIN_DEFAULT(); | 980 | BEGIN_DEFAULT(); |
1088 | return ']'; | 981 | return ']'; |
1089 | } | 982 | } |
1090 | YY_BREAK | 983 | YY_BREAK |
1091 | case 14: | 984 | case 11: |
1092 | YY_RULE_SETUP | 985 | YY_RULE_SETUP |
1093 | #line 185 "dtc-lexer.l" | 986 | #line 137 "dtc-lexer.l" |
1094 | { | 987 | { |
1095 | yylloc.file = srcpos_file; | ||
1096 | yylloc.first_line = yylineno; | ||
1097 | DPRINT("PropNodeName: %s\n", yytext); | 988 | DPRINT("PropNodeName: %s\n", yytext); |
1098 | yylval.propnodename = strdup(yytext); | 989 | yylval.propnodename = xstrdup(yytext); |
1099 | BEGIN_DEFAULT(); | 990 | BEGIN_DEFAULT(); |
1100 | return DT_PROPNODENAME; | 991 | return DT_PROPNODENAME; |
1101 | } | 992 | } |
1102 | YY_BREAK | 993 | YY_BREAK |
1103 | case 15: | 994 | case 12: |
1104 | YY_RULE_SETUP | 995 | YY_RULE_SETUP |
1105 | #line 194 "dtc-lexer.l" | 996 | #line 144 "dtc-lexer.l" |
1106 | { | 997 | { |
1107 | yylloc.file = srcpos_file; | ||
1108 | yylloc.first_line = yylineno; | ||
1109 | DPRINT("Binary Include\n"); | 998 | DPRINT("Binary Include\n"); |
1110 | return DT_INCBIN; | 999 | return DT_INCBIN; |
1111 | } | 1000 | } |
1112 | YY_BREAK | 1001 | YY_BREAK |
1113 | case 16: | 1002 | case 13: |
1114 | /* rule 16 can match eol */ | 1003 | /* rule 13 can match eol */ |
1115 | YY_RULE_SETUP | 1004 | YY_RULE_SETUP |
1116 | #line 201 "dtc-lexer.l" | 1005 | #line 149 "dtc-lexer.l" |
1117 | /* eat whitespace */ | 1006 | /* eat whitespace */ |
1118 | YY_BREAK | 1007 | YY_BREAK |
1119 | case 17: | 1008 | case 14: |
1120 | /* rule 17 can match eol */ | 1009 | /* rule 14 can match eol */ |
1121 | YY_RULE_SETUP | 1010 | YY_RULE_SETUP |
1122 | #line 202 "dtc-lexer.l" | 1011 | #line 150 "dtc-lexer.l" |
1123 | /* eat C-style comments */ | 1012 | /* eat C-style comments */ |
1124 | YY_BREAK | 1013 | YY_BREAK |
1125 | case 18: | 1014 | case 15: |
1126 | /* rule 18 can match eol */ | 1015 | /* rule 15 can match eol */ |
1127 | YY_RULE_SETUP | 1016 | YY_RULE_SETUP |
1128 | #line 203 "dtc-lexer.l" | 1017 | #line 151 "dtc-lexer.l" |
1129 | /* eat C++-style comments */ | 1018 | /* eat C++-style comments */ |
1130 | YY_BREAK | 1019 | YY_BREAK |
1131 | case 19: | 1020 | case 16: |
1132 | YY_RULE_SETUP | 1021 | YY_RULE_SETUP |
1133 | #line 205 "dtc-lexer.l" | 1022 | #line 153 "dtc-lexer.l" |
1134 | { | 1023 | { |
1135 | yylloc.file = srcpos_file; | ||
1136 | yylloc.first_line = yylineno; | ||
1137 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 1024 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
1138 | (unsigned)yytext[0]); | 1025 | (unsigned)yytext[0]); |
1139 | if (yytext[0] == '[') { | 1026 | if (yytext[0] == '[') { |
@@ -1148,12 +1035,12 @@ YY_RULE_SETUP | |||
1148 | return yytext[0]; | 1035 | return yytext[0]; |
1149 | } | 1036 | } |
1150 | YY_BREAK | 1037 | YY_BREAK |
1151 | case 20: | 1038 | case 17: |
1152 | YY_RULE_SETUP | 1039 | YY_RULE_SETUP |
1153 | #line 222 "dtc-lexer.l" | 1040 | #line 168 "dtc-lexer.l" |
1154 | ECHO; | 1041 | ECHO; |
1155 | YY_BREAK | 1042 | YY_BREAK |
1156 | #line 1157 "dtc-lexer.lex.c" | 1043 | #line 1044 "dtc-lexer.lex.c" |
1157 | 1044 | ||
1158 | case YY_END_OF_BUFFER: | 1045 | case YY_END_OF_BUFFER: |
1159 | { | 1046 | { |
@@ -1218,7 +1105,8 @@ ECHO; | |||
1218 | 1105 | ||
1219 | else | 1106 | else |
1220 | { | 1107 | { |
1221 | yy_cp = (yy_c_buf_p); | 1108 | yy_cp = (yy_last_accepting_cpos); |
1109 | yy_current_state = (yy_last_accepting_state); | ||
1222 | goto yy_find_action; | 1110 | goto yy_find_action; |
1223 | } | 1111 | } |
1224 | } | 1112 | } |
@@ -1443,7 +1331,7 @@ static int yy_get_next_buffer (void) | |||
1443 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1331 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1444 | { | 1332 | { |
1445 | yy_current_state = (int) yy_def[yy_current_state]; | 1333 | yy_current_state = (int) yy_def[yy_current_state]; |
1446 | if ( yy_current_state >= 104 ) | 1334 | if ( yy_current_state >= 94 ) |
1447 | yy_c = yy_meta[(unsigned int) yy_c]; | 1335 | yy_c = yy_meta[(unsigned int) yy_c]; |
1448 | } | 1336 | } |
1449 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1337 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
@@ -1471,11 +1359,11 @@ static int yy_get_next_buffer (void) | |||
1471 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1359 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1472 | { | 1360 | { |
1473 | yy_current_state = (int) yy_def[yy_current_state]; | 1361 | yy_current_state = (int) yy_def[yy_current_state]; |
1474 | if ( yy_current_state >= 104 ) | 1362 | if ( yy_current_state >= 94 ) |
1475 | yy_c = yy_meta[(unsigned int) yy_c]; | 1363 | yy_c = yy_meta[(unsigned int) yy_c]; |
1476 | } | 1364 | } |
1477 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1365 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1478 | yy_is_jam = (yy_current_state == 103); | 1366 | yy_is_jam = (yy_current_state == 93); |
1479 | 1367 | ||
1480 | return yy_is_jam ? 0 : yy_current_state; | 1368 | return yy_is_jam ? 0 : yy_current_state; |
1481 | } | 1369 | } |
@@ -1550,11 +1438,6 @@ static int yy_get_next_buffer (void) | |||
1550 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ | 1438 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ |
1551 | (yy_hold_char) = *++(yy_c_buf_p); | 1439 | (yy_hold_char) = *++(yy_c_buf_p); |
1552 | 1440 | ||
1553 | if ( c == '\n' ) | ||
1554 | |||
1555 | yylineno++; | ||
1556 | ; | ||
1557 | |||
1558 | return c; | 1441 | return c; |
1559 | } | 1442 | } |
1560 | #endif /* ifndef YY_NO_INPUT */ | 1443 | #endif /* ifndef YY_NO_INPUT */ |
@@ -1669,10 +1552,6 @@ static void yy_load_buffer_state (void) | |||
1669 | yyfree((void *) b ); | 1552 | yyfree((void *) b ); |
1670 | } | 1553 | } |
1671 | 1554 | ||
1672 | #ifndef __cplusplus | ||
1673 | extern int isatty (int ); | ||
1674 | #endif /* __cplusplus */ | ||
1675 | |||
1676 | /* Initializes or reinitializes a buffer. | 1555 | /* Initializes or reinitializes a buffer. |
1677 | * This function is sometimes called more than once on the same buffer, | 1556 | * This function is sometimes called more than once on the same buffer, |
1678 | * such as during a yyrestart() or at EOF. | 1557 | * such as during a yyrestart() or at EOF. |
@@ -1696,7 +1575,7 @@ extern int isatty (int ); | |||
1696 | b->yy_bs_column = 0; | 1575 | b->yy_bs_column = 0; |
1697 | } | 1576 | } |
1698 | 1577 | ||
1699 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | 1578 | b->yy_is_interactive = 0; |
1700 | 1579 | ||
1701 | errno = oerrno; | 1580 | errno = oerrno; |
1702 | } | 1581 | } |
@@ -2025,9 +1904,6 @@ static int yy_init_globals (void) | |||
2025 | * This function is called from yylex_destroy(), so don't allocate here. | 1904 | * This function is called from yylex_destroy(), so don't allocate here. |
2026 | */ | 1905 | */ |
2027 | 1906 | ||
2028 | /* We do not touch yylineno unless the option is enabled. */ | ||
2029 | yylineno = 1; | ||
2030 | |||
2031 | (yy_buffer_stack) = 0; | 1907 | (yy_buffer_stack) = 0; |
2032 | (yy_buffer_stack_top) = 0; | 1908 | (yy_buffer_stack_top) = 0; |
2033 | (yy_buffer_stack_max) = 0; | 1909 | (yy_buffer_stack_max) = 0; |
@@ -2120,104 +1996,29 @@ void yyfree (void * ptr ) | |||
2120 | 1996 | ||
2121 | #define YYTABLES_NAME "yytables" | 1997 | #define YYTABLES_NAME "yytables" |
2122 | 1998 | ||
2123 | #line 222 "dtc-lexer.l" | 1999 | #line 168 "dtc-lexer.l" |
2124 | |||
2125 | |||
2126 | |||
2127 | |||
2128 | /* | ||
2129 | * Stack of nested include file contexts. | ||
2130 | */ | ||
2131 | |||
2132 | struct incl_file { | ||
2133 | struct dtc_file *file; | ||
2134 | YY_BUFFER_STATE yy_prev_buf; | ||
2135 | int yy_prev_lineno; | ||
2136 | struct incl_file *prev; | ||
2137 | }; | ||
2138 | |||
2139 | static struct incl_file *incl_file_stack; | ||
2140 | 2000 | ||
2141 | 2001 | ||
2142 | /* | ||
2143 | * Detect infinite include recursion. | ||
2144 | */ | ||
2145 | #define MAX_INCLUDE_DEPTH (100) | ||
2146 | |||
2147 | static int incl_depth = 0; | ||
2148 | |||
2149 | 2002 | ||
2150 | static void push_input_file(const char *filename) | 2003 | static void push_input_file(const char *filename) |
2151 | { | 2004 | { |
2152 | struct incl_file *incl_file; | ||
2153 | struct dtc_file *newfile; | ||
2154 | struct search_path search, *searchptr = NULL; | ||
2155 | |||
2156 | assert(filename); | 2005 | assert(filename); |
2157 | 2006 | ||
2158 | if (incl_depth++ >= MAX_INCLUDE_DEPTH) | 2007 | srcfile_push(filename); |
2159 | die("Includes nested too deeply"); | ||
2160 | |||
2161 | if (srcpos_file) { | ||
2162 | search.dir = srcpos_file->dir; | ||
2163 | search.next = NULL; | ||
2164 | search.prev = NULL; | ||
2165 | searchptr = &search; | ||
2166 | } | ||
2167 | |||
2168 | newfile = dtc_open_file(filename, searchptr); | ||
2169 | 2008 | ||
2170 | incl_file = xmalloc(sizeof(struct incl_file)); | 2009 | yyin = current_srcfile->f; |
2171 | 2010 | ||
2172 | /* | 2011 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); |
2173 | * Save current context. | ||
2174 | */ | ||
2175 | incl_file->yy_prev_buf = YY_CURRENT_BUFFER; | ||
2176 | incl_file->yy_prev_lineno = yylineno; | ||
2177 | incl_file->file = srcpos_file; | ||
2178 | incl_file->prev = incl_file_stack; | ||
2179 | |||
2180 | incl_file_stack = incl_file; | ||
2181 | |||
2182 | /* | ||
2183 | * Establish new context. | ||
2184 | */ | ||
2185 | srcpos_file = newfile; | ||
2186 | yylineno = 1; | ||
2187 | yyin = newfile->file; | ||
2188 | yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); | ||
2189 | } | 2012 | } |
2190 | 2013 | ||
2191 | 2014 | ||
2192 | static int pop_input_file(void) | 2015 | static int pop_input_file(void) |
2193 | { | 2016 | { |
2194 | struct incl_file *incl_file; | 2017 | if (srcfile_pop() == 0) |
2195 | |||
2196 | if (incl_file_stack == 0) | ||
2197 | return 0; | 2018 | return 0; |
2198 | 2019 | ||
2199 | dtc_close_file(srcpos_file); | 2020 | yypop_buffer_state(); |
2200 | 2021 | yyin = current_srcfile->f; | |
2201 | /* | ||
2202 | * Pop. | ||
2203 | */ | ||
2204 | --incl_depth; | ||
2205 | incl_file = incl_file_stack; | ||
2206 | incl_file_stack = incl_file->prev; | ||
2207 | |||
2208 | /* | ||
2209 | * Recover old context. | ||
2210 | */ | ||
2211 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
2212 | yy_switch_to_buffer(incl_file->yy_prev_buf); | ||
2213 | yylineno = incl_file->yy_prev_lineno; | ||
2214 | srcpos_file = incl_file->file; | ||
2215 | yyin = incl_file->file ? incl_file->file->file : NULL; | ||
2216 | |||
2217 | /* | ||
2218 | * Free old state. | ||
2219 | */ | ||
2220 | free(incl_file); | ||
2221 | 2022 | ||
2222 | return 1; | 2023 | return 1; |
2223 | } | 2024 | } |
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index 27129377e5d2..9be2eea18a30 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.tab.c_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,7 +28,7 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
@@ -47,7 +46,7 @@ | |||
47 | #define YYBISON 1 | 46 | #define YYBISON 1 |
48 | 47 | ||
49 | /* Bison version. */ | 48 | /* Bison version. */ |
50 | #define YYBISON_VERSION "2.3" | 49 | #define YYBISON_VERSION "2.4.1" |
51 | 50 | ||
52 | /* Skeleton name. */ | 51 | /* Skeleton name. */ |
53 | #define YYSKELETON_NAME "yacc.c" | 52 | #define YYSKELETON_NAME "yacc.c" |
@@ -55,55 +54,32 @@ | |||
55 | /* Pure parsers. */ | 54 | /* Pure parsers. */ |
56 | #define YYPURE 0 | 55 | #define YYPURE 0 |
57 | 56 | ||
58 | /* Using locations. */ | 57 | /* Push parsers. */ |
59 | #define YYLSP_NEEDED 1 | 58 | #define YYPUSH 0 |
60 | |||
61 | 59 | ||
60 | /* Pull parsers. */ | ||
61 | #define YYPULL 1 | ||
62 | 62 | ||
63 | /* Tokens. */ | 63 | /* Using locations. */ |
64 | #ifndef YYTOKENTYPE | 64 | #define YYLSP_NEEDED 0 |
65 | # define YYTOKENTYPE | ||
66 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
67 | know about them. */ | ||
68 | enum yytokentype { | ||
69 | DT_V1 = 258, | ||
70 | DT_MEMRESERVE = 259, | ||
71 | DT_PROPNODENAME = 260, | ||
72 | DT_LITERAL = 261, | ||
73 | DT_LEGACYLITERAL = 262, | ||
74 | DT_BASE = 263, | ||
75 | DT_BYTE = 264, | ||
76 | DT_STRING = 265, | ||
77 | DT_LABEL = 266, | ||
78 | DT_REF = 267, | ||
79 | DT_INCBIN = 268 | ||
80 | }; | ||
81 | #endif | ||
82 | /* Tokens. */ | ||
83 | #define DT_V1 258 | ||
84 | #define DT_MEMRESERVE 259 | ||
85 | #define DT_PROPNODENAME 260 | ||
86 | #define DT_LITERAL 261 | ||
87 | #define DT_LEGACYLITERAL 262 | ||
88 | #define DT_BASE 263 | ||
89 | #define DT_BYTE 264 | ||
90 | #define DT_STRING 265 | ||
91 | #define DT_LABEL 266 | ||
92 | #define DT_REF 267 | ||
93 | #define DT_INCBIN 268 | ||
94 | |||
95 | 65 | ||
96 | 66 | ||
97 | 67 | ||
98 | /* Copy the first part of user declarations. */ | 68 | /* Copy the first part of user declarations. */ |
99 | #line 23 "dtc-parser.y" | 69 | |
70 | /* Line 189 of yacc.c */ | ||
71 | #line 21 "dtc-parser.y" | ||
100 | 72 | ||
101 | #include <stdio.h> | 73 | #include <stdio.h> |
102 | 74 | ||
103 | #include "dtc.h" | 75 | #include "dtc.h" |
104 | #include "srcpos.h" | 76 | #include "srcpos.h" |
105 | 77 | ||
78 | YYLTYPE yylloc; | ||
79 | |||
106 | extern int yylex(void); | 80 | extern int yylex(void); |
81 | extern void print_error(char const *fmt, ...); | ||
82 | extern void yyerror(char const *s); | ||
107 | 83 | ||
108 | extern struct boot_info *the_boot_info; | 84 | extern struct boot_info *the_boot_info; |
109 | extern int treesource_error; | 85 | extern int treesource_error; |
@@ -111,6 +87,9 @@ extern int treesource_error; | |||
111 | static unsigned long long eval_literal(const char *s, int base, int bits); | 87 | static unsigned long long eval_literal(const char *s, int base, int bits); |
112 | 88 | ||
113 | 89 | ||
90 | /* Line 189 of yacc.c */ | ||
91 | #line 92 "dtc-parser.tab.c" | ||
92 | |||
114 | /* Enabling traces. */ | 93 | /* Enabling traces. */ |
115 | #ifndef YYDEBUG | 94 | #ifndef YYDEBUG |
116 | # define YYDEBUG 0 | 95 | # define YYDEBUG 0 |
@@ -129,10 +108,35 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
129 | # define YYTOKEN_TABLE 0 | 108 | # define YYTOKEN_TABLE 0 |
130 | #endif | 109 | #endif |
131 | 110 | ||
111 | |||
112 | /* Tokens. */ | ||
113 | #ifndef YYTOKENTYPE | ||
114 | # define YYTOKENTYPE | ||
115 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
116 | know about them. */ | ||
117 | enum yytokentype { | ||
118 | DT_V1 = 258, | ||
119 | DT_MEMRESERVE = 259, | ||
120 | DT_PROPNODENAME = 260, | ||
121 | DT_LITERAL = 261, | ||
122 | DT_BASE = 262, | ||
123 | DT_BYTE = 263, | ||
124 | DT_STRING = 264, | ||
125 | DT_LABEL = 265, | ||
126 | DT_REF = 266, | ||
127 | DT_INCBIN = 267 | ||
128 | }; | ||
129 | #endif | ||
130 | |||
131 | |||
132 | |||
132 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 133 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
133 | typedef union YYSTYPE | 134 | typedef union YYSTYPE |
134 | #line 37 "dtc-parser.y" | ||
135 | { | 135 | { |
136 | |||
137 | /* Line 214 of yacc.c */ | ||
138 | #line 39 "dtc-parser.y" | ||
139 | |||
136 | char *propnodename; | 140 | char *propnodename; |
137 | char *literal; | 141 | char *literal; |
138 | char *labelref; | 142 | char *labelref; |
@@ -147,34 +151,23 @@ typedef union YYSTYPE | |||
147 | struct node *node; | 151 | struct node *node; |
148 | struct node *nodelist; | 152 | struct node *nodelist; |
149 | struct reserve_info *re; | 153 | struct reserve_info *re; |
150 | } | 154 | |
151 | /* Line 187 of yacc.c. */ | 155 | |
152 | #line 153 "dtc-parser.tab.c" | 156 | |
153 | YYSTYPE; | 157 | /* Line 214 of yacc.c */ |
158 | #line 159 "dtc-parser.tab.c" | ||
159 | } YYSTYPE; | ||
160 | # define YYSTYPE_IS_TRIVIAL 1 | ||
154 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 161 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
155 | # define YYSTYPE_IS_DECLARED 1 | 162 | # define YYSTYPE_IS_DECLARED 1 |
156 | # define YYSTYPE_IS_TRIVIAL 1 | ||
157 | #endif | ||
158 | |||
159 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | ||
160 | typedef struct YYLTYPE | ||
161 | { | ||
162 | int first_line; | ||
163 | int first_column; | ||
164 | int last_line; | ||
165 | int last_column; | ||
166 | } YYLTYPE; | ||
167 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | ||
168 | # define YYLTYPE_IS_DECLARED 1 | ||
169 | # define YYLTYPE_IS_TRIVIAL 1 | ||
170 | #endif | 163 | #endif |
171 | 164 | ||
172 | 165 | ||
173 | /* Copy the second part of user declarations. */ | 166 | /* Copy the second part of user declarations. */ |
174 | 167 | ||
175 | 168 | ||
176 | /* Line 216 of yacc.c. */ | 169 | /* Line 264 of yacc.c */ |
177 | #line 178 "dtc-parser.tab.c" | 170 | #line 171 "dtc-parser.tab.c" |
178 | 171 | ||
179 | #ifdef short | 172 | #ifdef short |
180 | # undef short | 173 | # undef short |
@@ -249,14 +242,14 @@ typedef short int yytype_int16; | |||
249 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 242 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
250 | || defined __cplusplus || defined _MSC_VER) | 243 | || defined __cplusplus || defined _MSC_VER) |
251 | static int | 244 | static int |
252 | YYID (int i) | 245 | YYID (int yyi) |
253 | #else | 246 | #else |
254 | static int | 247 | static int |
255 | YYID (i) | 248 | YYID (yyi) |
256 | int i; | 249 | int yyi; |
257 | #endif | 250 | #endif |
258 | { | 251 | { |
259 | return i; | 252 | return yyi; |
260 | } | 253 | } |
261 | #endif | 254 | #endif |
262 | 255 | ||
@@ -332,15 +325,13 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
332 | 325 | ||
333 | #if (! defined yyoverflow \ | 326 | #if (! defined yyoverflow \ |
334 | && (! defined __cplusplus \ | 327 | && (! defined __cplusplus \ |
335 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ | 328 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
336 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
337 | 329 | ||
338 | /* A type that is properly aligned for any stack member. */ | 330 | /* A type that is properly aligned for any stack member. */ |
339 | union yyalloc | 331 | union yyalloc |
340 | { | 332 | { |
341 | yytype_int16 yyss; | 333 | yytype_int16 yyss_alloc; |
342 | YYSTYPE yyvs; | 334 | YYSTYPE yyvs_alloc; |
343 | YYLTYPE yyls; | ||
344 | }; | 335 | }; |
345 | 336 | ||
346 | /* The size of the maximum gap between one aligned stack and the next. */ | 337 | /* The size of the maximum gap between one aligned stack and the next. */ |
@@ -349,8 +340,8 @@ union yyalloc | |||
349 | /* The size of an array large to enough to hold all stacks, each with | 340 | /* The size of an array large to enough to hold all stacks, each with |
350 | N elements. */ | 341 | N elements. */ |
351 | # define YYSTACK_BYTES(N) \ | 342 | # define YYSTACK_BYTES(N) \ |
352 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ | 343 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
353 | + 2 * YYSTACK_GAP_MAXIMUM) | 344 | + YYSTACK_GAP_MAXIMUM) |
354 | 345 | ||
355 | /* Copy COUNT objects from FROM to TO. The source and destination do | 346 | /* Copy COUNT objects from FROM to TO. The source and destination do |
356 | not overlap. */ | 347 | not overlap. */ |
@@ -375,12 +366,12 @@ union yyalloc | |||
375 | elements in the stack, and YYPTR gives the new location of the | 366 | elements in the stack, and YYPTR gives the new location of the |
376 | stack. Advance YYPTR to a properly aligned location for the next | 367 | stack. Advance YYPTR to a properly aligned location for the next |
377 | stack. */ | 368 | stack. */ |
378 | # define YYSTACK_RELOCATE(Stack) \ | 369 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
379 | do \ | 370 | do \ |
380 | { \ | 371 | { \ |
381 | YYSIZE_T yynewbytes; \ | 372 | YYSIZE_T yynewbytes; \ |
382 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | 373 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
383 | Stack = &yyptr->Stack; \ | 374 | Stack = &yyptr->Stack_alloc; \ |
384 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 375 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
385 | yyptr += yynewbytes / sizeof (*yyptr); \ | 376 | yyptr += yynewbytes / sizeof (*yyptr); \ |
386 | } \ | 377 | } \ |
@@ -389,22 +380,22 @@ union yyalloc | |||
389 | #endif | 380 | #endif |
390 | 381 | ||
391 | /* YYFINAL -- State number of the termination state. */ | 382 | /* YYFINAL -- State number of the termination state. */ |
392 | #define YYFINAL 9 | 383 | #define YYFINAL 4 |
393 | /* YYLAST -- Last index in YYTABLE. */ | 384 | /* YYLAST -- Last index in YYTABLE. */ |
394 | #define YYLAST 73 | 385 | #define YYLAST 56 |
395 | 386 | ||
396 | /* YYNTOKENS -- Number of terminals. */ | 387 | /* YYNTOKENS -- Number of terminals. */ |
397 | #define YYNTOKENS 27 | 388 | #define YYNTOKENS 25 |
398 | /* YYNNTS -- Number of nonterminals. */ | 389 | /* YYNNTS -- Number of nonterminals. */ |
399 | #define YYNNTS 20 | 390 | #define YYNNTS 16 |
400 | /* YYNRULES -- Number of rules. */ | 391 | /* YYNRULES -- Number of rules. */ |
401 | #define YYNRULES 45 | 392 | #define YYNRULES 39 |
402 | /* YYNRULES -- Number of states. */ | 393 | /* YYNRULES -- Number of states. */ |
403 | #define YYNSTATES 76 | 394 | #define YYNSTATES 67 |
404 | 395 | ||
405 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 396 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
406 | #define YYUNDEFTOK 2 | 397 | #define YYUNDEFTOK 2 |
407 | #define YYMAXUTOK 268 | 398 | #define YYMAXUTOK 267 |
408 | 399 | ||
409 | #define YYTRANSLATE(YYX) \ | 400 | #define YYTRANSLATE(YYX) \ |
410 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 401 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
@@ -416,15 +407,15 @@ static const yytype_uint8 yytranslate[] = | |||
416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 407 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
418 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
419 | 24, 26, 2, 2, 25, 15, 2, 16, 2, 2, | 410 | 22, 24, 2, 2, 23, 2, 2, 14, 2, 2, |
420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, | 411 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, |
421 | 20, 19, 21, 2, 2, 2, 2, 2, 2, 2, | 412 | 18, 17, 19, 2, 2, 2, 2, 2, 2, 2, |
422 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 413 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
423 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 414 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
424 | 2, 22, 2, 23, 2, 2, 2, 2, 2, 2, | 415 | 2, 20, 2, 21, 2, 2, 2, 2, 2, 2, |
425 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
426 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
427 | 2, 2, 2, 17, 2, 18, 2, 2, 2, 2, | 418 | 2, 2, 2, 15, 2, 16, 2, 2, 2, 2, |
428 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 419 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
429 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
430 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 421 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
@@ -438,7 +429,7 @@ static const yytype_uint8 yytranslate[] = | |||
438 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 429 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
439 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 430 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
440 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | 431 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
441 | 5, 6, 7, 8, 9, 10, 11, 12, 13 | 432 | 5, 6, 7, 8, 9, 10, 11, 12 |
442 | }; | 433 | }; |
443 | 434 | ||
444 | #if YYDEBUG | 435 | #if YYDEBUG |
@@ -446,41 +437,37 @@ static const yytype_uint8 yytranslate[] = | |||
446 | YYRHS. */ | 437 | YYRHS. */ |
447 | static const yytype_uint8 yyprhs[] = | 438 | static const yytype_uint8 yyprhs[] = |
448 | { | 439 | { |
449 | 0, 0, 3, 8, 11, 12, 15, 21, 22, 25, | 440 | 0, 0, 3, 8, 9, 12, 17, 20, 22, 25, |
450 | 27, 34, 36, 38, 41, 47, 48, 51, 57, 61, | 441 | 29, 33, 39, 40, 43, 48, 51, 54, 57, 62, |
451 | 64, 69, 74, 77, 87, 93, 96, 97, 100, 103, | 442 | 67, 70, 80, 86, 89, 90, 93, 96, 97, 100, |
452 | 104, 107, 110, 113, 114, 116, 118, 121, 122, 125, | 443 | 103, 106, 108, 109, 112, 115, 116, 119, 122, 125 |
453 | 128, 129, 132, 135, 139, 140 | ||
454 | }; | 444 | }; |
455 | 445 | ||
456 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 446 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
457 | static const yytype_int8 yyrhs[] = | 447 | static const yytype_int8 yyrhs[] = |
458 | { | 448 | { |
459 | 28, 0, -1, 3, 14, 29, 34, -1, 31, 34, | 449 | 26, 0, -1, 3, 13, 27, 30, -1, -1, 28, |
460 | -1, -1, 30, 29, -1, 46, 4, 33, 33, 14, | 450 | 27, -1, 4, 29, 29, 13, -1, 10, 28, -1, |
461 | -1, -1, 32, 31, -1, 30, -1, 46, 4, 33, | 451 | 6, -1, 14, 31, -1, 30, 14, 31, -1, 30, |
462 | 15, 33, 14, -1, 6, -1, 7, -1, 16, 35, | 452 | 11, 31, -1, 15, 32, 39, 16, 13, -1, -1, |
463 | -1, 17, 36, 44, 18, 14, -1, -1, 36, 37, | 453 | 32, 33, -1, 5, 17, 34, 13, -1, 5, 13, |
464 | -1, 46, 5, 19, 38, 14, -1, 46, 5, 14, | 454 | -1, 10, 33, -1, 35, 9, -1, 35, 18, 36, |
465 | -1, 39, 10, -1, 39, 20, 40, 21, -1, 39, | 455 | 19, -1, 35, 20, 38, 21, -1, 35, 11, -1, |
466 | 22, 43, 23, -1, 39, 12, -1, 39, 13, 24, | 456 | 35, 12, 22, 9, 23, 29, 23, 29, 24, -1, |
467 | 10, 25, 33, 25, 33, 26, -1, 39, 13, 24, | 457 | 35, 12, 22, 9, 24, -1, 34, 10, -1, -1, |
468 | 10, 26, -1, 38, 11, -1, -1, 38, 25, -1, | 458 | 34, 23, -1, 35, 10, -1, -1, 36, 37, -1, |
469 | 39, 11, -1, -1, 40, 42, -1, 40, 12, -1, | 459 | 36, 11, -1, 36, 10, -1, 6, -1, -1, 38, |
470 | 40, 11, -1, -1, 8, -1, 6, -1, 41, 7, | 460 | 8, -1, 38, 10, -1, -1, 40, 39, -1, 40, |
471 | -1, -1, 43, 9, -1, 43, 11, -1, -1, 45, | 461 | 33, -1, 5, 31, -1, 10, 40, -1 |
472 | 44, -1, 45, 37, -1, 46, 5, 35, -1, -1, | ||
473 | 11, -1 | ||
474 | }; | 462 | }; |
475 | 463 | ||
476 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 464 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
477 | static const yytype_uint16 yyrline[] = | 465 | static const yytype_uint16 yyrline[] = |
478 | { | 466 | { |
479 | 0, 89, 89, 93, 101, 104, 111, 119, 122, 129, | 467 | 0, 86, 86, 95, 98, 105, 109, 117, 124, 128, |
480 | 133, 140, 144, 151, 158, 166, 169, 176, 180, 187, | 468 | 132, 145, 153, 156, 163, 167, 171, 179, 183, 187, |
481 | 191, 195, 199, 203, 220, 231, 239, 242, 246, 254, | 469 | 191, 195, 212, 222, 230, 233, 237, 245, 248, 252, |
482 | 257, 261, 266, 274, 277, 281, 285, 293, 296, 300, | 470 | 257, 264, 272, 275, 279, 287, 290, 294, 302, 306 |
483 | 308, 311, 315, 323, 331, 334 | ||
484 | }; | 471 | }; |
485 | #endif | 472 | #endif |
486 | 473 | ||
@@ -490,13 +477,12 @@ static const yytype_uint16 yyrline[] = | |||
490 | static const char *const yytname[] = | 477 | static const char *const yytname[] = |
491 | { | 478 | { |
492 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", | 479 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", |
493 | "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE", | 480 | "DT_PROPNODENAME", "DT_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", |
494 | "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'-'", | 481 | "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", |
495 | "'/'", "'{'", "'}'", "'='", "'<'", "'>'", "'['", "']'", "'('", "','", | 482 | "'<'", "'>'", "'['", "']'", "'('", "','", "')'", "$accept", "sourcefile", |
496 | "')'", "$accept", "sourcefile", "memreserves", "memreserve", | 483 | "memreserves", "memreserve", "addr", "devicetree", "nodedef", "proplist", |
497 | "v0_memreserves", "v0_memreserve", "addr", "devicetree", "nodedef", | 484 | "propdef", "propdata", "propdataprefix", "celllist", "cellval", |
498 | "proplist", "propdef", "propdata", "propdataprefix", "celllist", | 485 | "bytestring", "subnodes", "subnode", 0 |
499 | "cellbase", "cellval", "bytestring", "subnodes", "subnode", "label", 0 | ||
500 | }; | 486 | }; |
501 | #endif | 487 | #endif |
502 | 488 | ||
@@ -506,29 +492,27 @@ static const char *const yytname[] = | |||
506 | static const yytype_uint16 yytoknum[] = | 492 | static const yytype_uint16 yytoknum[] = |
507 | { | 493 | { |
508 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 494 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
509 | 265, 266, 267, 268, 59, 45, 47, 123, 125, 61, | 495 | 265, 266, 267, 59, 47, 123, 125, 61, 60, 62, |
510 | 60, 62, 91, 93, 40, 44, 41 | 496 | 91, 93, 40, 44, 41 |
511 | }; | 497 | }; |
512 | # endif | 498 | # endif |
513 | 499 | ||
514 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 500 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
515 | static const yytype_uint8 yyr1[] = | 501 | static const yytype_uint8 yyr1[] = |
516 | { | 502 | { |
517 | 0, 27, 28, 28, 29, 29, 30, 31, 31, 32, | 503 | 0, 25, 26, 27, 27, 28, 28, 29, 30, 30, |
518 | 32, 33, 33, 34, 35, 36, 36, 37, 37, 38, | 504 | 30, 31, 32, 32, 33, 33, 33, 34, 34, 34, |
519 | 38, 38, 38, 38, 38, 38, 39, 39, 39, 40, | 505 | 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, |
520 | 40, 40, 40, 41, 41, 42, 42, 43, 43, 43, | 506 | 36, 37, 38, 38, 38, 39, 39, 39, 40, 40 |
521 | 44, 44, 44, 45, 46, 46 | ||
522 | }; | 507 | }; |
523 | 508 | ||
524 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 509 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
525 | static const yytype_uint8 yyr2[] = | 510 | static const yytype_uint8 yyr2[] = |
526 | { | 511 | { |
527 | 0, 2, 4, 2, 0, 2, 5, 0, 2, 1, | 512 | 0, 2, 4, 0, 2, 4, 2, 1, 2, 3, |
528 | 6, 1, 1, 2, 5, 0, 2, 5, 3, 2, | 513 | 3, 5, 0, 2, 4, 2, 2, 2, 4, 4, |
529 | 4, 4, 2, 9, 5, 2, 0, 2, 2, 0, | 514 | 2, 9, 5, 2, 0, 2, 2, 0, 2, 2, |
530 | 2, 2, 2, 0, 1, 1, 2, 0, 2, 2, | 515 | 2, 1, 0, 2, 2, 0, 2, 2, 2, 2 |
531 | 0, 2, 2, 3, 0, 1 | ||
532 | }; | 516 | }; |
533 | 517 | ||
534 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 518 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
@@ -536,86 +520,79 @@ static const yytype_uint8 yyr2[] = | |||
536 | means the default is an error. */ | 520 | means the default is an error. */ |
537 | static const yytype_uint8 yydefact[] = | 521 | static const yytype_uint8 yydefact[] = |
538 | { | 522 | { |
539 | 7, 0, 45, 0, 9, 0, 7, 0, 4, 1, | 523 | 0, 0, 0, 3, 1, 0, 0, 0, 3, 7, |
540 | 0, 3, 8, 0, 0, 4, 0, 15, 13, 11, | 524 | 0, 6, 0, 2, 4, 0, 12, 8, 0, 0, |
541 | 12, 0, 2, 5, 0, 40, 0, 0, 0, 16, | 525 | 5, 35, 10, 9, 0, 0, 13, 0, 35, 15, |
542 | 0, 40, 0, 0, 6, 0, 42, 41, 0, 10, | 526 | 24, 38, 16, 39, 0, 37, 36, 0, 0, 11, |
543 | 14, 18, 26, 43, 0, 0, 25, 17, 27, 19, | 527 | 23, 14, 25, 17, 26, 20, 0, 27, 32, 0, |
544 | 28, 22, 0, 29, 37, 0, 33, 0, 0, 35, | 528 | 0, 0, 0, 31, 30, 29, 18, 28, 33, 34, |
545 | 34, 32, 31, 20, 0, 30, 38, 39, 21, 0, | 529 | 19, 0, 22, 0, 0, 0, 21 |
546 | 24, 36, 0, 0, 0, 23 | ||
547 | }; | 530 | }; |
548 | 531 | ||
549 | /* YYDEFGOTO[NTERM-NUM]. */ | 532 | /* YYDEFGOTO[NTERM-NUM]. */ |
550 | static const yytype_int8 yydefgoto[] = | 533 | static const yytype_int8 yydefgoto[] = |
551 | { | 534 | { |
552 | -1, 3, 14, 4, 5, 6, 27, 11, 18, 25, | 535 | -1, 2, 7, 8, 10, 13, 17, 21, 26, 37, |
553 | 29, 44, 45, 56, 64, 65, 57, 30, 31, 7 | 536 | 38, 50, 57, 51, 27, 28 |
554 | }; | 537 | }; |
555 | 538 | ||
556 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 539 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
557 | STATE-NUM. */ | 540 | STATE-NUM. */ |
558 | #define YYPACT_NINF -14 | 541 | #define YYPACT_NINF -12 |
559 | static const yytype_int8 yypact[] = | 542 | static const yytype_int8 yypact[] = |
560 | { | 543 | { |
561 | 30, -11, -14, 7, -14, -1, 27, 13, 27, -14, | 544 | 10, -11, 18, -1, -12, 22, -1, 15, -1, -12, |
562 | 8, -14, -14, 40, -1, 27, 35, -14, -14, -14, | 545 | 22, -12, 20, 1, -12, 17, -12, -12, 20, 20, |
563 | -14, 21, -14, -14, 40, 24, 40, 28, 40, -14, | 546 | -12, 6, -12, -12, 21, 6, -12, 23, 6, -12, |
564 | 32, 24, 46, 38, -14, 39, -14, -14, 26, -14, | 547 | -12, -12, -12, -12, 28, -12, -12, -6, 13, -12, |
565 | -14, -14, -14, -14, -9, 10, -14, -14, -14, -14, | 548 | -12, -12, -12, -12, -12, -12, 24, -12, -12, 33, |
566 | -14, -14, 31, -14, -14, 44, -2, 3, 23, -14, | 549 | -5, 0, -4, -12, -12, -12, -12, -12, -12, -12, |
567 | -14, -14, -14, -14, 50, -14, -14, -14, -14, 40, | 550 | -12, 22, -12, 25, 22, 19, -12 |
568 | -14, -14, 33, 40, 36, -14 | ||
569 | }; | 551 | }; |
570 | 552 | ||
571 | /* YYPGOTO[NTERM-NUM]. */ | 553 | /* YYPGOTO[NTERM-NUM]. */ |
572 | static const yytype_int8 yypgoto[] = | 554 | static const yytype_int8 yypgoto[] = |
573 | { | 555 | { |
574 | -14, -14, 48, 29, 53, -14, -13, 47, 34, -14, | 556 | -12, -12, 36, 39, -10, -12, 8, -12, 12, -12, |
575 | 37, -14, -14, -14, -14, -14, -14, 42, -14, -7 | 557 | -12, -12, -12, -12, 27, 31 |
576 | }; | 558 | }; |
577 | 559 | ||
578 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 560 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
579 | positive, shift that token. If negative, reduce the rule which | 561 | positive, shift that token. If negative, reduce the rule which |
580 | number is the opposite. If zero, do what YYDEFACT says. | 562 | number is the opposite. If zero, do what YYDEFACT says. |
581 | If YYTABLE_NINF, syntax error. */ | 563 | If YYTABLE_NINF, syntax error. */ |
582 | #define YYTABLE_NINF -45 | 564 | #define YYTABLE_NINF -1 |
583 | static const yytype_int8 yytable[] = | 565 | static const yytype_uint8 yytable[] = |
584 | { | 566 | { |
585 | 21, 16, 46, 8, 59, 47, 60, 9, 16, 61, | 567 | 15, 53, 3, 5, 40, 54, 55, 41, 58, 6, |
586 | 62, 28, 66, 33, 67, 10, 48, 13, 32, 63, | 568 | 59, 24, 18, 1, 56, 19, 25, 42, 4, 61, |
587 | 49, 50, 51, 52, 32, 17, 68, 19, 20, -44, | 569 | 62, 60, 43, 44, 45, 46, 22, 23, 9, 12, |
588 | 53, -44, 54, 1, -44, 2, 26, 15, 2, 24, | 570 | 20, 47, 31, 48, 29, 16, 16, 32, 30, 34, |
589 | 41, 2, 34, 17, 15, 42, 19, 20, 69, 70, | 571 | 35, 39, 52, 66, 14, 11, 49, 0, 64, 0, |
590 | 35, 38, 39, 40, 58, 55, 72, 71, 73, 12, | 572 | 0, 63, 0, 0, 65, 36, 33 |
591 | 74, 22, 75, 23, 0, 0, 0, 0, 36, 0, | ||
592 | 0, 0, 43, 37 | ||
593 | }; | 573 | }; |
594 | 574 | ||
595 | static const yytype_int8 yycheck[] = | 575 | static const yytype_int8 yycheck[] = |
596 | { | 576 | { |
597 | 13, 8, 11, 14, 6, 14, 8, 0, 15, 11, | 577 | 10, 6, 13, 4, 10, 10, 11, 13, 8, 10, |
598 | 12, 24, 9, 26, 11, 16, 25, 4, 25, 21, | 578 | 10, 5, 11, 3, 19, 14, 10, 23, 0, 23, |
599 | 10, 11, 12, 13, 31, 17, 23, 6, 7, 5, | 579 | 24, 21, 9, 10, 11, 12, 18, 19, 6, 14, |
600 | 20, 4, 22, 3, 4, 11, 15, 8, 11, 4, | 580 | 13, 18, 24, 20, 13, 15, 15, 25, 17, 16, |
601 | 14, 11, 14, 17, 15, 19, 6, 7, 25, 26, | 581 | 28, 13, 9, 24, 8, 6, 22, -1, 23, -1, |
602 | 18, 5, 14, 14, 10, 24, 69, 7, 25, 6, | 582 | -1, 61, -1, -1, 64, 28, 25 |
603 | 73, 14, 26, 15, -1, -1, -1, -1, 31, -1, | ||
604 | -1, -1, 38, 31 | ||
605 | }; | 583 | }; |
606 | 584 | ||
607 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 585 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
608 | symbol of state STATE-NUM. */ | 586 | symbol of state STATE-NUM. */ |
609 | static const yytype_uint8 yystos[] = | 587 | static const yytype_uint8 yystos[] = |
610 | { | 588 | { |
611 | 0, 3, 11, 28, 30, 31, 32, 46, 14, 0, | 589 | 0, 3, 26, 13, 0, 4, 10, 27, 28, 6, |
612 | 16, 34, 31, 4, 29, 30, 46, 17, 35, 6, | 590 | 29, 28, 14, 30, 27, 29, 15, 31, 11, 14, |
613 | 7, 33, 34, 29, 4, 36, 15, 33, 33, 37, | 591 | 13, 32, 31, 31, 5, 10, 33, 39, 40, 13, |
614 | 44, 45, 46, 33, 14, 18, 37, 44, 5, 14, | 592 | 17, 31, 33, 40, 16, 33, 39, 34, 35, 13, |
615 | 14, 14, 19, 35, 38, 39, 11, 14, 25, 10, | 593 | 10, 13, 23, 9, 10, 11, 12, 18, 20, 22, |
616 | 11, 12, 13, 20, 22, 24, 40, 43, 10, 6, | 594 | 36, 38, 9, 6, 10, 11, 19, 37, 8, 10, |
617 | 8, 11, 12, 21, 41, 42, 9, 11, 23, 25, | 595 | 21, 23, 24, 29, 23, 29, 24 |
618 | 26, 7, 33, 25, 33, 26 | ||
619 | }; | 596 | }; |
620 | 597 | ||
621 | #define yyerrok (yyerrstatus = 0) | 598 | #define yyerrok (yyerrstatus = 0) |
@@ -728,7 +705,7 @@ do { \ | |||
728 | { \ | 705 | { \ |
729 | YYFPRINTF (stderr, "%s ", Title); \ | 706 | YYFPRINTF (stderr, "%s ", Title); \ |
730 | yy_symbol_print (stderr, \ | 707 | yy_symbol_print (stderr, \ |
731 | Type, Value, Location); \ | 708 | Type, Value); \ |
732 | YYFPRINTF (stderr, "\n"); \ | 709 | YYFPRINTF (stderr, "\n"); \ |
733 | } \ | 710 | } \ |
734 | } while (YYID (0)) | 711 | } while (YYID (0)) |
@@ -742,19 +719,17 @@ do { \ | |||
742 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 719 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
743 | || defined __cplusplus || defined _MSC_VER) | 720 | || defined __cplusplus || defined _MSC_VER) |
744 | static void | 721 | static void |
745 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | 722 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
746 | #else | 723 | #else |
747 | static void | 724 | static void |
748 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) | 725 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
749 | FILE *yyoutput; | 726 | FILE *yyoutput; |
750 | int yytype; | 727 | int yytype; |
751 | YYSTYPE const * const yyvaluep; | 728 | YYSTYPE const * const yyvaluep; |
752 | YYLTYPE const * const yylocationp; | ||
753 | #endif | 729 | #endif |
754 | { | 730 | { |
755 | if (!yyvaluep) | 731 | if (!yyvaluep) |
756 | return; | 732 | return; |
757 | YYUSE (yylocationp); | ||
758 | # ifdef YYPRINT | 733 | # ifdef YYPRINT |
759 | if (yytype < YYNTOKENS) | 734 | if (yytype < YYNTOKENS) |
760 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | 735 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
@@ -776,14 +751,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) | |||
776 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 751 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
777 | || defined __cplusplus || defined _MSC_VER) | 752 | || defined __cplusplus || defined _MSC_VER) |
778 | static void | 753 | static void |
779 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | 754 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
780 | #else | 755 | #else |
781 | static void | 756 | static void |
782 | yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) | 757 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
783 | FILE *yyoutput; | 758 | FILE *yyoutput; |
784 | int yytype; | 759 | int yytype; |
785 | YYSTYPE const * const yyvaluep; | 760 | YYSTYPE const * const yyvaluep; |
786 | YYLTYPE const * const yylocationp; | ||
787 | #endif | 761 | #endif |
788 | { | 762 | { |
789 | if (yytype < YYNTOKENS) | 763 | if (yytype < YYNTOKENS) |
@@ -791,9 +765,7 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) | |||
791 | else | 765 | else |
792 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | 766 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
793 | 767 | ||
794 | YY_LOCATION_PRINT (yyoutput, *yylocationp); | 768 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
795 | YYFPRINTF (yyoutput, ": "); | ||
796 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | ||
797 | YYFPRINTF (yyoutput, ")"); | 769 | YYFPRINTF (yyoutput, ")"); |
798 | } | 770 | } |
799 | 771 | ||
@@ -805,17 +777,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) | |||
805 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 777 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
806 | || defined __cplusplus || defined _MSC_VER) | 778 | || defined __cplusplus || defined _MSC_VER) |
807 | static void | 779 | static void |
808 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) | 780 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
809 | #else | 781 | #else |
810 | static void | 782 | static void |
811 | yy_stack_print (bottom, top) | 783 | yy_stack_print (yybottom, yytop) |
812 | yytype_int16 *bottom; | 784 | yytype_int16 *yybottom; |
813 | yytype_int16 *top; | 785 | yytype_int16 *yytop; |
814 | #endif | 786 | #endif |
815 | { | 787 | { |
816 | YYFPRINTF (stderr, "Stack now"); | 788 | YYFPRINTF (stderr, "Stack now"); |
817 | for (; bottom <= top; ++bottom) | 789 | for (; yybottom <= yytop; yybottom++) |
818 | YYFPRINTF (stderr, " %d", *bottom); | 790 | { |
791 | int yybot = *yybottom; | ||
792 | YYFPRINTF (stderr, " %d", yybot); | ||
793 | } | ||
819 | YYFPRINTF (stderr, "\n"); | 794 | YYFPRINTF (stderr, "\n"); |
820 | } | 795 | } |
821 | 796 | ||
@@ -833,12 +808,11 @@ do { \ | |||
833 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 808 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
834 | || defined __cplusplus || defined _MSC_VER) | 809 | || defined __cplusplus || defined _MSC_VER) |
835 | static void | 810 | static void |
836 | yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) | 811 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
837 | #else | 812 | #else |
838 | static void | 813 | static void |
839 | yy_reduce_print (yyvsp, yylsp, yyrule) | 814 | yy_reduce_print (yyvsp, yyrule) |
840 | YYSTYPE *yyvsp; | 815 | YYSTYPE *yyvsp; |
841 | YYLTYPE *yylsp; | ||
842 | int yyrule; | 816 | int yyrule; |
843 | #endif | 817 | #endif |
844 | { | 818 | { |
@@ -850,18 +824,18 @@ yy_reduce_print (yyvsp, yylsp, yyrule) | |||
850 | /* The symbols being reduced. */ | 824 | /* The symbols being reduced. */ |
851 | for (yyi = 0; yyi < yynrhs; yyi++) | 825 | for (yyi = 0; yyi < yynrhs; yyi++) |
852 | { | 826 | { |
853 | fprintf (stderr, " $%d = ", yyi + 1); | 827 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
854 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 828 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
855 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 829 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
856 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | 830 | ); |
857 | fprintf (stderr, "\n"); | 831 | YYFPRINTF (stderr, "\n"); |
858 | } | 832 | } |
859 | } | 833 | } |
860 | 834 | ||
861 | # define YY_REDUCE_PRINT(Rule) \ | 835 | # define YY_REDUCE_PRINT(Rule) \ |
862 | do { \ | 836 | do { \ |
863 | if (yydebug) \ | 837 | if (yydebug) \ |
864 | yy_reduce_print (yyvsp, yylsp, Rule); \ | 838 | yy_reduce_print (yyvsp, Rule); \ |
865 | } while (YYID (0)) | 839 | } while (YYID (0)) |
866 | 840 | ||
867 | /* Nonzero means print parse trace. It is left uninitialized so that | 841 | /* Nonzero means print parse trace. It is left uninitialized so that |
@@ -1112,18 +1086,16 @@ yysyntax_error (char *yyresult, int yystate, int yychar) | |||
1112 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1086 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
1113 | || defined __cplusplus || defined _MSC_VER) | 1087 | || defined __cplusplus || defined _MSC_VER) |
1114 | static void | 1088 | static void |
1115 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) | 1089 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
1116 | #else | 1090 | #else |
1117 | static void | 1091 | static void |
1118 | yydestruct (yymsg, yytype, yyvaluep, yylocationp) | 1092 | yydestruct (yymsg, yytype, yyvaluep) |
1119 | const char *yymsg; | 1093 | const char *yymsg; |
1120 | int yytype; | 1094 | int yytype; |
1121 | YYSTYPE *yyvaluep; | 1095 | YYSTYPE *yyvaluep; |
1122 | YYLTYPE *yylocationp; | ||
1123 | #endif | 1096 | #endif |
1124 | { | 1097 | { |
1125 | YYUSE (yyvaluep); | 1098 | YYUSE (yyvaluep); |
1126 | YYUSE (yylocationp); | ||
1127 | 1099 | ||
1128 | if (!yymsg) | 1100 | if (!yymsg) |
1129 | yymsg = "Deleting"; | 1101 | yymsg = "Deleting"; |
@@ -1136,10 +1108,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) | |||
1136 | break; | 1108 | break; |
1137 | } | 1109 | } |
1138 | } | 1110 | } |
1139 | |||
1140 | 1111 | ||
1141 | /* Prevent warnings from -Wmissing-prototypes. */ | 1112 | /* Prevent warnings from -Wmissing-prototypes. */ |
1142 | |||
1143 | #ifdef YYPARSE_PARAM | 1113 | #ifdef YYPARSE_PARAM |
1144 | #if defined __STDC__ || defined __cplusplus | 1114 | #if defined __STDC__ || defined __cplusplus |
1145 | int yyparse (void *YYPARSE_PARAM); | 1115 | int yyparse (void *YYPARSE_PARAM); |
@@ -1155,23 +1125,20 @@ int yyparse (); | |||
1155 | #endif /* ! YYPARSE_PARAM */ | 1125 | #endif /* ! YYPARSE_PARAM */ |
1156 | 1126 | ||
1157 | 1127 | ||
1158 | 1128 | /* The lookahead symbol. */ | |
1159 | /* The look-ahead symbol. */ | ||
1160 | int yychar; | 1129 | int yychar; |
1161 | 1130 | ||
1162 | /* The semantic value of the look-ahead symbol. */ | 1131 | /* The semantic value of the lookahead symbol. */ |
1163 | YYSTYPE yylval; | 1132 | YYSTYPE yylval; |
1164 | 1133 | ||
1165 | /* Number of syntax errors so far. */ | 1134 | /* Number of syntax errors so far. */ |
1166 | int yynerrs; | 1135 | int yynerrs; |
1167 | /* Location data for the look-ahead symbol. */ | ||
1168 | YYLTYPE yylloc; | ||
1169 | 1136 | ||
1170 | 1137 | ||
1171 | 1138 | ||
1172 | /*----------. | 1139 | /*-------------------------. |
1173 | | yyparse. | | 1140 | | yyparse or yypush_parse. | |
1174 | `----------*/ | 1141 | `-------------------------*/ |
1175 | 1142 | ||
1176 | #ifdef YYPARSE_PARAM | 1143 | #ifdef YYPARSE_PARAM |
1177 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1144 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1195,79 +1162,70 @@ yyparse () | |||
1195 | #endif | 1162 | #endif |
1196 | #endif | 1163 | #endif |
1197 | { | 1164 | { |
1198 | |||
1199 | int yystate; | ||
1200 | int yyn; | ||
1201 | int yyresult; | ||
1202 | /* Number of tokens to shift before error messages enabled. */ | ||
1203 | int yyerrstatus; | ||
1204 | /* Look-ahead token as an internal (translated) token number. */ | ||
1205 | int yytoken = 0; | ||
1206 | #if YYERROR_VERBOSE | ||
1207 | /* Buffer for error messages, and its allocated size. */ | ||
1208 | char yymsgbuf[128]; | ||
1209 | char *yymsg = yymsgbuf; | ||
1210 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1211 | #endif | ||
1212 | 1165 | ||
1213 | /* Three stacks and their tools: | ||
1214 | `yyss': related to states, | ||
1215 | `yyvs': related to semantic values, | ||
1216 | `yyls': related to locations. | ||
1217 | 1166 | ||
1218 | Refer to the stacks thru separate pointers, to allow yyoverflow | 1167 | int yystate; |
1219 | to reallocate them elsewhere. */ | 1168 | /* Number of tokens to shift before error messages enabled. */ |
1169 | int yyerrstatus; | ||
1220 | 1170 | ||
1221 | /* The state stack. */ | 1171 | /* The stacks and their tools: |
1222 | yytype_int16 yyssa[YYINITDEPTH]; | 1172 | `yyss': related to states. |
1223 | yytype_int16 *yyss = yyssa; | 1173 | `yyvs': related to semantic values. |
1224 | yytype_int16 *yyssp; | ||
1225 | 1174 | ||
1226 | /* The semantic value stack. */ | 1175 | Refer to the stacks thru separate pointers, to allow yyoverflow |
1227 | YYSTYPE yyvsa[YYINITDEPTH]; | 1176 | to reallocate them elsewhere. */ |
1228 | YYSTYPE *yyvs = yyvsa; | ||
1229 | YYSTYPE *yyvsp; | ||
1230 | 1177 | ||
1231 | /* The location stack. */ | 1178 | /* The state stack. */ |
1232 | YYLTYPE yylsa[YYINITDEPTH]; | 1179 | yytype_int16 yyssa[YYINITDEPTH]; |
1233 | YYLTYPE *yyls = yylsa; | 1180 | yytype_int16 *yyss; |
1234 | YYLTYPE *yylsp; | 1181 | yytype_int16 *yyssp; |
1235 | /* The locations where the error started and ended. */ | ||
1236 | YYLTYPE yyerror_range[2]; | ||
1237 | 1182 | ||
1238 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) | 1183 | /* The semantic value stack. */ |
1184 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1185 | YYSTYPE *yyvs; | ||
1186 | YYSTYPE *yyvsp; | ||
1239 | 1187 | ||
1240 | YYSIZE_T yystacksize = YYINITDEPTH; | 1188 | YYSIZE_T yystacksize; |
1241 | 1189 | ||
1190 | int yyn; | ||
1191 | int yyresult; | ||
1192 | /* Lookahead token as an internal (translated) token number. */ | ||
1193 | int yytoken; | ||
1242 | /* The variables used to return semantic value and location from the | 1194 | /* The variables used to return semantic value and location from the |
1243 | action routines. */ | 1195 | action routines. */ |
1244 | YYSTYPE yyval; | 1196 | YYSTYPE yyval; |
1245 | YYLTYPE yyloc; | 1197 | |
1198 | #if YYERROR_VERBOSE | ||
1199 | /* Buffer for error messages, and its allocated size. */ | ||
1200 | char yymsgbuf[128]; | ||
1201 | char *yymsg = yymsgbuf; | ||
1202 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1203 | #endif | ||
1204 | |||
1205 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1246 | 1206 | ||
1247 | /* The number of symbols on the RHS of the reduced rule. | 1207 | /* The number of symbols on the RHS of the reduced rule. |
1248 | Keep to zero when no symbol should be popped. */ | 1208 | Keep to zero when no symbol should be popped. */ |
1249 | int yylen = 0; | 1209 | int yylen = 0; |
1250 | 1210 | ||
1211 | yytoken = 0; | ||
1212 | yyss = yyssa; | ||
1213 | yyvs = yyvsa; | ||
1214 | yystacksize = YYINITDEPTH; | ||
1215 | |||
1251 | YYDPRINTF ((stderr, "Starting parse\n")); | 1216 | YYDPRINTF ((stderr, "Starting parse\n")); |
1252 | 1217 | ||
1253 | yystate = 0; | 1218 | yystate = 0; |
1254 | yyerrstatus = 0; | 1219 | yyerrstatus = 0; |
1255 | yynerrs = 0; | 1220 | yynerrs = 0; |
1256 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1221 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1257 | 1222 | ||
1258 | /* Initialize stack pointers. | 1223 | /* Initialize stack pointers. |
1259 | Waste one element of value and location stack | 1224 | Waste one element of value and location stack |
1260 | so that they stay on the same level as the state stack. | 1225 | so that they stay on the same level as the state stack. |
1261 | The wasted elements are never initialized. */ | 1226 | The wasted elements are never initialized. */ |
1262 | |||
1263 | yyssp = yyss; | 1227 | yyssp = yyss; |
1264 | yyvsp = yyvs; | 1228 | yyvsp = yyvs; |
1265 | yylsp = yyls; | ||
1266 | #if YYLTYPE_IS_TRIVIAL | ||
1267 | /* Initialize the default location before parsing starts. */ | ||
1268 | yylloc.first_line = yylloc.last_line = 1; | ||
1269 | yylloc.first_column = yylloc.last_column = 0; | ||
1270 | #endif | ||
1271 | 1229 | ||
1272 | goto yysetstate; | 1230 | goto yysetstate; |
1273 | 1231 | ||
@@ -1294,7 +1252,6 @@ yyparse () | |||
1294 | memory. */ | 1252 | memory. */ |
1295 | YYSTYPE *yyvs1 = yyvs; | 1253 | YYSTYPE *yyvs1 = yyvs; |
1296 | yytype_int16 *yyss1 = yyss; | 1254 | yytype_int16 *yyss1 = yyss; |
1297 | YYLTYPE *yyls1 = yyls; | ||
1298 | 1255 | ||
1299 | /* Each stack pointer address is followed by the size of the | 1256 | /* Each stack pointer address is followed by the size of the |
1300 | data in use in that stack, in bytes. This used to be a | 1257 | data in use in that stack, in bytes. This used to be a |
@@ -1303,9 +1260,8 @@ yyparse () | |||
1303 | yyoverflow (YY_("memory exhausted"), | 1260 | yyoverflow (YY_("memory exhausted"), |
1304 | &yyss1, yysize * sizeof (*yyssp), | 1261 | &yyss1, yysize * sizeof (*yyssp), |
1305 | &yyvs1, yysize * sizeof (*yyvsp), | 1262 | &yyvs1, yysize * sizeof (*yyvsp), |
1306 | &yyls1, yysize * sizeof (*yylsp), | ||
1307 | &yystacksize); | 1263 | &yystacksize); |
1308 | yyls = yyls1; | 1264 | |
1309 | yyss = yyss1; | 1265 | yyss = yyss1; |
1310 | yyvs = yyvs1; | 1266 | yyvs = yyvs1; |
1311 | } | 1267 | } |
@@ -1326,9 +1282,8 @@ yyparse () | |||
1326 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1282 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1327 | if (! yyptr) | 1283 | if (! yyptr) |
1328 | goto yyexhaustedlab; | 1284 | goto yyexhaustedlab; |
1329 | YYSTACK_RELOCATE (yyss); | 1285 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1330 | YYSTACK_RELOCATE (yyvs); | 1286 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1331 | YYSTACK_RELOCATE (yyls); | ||
1332 | # undef YYSTACK_RELOCATE | 1287 | # undef YYSTACK_RELOCATE |
1333 | if (yyss1 != yyssa) | 1288 | if (yyss1 != yyssa) |
1334 | YYSTACK_FREE (yyss1); | 1289 | YYSTACK_FREE (yyss1); |
@@ -1338,7 +1293,6 @@ yyparse () | |||
1338 | 1293 | ||
1339 | yyssp = yyss + yysize - 1; | 1294 | yyssp = yyss + yysize - 1; |
1340 | yyvsp = yyvs + yysize - 1; | 1295 | yyvsp = yyvs + yysize - 1; |
1341 | yylsp = yyls + yysize - 1; | ||
1342 | 1296 | ||
1343 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1297 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1344 | (unsigned long int) yystacksize)); | 1298 | (unsigned long int) yystacksize)); |
@@ -1349,6 +1303,9 @@ yyparse () | |||
1349 | 1303 | ||
1350 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1304 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1351 | 1305 | ||
1306 | if (yystate == YYFINAL) | ||
1307 | YYACCEPT; | ||
1308 | |||
1352 | goto yybackup; | 1309 | goto yybackup; |
1353 | 1310 | ||
1354 | /*-----------. | 1311 | /*-----------. |
@@ -1357,16 +1314,16 @@ yyparse () | |||
1357 | yybackup: | 1314 | yybackup: |
1358 | 1315 | ||
1359 | /* Do appropriate processing given the current state. Read a | 1316 | /* Do appropriate processing given the current state. Read a |
1360 | look-ahead token if we need one and don't already have one. */ | 1317 | lookahead token if we need one and don't already have one. */ |
1361 | 1318 | ||
1362 | /* First try to decide what to do without reference to look-ahead token. */ | 1319 | /* First try to decide what to do without reference to lookahead token. */ |
1363 | yyn = yypact[yystate]; | 1320 | yyn = yypact[yystate]; |
1364 | if (yyn == YYPACT_NINF) | 1321 | if (yyn == YYPACT_NINF) |
1365 | goto yydefault; | 1322 | goto yydefault; |
1366 | 1323 | ||
1367 | /* Not known => get a look-ahead token if don't already have one. */ | 1324 | /* Not known => get a lookahead token if don't already have one. */ |
1368 | 1325 | ||
1369 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | 1326 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1370 | if (yychar == YYEMPTY) | 1327 | if (yychar == YYEMPTY) |
1371 | { | 1328 | { |
1372 | YYDPRINTF ((stderr, "Reading a token: ")); | 1329 | YYDPRINTF ((stderr, "Reading a token: ")); |
@@ -1398,24 +1355,20 @@ yybackup: | |||
1398 | goto yyreduce; | 1355 | goto yyreduce; |
1399 | } | 1356 | } |
1400 | 1357 | ||
1401 | if (yyn == YYFINAL) | ||
1402 | YYACCEPT; | ||
1403 | |||
1404 | /* Count tokens shifted since error; after three, turn off error | 1358 | /* Count tokens shifted since error; after three, turn off error |
1405 | status. */ | 1359 | status. */ |
1406 | if (yyerrstatus) | 1360 | if (yyerrstatus) |
1407 | yyerrstatus--; | 1361 | yyerrstatus--; |
1408 | 1362 | ||
1409 | /* Shift the look-ahead token. */ | 1363 | /* Shift the lookahead token. */ |
1410 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 1364 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1411 | 1365 | ||
1412 | /* Discard the shifted token unless it is eof. */ | 1366 | /* Discard the shifted token. */ |
1413 | if (yychar != YYEOF) | 1367 | yychar = YYEMPTY; |
1414 | yychar = YYEMPTY; | ||
1415 | 1368 | ||
1416 | yystate = yyn; | 1369 | yystate = yyn; |
1417 | *++yyvsp = yylval; | 1370 | *++yyvsp = yylval; |
1418 | *++yylsp = yylloc; | 1371 | |
1419 | goto yynewstate; | 1372 | goto yynewstate; |
1420 | 1373 | ||
1421 | 1374 | ||
@@ -1446,337 +1399,387 @@ yyreduce: | |||
1446 | GCC warning that YYVAL may be used uninitialized. */ | 1399 | GCC warning that YYVAL may be used uninitialized. */ |
1447 | yyval = yyvsp[1-yylen]; | 1400 | yyval = yyvsp[1-yylen]; |
1448 | 1401 | ||
1449 | /* Default location. */ | 1402 | |
1450 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | ||
1451 | YY_REDUCE_PRINT (yyn); | 1403 | YY_REDUCE_PRINT (yyn); |
1452 | switch (yyn) | 1404 | switch (yyn) |
1453 | { | 1405 | { |
1454 | case 2: | 1406 | case 2: |
1455 | #line 90 "dtc-parser.y" | 1407 | |
1408 | /* Line 1455 of yacc.c */ | ||
1409 | #line 87 "dtc-parser.y" | ||
1456 | { | 1410 | { |
1457 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 0); | 1411 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), |
1412 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | ||
1458 | ;} | 1413 | ;} |
1459 | break; | 1414 | break; |
1460 | 1415 | ||
1461 | case 3: | 1416 | case 3: |
1462 | #line 94 "dtc-parser.y" | 1417 | |
1418 | /* Line 1455 of yacc.c */ | ||
1419 | #line 95 "dtc-parser.y" | ||
1463 | { | 1420 | { |
1464 | the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node), 0); | 1421 | (yyval.re) = NULL; |
1465 | ;} | 1422 | ;} |
1466 | break; | 1423 | break; |
1467 | 1424 | ||
1468 | case 4: | 1425 | case 4: |
1469 | #line 101 "dtc-parser.y" | 1426 | |
1427 | /* Line 1455 of yacc.c */ | ||
1428 | #line 99 "dtc-parser.y" | ||
1470 | { | 1429 | { |
1471 | (yyval.re) = NULL; | 1430 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); |
1472 | ;} | 1431 | ;} |
1473 | break; | 1432 | break; |
1474 | 1433 | ||
1475 | case 5: | 1434 | case 5: |
1476 | #line 105 "dtc-parser.y" | 1435 | |
1436 | /* Line 1455 of yacc.c */ | ||
1437 | #line 106 "dtc-parser.y" | ||
1477 | { | 1438 | { |
1478 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1439 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].addr), (yyvsp[(3) - (4)].addr)); |
1479 | ;} | 1440 | ;} |
1480 | break; | 1441 | break; |
1481 | 1442 | ||
1482 | case 6: | 1443 | case 6: |
1483 | #line 112 "dtc-parser.y" | 1444 | |
1445 | /* Line 1455 of yacc.c */ | ||
1446 | #line 110 "dtc-parser.y" | ||
1484 | { | 1447 | { |
1485 | (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref)); | 1448 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); |
1449 | (yyval.re) = (yyvsp[(2) - (2)].re); | ||
1486 | ;} | 1450 | ;} |
1487 | break; | 1451 | break; |
1488 | 1452 | ||
1489 | case 7: | 1453 | case 7: |
1490 | #line 119 "dtc-parser.y" | 1454 | |
1455 | /* Line 1455 of yacc.c */ | ||
1456 | #line 118 "dtc-parser.y" | ||
1491 | { | 1457 | { |
1492 | (yyval.re) = NULL; | 1458 | (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); |
1493 | ;} | 1459 | ;} |
1494 | break; | 1460 | break; |
1495 | 1461 | ||
1496 | case 8: | 1462 | case 8: |
1497 | #line 123 "dtc-parser.y" | 1463 | |
1464 | /* Line 1455 of yacc.c */ | ||
1465 | #line 125 "dtc-parser.y" | ||
1498 | { | 1466 | { |
1499 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1467 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); |
1500 | ;} | 1468 | ;} |
1501 | break; | 1469 | break; |
1502 | 1470 | ||
1503 | case 9: | 1471 | case 9: |
1504 | #line 130 "dtc-parser.y" | 1472 | |
1473 | /* Line 1455 of yacc.c */ | ||
1474 | #line 129 "dtc-parser.y" | ||
1505 | { | 1475 | { |
1506 | (yyval.re) = (yyvsp[(1) - (1)].re); | 1476 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); |
1507 | ;} | 1477 | ;} |
1508 | break; | 1478 | break; |
1509 | 1479 | ||
1510 | case 10: | 1480 | case 10: |
1511 | #line 134 "dtc-parser.y" | 1481 | |
1482 | /* Line 1455 of yacc.c */ | ||
1483 | #line 133 "dtc-parser.y" | ||
1512 | { | 1484 | { |
1513 | (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref)); | 1485 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); |
1486 | |||
1487 | if (target) | ||
1488 | merge_nodes(target, (yyvsp[(3) - (3)].node)); | ||
1489 | else | ||
1490 | print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); | ||
1491 | (yyval.node) = (yyvsp[(1) - (3)].node); | ||
1514 | ;} | 1492 | ;} |
1515 | break; | 1493 | break; |
1516 | 1494 | ||
1517 | case 11: | 1495 | case 11: |
1518 | #line 141 "dtc-parser.y" | 1496 | |
1497 | /* Line 1455 of yacc.c */ | ||
1498 | #line 146 "dtc-parser.y" | ||
1519 | { | 1499 | { |
1520 | (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); | 1500 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); |
1521 | ;} | 1501 | ;} |
1522 | break; | 1502 | break; |
1523 | 1503 | ||
1524 | case 12: | 1504 | case 12: |
1525 | #line 145 "dtc-parser.y" | 1505 | |
1506 | /* Line 1455 of yacc.c */ | ||
1507 | #line 153 "dtc-parser.y" | ||
1526 | { | 1508 | { |
1527 | (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64); | 1509 | (yyval.proplist) = NULL; |
1528 | ;} | 1510 | ;} |
1529 | break; | 1511 | break; |
1530 | 1512 | ||
1531 | case 13: | 1513 | case 13: |
1532 | #line 152 "dtc-parser.y" | 1514 | |
1515 | /* Line 1455 of yacc.c */ | ||
1516 | #line 157 "dtc-parser.y" | ||
1533 | { | 1517 | { |
1534 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL); | 1518 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); |
1535 | ;} | 1519 | ;} |
1536 | break; | 1520 | break; |
1537 | 1521 | ||
1538 | case 14: | 1522 | case 14: |
1539 | #line 159 "dtc-parser.y" | 1523 | |
1524 | /* Line 1455 of yacc.c */ | ||
1525 | #line 164 "dtc-parser.y" | ||
1540 | { | 1526 | { |
1541 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); | 1527 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); |
1542 | ;} | 1528 | ;} |
1543 | break; | 1529 | break; |
1544 | 1530 | ||
1545 | case 15: | 1531 | case 15: |
1546 | #line 166 "dtc-parser.y" | 1532 | |
1533 | /* Line 1455 of yacc.c */ | ||
1534 | #line 168 "dtc-parser.y" | ||
1547 | { | 1535 | { |
1548 | (yyval.proplist) = NULL; | 1536 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); |
1549 | ;} | 1537 | ;} |
1550 | break; | 1538 | break; |
1551 | 1539 | ||
1552 | case 16: | 1540 | case 16: |
1553 | #line 170 "dtc-parser.y" | 1541 | |
1542 | /* Line 1455 of yacc.c */ | ||
1543 | #line 172 "dtc-parser.y" | ||
1554 | { | 1544 | { |
1555 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); | 1545 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); |
1546 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | ||
1556 | ;} | 1547 | ;} |
1557 | break; | 1548 | break; |
1558 | 1549 | ||
1559 | case 17: | 1550 | case 17: |
1560 | #line 177 "dtc-parser.y" | 1551 | |
1552 | /* Line 1455 of yacc.c */ | ||
1553 | #line 180 "dtc-parser.y" | ||
1561 | { | 1554 | { |
1562 | (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref)); | 1555 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); |
1563 | ;} | 1556 | ;} |
1564 | break; | 1557 | break; |
1565 | 1558 | ||
1566 | case 18: | 1559 | case 18: |
1567 | #line 181 "dtc-parser.y" | 1560 | |
1561 | /* Line 1455 of yacc.c */ | ||
1562 | #line 184 "dtc-parser.y" | ||
1568 | { | 1563 | { |
1569 | (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref)); | 1564 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
1570 | ;} | 1565 | ;} |
1571 | break; | 1566 | break; |
1572 | 1567 | ||
1573 | case 19: | 1568 | case 19: |
1569 | |||
1570 | /* Line 1455 of yacc.c */ | ||
1574 | #line 188 "dtc-parser.y" | 1571 | #line 188 "dtc-parser.y" |
1575 | { | 1572 | { |
1576 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); | 1573 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
1577 | ;} | 1574 | ;} |
1578 | break; | 1575 | break; |
1579 | 1576 | ||
1580 | case 20: | 1577 | case 20: |
1578 | |||
1579 | /* Line 1455 of yacc.c */ | ||
1581 | #line 192 "dtc-parser.y" | 1580 | #line 192 "dtc-parser.y" |
1582 | { | 1581 | { |
1583 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1582 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); |
1584 | ;} | 1583 | ;} |
1585 | break; | 1584 | break; |
1586 | 1585 | ||
1587 | case 21: | 1586 | case 21: |
1588 | #line 196 "dtc-parser.y" | ||
1589 | { | ||
1590 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | ||
1591 | ;} | ||
1592 | break; | ||
1593 | |||
1594 | case 22: | ||
1595 | #line 200 "dtc-parser.y" | ||
1596 | { | ||
1597 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | ||
1598 | ;} | ||
1599 | break; | ||
1600 | 1587 | ||
1601 | case 23: | 1588 | /* Line 1455 of yacc.c */ |
1602 | #line 204 "dtc-parser.y" | 1589 | #line 196 "dtc-parser.y" |
1603 | { | 1590 | { |
1604 | struct search_path path = { srcpos_file->dir, NULL, NULL }; | 1591 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); |
1605 | struct dtc_file *file = dtc_open_file((yyvsp[(4) - (9)].data).val, &path); | 1592 | struct data d; |
1606 | struct data d = empty_data; | ||
1607 | 1593 | ||
1608 | if ((yyvsp[(6) - (9)].addr) != 0) | 1594 | if ((yyvsp[(6) - (9)].addr) != 0) |
1609 | if (fseek(file->file, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0) | 1595 | if (fseek(f, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0) |
1610 | yyerrorf("Couldn't seek to offset %llu in \"%s\": %s", | 1596 | print_error("Couldn't seek to offset %llu in \"%s\": %s", |
1611 | (unsigned long long)(yyvsp[(6) - (9)].addr), | 1597 | (unsigned long long)(yyvsp[(6) - (9)].addr), |
1612 | (yyvsp[(4) - (9)].data).val, strerror(errno)); | 1598 | (yyvsp[(4) - (9)].data).val, |
1599 | strerror(errno)); | ||
1613 | 1600 | ||
1614 | d = data_copy_file(file->file, (yyvsp[(8) - (9)].addr)); | 1601 | d = data_copy_file(f, (yyvsp[(8) - (9)].addr)); |
1615 | 1602 | ||
1616 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); | 1603 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); |
1617 | dtc_close_file(file); | 1604 | fclose(f); |
1618 | ;} | 1605 | ;} |
1619 | break; | 1606 | break; |
1620 | 1607 | ||
1621 | case 24: | 1608 | case 22: |
1622 | #line 221 "dtc-parser.y" | 1609 | |
1610 | /* Line 1455 of yacc.c */ | ||
1611 | #line 213 "dtc-parser.y" | ||
1623 | { | 1612 | { |
1624 | struct search_path path = { srcpos_file->dir, NULL, NULL }; | 1613 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); |
1625 | struct dtc_file *file = dtc_open_file((yyvsp[(4) - (5)].data).val, &path); | ||
1626 | struct data d = empty_data; | 1614 | struct data d = empty_data; |
1627 | 1615 | ||
1628 | d = data_copy_file(file->file, -1); | 1616 | d = data_copy_file(f, -1); |
1629 | 1617 | ||
1630 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); | 1618 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); |
1631 | dtc_close_file(file); | 1619 | fclose(f); |
1632 | ;} | 1620 | ;} |
1633 | break; | 1621 | break; |
1634 | 1622 | ||
1635 | case 25: | 1623 | case 23: |
1636 | #line 232 "dtc-parser.y" | 1624 | |
1625 | /* Line 1455 of yacc.c */ | ||
1626 | #line 223 "dtc-parser.y" | ||
1637 | { | 1627 | { |
1638 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1628 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1639 | ;} | 1629 | ;} |
1640 | break; | 1630 | break; |
1641 | 1631 | ||
1642 | case 26: | 1632 | case 24: |
1643 | #line 239 "dtc-parser.y" | 1633 | |
1634 | /* Line 1455 of yacc.c */ | ||
1635 | #line 230 "dtc-parser.y" | ||
1644 | { | 1636 | { |
1645 | (yyval.data) = empty_data; | 1637 | (yyval.data) = empty_data; |
1646 | ;} | 1638 | ;} |
1647 | break; | 1639 | break; |
1648 | 1640 | ||
1649 | case 27: | 1641 | case 25: |
1650 | #line 243 "dtc-parser.y" | 1642 | |
1643 | /* Line 1455 of yacc.c */ | ||
1644 | #line 234 "dtc-parser.y" | ||
1651 | { | 1645 | { |
1652 | (yyval.data) = (yyvsp[(1) - (2)].data); | 1646 | (yyval.data) = (yyvsp[(1) - (2)].data); |
1653 | ;} | 1647 | ;} |
1654 | break; | 1648 | break; |
1655 | 1649 | ||
1656 | case 28: | 1650 | case 26: |
1657 | #line 247 "dtc-parser.y" | 1651 | |
1652 | /* Line 1455 of yacc.c */ | ||
1653 | #line 238 "dtc-parser.y" | ||
1658 | { | 1654 | { |
1659 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1655 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1660 | ;} | 1656 | ;} |
1661 | break; | 1657 | break; |
1662 | 1658 | ||
1663 | case 29: | 1659 | case 27: |
1664 | #line 254 "dtc-parser.y" | 1660 | |
1661 | /* Line 1455 of yacc.c */ | ||
1662 | #line 245 "dtc-parser.y" | ||
1665 | { | 1663 | { |
1666 | (yyval.data) = empty_data; | 1664 | (yyval.data) = empty_data; |
1667 | ;} | 1665 | ;} |
1668 | break; | 1666 | break; |
1669 | 1667 | ||
1670 | case 30: | 1668 | case 28: |
1671 | #line 258 "dtc-parser.y" | 1669 | |
1670 | /* Line 1455 of yacc.c */ | ||
1671 | #line 249 "dtc-parser.y" | ||
1672 | { | 1672 | { |
1673 | (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); | 1673 | (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); |
1674 | ;} | 1674 | ;} |
1675 | break; | 1675 | break; |
1676 | 1676 | ||
1677 | case 31: | 1677 | case 29: |
1678 | #line 262 "dtc-parser.y" | 1678 | |
1679 | /* Line 1455 of yacc.c */ | ||
1680 | #line 253 "dtc-parser.y" | ||
1679 | { | 1681 | { |
1680 | (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, | 1682 | (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, |
1681 | (yyvsp[(2) - (2)].labelref)), -1); | 1683 | (yyvsp[(2) - (2)].labelref)), -1); |
1682 | ;} | 1684 | ;} |
1683 | break; | 1685 | break; |
1684 | 1686 | ||
1685 | case 32: | 1687 | case 30: |
1686 | #line 267 "dtc-parser.y" | 1688 | |
1689 | /* Line 1455 of yacc.c */ | ||
1690 | #line 258 "dtc-parser.y" | ||
1687 | { | 1691 | { |
1688 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1692 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1689 | ;} | 1693 | ;} |
1690 | break; | 1694 | break; |
1691 | 1695 | ||
1692 | case 33: | 1696 | case 31: |
1693 | #line 274 "dtc-parser.y" | ||
1694 | { | ||
1695 | (yyval.cbase) = 16; | ||
1696 | ;} | ||
1697 | break; | ||
1698 | 1697 | ||
1699 | case 35: | 1698 | /* Line 1455 of yacc.c */ |
1700 | #line 282 "dtc-parser.y" | 1699 | #line 265 "dtc-parser.y" |
1701 | { | 1700 | { |
1702 | (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); | 1701 | (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); |
1703 | ;} | 1702 | ;} |
1704 | break; | 1703 | break; |
1705 | 1704 | ||
1706 | case 36: | 1705 | case 32: |
1707 | #line 286 "dtc-parser.y" | ||
1708 | { | ||
1709 | (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32); | ||
1710 | ;} | ||
1711 | break; | ||
1712 | 1706 | ||
1713 | case 37: | 1707 | /* Line 1455 of yacc.c */ |
1714 | #line 293 "dtc-parser.y" | 1708 | #line 272 "dtc-parser.y" |
1715 | { | 1709 | { |
1716 | (yyval.data) = empty_data; | 1710 | (yyval.data) = empty_data; |
1717 | ;} | 1711 | ;} |
1718 | break; | 1712 | break; |
1719 | 1713 | ||
1720 | case 38: | 1714 | case 33: |
1721 | #line 297 "dtc-parser.y" | 1715 | |
1716 | /* Line 1455 of yacc.c */ | ||
1717 | #line 276 "dtc-parser.y" | ||
1722 | { | 1718 | { |
1723 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | 1719 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); |
1724 | ;} | 1720 | ;} |
1725 | break; | 1721 | break; |
1726 | 1722 | ||
1727 | case 39: | 1723 | case 34: |
1728 | #line 301 "dtc-parser.y" | 1724 | |
1725 | /* Line 1455 of yacc.c */ | ||
1726 | #line 280 "dtc-parser.y" | ||
1729 | { | 1727 | { |
1730 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1728 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1731 | ;} | 1729 | ;} |
1732 | break; | 1730 | break; |
1733 | 1731 | ||
1734 | case 40: | 1732 | case 35: |
1735 | #line 308 "dtc-parser.y" | 1733 | |
1734 | /* Line 1455 of yacc.c */ | ||
1735 | #line 287 "dtc-parser.y" | ||
1736 | { | 1736 | { |
1737 | (yyval.nodelist) = NULL; | 1737 | (yyval.nodelist) = NULL; |
1738 | ;} | 1738 | ;} |
1739 | break; | 1739 | break; |
1740 | 1740 | ||
1741 | case 41: | 1741 | case 36: |
1742 | #line 312 "dtc-parser.y" | 1742 | |
1743 | /* Line 1455 of yacc.c */ | ||
1744 | #line 291 "dtc-parser.y" | ||
1743 | { | 1745 | { |
1744 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | 1746 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); |
1745 | ;} | 1747 | ;} |
1746 | break; | 1748 | break; |
1747 | 1749 | ||
1748 | case 42: | 1750 | case 37: |
1749 | #line 316 "dtc-parser.y" | 1751 | |
1752 | /* Line 1455 of yacc.c */ | ||
1753 | #line 295 "dtc-parser.y" | ||
1750 | { | 1754 | { |
1751 | yyerror("syntax error: properties must precede subnodes"); | 1755 | print_error("syntax error: properties must precede subnodes"); |
1752 | YYERROR; | 1756 | YYERROR; |
1753 | ;} | 1757 | ;} |
1754 | break; | 1758 | break; |
1755 | 1759 | ||
1756 | case 43: | 1760 | case 38: |
1757 | #line 324 "dtc-parser.y" | ||
1758 | { | ||
1759 | (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref)); | ||
1760 | ;} | ||
1761 | break; | ||
1762 | 1761 | ||
1763 | case 44: | 1762 | /* Line 1455 of yacc.c */ |
1764 | #line 331 "dtc-parser.y" | 1763 | #line 303 "dtc-parser.y" |
1765 | { | 1764 | { |
1766 | (yyval.labelref) = NULL; | 1765 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); |
1767 | ;} | 1766 | ;} |
1768 | break; | 1767 | break; |
1769 | 1768 | ||
1770 | case 45: | 1769 | case 39: |
1771 | #line 335 "dtc-parser.y" | 1770 | |
1771 | /* Line 1455 of yacc.c */ | ||
1772 | #line 307 "dtc-parser.y" | ||
1772 | { | 1773 | { |
1773 | (yyval.labelref) = (yyvsp[(1) - (1)].labelref); | 1774 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); |
1775 | (yyval.node) = (yyvsp[(2) - (2)].node); | ||
1774 | ;} | 1776 | ;} |
1775 | break; | 1777 | break; |
1776 | 1778 | ||
1777 | 1779 | ||
1778 | /* Line 1267 of yacc.c. */ | 1780 | |
1779 | #line 1780 "dtc-parser.tab.c" | 1781 | /* Line 1455 of yacc.c */ |
1782 | #line 1783 "dtc-parser.tab.c" | ||
1780 | default: break; | 1783 | default: break; |
1781 | } | 1784 | } |
1782 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | 1785 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
@@ -1786,7 +1789,6 @@ yyreduce: | |||
1786 | YY_STACK_PRINT (yyss, yyssp); | 1789 | YY_STACK_PRINT (yyss, yyssp); |
1787 | 1790 | ||
1788 | *++yyvsp = yyval; | 1791 | *++yyvsp = yyval; |
1789 | *++yylsp = yyloc; | ||
1790 | 1792 | ||
1791 | /* Now `shift' the result of the reduction. Determine what state | 1793 | /* Now `shift' the result of the reduction. Determine what state |
1792 | that goes to, based on the state we popped back to and the rule | 1794 | that goes to, based on the state we popped back to and the rule |
@@ -1848,11 +1850,11 @@ yyerrlab: | |||
1848 | #endif | 1850 | #endif |
1849 | } | 1851 | } |
1850 | 1852 | ||
1851 | yyerror_range[0] = yylloc; | 1853 | |
1852 | 1854 | ||
1853 | if (yyerrstatus == 3) | 1855 | if (yyerrstatus == 3) |
1854 | { | 1856 | { |
1855 | /* If just tried and failed to reuse look-ahead token after an | 1857 | /* If just tried and failed to reuse lookahead token after an |
1856 | error, discard it. */ | 1858 | error, discard it. */ |
1857 | 1859 | ||
1858 | if (yychar <= YYEOF) | 1860 | if (yychar <= YYEOF) |
@@ -1864,12 +1866,12 @@ yyerrlab: | |||
1864 | else | 1866 | else |
1865 | { | 1867 | { |
1866 | yydestruct ("Error: discarding", | 1868 | yydestruct ("Error: discarding", |
1867 | yytoken, &yylval, &yylloc); | 1869 | yytoken, &yylval); |
1868 | yychar = YYEMPTY; | 1870 | yychar = YYEMPTY; |
1869 | } | 1871 | } |
1870 | } | 1872 | } |
1871 | 1873 | ||
1872 | /* Else will try to reuse look-ahead token after shifting the error | 1874 | /* Else will try to reuse lookahead token after shifting the error |
1873 | token. */ | 1875 | token. */ |
1874 | goto yyerrlab1; | 1876 | goto yyerrlab1; |
1875 | 1877 | ||
@@ -1885,7 +1887,6 @@ yyerrorlab: | |||
1885 | if (/*CONSTCOND*/ 0) | 1887 | if (/*CONSTCOND*/ 0) |
1886 | goto yyerrorlab; | 1888 | goto yyerrorlab; |
1887 | 1889 | ||
1888 | yyerror_range[0] = yylsp[1-yylen]; | ||
1889 | /* Do not reclaim the symbols of the rule which action triggered | 1890 | /* Do not reclaim the symbols of the rule which action triggered |
1890 | this YYERROR. */ | 1891 | this YYERROR. */ |
1891 | YYPOPSTACK (yylen); | 1892 | YYPOPSTACK (yylen); |
@@ -1919,24 +1920,16 @@ yyerrlab1: | |||
1919 | if (yyssp == yyss) | 1920 | if (yyssp == yyss) |
1920 | YYABORT; | 1921 | YYABORT; |
1921 | 1922 | ||
1922 | yyerror_range[0] = *yylsp; | 1923 | |
1923 | yydestruct ("Error: popping", | 1924 | yydestruct ("Error: popping", |
1924 | yystos[yystate], yyvsp, yylsp); | 1925 | yystos[yystate], yyvsp); |
1925 | YYPOPSTACK (1); | 1926 | YYPOPSTACK (1); |
1926 | yystate = *yyssp; | 1927 | yystate = *yyssp; |
1927 | YY_STACK_PRINT (yyss, yyssp); | 1928 | YY_STACK_PRINT (yyss, yyssp); |
1928 | } | 1929 | } |
1929 | 1930 | ||
1930 | if (yyn == YYFINAL) | ||
1931 | YYACCEPT; | ||
1932 | |||
1933 | *++yyvsp = yylval; | 1931 | *++yyvsp = yylval; |
1934 | 1932 | ||
1935 | yyerror_range[1] = yylloc; | ||
1936 | /* Using YYLLOC is tempting, but would change the location of | ||
1937 | the look-ahead. YYLOC is available though. */ | ||
1938 | YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); | ||
1939 | *++yylsp = yyloc; | ||
1940 | 1933 | ||
1941 | /* Shift the error token. */ | 1934 | /* Shift the error token. */ |
1942 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | 1935 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
@@ -1959,7 +1952,7 @@ yyabortlab: | |||
1959 | yyresult = 1; | 1952 | yyresult = 1; |
1960 | goto yyreturn; | 1953 | goto yyreturn; |
1961 | 1954 | ||
1962 | #ifndef yyoverflow | 1955 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
1963 | /*-------------------------------------------------. | 1956 | /*-------------------------------------------------. |
1964 | | yyexhaustedlab -- memory exhaustion comes here. | | 1957 | | yyexhaustedlab -- memory exhaustion comes here. | |
1965 | `-------------------------------------------------*/ | 1958 | `-------------------------------------------------*/ |
@@ -1970,9 +1963,9 @@ yyexhaustedlab: | |||
1970 | #endif | 1963 | #endif |
1971 | 1964 | ||
1972 | yyreturn: | 1965 | yyreturn: |
1973 | if (yychar != YYEOF && yychar != YYEMPTY) | 1966 | if (yychar != YYEMPTY) |
1974 | yydestruct ("Cleanup: discarding lookahead", | 1967 | yydestruct ("Cleanup: discarding lookahead", |
1975 | yytoken, &yylval, &yylloc); | 1968 | yytoken, &yylval); |
1976 | /* Do not reclaim the symbols of the rule which action triggered | 1969 | /* Do not reclaim the symbols of the rule which action triggered |
1977 | this YYABORT or YYACCEPT. */ | 1970 | this YYABORT or YYACCEPT. */ |
1978 | YYPOPSTACK (yylen); | 1971 | YYPOPSTACK (yylen); |
@@ -1980,7 +1973,7 @@ yyreturn: | |||
1980 | while (yyssp != yyss) | 1973 | while (yyssp != yyss) |
1981 | { | 1974 | { |
1982 | yydestruct ("Cleanup: popping", | 1975 | yydestruct ("Cleanup: popping", |
1983 | yystos[*yyssp], yyvsp, yylsp); | 1976 | yystos[*yyssp], yyvsp); |
1984 | YYPOPSTACK (1); | 1977 | YYPOPSTACK (1); |
1985 | } | 1978 | } |
1986 | #ifndef yyoverflow | 1979 | #ifndef yyoverflow |
@@ -1996,29 +1989,24 @@ yyreturn: | |||
1996 | } | 1989 | } |
1997 | 1990 | ||
1998 | 1991 | ||
1999 | #line 340 "dtc-parser.y" | 1992 | |
1993 | /* Line 1675 of yacc.c */ | ||
1994 | #line 313 "dtc-parser.y" | ||
2000 | 1995 | ||
2001 | 1996 | ||
2002 | void yyerrorf(char const *s, ...) | 1997 | void print_error(char const *fmt, ...) |
2003 | { | 1998 | { |
2004 | const char *fname = srcpos_file ? srcpos_file->name : "<no-file>"; | ||
2005 | va_list va; | 1999 | va_list va; |
2006 | va_start(va, s); | ||
2007 | |||
2008 | if (strcmp(fname, "-") == 0) | ||
2009 | fname = "stdin"; | ||
2010 | 2000 | ||
2011 | fprintf(stderr, "%s:%d ", fname, yylloc.first_line); | 2001 | va_start(va, fmt); |
2012 | vfprintf(stderr, s, va); | 2002 | srcpos_verror(&yylloc, fmt, va); |
2013 | fprintf(stderr, "\n"); | 2003 | va_end(va); |
2014 | 2004 | ||
2015 | treesource_error = 1; | 2005 | treesource_error = 1; |
2016 | va_end(va); | ||
2017 | } | 2006 | } |
2018 | 2007 | ||
2019 | void yyerror (char const *s) | 2008 | void yyerror(char const *s) { |
2020 | { | 2009 | print_error("%s", s); |
2021 | yyerrorf("%s", s); | ||
2022 | } | 2010 | } |
2023 | 2011 | ||
2024 | static unsigned long long eval_literal(const char *s, int base, int bits) | 2012 | static unsigned long long eval_literal(const char *s, int base, int bits) |
@@ -2029,12 +2017,12 @@ static unsigned long long eval_literal(const char *s, int base, int bits) | |||
2029 | errno = 0; | 2017 | errno = 0; |
2030 | val = strtoull(s, &e, base); | 2018 | val = strtoull(s, &e, base); |
2031 | if (*e) | 2019 | if (*e) |
2032 | yyerror("bad characters in literal"); | 2020 | print_error("bad characters in literal"); |
2033 | else if ((errno == ERANGE) | 2021 | else if ((errno == ERANGE) |
2034 | || ((bits < 64) && (val >= (1ULL << bits)))) | 2022 | || ((bits < 64) && (val >= (1ULL << bits)))) |
2035 | yyerror("literal out of range"); | 2023 | print_error("literal out of range"); |
2036 | else if (errno != 0) | 2024 | else if (errno != 0) |
2037 | yyerror("bad literal"); | 2025 | print_error("bad literal"); |
2038 | return val; | 2026 | return val; |
2039 | } | 2027 | } |
2040 | 2028 | ||
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index ba99100d55c9..95c9547adea5 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.tab.h_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton interface for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton interface for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,10 +28,11 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
35 | |||
36 | /* Tokens. */ | 36 | /* Tokens. */ |
37 | #ifndef YYTOKENTYPE | 37 | #ifndef YYTOKENTYPE |
38 | # define YYTOKENTYPE | 38 | # define YYTOKENTYPE |
@@ -43,35 +43,24 @@ | |||
43 | DT_MEMRESERVE = 259, | 43 | DT_MEMRESERVE = 259, |
44 | DT_PROPNODENAME = 260, | 44 | DT_PROPNODENAME = 260, |
45 | DT_LITERAL = 261, | 45 | DT_LITERAL = 261, |
46 | DT_LEGACYLITERAL = 262, | 46 | DT_BASE = 262, |
47 | DT_BASE = 263, | 47 | DT_BYTE = 263, |
48 | DT_BYTE = 264, | 48 | DT_STRING = 264, |
49 | DT_STRING = 265, | 49 | DT_LABEL = 265, |
50 | DT_LABEL = 266, | 50 | DT_REF = 266, |
51 | DT_REF = 267, | 51 | DT_INCBIN = 267 |
52 | DT_INCBIN = 268 | ||
53 | }; | 52 | }; |
54 | #endif | 53 | #endif |
55 | /* Tokens. */ | ||
56 | #define DT_V1 258 | ||
57 | #define DT_MEMRESERVE 259 | ||
58 | #define DT_PROPNODENAME 260 | ||
59 | #define DT_LITERAL 261 | ||
60 | #define DT_LEGACYLITERAL 262 | ||
61 | #define DT_BASE 263 | ||
62 | #define DT_BYTE 264 | ||
63 | #define DT_STRING 265 | ||
64 | #define DT_LABEL 266 | ||
65 | #define DT_REF 267 | ||
66 | #define DT_INCBIN 268 | ||
67 | |||
68 | 54 | ||
69 | 55 | ||
70 | 56 | ||
71 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 57 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
72 | typedef union YYSTYPE | 58 | typedef union YYSTYPE |
73 | #line 37 "dtc-parser.y" | ||
74 | { | 59 | { |
60 | |||
61 | /* Line 1676 of yacc.c */ | ||
62 | #line 39 "dtc-parser.y" | ||
63 | |||
75 | char *propnodename; | 64 | char *propnodename; |
76 | char *literal; | 65 | char *literal; |
77 | char *labelref; | 66 | char *labelref; |
@@ -86,28 +75,17 @@ typedef union YYSTYPE | |||
86 | struct node *node; | 75 | struct node *node; |
87 | struct node *nodelist; | 76 | struct node *nodelist; |
88 | struct reserve_info *re; | 77 | struct reserve_info *re; |
89 | } | 78 | |
90 | /* Line 1489 of yacc.c. */ | 79 | |
91 | #line 92 "dtc-parser.tab.h" | 80 | |
92 | YYSTYPE; | 81 | /* Line 1676 of yacc.c */ |
82 | #line 83 "dtc-parser.tab.h" | ||
83 | } YYSTYPE; | ||
84 | # define YYSTYPE_IS_TRIVIAL 1 | ||
93 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 85 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
94 | # define YYSTYPE_IS_DECLARED 1 | 86 | # define YYSTYPE_IS_DECLARED 1 |
95 | # define YYSTYPE_IS_TRIVIAL 1 | ||
96 | #endif | 87 | #endif |
97 | 88 | ||
98 | extern YYSTYPE yylval; | 89 | extern YYSTYPE yylval; |
99 | 90 | ||
100 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | ||
101 | typedef struct YYLTYPE | ||
102 | { | ||
103 | int first_line; | ||
104 | int first_column; | ||
105 | int last_line; | ||
106 | int last_column; | ||
107 | } YYLTYPE; | ||
108 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | ||
109 | # define YYLTYPE_IS_DECLARED 1 | ||
110 | # define YYLTYPE_IS_TRIVIAL 1 | ||
111 | #endif | ||
112 | 91 | ||
113 | extern YYLTYPE yylloc; | ||
diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index b2ab562420ea..5e84a67fc1d2 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y | |||
@@ -18,15 +18,17 @@ | |||
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | %locations | ||
22 | |||
23 | %{ | 21 | %{ |
24 | #include <stdio.h> | 22 | #include <stdio.h> |
25 | 23 | ||
26 | #include "dtc.h" | 24 | #include "dtc.h" |
27 | #include "srcpos.h" | 25 | #include "srcpos.h" |
28 | 26 | ||
27 | YYLTYPE yylloc; | ||
28 | |||
29 | extern int yylex(void); | 29 | extern int yylex(void); |
30 | extern void print_error(char const *fmt, ...); | ||
31 | extern void yyerror(char const *s); | ||
30 | 32 | ||
31 | extern struct boot_info *the_boot_info; | 33 | extern struct boot_info *the_boot_info; |
32 | extern int treesource_error; | 34 | extern int treesource_error; |
@@ -55,7 +57,6 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
55 | %token DT_MEMRESERVE | 57 | %token DT_MEMRESERVE |
56 | %token <propnodename> DT_PROPNODENAME | 58 | %token <propnodename> DT_PROPNODENAME |
57 | %token <literal> DT_LITERAL | 59 | %token <literal> DT_LITERAL |
58 | %token <literal> DT_LEGACYLITERAL | ||
59 | %token <cbase> DT_BASE | 60 | %token <cbase> DT_BASE |
60 | %token <byte> DT_BYTE | 61 | %token <byte> DT_BYTE |
61 | %token <data> DT_STRING | 62 | %token <data> DT_STRING |
@@ -67,11 +68,8 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
67 | %type <data> propdataprefix | 68 | %type <data> propdataprefix |
68 | %type <re> memreserve | 69 | %type <re> memreserve |
69 | %type <re> memreserves | 70 | %type <re> memreserves |
70 | %type <re> v0_memreserve | ||
71 | %type <re> v0_memreserves | ||
72 | %type <addr> addr | 71 | %type <addr> addr |
73 | %type <data> celllist | 72 | %type <data> celllist |
74 | %type <cbase> cellbase | ||
75 | %type <cell> cellval | 73 | %type <cell> cellval |
76 | %type <data> bytestring | 74 | %type <data> bytestring |
77 | %type <prop> propdef | 75 | %type <prop> propdef |
@@ -81,18 +79,14 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
81 | %type <node> nodedef | 79 | %type <node> nodedef |
82 | %type <node> subnode | 80 | %type <node> subnode |
83 | %type <nodelist> subnodes | 81 | %type <nodelist> subnodes |
84 | %type <labelref> label | ||
85 | 82 | ||
86 | %% | 83 | %% |
87 | 84 | ||
88 | sourcefile: | 85 | sourcefile: |
89 | DT_V1 ';' memreserves devicetree | 86 | DT_V1 ';' memreserves devicetree |
90 | { | 87 | { |
91 | the_boot_info = build_boot_info($3, $4, 0); | 88 | the_boot_info = build_boot_info($3, $4, |
92 | } | 89 | guess_boot_cpuid($4)); |
93 | | v0_memreserves devicetree | ||
94 | { | ||
95 | the_boot_info = build_boot_info($1, $2, 0); | ||
96 | } | 90 | } |
97 | ; | 91 | ; |
98 | 92 | ||
@@ -108,31 +102,14 @@ memreserves: | |||
108 | ; | 102 | ; |
109 | 103 | ||
110 | memreserve: | 104 | memreserve: |
111 | label DT_MEMRESERVE addr addr ';' | 105 | DT_MEMRESERVE addr addr ';' |
112 | { | 106 | { |
113 | $$ = build_reserve_entry($3, $4, $1); | 107 | $$ = build_reserve_entry($2, $3); |
114 | } | 108 | } |
115 | ; | 109 | | DT_LABEL memreserve |
116 | |||
117 | v0_memreserves: | ||
118 | /* empty */ | ||
119 | { | 110 | { |
120 | $$ = NULL; | 111 | add_label(&$2->labels, $1); |
121 | } | 112 | $$ = $2; |
122 | | v0_memreserve v0_memreserves | ||
123 | { | ||
124 | $$ = chain_reserve_entry($1, $2); | ||
125 | }; | ||
126 | ; | ||
127 | |||
128 | v0_memreserve: | ||
129 | memreserve | ||
130 | { | ||
131 | $$ = $1; | ||
132 | } | ||
133 | | label DT_MEMRESERVE addr '-' addr ';' | ||
134 | { | ||
135 | $$ = build_reserve_entry($3, $5 - $3 + 1, $1); | ||
136 | } | 113 | } |
137 | ; | 114 | ; |
138 | 115 | ||
@@ -141,16 +118,26 @@ addr: | |||
141 | { | 118 | { |
142 | $$ = eval_literal($1, 0, 64); | 119 | $$ = eval_literal($1, 0, 64); |
143 | } | 120 | } |
144 | | DT_LEGACYLITERAL | ||
145 | { | ||
146 | $$ = eval_literal($1, 16, 64); | ||
147 | } | ||
148 | ; | 121 | ; |
149 | 122 | ||
150 | devicetree: | 123 | devicetree: |
151 | '/' nodedef | 124 | '/' nodedef |
152 | { | 125 | { |
153 | $$ = name_node($2, "", NULL); | 126 | $$ = name_node($2, ""); |
127 | } | ||
128 | | devicetree '/' nodedef | ||
129 | { | ||
130 | $$ = merge_nodes($1, $3); | ||
131 | } | ||
132 | | devicetree DT_REF nodedef | ||
133 | { | ||
134 | struct node *target = get_node_by_ref($1, $2); | ||
135 | |||
136 | if (target) | ||
137 | merge_nodes(target, $3); | ||
138 | else | ||
139 | print_error("label or path, '%s', not found", $2); | ||
140 | $$ = $1; | ||
154 | } | 141 | } |
155 | ; | 142 | ; |
156 | 143 | ||
@@ -173,13 +160,18 @@ proplist: | |||
173 | ; | 160 | ; |
174 | 161 | ||
175 | propdef: | 162 | propdef: |
176 | label DT_PROPNODENAME '=' propdata ';' | 163 | DT_PROPNODENAME '=' propdata ';' |
164 | { | ||
165 | $$ = build_property($1, $3); | ||
166 | } | ||
167 | | DT_PROPNODENAME ';' | ||
177 | { | 168 | { |
178 | $$ = build_property($2, $4, $1); | 169 | $$ = build_property($1, empty_data); |
179 | } | 170 | } |
180 | | label DT_PROPNODENAME ';' | 171 | | DT_LABEL propdef |
181 | { | 172 | { |
182 | $$ = build_property($2, empty_data, $1); | 173 | add_label(&$2->labels, $1); |
174 | $$ = $2; | ||
183 | } | 175 | } |
184 | ; | 176 | ; |
185 | 177 | ||
@@ -202,31 +194,30 @@ propdata: | |||
202 | } | 194 | } |
203 | | propdataprefix DT_INCBIN '(' DT_STRING ',' addr ',' addr ')' | 195 | | propdataprefix DT_INCBIN '(' DT_STRING ',' addr ',' addr ')' |
204 | { | 196 | { |
205 | struct search_path path = { srcpos_file->dir, NULL, NULL }; | 197 | FILE *f = srcfile_relative_open($4.val, NULL); |
206 | struct dtc_file *file = dtc_open_file($4.val, &path); | 198 | struct data d; |
207 | struct data d = empty_data; | ||
208 | 199 | ||
209 | if ($6 != 0) | 200 | if ($6 != 0) |
210 | if (fseek(file->file, $6, SEEK_SET) != 0) | 201 | if (fseek(f, $6, SEEK_SET) != 0) |
211 | yyerrorf("Couldn't seek to offset %llu in \"%s\": %s", | 202 | print_error("Couldn't seek to offset %llu in \"%s\": %s", |
212 | (unsigned long long)$6, | 203 | (unsigned long long)$6, |
213 | $4.val, strerror(errno)); | 204 | $4.val, |
205 | strerror(errno)); | ||
214 | 206 | ||
215 | d = data_copy_file(file->file, $8); | 207 | d = data_copy_file(f, $8); |
216 | 208 | ||
217 | $$ = data_merge($1, d); | 209 | $$ = data_merge($1, d); |
218 | dtc_close_file(file); | 210 | fclose(f); |
219 | } | 211 | } |
220 | | propdataprefix DT_INCBIN '(' DT_STRING ')' | 212 | | propdataprefix DT_INCBIN '(' DT_STRING ')' |
221 | { | 213 | { |
222 | struct search_path path = { srcpos_file->dir, NULL, NULL }; | 214 | FILE *f = srcfile_relative_open($4.val, NULL); |
223 | struct dtc_file *file = dtc_open_file($4.val, &path); | ||
224 | struct data d = empty_data; | 215 | struct data d = empty_data; |
225 | 216 | ||
226 | d = data_copy_file(file->file, -1); | 217 | d = data_copy_file(f, -1); |
227 | 218 | ||
228 | $$ = data_merge($1, d); | 219 | $$ = data_merge($1, d); |
229 | dtc_close_file(file); | 220 | fclose(f); |
230 | } | 221 | } |
231 | | propdata DT_LABEL | 222 | | propdata DT_LABEL |
232 | { | 223 | { |
@@ -269,23 +260,11 @@ celllist: | |||
269 | } | 260 | } |
270 | ; | 261 | ; |
271 | 262 | ||
272 | cellbase: | ||
273 | /* empty */ | ||
274 | { | ||
275 | $$ = 16; | ||
276 | } | ||
277 | | DT_BASE | ||
278 | ; | ||
279 | |||
280 | cellval: | 263 | cellval: |
281 | DT_LITERAL | 264 | DT_LITERAL |
282 | { | 265 | { |
283 | $$ = eval_literal($1, 0, 32); | 266 | $$ = eval_literal($1, 0, 32); |
284 | } | 267 | } |
285 | | cellbase DT_LEGACYLITERAL | ||
286 | { | ||
287 | $$ = eval_literal($2, $1, 32); | ||
288 | } | ||
289 | ; | 268 | ; |
290 | 269 | ||
291 | bytestring: | 270 | bytestring: |
@@ -308,57 +287,44 @@ subnodes: | |||
308 | { | 287 | { |
309 | $$ = NULL; | 288 | $$ = NULL; |
310 | } | 289 | } |
311 | | subnode subnodes | 290 | | subnode subnodes |
312 | { | 291 | { |
313 | $$ = chain_node($1, $2); | 292 | $$ = chain_node($1, $2); |
314 | } | 293 | } |
315 | | subnode propdef | 294 | | subnode propdef |
316 | { | 295 | { |
317 | yyerror("syntax error: properties must precede subnodes"); | 296 | print_error("syntax error: properties must precede subnodes"); |
318 | YYERROR; | 297 | YYERROR; |
319 | } | 298 | } |
320 | ; | 299 | ; |
321 | 300 | ||
322 | subnode: | 301 | subnode: |
323 | label DT_PROPNODENAME nodedef | 302 | DT_PROPNODENAME nodedef |
324 | { | 303 | { |
325 | $$ = name_node($3, $2, $1); | 304 | $$ = name_node($2, $1); |
326 | } | 305 | } |
327 | ; | 306 | | DT_LABEL subnode |
328 | |||
329 | label: | ||
330 | /* empty */ | ||
331 | { | 307 | { |
332 | $$ = NULL; | 308 | add_label(&$2->labels, $1); |
333 | } | 309 | $$ = $2; |
334 | | DT_LABEL | ||
335 | { | ||
336 | $$ = $1; | ||
337 | } | 310 | } |
338 | ; | 311 | ; |
339 | 312 | ||
340 | %% | 313 | %% |
341 | 314 | ||
342 | void yyerrorf(char const *s, ...) | 315 | void print_error(char const *fmt, ...) |
343 | { | 316 | { |
344 | const char *fname = srcpos_file ? srcpos_file->name : "<no-file>"; | ||
345 | va_list va; | 317 | va_list va; |
346 | va_start(va, s); | ||
347 | |||
348 | if (strcmp(fname, "-") == 0) | ||
349 | fname = "stdin"; | ||
350 | 318 | ||
351 | fprintf(stderr, "%s:%d ", fname, yylloc.first_line); | 319 | va_start(va, fmt); |
352 | vfprintf(stderr, s, va); | 320 | srcpos_verror(&yylloc, fmt, va); |
353 | fprintf(stderr, "\n"); | 321 | va_end(va); |
354 | 322 | ||
355 | treesource_error = 1; | 323 | treesource_error = 1; |
356 | va_end(va); | ||
357 | } | 324 | } |
358 | 325 | ||
359 | void yyerror (char const *s) | 326 | void yyerror(char const *s) { |
360 | { | 327 | print_error("%s", s); |
361 | yyerrorf("%s", s); | ||
362 | } | 328 | } |
363 | 329 | ||
364 | static unsigned long long eval_literal(const char *s, int base, int bits) | 330 | static unsigned long long eval_literal(const char *s, int base, int bits) |
@@ -369,11 +335,11 @@ static unsigned long long eval_literal(const char *s, int base, int bits) | |||
369 | errno = 0; | 335 | errno = 0; |
370 | val = strtoull(s, &e, base); | 336 | val = strtoull(s, &e, base); |
371 | if (*e) | 337 | if (*e) |
372 | yyerror("bad characters in literal"); | 338 | print_error("bad characters in literal"); |
373 | else if ((errno == ERANGE) | 339 | else if ((errno == ERANGE) |
374 | || ((bits < 64) && (val >= (1ULL << bits)))) | 340 | || ((bits < 64) && (val >= (1ULL << bits)))) |
375 | yyerror("literal out of range"); | 341 | print_error("literal out of range"); |
376 | else if (errno != 0) | 342 | else if (errno != 0) |
377 | yyerror("bad literal"); | 343 | print_error("bad literal"); |
378 | return val; | 344 | return val; |
379 | } | 345 | } |
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index d8fd43b4ac1a..cbc0193098e4 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
@@ -30,30 +30,7 @@ int quiet; /* Level of quietness */ | |||
30 | int reservenum; /* Number of memory reservation slots */ | 30 | int reservenum; /* Number of memory reservation slots */ |
31 | int minsize; /* Minimum blob size */ | 31 | int minsize; /* Minimum blob size */ |
32 | int padsize; /* Additional padding to blob */ | 32 | int padsize; /* Additional padding to blob */ |
33 | 33 | int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ | |
34 | char *join_path(const char *path, const char *name) | ||
35 | { | ||
36 | int lenp = strlen(path); | ||
37 | int lenn = strlen(name); | ||
38 | int len; | ||
39 | int needslash = 1; | ||
40 | char *str; | ||
41 | |||
42 | len = lenp + lenn + 2; | ||
43 | if ((lenp > 0) && (path[lenp-1] == '/')) { | ||
44 | needslash = 0; | ||
45 | len--; | ||
46 | } | ||
47 | |||
48 | str = xmalloc(len); | ||
49 | memcpy(str, path, lenp); | ||
50 | if (needslash) { | ||
51 | str[lenp] = '/'; | ||
52 | lenp++; | ||
53 | } | ||
54 | memcpy(str+lenp, name, lenn+1); | ||
55 | return str; | ||
56 | } | ||
57 | 34 | ||
58 | static void fill_fullpaths(struct node *tree, const char *prefix) | 35 | static void fill_fullpaths(struct node *tree, const char *prefix) |
59 | { | 36 | { |
@@ -104,8 +81,15 @@ static void __attribute__ ((noreturn)) usage(void) | |||
104 | fprintf(stderr, "\t\tSet the physical boot cpu\n"); | 81 | fprintf(stderr, "\t\tSet the physical boot cpu\n"); |
105 | fprintf(stderr, "\t-f\n"); | 82 | fprintf(stderr, "\t-f\n"); |
106 | fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); | 83 | fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); |
84 | fprintf(stderr, "\t-s\n"); | ||
85 | fprintf(stderr, "\t\tSort nodes and properties before outputting (only useful for\n\t\tcomparing trees)\n"); | ||
107 | fprintf(stderr, "\t-v\n"); | 86 | fprintf(stderr, "\t-v\n"); |
108 | fprintf(stderr, "\t\tPrint DTC version and exit\n"); | 87 | fprintf(stderr, "\t\tPrint DTC version and exit\n"); |
88 | fprintf(stderr, "\t-H <phandle format>\n"); | ||
89 | fprintf(stderr, "\t\tphandle formats are:\n"); | ||
90 | fprintf(stderr, "\t\t\tlegacy - \"linux,phandle\" properties only\n"); | ||
91 | fprintf(stderr, "\t\t\tepapr - \"phandle\" properties only\n"); | ||
92 | fprintf(stderr, "\t\t\tboth - Both \"linux,phandle\" and \"phandle\" properties\n"); | ||
109 | exit(3); | 93 | exit(3); |
110 | } | 94 | } |
111 | 95 | ||
@@ -115,7 +99,7 @@ int main(int argc, char *argv[]) | |||
115 | const char *inform = "dts"; | 99 | const char *inform = "dts"; |
116 | const char *outform = "dts"; | 100 | const char *outform = "dts"; |
117 | const char *outname = "-"; | 101 | const char *outname = "-"; |
118 | int force = 0, check = 0; | 102 | int force = 0, check = 0, sort = 0; |
119 | const char *arg; | 103 | const char *arg; |
120 | int opt; | 104 | int opt; |
121 | FILE *outf = NULL; | 105 | FILE *outf = NULL; |
@@ -127,7 +111,7 @@ int main(int argc, char *argv[]) | |||
127 | minsize = 0; | 111 | minsize = 0; |
128 | padsize = 0; | 112 | padsize = 0; |
129 | 113 | ||
130 | while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:v")) != EOF) { | 114 | while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) { |
131 | switch (opt) { | 115 | switch (opt) { |
132 | case 'I': | 116 | case 'I': |
133 | inform = optarg; | 117 | inform = optarg; |
@@ -165,6 +149,22 @@ int main(int argc, char *argv[]) | |||
165 | case 'v': | 149 | case 'v': |
166 | printf("Version: %s\n", DTC_VERSION); | 150 | printf("Version: %s\n", DTC_VERSION); |
167 | exit(0); | 151 | exit(0); |
152 | case 'H': | ||
153 | if (streq(optarg, "legacy")) | ||
154 | phandle_format = PHANDLE_LEGACY; | ||
155 | else if (streq(optarg, "epapr")) | ||
156 | phandle_format = PHANDLE_EPAPR; | ||
157 | else if (streq(optarg, "both")) | ||
158 | phandle_format = PHANDLE_BOTH; | ||
159 | else | ||
160 | die("Invalid argument \"%s\" to -H option\n", | ||
161 | optarg); | ||
162 | break; | ||
163 | |||
164 | case 's': | ||
165 | sort = 1; | ||
166 | break; | ||
167 | |||
168 | case 'h': | 168 | case 'h': |
169 | default: | 169 | default: |
170 | usage(); | 170 | usage(); |
@@ -182,6 +182,9 @@ int main(int argc, char *argv[]) | |||
182 | if (minsize && padsize) | 182 | if (minsize && padsize) |
183 | die("Can't set both -p and -S\n"); | 183 | die("Can't set both -p and -S\n"); |
184 | 184 | ||
185 | if (minsize) | ||
186 | fprintf(stderr, "DTC: Use of \"-S\" is deprecated; it will be removed soon, use \"-p\" instead\n"); | ||
187 | |||
185 | fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", | 188 | fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", |
186 | inform, outform, arg); | 189 | inform, outform, arg); |
187 | 190 | ||
@@ -200,6 +203,8 @@ int main(int argc, char *argv[]) | |||
200 | fill_fullpaths(bi->dt, ""); | 203 | fill_fullpaths(bi->dt, ""); |
201 | process_checks(force, bi); | 204 | process_checks(force, bi); |
202 | 205 | ||
206 | if (sort) | ||
207 | sort_tree(bi); | ||
203 | 208 | ||
204 | if (streq(outname, "-")) { | 209 | if (streq(outname, "-")) { |
205 | outf = stdout; | 210 | outf = stdout; |
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 08d54c870086..f37c97eb3dfc 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h | |||
@@ -34,7 +34,17 @@ | |||
34 | #include <libfdt_env.h> | 34 | #include <libfdt_env.h> |
35 | #include <fdt.h> | 35 | #include <fdt.h> |
36 | 36 | ||
37 | #include "util.h" | ||
38 | |||
39 | #ifdef DEBUG | ||
40 | #define debug(fmt,args...) printf(fmt, ##args) | ||
41 | #else | ||
42 | #define debug(fmt,args...) | ||
43 | #endif | ||
44 | |||
45 | |||
37 | #define DEFAULT_FDT_VERSION 17 | 46 | #define DEFAULT_FDT_VERSION 17 |
47 | |||
38 | /* | 48 | /* |
39 | * Command line options | 49 | * Command line options |
40 | */ | 50 | */ |
@@ -42,36 +52,11 @@ extern int quiet; /* Level of quietness */ | |||
42 | extern int reservenum; /* Number of memory reservation slots */ | 52 | extern int reservenum; /* Number of memory reservation slots */ |
43 | extern int minsize; /* Minimum blob size */ | 53 | extern int minsize; /* Minimum blob size */ |
44 | extern int padsize; /* Additional padding to blob */ | 54 | extern int padsize; /* Additional padding to blob */ |
55 | extern int phandle_format; /* Use linux,phandle or phandle properties */ | ||
45 | 56 | ||
46 | static inline void __attribute__((noreturn)) die(char * str, ...) | 57 | #define PHANDLE_LEGACY 0x1 |
47 | { | 58 | #define PHANDLE_EPAPR 0x2 |
48 | va_list ap; | 59 | #define PHANDLE_BOTH 0x3 |
49 | |||
50 | va_start(ap, str); | ||
51 | fprintf(stderr, "FATAL ERROR: "); | ||
52 | vfprintf(stderr, str, ap); | ||
53 | exit(1); | ||
54 | } | ||
55 | |||
56 | static inline void *xmalloc(size_t len) | ||
57 | { | ||
58 | void *new = malloc(len); | ||
59 | |||
60 | if (! new) | ||
61 | die("malloc() failed\n"); | ||
62 | |||
63 | return new; | ||
64 | } | ||
65 | |||
66 | static inline void *xrealloc(void *p, size_t len) | ||
67 | { | ||
68 | void *new = realloc(p, len); | ||
69 | |||
70 | if (! new) | ||
71 | die("realloc() failed (len=%d)\n", len); | ||
72 | |||
73 | return new; | ||
74 | } | ||
75 | 60 | ||
76 | typedef uint32_t cell_t; | 61 | typedef uint32_t cell_t; |
77 | 62 | ||
@@ -140,13 +125,18 @@ int data_is_one_string(struct data d); | |||
140 | #define MAX_NODENAME_LEN 31 | 125 | #define MAX_NODENAME_LEN 31 |
141 | 126 | ||
142 | /* Live trees */ | 127 | /* Live trees */ |
128 | struct label { | ||
129 | char *label; | ||
130 | struct label *next; | ||
131 | }; | ||
132 | |||
143 | struct property { | 133 | struct property { |
144 | char *name; | 134 | char *name; |
145 | struct data val; | 135 | struct data val; |
146 | 136 | ||
147 | struct property *next; | 137 | struct property *next; |
148 | 138 | ||
149 | char *label; | 139 | struct label *labels; |
150 | }; | 140 | }; |
151 | 141 | ||
152 | struct node { | 142 | struct node { |
@@ -163,22 +153,28 @@ struct node { | |||
163 | cell_t phandle; | 153 | cell_t phandle; |
164 | int addr_cells, size_cells; | 154 | int addr_cells, size_cells; |
165 | 155 | ||
166 | char *label; | 156 | struct label *labels; |
167 | }; | 157 | }; |
168 | 158 | ||
159 | #define for_each_label(l0, l) \ | ||
160 | for ((l) = (l0); (l); (l) = (l)->next) | ||
161 | |||
169 | #define for_each_property(n, p) \ | 162 | #define for_each_property(n, p) \ |
170 | for ((p) = (n)->proplist; (p); (p) = (p)->next) | 163 | for ((p) = (n)->proplist; (p); (p) = (p)->next) |
171 | 164 | ||
172 | #define for_each_child(n, c) \ | 165 | #define for_each_child(n, c) \ |
173 | for ((c) = (n)->children; (c); (c) = (c)->next_sibling) | 166 | for ((c) = (n)->children; (c); (c) = (c)->next_sibling) |
174 | 167 | ||
175 | struct property *build_property(char *name, struct data val, char *label); | 168 | void add_label(struct label **labels, char *label); |
169 | |||
170 | struct property *build_property(char *name, struct data val); | ||
176 | struct property *chain_property(struct property *first, struct property *list); | 171 | struct property *chain_property(struct property *first, struct property *list); |
177 | struct property *reverse_properties(struct property *first); | 172 | struct property *reverse_properties(struct property *first); |
178 | 173 | ||
179 | struct node *build_node(struct property *proplist, struct node *children); | 174 | struct node *build_node(struct property *proplist, struct node *children); |
180 | struct node *name_node(struct node *node, char *name, char *label); | 175 | struct node *name_node(struct node *node, char *name); |
181 | struct node *chain_node(struct node *first, struct node *list); | 176 | struct node *chain_node(struct node *first, struct node *list); |
177 | struct node *merge_nodes(struct node *old_node, struct node *new_node); | ||
182 | 178 | ||
183 | void add_property(struct node *node, struct property *prop); | 179 | void add_property(struct node *node, struct property *prop); |
184 | void add_child(struct node *parent, struct node *child); | 180 | void add_child(struct node *parent, struct node *child); |
@@ -186,6 +182,10 @@ void add_child(struct node *parent, struct node *child); | |||
186 | const char *get_unitname(struct node *node); | 182 | const char *get_unitname(struct node *node); |
187 | struct property *get_property(struct node *node, const char *propname); | 183 | struct property *get_property(struct node *node, const char *propname); |
188 | cell_t propval_cell(struct property *prop); | 184 | cell_t propval_cell(struct property *prop); |
185 | struct property *get_property_by_label(struct node *tree, const char *label, | ||
186 | struct node **node); | ||
187 | struct marker *get_marker_label(struct node *tree, const char *label, | ||
188 | struct node **node, struct property **prop); | ||
189 | struct node *get_subnode(struct node *node, const char *nodename); | 189 | struct node *get_subnode(struct node *node, const char *nodename); |
190 | struct node *get_node_by_path(struct node *tree, const char *path); | 190 | struct node *get_node_by_path(struct node *tree, const char *path); |
191 | struct node *get_node_by_label(struct node *tree, const char *label); | 191 | struct node *get_node_by_label(struct node *tree, const char *label); |
@@ -193,6 +193,8 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle); | |||
193 | struct node *get_node_by_ref(struct node *tree, const char *ref); | 193 | struct node *get_node_by_ref(struct node *tree, const char *ref); |
194 | cell_t get_node_phandle(struct node *root, struct node *node); | 194 | cell_t get_node_phandle(struct node *root, struct node *node); |
195 | 195 | ||
196 | uint32_t guess_boot_cpuid(struct node *tree); | ||
197 | |||
196 | /* Boot info (tree plus memreserve information */ | 198 | /* Boot info (tree plus memreserve information */ |
197 | 199 | ||
198 | struct reserve_info { | 200 | struct reserve_info { |
@@ -200,10 +202,10 @@ struct reserve_info { | |||
200 | 202 | ||
201 | struct reserve_info *next; | 203 | struct reserve_info *next; |
202 | 204 | ||
203 | char *label; | 205 | struct label *labels; |
204 | }; | 206 | }; |
205 | 207 | ||
206 | struct reserve_info *build_reserve_entry(uint64_t start, uint64_t len, char *label); | 208 | struct reserve_info *build_reserve_entry(uint64_t start, uint64_t len); |
207 | struct reserve_info *chain_reserve_entry(struct reserve_info *first, | 209 | struct reserve_info *chain_reserve_entry(struct reserve_info *first, |
208 | struct reserve_info *list); | 210 | struct reserve_info *list); |
209 | struct reserve_info *add_reserve_entry(struct reserve_info *list, | 211 | struct reserve_info *add_reserve_entry(struct reserve_info *list, |
@@ -218,6 +220,7 @@ struct boot_info { | |||
218 | 220 | ||
219 | struct boot_info *build_boot_info(struct reserve_info *reservelist, | 221 | struct boot_info *build_boot_info(struct reserve_info *reservelist, |
220 | struct node *tree, uint32_t boot_cpuid_phys); | 222 | struct node *tree, uint32_t boot_cpuid_phys); |
223 | void sort_tree(struct boot_info *bi); | ||
221 | 224 | ||
222 | /* Checks */ | 225 | /* Checks */ |
223 | 226 | ||
@@ -239,8 +242,4 @@ struct boot_info *dt_from_source(const char *f); | |||
239 | 242 | ||
240 | struct boot_info *dt_from_fs(const char *dirname); | 243 | struct boot_info *dt_from_fs(const char *dirname); |
241 | 244 | ||
242 | /* misc */ | ||
243 | |||
244 | char *join_path(const char *path, const char *name); | ||
245 | |||
246 | #endif /* _DTC_H */ | 245 | #endif /* _DTC_H */ |
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index 76acd28c068d..ead0332c87e1 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
@@ -52,9 +52,9 @@ struct emitter { | |||
52 | void (*string)(void *, char *, int); | 52 | void (*string)(void *, char *, int); |
53 | void (*align)(void *, int); | 53 | void (*align)(void *, int); |
54 | void (*data)(void *, struct data); | 54 | void (*data)(void *, struct data); |
55 | void (*beginnode)(void *, const char *); | 55 | void (*beginnode)(void *, struct label *labels); |
56 | void (*endnode)(void *, const char *); | 56 | void (*endnode)(void *, struct label *labels); |
57 | void (*property)(void *, const char *); | 57 | void (*property)(void *, struct label *labels); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static void bin_emit_cell(void *e, cell_t val) | 60 | static void bin_emit_cell(void *e, cell_t val) |
@@ -89,17 +89,17 @@ static void bin_emit_data(void *e, struct data d) | |||
89 | *dtbuf = data_append_data(*dtbuf, d.val, d.len); | 89 | *dtbuf = data_append_data(*dtbuf, d.val, d.len); |
90 | } | 90 | } |
91 | 91 | ||
92 | static void bin_emit_beginnode(void *e, const char *label) | 92 | static void bin_emit_beginnode(void *e, struct label *labels) |
93 | { | 93 | { |
94 | bin_emit_cell(e, FDT_BEGIN_NODE); | 94 | bin_emit_cell(e, FDT_BEGIN_NODE); |
95 | } | 95 | } |
96 | 96 | ||
97 | static void bin_emit_endnode(void *e, const char *label) | 97 | static void bin_emit_endnode(void *e, struct label *labels) |
98 | { | 98 | { |
99 | bin_emit_cell(e, FDT_END_NODE); | 99 | bin_emit_cell(e, FDT_END_NODE); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void bin_emit_property(void *e, const char *label) | 102 | static void bin_emit_property(void *e, struct label *labels) |
103 | { | 103 | { |
104 | bin_emit_cell(e, FDT_PROP); | 104 | bin_emit_cell(e, FDT_PROP); |
105 | } | 105 | } |
@@ -127,11 +127,21 @@ static void emit_offset_label(FILE *f, const char *label, int offset) | |||
127 | fprintf(f, "%s\t= . + %d\n", label, offset); | 127 | fprintf(f, "%s\t= . + %d\n", label, offset); |
128 | } | 128 | } |
129 | 129 | ||
130 | #define ASM_EMIT_BELONG(f, fmt, ...) \ | ||
131 | { \ | ||
132 | fprintf((f), "\t.byte\t((" fmt ") >> 24) & 0xff\n", __VA_ARGS__); \ | ||
133 | fprintf((f), "\t.byte\t((" fmt ") >> 16) & 0xff\n", __VA_ARGS__); \ | ||
134 | fprintf((f), "\t.byte\t((" fmt ") >> 8) & 0xff\n", __VA_ARGS__); \ | ||
135 | fprintf((f), "\t.byte\t(" fmt ") & 0xff\n", __VA_ARGS__); \ | ||
136 | } | ||
137 | |||
130 | static void asm_emit_cell(void *e, cell_t val) | 138 | static void asm_emit_cell(void *e, cell_t val) |
131 | { | 139 | { |
132 | FILE *f = e; | 140 | FILE *f = e; |
133 | 141 | ||
134 | fprintf(f, "\t.long\t0x%x\n", val); | 142 | fprintf(f, "\t.byte 0x%02x; .byte 0x%02x; .byte 0x%02x; .byte 0x%02x\n", |
143 | (val >> 24) & 0xff, (val >> 16) & 0xff, | ||
144 | (val >> 8) & 0xff, val & 0xff); | ||
135 | } | 145 | } |
136 | 146 | ||
137 | static void asm_emit_string(void *e, char *str, int len) | 147 | static void asm_emit_string(void *e, char *str, int len) |
@@ -156,7 +166,7 @@ static void asm_emit_align(void *e, int a) | |||
156 | { | 166 | { |
157 | FILE *f = e; | 167 | FILE *f = e; |
158 | 168 | ||
159 | fprintf(f, "\t.balign\t%d\n", a); | 169 | fprintf(f, "\t.balign\t%d, 0\n", a); |
160 | } | 170 | } |
161 | 171 | ||
162 | static void asm_emit_data(void *e, struct data d) | 172 | static void asm_emit_data(void *e, struct data d) |
@@ -169,8 +179,7 @@ static void asm_emit_data(void *e, struct data d) | |||
169 | emit_offset_label(f, m->ref, m->offset); | 179 | emit_offset_label(f, m->ref, m->offset); |
170 | 180 | ||
171 | while ((d.len - off) >= sizeof(uint32_t)) { | 181 | while ((d.len - off) >= sizeof(uint32_t)) { |
172 | fprintf(f, "\t.long\t0x%x\n", | 182 | asm_emit_cell(e, fdt32_to_cpu(*((uint32_t *)(d.val+off)))); |
173 | fdt32_to_cpu(*((uint32_t *)(d.val+off)))); | ||
174 | off += sizeof(uint32_t); | 183 | off += sizeof(uint32_t); |
175 | } | 184 | } |
176 | 185 | ||
@@ -182,37 +191,43 @@ static void asm_emit_data(void *e, struct data d) | |||
182 | assert(off == d.len); | 191 | assert(off == d.len); |
183 | } | 192 | } |
184 | 193 | ||
185 | static void asm_emit_beginnode(void *e, const char *label) | 194 | static void asm_emit_beginnode(void *e, struct label *labels) |
186 | { | 195 | { |
187 | FILE *f = e; | 196 | FILE *f = e; |
197 | struct label *l; | ||
188 | 198 | ||
189 | if (label) { | 199 | for_each_label(labels, l) { |
190 | fprintf(f, "\t.globl\t%s\n", label); | 200 | fprintf(f, "\t.globl\t%s\n", l->label); |
191 | fprintf(f, "%s:\n", label); | 201 | fprintf(f, "%s:\n", l->label); |
192 | } | 202 | } |
193 | fprintf(f, "\t.long\tFDT_BEGIN_NODE\n"); | 203 | fprintf(f, "\t/* FDT_BEGIN_NODE */\n"); |
204 | asm_emit_cell(e, FDT_BEGIN_NODE); | ||
194 | } | 205 | } |
195 | 206 | ||
196 | static void asm_emit_endnode(void *e, const char *label) | 207 | static void asm_emit_endnode(void *e, struct label *labels) |
197 | { | 208 | { |
198 | FILE *f = e; | 209 | FILE *f = e; |
210 | struct label *l; | ||
199 | 211 | ||
200 | fprintf(f, "\t.long\tFDT_END_NODE\n"); | 212 | fprintf(f, "\t/* FDT_END_NODE */\n"); |
201 | if (label) { | 213 | asm_emit_cell(e, FDT_END_NODE); |
202 | fprintf(f, "\t.globl\t%s_end\n", label); | 214 | for_each_label(labels, l) { |
203 | fprintf(f, "%s_end:\n", label); | 215 | fprintf(f, "\t.globl\t%s_end\n", l->label); |
216 | fprintf(f, "%s_end:\n", l->label); | ||
204 | } | 217 | } |
205 | } | 218 | } |
206 | 219 | ||
207 | static void asm_emit_property(void *e, const char *label) | 220 | static void asm_emit_property(void *e, struct label *labels) |
208 | { | 221 | { |
209 | FILE *f = e; | 222 | FILE *f = e; |
223 | struct label *l; | ||
210 | 224 | ||
211 | if (label) { | 225 | for_each_label(labels, l) { |
212 | fprintf(f, "\t.globl\t%s\n", label); | 226 | fprintf(f, "\t.globl\t%s\n", l->label); |
213 | fprintf(f, "%s:\n", label); | 227 | fprintf(f, "%s:\n", l->label); |
214 | } | 228 | } |
215 | fprintf(f, "\t.long\tFDT_PROP\n"); | 229 | fprintf(f, "\t/* FDT_PROP */\n"); |
230 | asm_emit_cell(e, FDT_PROP); | ||
216 | } | 231 | } |
217 | 232 | ||
218 | static struct emitter asm_emitter = { | 233 | static struct emitter asm_emitter = { |
@@ -248,7 +263,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
248 | struct node *child; | 263 | struct node *child; |
249 | int seen_name_prop = 0; | 264 | int seen_name_prop = 0; |
250 | 265 | ||
251 | emit->beginnode(etarget, tree->label); | 266 | emit->beginnode(etarget, tree->labels); |
252 | 267 | ||
253 | if (vi->flags & FTF_FULLPATH) | 268 | if (vi->flags & FTF_FULLPATH) |
254 | emit->string(etarget, tree->fullpath, 0); | 269 | emit->string(etarget, tree->fullpath, 0); |
@@ -265,7 +280,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
265 | 280 | ||
266 | nameoff = stringtable_insert(strbuf, prop->name); | 281 | nameoff = stringtable_insert(strbuf, prop->name); |
267 | 282 | ||
268 | emit->property(etarget, prop->label); | 283 | emit->property(etarget, prop->labels); |
269 | emit->cell(etarget, prop->val.len); | 284 | emit->cell(etarget, prop->val.len); |
270 | emit->cell(etarget, nameoff); | 285 | emit->cell(etarget, nameoff); |
271 | 286 | ||
@@ -292,7 +307,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
292 | flatten_tree(child, emit, etarget, strbuf, vi); | 307 | flatten_tree(child, emit, etarget, strbuf, vi); |
293 | } | 308 | } |
294 | 309 | ||
295 | emit->endnode(etarget, tree->label); | 310 | emit->endnode(etarget, tree->labels); |
296 | } | 311 | } |
297 | 312 | ||
298 | static struct data flatten_reserve_list(struct reserve_info *reservelist, | 313 | static struct data flatten_reserve_list(struct reserve_info *reservelist, |
@@ -413,10 +428,13 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) | |||
413 | if (padlen > 0) | 428 | if (padlen > 0) |
414 | blob = data_append_zeroes(blob, padlen); | 429 | blob = data_append_zeroes(blob, padlen); |
415 | 430 | ||
416 | fwrite(blob.val, blob.len, 1, f); | 431 | if (fwrite(blob.val, blob.len, 1, f) != 1) { |
417 | 432 | if (ferror(f)) | |
418 | if (ferror(f)) | 433 | die("Error writing device tree blob: %s\n", |
419 | die("Error writing device tree blob: %s\n", strerror(errno)); | 434 | strerror(errno)); |
435 | else | ||
436 | die("Short write on device tree blob\n"); | ||
437 | } | ||
420 | 438 | ||
421 | /* | 439 | /* |
422 | * data_merge() frees the right-hand element so only the blob | 440 | * data_merge() frees the right-hand element so only the blob |
@@ -455,39 +473,44 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) | |||
455 | die("Unknown device tree blob version %d\n", version); | 473 | die("Unknown device tree blob version %d\n", version); |
456 | 474 | ||
457 | fprintf(f, "/* autogenerated by dtc, do not edit */\n\n"); | 475 | fprintf(f, "/* autogenerated by dtc, do not edit */\n\n"); |
458 | fprintf(f, "#define FDT_MAGIC 0x%x\n", FDT_MAGIC); | ||
459 | fprintf(f, "#define FDT_BEGIN_NODE 0x%x\n", FDT_BEGIN_NODE); | ||
460 | fprintf(f, "#define FDT_END_NODE 0x%x\n", FDT_END_NODE); | ||
461 | fprintf(f, "#define FDT_PROP 0x%x\n", FDT_PROP); | ||
462 | fprintf(f, "#define FDT_END 0x%x\n", FDT_END); | ||
463 | fprintf(f, "\n"); | ||
464 | 476 | ||
465 | emit_label(f, symprefix, "blob_start"); | 477 | emit_label(f, symprefix, "blob_start"); |
466 | emit_label(f, symprefix, "header"); | 478 | emit_label(f, symprefix, "header"); |
467 | fprintf(f, "\t.long\tFDT_MAGIC\t\t\t\t/* magic */\n"); | 479 | fprintf(f, "\t/* magic */\n"); |
468 | fprintf(f, "\t.long\t_%s_blob_abs_end - _%s_blob_start\t/* totalsize */\n", | 480 | asm_emit_cell(f, FDT_MAGIC); |
469 | symprefix, symprefix); | 481 | fprintf(f, "\t/* totalsize */\n"); |
470 | fprintf(f, "\t.long\t_%s_struct_start - _%s_blob_start\t/* off_dt_struct */\n", | 482 | ASM_EMIT_BELONG(f, "_%s_blob_abs_end - _%s_blob_start", |
483 | symprefix, symprefix); | ||
484 | fprintf(f, "\t/* off_dt_struct */\n"); | ||
485 | ASM_EMIT_BELONG(f, "_%s_struct_start - _%s_blob_start", | ||
471 | symprefix, symprefix); | 486 | symprefix, symprefix); |
472 | fprintf(f, "\t.long\t_%s_strings_start - _%s_blob_start\t/* off_dt_strings */\n", | 487 | fprintf(f, "\t/* off_dt_strings */\n"); |
488 | ASM_EMIT_BELONG(f, "_%s_strings_start - _%s_blob_start", | ||
473 | symprefix, symprefix); | 489 | symprefix, symprefix); |
474 | fprintf(f, "\t.long\t_%s_reserve_map - _%s_blob_start\t/* off_dt_strings */\n", | 490 | fprintf(f, "\t/* off_mem_rsvmap */\n"); |
491 | ASM_EMIT_BELONG(f, "_%s_reserve_map - _%s_blob_start", | ||
475 | symprefix, symprefix); | 492 | symprefix, symprefix); |
476 | fprintf(f, "\t.long\t%d\t\t\t\t\t/* version */\n", vi->version); | 493 | fprintf(f, "\t/* version */\n"); |
477 | fprintf(f, "\t.long\t%d\t\t\t\t\t/* last_comp_version */\n", | 494 | asm_emit_cell(f, vi->version); |
478 | vi->last_comp_version); | 495 | fprintf(f, "\t/* last_comp_version */\n"); |
479 | 496 | asm_emit_cell(f, vi->last_comp_version); | |
480 | if (vi->flags & FTF_BOOTCPUID) | 497 | |
481 | fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n", | 498 | if (vi->flags & FTF_BOOTCPUID) { |
482 | bi->boot_cpuid_phys); | 499 | fprintf(f, "\t/* boot_cpuid_phys */\n"); |
500 | asm_emit_cell(f, bi->boot_cpuid_phys); | ||
501 | } | ||
483 | 502 | ||
484 | if (vi->flags & FTF_STRTABSIZE) | 503 | if (vi->flags & FTF_STRTABSIZE) { |
485 | fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n", | 504 | fprintf(f, "\t/* size_dt_strings */\n"); |
486 | symprefix, symprefix); | 505 | ASM_EMIT_BELONG(f, "_%s_strings_end - _%s_strings_start", |
506 | symprefix, symprefix); | ||
507 | } | ||
487 | 508 | ||
488 | if (vi->flags & FTF_STRUCTSIZE) | 509 | if (vi->flags & FTF_STRUCTSIZE) { |
489 | fprintf(f, "\t.long\t_%s_struct_end - _%s_struct_start\t/* size_dt_struct */\n", | 510 | fprintf(f, "\t/* size_dt_struct */\n"); |
511 | ASM_EMIT_BELONG(f, "_%s_struct_end - _%s_struct_start", | ||
490 | symprefix, symprefix); | 512 | symprefix, symprefix); |
513 | } | ||
491 | 514 | ||
492 | /* | 515 | /* |
493 | * Reserve map entries. | 516 | * Reserve map entries. |
@@ -505,16 +528,17 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) | |||
505 | * as it appears .quad isn't available in some assemblers. | 528 | * as it appears .quad isn't available in some assemblers. |
506 | */ | 529 | */ |
507 | for (re = bi->reservelist; re; re = re->next) { | 530 | for (re = bi->reservelist; re; re = re->next) { |
508 | if (re->label) { | 531 | struct label *l; |
509 | fprintf(f, "\t.globl\t%s\n", re->label); | 532 | |
510 | fprintf(f, "%s:\n", re->label); | 533 | for_each_label(re->labels, l) { |
534 | fprintf(f, "\t.globl\t%s\n", l->label); | ||
535 | fprintf(f, "%s:\n", l->label); | ||
511 | } | 536 | } |
512 | fprintf(f, "\t.long\t0x%08x, 0x%08x\n", | 537 | ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.address >> 32)); |
513 | (unsigned int)(re->re.address >> 32), | 538 | ASM_EMIT_BELONG(f, "0x%08x", |
514 | (unsigned int)(re->re.address & 0xffffffff)); | 539 | (unsigned int)(re->re.address & 0xffffffff)); |
515 | fprintf(f, "\t.long\t0x%08x, 0x%08x\n", | 540 | ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size >> 32)); |
516 | (unsigned int)(re->re.size >> 32), | 541 | ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size & 0xffffffff)); |
517 | (unsigned int)(re->re.size & 0xffffffff)); | ||
518 | } | 542 | } |
519 | for (i = 0; i < reservenum; i++) { | 543 | for (i = 0; i < reservenum; i++) { |
520 | fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); | 544 | fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); |
@@ -524,7 +548,9 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) | |||
524 | 548 | ||
525 | emit_label(f, symprefix, "struct_start"); | 549 | emit_label(f, symprefix, "struct_start"); |
526 | flatten_tree(bi->dt, &asm_emitter, f, &strbuf, vi); | 550 | flatten_tree(bi->dt, &asm_emitter, f, &strbuf, vi); |
527 | fprintf(f, "\t.long\tFDT_END\n"); | 551 | |
552 | fprintf(f, "\t/* FDT_END */\n"); | ||
553 | asm_emit_cell(f, FDT_END); | ||
528 | emit_label(f, symprefix, "struct_end"); | 554 | emit_label(f, symprefix, "struct_end"); |
529 | 555 | ||
530 | emit_label(f, symprefix, "strings_start"); | 556 | emit_label(f, symprefix, "strings_start"); |
@@ -601,7 +627,7 @@ static char *flat_read_string(struct inbuf *inb) | |||
601 | len++; | 627 | len++; |
602 | } while ((*p++) != '\0'); | 628 | } while ((*p++) != '\0'); |
603 | 629 | ||
604 | str = strdup(inb->ptr); | 630 | str = xstrdup(inb->ptr); |
605 | 631 | ||
606 | inb->ptr += len; | 632 | inb->ptr += len; |
607 | 633 | ||
@@ -643,7 +669,7 @@ static char *flat_read_stringtable(struct inbuf *inb, int offset) | |||
643 | p++; | 669 | p++; |
644 | } | 670 | } |
645 | 671 | ||
646 | return strdup(inb->base + offset); | 672 | return xstrdup(inb->base + offset); |
647 | } | 673 | } |
648 | 674 | ||
649 | static struct property *flat_read_property(struct inbuf *dtbuf, | 675 | static struct property *flat_read_property(struct inbuf *dtbuf, |
@@ -663,7 +689,7 @@ static struct property *flat_read_property(struct inbuf *dtbuf, | |||
663 | 689 | ||
664 | val = flat_read_data(dtbuf, proplen); | 690 | val = flat_read_data(dtbuf, proplen); |
665 | 691 | ||
666 | return build_property(name, val, NULL); | 692 | return build_property(name, val); |
667 | } | 693 | } |
668 | 694 | ||
669 | 695 | ||
@@ -688,7 +714,7 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) | |||
688 | if (re.size == 0) | 714 | if (re.size == 0) |
689 | break; | 715 | break; |
690 | 716 | ||
691 | new = build_reserve_entry(re.address, re.size, NULL); | 717 | new = build_reserve_entry(re.address, re.size); |
692 | reservelist = add_reserve_entry(reservelist, new); | 718 | reservelist = add_reserve_entry(reservelist, new); |
693 | } | 719 | } |
694 | 720 | ||
@@ -710,7 +736,7 @@ static char *nodename_from_path(const char *ppath, const char *cpath) | |||
710 | if (!streq(ppath, "/")) | 736 | if (!streq(ppath, "/")) |
711 | plen++; | 737 | plen++; |
712 | 738 | ||
713 | return strdup(cpath + plen); | 739 | return xstrdup(cpath + plen); |
714 | } | 740 | } |
715 | 741 | ||
716 | static struct node *unflatten_tree(struct inbuf *dtbuf, | 742 | static struct node *unflatten_tree(struct inbuf *dtbuf, |
@@ -776,7 +802,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, | |||
776 | 802 | ||
777 | struct boot_info *dt_from_blob(const char *fname) | 803 | struct boot_info *dt_from_blob(const char *fname) |
778 | { | 804 | { |
779 | struct dtc_file *dtcf; | 805 | FILE *f; |
780 | uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys; | 806 | uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys; |
781 | uint32_t off_dt, off_str, off_mem_rsvmap; | 807 | uint32_t off_dt, off_str, off_mem_rsvmap; |
782 | int rc; | 808 | int rc; |
@@ -791,14 +817,14 @@ struct boot_info *dt_from_blob(const char *fname) | |||
791 | uint32_t val; | 817 | uint32_t val; |
792 | int flags = 0; | 818 | int flags = 0; |
793 | 819 | ||
794 | dtcf = dtc_open_file(fname, NULL); | 820 | f = srcfile_relative_open(fname, NULL); |
795 | 821 | ||
796 | rc = fread(&magic, sizeof(magic), 1, dtcf->file); | 822 | rc = fread(&magic, sizeof(magic), 1, f); |
797 | if (ferror(dtcf->file)) | 823 | if (ferror(f)) |
798 | die("Error reading DT blob magic number: %s\n", | 824 | die("Error reading DT blob magic number: %s\n", |
799 | strerror(errno)); | 825 | strerror(errno)); |
800 | if (rc < 1) { | 826 | if (rc < 1) { |
801 | if (feof(dtcf->file)) | 827 | if (feof(f)) |
802 | die("EOF reading DT blob magic number\n"); | 828 | die("EOF reading DT blob magic number\n"); |
803 | else | 829 | else |
804 | die("Mysterious short read reading magic number\n"); | 830 | die("Mysterious short read reading magic number\n"); |
@@ -808,11 +834,11 @@ struct boot_info *dt_from_blob(const char *fname) | |||
808 | if (magic != FDT_MAGIC) | 834 | if (magic != FDT_MAGIC) |
809 | die("Blob has incorrect magic number\n"); | 835 | die("Blob has incorrect magic number\n"); |
810 | 836 | ||
811 | rc = fread(&totalsize, sizeof(totalsize), 1, dtcf->file); | 837 | rc = fread(&totalsize, sizeof(totalsize), 1, f); |
812 | if (ferror(dtcf->file)) | 838 | if (ferror(f)) |
813 | die("Error reading DT blob size: %s\n", strerror(errno)); | 839 | die("Error reading DT blob size: %s\n", strerror(errno)); |
814 | if (rc < 1) { | 840 | if (rc < 1) { |
815 | if (feof(dtcf->file)) | 841 | if (feof(f)) |
816 | die("EOF reading DT blob size\n"); | 842 | die("EOF reading DT blob size\n"); |
817 | else | 843 | else |
818 | die("Mysterious short read reading blob size\n"); | 844 | die("Mysterious short read reading blob size\n"); |
@@ -832,12 +858,12 @@ struct boot_info *dt_from_blob(const char *fname) | |||
832 | p = blob + sizeof(magic) + sizeof(totalsize); | 858 | p = blob + sizeof(magic) + sizeof(totalsize); |
833 | 859 | ||
834 | while (sizeleft) { | 860 | while (sizeleft) { |
835 | if (feof(dtcf->file)) | 861 | if (feof(f)) |
836 | die("EOF before reading %d bytes of DT blob\n", | 862 | die("EOF before reading %d bytes of DT blob\n", |
837 | totalsize); | 863 | totalsize); |
838 | 864 | ||
839 | rc = fread(p, 1, sizeleft, dtcf->file); | 865 | rc = fread(p, 1, sizeleft, f); |
840 | if (ferror(dtcf->file)) | 866 | if (ferror(f)) |
841 | die("Error reading DT blob: %s\n", | 867 | die("Error reading DT blob: %s\n", |
842 | strerror(errno)); | 868 | strerror(errno)); |
843 | 869 | ||
@@ -900,7 +926,7 @@ struct boot_info *dt_from_blob(const char *fname) | |||
900 | 926 | ||
901 | free(blob); | 927 | free(blob); |
902 | 928 | ||
903 | dtc_close_file(dtcf); | 929 | fclose(f); |
904 | 930 | ||
905 | return build_boot_info(reservelist, tree, boot_cpuid_phys); | 931 | return build_boot_info(reservelist, tree, boot_cpuid_phys); |
906 | } | 932 | } |
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index 8fe1bdf239f0..f3774530170a 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c | |||
@@ -58,10 +58,9 @@ static struct node *read_fstree(const char *dirname) | |||
58 | "WARNING: Cannot open %s: %s\n", | 58 | "WARNING: Cannot open %s: %s\n", |
59 | tmpnam, strerror(errno)); | 59 | tmpnam, strerror(errno)); |
60 | } else { | 60 | } else { |
61 | prop = build_property(strdup(de->d_name), | 61 | prop = build_property(xstrdup(de->d_name), |
62 | data_copy_file(pfile, | 62 | data_copy_file(pfile, |
63 | st.st_size), | 63 | st.st_size)); |
64 | NULL); | ||
65 | add_property(tree, prop); | 64 | add_property(tree, prop); |
66 | fclose(pfile); | 65 | fclose(pfile); |
67 | } | 66 | } |
@@ -69,8 +68,7 @@ static struct node *read_fstree(const char *dirname) | |||
69 | struct node *newchild; | 68 | struct node *newchild; |
70 | 69 | ||
71 | newchild = read_fstree(tmpnam); | 70 | newchild = read_fstree(tmpnam); |
72 | newchild = name_node(newchild, strdup(de->d_name), | 71 | newchild = name_node(newchild, xstrdup(de->d_name)); |
73 | NULL); | ||
74 | add_child(tree, newchild); | 72 | add_child(tree, newchild); |
75 | } | 73 | } |
76 | 74 | ||
@@ -86,8 +84,8 @@ struct boot_info *dt_from_fs(const char *dirname) | |||
86 | struct node *tree; | 84 | struct node *tree; |
87 | 85 | ||
88 | tree = read_fstree(dirname); | 86 | tree = read_fstree(dirname); |
89 | tree = name_node(tree, "", NULL); | 87 | tree = name_node(tree, ""); |
90 | 88 | ||
91 | return build_boot_info(NULL, tree, 0); | 89 | return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); |
92 | } | 90 | } |
93 | 91 | ||
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c index 0ca3de550b3f..c9209d5c999e 100644 --- a/scripts/dtc/livetree.c +++ b/scripts/dtc/livetree.c | |||
@@ -24,17 +24,30 @@ | |||
24 | * Tree building functions | 24 | * Tree building functions |
25 | */ | 25 | */ |
26 | 26 | ||
27 | struct property *build_property(char *name, struct data val, char *label) | 27 | void add_label(struct label **labels, char *label) |
28 | { | ||
29 | struct label *new; | ||
30 | |||
31 | /* Make sure the label isn't already there */ | ||
32 | for_each_label(*labels, new) | ||
33 | if (streq(new->label, label)) | ||
34 | return; | ||
35 | |||
36 | new = xmalloc(sizeof(*new)); | ||
37 | new->label = label; | ||
38 | new->next = *labels; | ||
39 | *labels = new; | ||
40 | } | ||
41 | |||
42 | struct property *build_property(char *name, struct data val) | ||
28 | { | 43 | { |
29 | struct property *new = xmalloc(sizeof(*new)); | 44 | struct property *new = xmalloc(sizeof(*new)); |
30 | 45 | ||
46 | memset(new, 0, sizeof(*new)); | ||
47 | |||
31 | new->name = name; | 48 | new->name = name; |
32 | new->val = val; | 49 | new->val = val; |
33 | 50 | ||
34 | new->next = NULL; | ||
35 | |||
36 | new->label = label; | ||
37 | |||
38 | return new; | 51 | return new; |
39 | } | 52 | } |
40 | 53 | ||
@@ -78,17 +91,82 @@ struct node *build_node(struct property *proplist, struct node *children) | |||
78 | return new; | 91 | return new; |
79 | } | 92 | } |
80 | 93 | ||
81 | struct node *name_node(struct node *node, char *name, char * label) | 94 | struct node *name_node(struct node *node, char *name) |
82 | { | 95 | { |
83 | assert(node->name == NULL); | 96 | assert(node->name == NULL); |
84 | 97 | ||
85 | node->name = name; | 98 | node->name = name; |
86 | 99 | ||
87 | node->label = label; | ||
88 | |||
89 | return node; | 100 | return node; |
90 | } | 101 | } |
91 | 102 | ||
103 | struct node *merge_nodes(struct node *old_node, struct node *new_node) | ||
104 | { | ||
105 | struct property *new_prop, *old_prop; | ||
106 | struct node *new_child, *old_child; | ||
107 | struct label *l; | ||
108 | |||
109 | /* Add new node labels to old node */ | ||
110 | for_each_label(new_node->labels, l) | ||
111 | add_label(&old_node->labels, l->label); | ||
112 | |||
113 | /* Move properties from the new node to the old node. If there | ||
114 | * is a collision, replace the old value with the new */ | ||
115 | while (new_node->proplist) { | ||
116 | /* Pop the property off the list */ | ||
117 | new_prop = new_node->proplist; | ||
118 | new_node->proplist = new_prop->next; | ||
119 | new_prop->next = NULL; | ||
120 | |||
121 | /* Look for a collision, set new value if there is */ | ||
122 | for_each_property(old_node, old_prop) { | ||
123 | if (streq(old_prop->name, new_prop->name)) { | ||
124 | /* Add new labels to old property */ | ||
125 | for_each_label(new_prop->labels, l) | ||
126 | add_label(&old_prop->labels, l->label); | ||
127 | |||
128 | old_prop->val = new_prop->val; | ||
129 | free(new_prop); | ||
130 | new_prop = NULL; | ||
131 | break; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | /* if no collision occurred, add property to the old node. */ | ||
136 | if (new_prop) | ||
137 | add_property(old_node, new_prop); | ||
138 | } | ||
139 | |||
140 | /* Move the override child nodes into the primary node. If | ||
141 | * there is a collision, then merge the nodes. */ | ||
142 | while (new_node->children) { | ||
143 | /* Pop the child node off the list */ | ||
144 | new_child = new_node->children; | ||
145 | new_node->children = new_child->next_sibling; | ||
146 | new_child->parent = NULL; | ||
147 | new_child->next_sibling = NULL; | ||
148 | |||
149 | /* Search for a collision. Merge if there is */ | ||
150 | for_each_child(old_node, old_child) { | ||
151 | if (streq(old_child->name, new_child->name)) { | ||
152 | merge_nodes(old_child, new_child); | ||
153 | new_child = NULL; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | /* if no collision occured, add child to the old node. */ | ||
159 | if (new_child) | ||
160 | add_child(old_node, new_child); | ||
161 | } | ||
162 | |||
163 | /* The new node contents are now merged into the old node. Free | ||
164 | * the new node. */ | ||
165 | free(new_node); | ||
166 | |||
167 | return old_node; | ||
168 | } | ||
169 | |||
92 | struct node *chain_node(struct node *first, struct node *list) | 170 | struct node *chain_node(struct node *first, struct node *list) |
93 | { | 171 | { |
94 | assert(first->next_sibling == NULL); | 172 | assert(first->next_sibling == NULL); |
@@ -124,18 +202,15 @@ void add_child(struct node *parent, struct node *child) | |||
124 | *p = child; | 202 | *p = child; |
125 | } | 203 | } |
126 | 204 | ||
127 | struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size, | 205 | struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size) |
128 | char *label) | ||
129 | { | 206 | { |
130 | struct reserve_info *new = xmalloc(sizeof(*new)); | 207 | struct reserve_info *new = xmalloc(sizeof(*new)); |
131 | 208 | ||
209 | memset(new, 0, sizeof(*new)); | ||
210 | |||
132 | new->re.address = address; | 211 | new->re.address = address; |
133 | new->re.size = size; | 212 | new->re.size = size; |
134 | 213 | ||
135 | new->next = NULL; | ||
136 | |||
137 | new->label = label; | ||
138 | |||
139 | return new; | 214 | return new; |
140 | } | 215 | } |
141 | 216 | ||
@@ -208,6 +283,60 @@ cell_t propval_cell(struct property *prop) | |||
208 | return fdt32_to_cpu(*((cell_t *)prop->val.val)); | 283 | return fdt32_to_cpu(*((cell_t *)prop->val.val)); |
209 | } | 284 | } |
210 | 285 | ||
286 | struct property *get_property_by_label(struct node *tree, const char *label, | ||
287 | struct node **node) | ||
288 | { | ||
289 | struct property *prop; | ||
290 | struct node *c; | ||
291 | |||
292 | *node = tree; | ||
293 | |||
294 | for_each_property(tree, prop) { | ||
295 | struct label *l; | ||
296 | |||
297 | for_each_label(prop->labels, l) | ||
298 | if (streq(l->label, label)) | ||
299 | return prop; | ||
300 | } | ||
301 | |||
302 | for_each_child(tree, c) { | ||
303 | prop = get_property_by_label(c, label, node); | ||
304 | if (prop) | ||
305 | return prop; | ||
306 | } | ||
307 | |||
308 | *node = NULL; | ||
309 | return NULL; | ||
310 | } | ||
311 | |||
312 | struct marker *get_marker_label(struct node *tree, const char *label, | ||
313 | struct node **node, struct property **prop) | ||
314 | { | ||
315 | struct marker *m; | ||
316 | struct property *p; | ||
317 | struct node *c; | ||
318 | |||
319 | *node = tree; | ||
320 | |||
321 | for_each_property(tree, p) { | ||
322 | *prop = p; | ||
323 | m = p->val.markers; | ||
324 | for_each_marker_of_type(m, LABEL) | ||
325 | if (streq(m->ref, label)) | ||
326 | return m; | ||
327 | } | ||
328 | |||
329 | for_each_child(tree, c) { | ||
330 | m = get_marker_label(c, label, node, prop); | ||
331 | if (m) | ||
332 | return m; | ||
333 | } | ||
334 | |||
335 | *prop = NULL; | ||
336 | *node = NULL; | ||
337 | return NULL; | ||
338 | } | ||
339 | |||
211 | struct node *get_subnode(struct node *node, const char *nodename) | 340 | struct node *get_subnode(struct node *node, const char *nodename) |
212 | { | 341 | { |
213 | struct node *child; | 342 | struct node *child; |
@@ -245,11 +374,13 @@ struct node *get_node_by_path(struct node *tree, const char *path) | |||
245 | struct node *get_node_by_label(struct node *tree, const char *label) | 374 | struct node *get_node_by_label(struct node *tree, const char *label) |
246 | { | 375 | { |
247 | struct node *child, *node; | 376 | struct node *child, *node; |
377 | struct label *l; | ||
248 | 378 | ||
249 | assert(label && (strlen(label) > 0)); | 379 | assert(label && (strlen(label) > 0)); |
250 | 380 | ||
251 | if (tree->label && streq(tree->label, label)) | 381 | for_each_label(tree->labels, l) |
252 | return tree; | 382 | if (streq(l->label, label)) |
383 | return tree; | ||
253 | 384 | ||
254 | for_each_child(tree, child) { | 385 | for_each_child(tree, child) { |
255 | node = get_node_by_label(child, label); | 386 | node = get_node_by_label(child, label); |
@@ -293,16 +424,186 @@ cell_t get_node_phandle(struct node *root, struct node *node) | |||
293 | if ((node->phandle != 0) && (node->phandle != -1)) | 424 | if ((node->phandle != 0) && (node->phandle != -1)) |
294 | return node->phandle; | 425 | return node->phandle; |
295 | 426 | ||
296 | assert(! get_property(node, "linux,phandle")); | ||
297 | |||
298 | while (get_node_by_phandle(root, phandle)) | 427 | while (get_node_by_phandle(root, phandle)) |
299 | phandle++; | 428 | phandle++; |
300 | 429 | ||
301 | node->phandle = phandle; | 430 | node->phandle = phandle; |
302 | add_property(node, | 431 | |
303 | build_property("linux,phandle", | 432 | if (!get_property(node, "linux,phandle") |
304 | data_append_cell(empty_data, phandle), | 433 | && (phandle_format & PHANDLE_LEGACY)) |
305 | NULL)); | 434 | add_property(node, |
435 | build_property("linux,phandle", | ||
436 | data_append_cell(empty_data, phandle))); | ||
437 | |||
438 | if (!get_property(node, "phandle") | ||
439 | && (phandle_format & PHANDLE_EPAPR)) | ||
440 | add_property(node, | ||
441 | build_property("phandle", | ||
442 | data_append_cell(empty_data, phandle))); | ||
443 | |||
444 | /* If the node *does* have a phandle property, we must | ||
445 | * be dealing with a self-referencing phandle, which will be | ||
446 | * fixed up momentarily in the caller */ | ||
306 | 447 | ||
307 | return node->phandle; | 448 | return node->phandle; |
308 | } | 449 | } |
450 | |||
451 | uint32_t guess_boot_cpuid(struct node *tree) | ||
452 | { | ||
453 | struct node *cpus, *bootcpu; | ||
454 | struct property *reg; | ||
455 | |||
456 | cpus = get_node_by_path(tree, "/cpus"); | ||
457 | if (!cpus) | ||
458 | return 0; | ||
459 | |||
460 | |||
461 | bootcpu = cpus->children; | ||
462 | if (!bootcpu) | ||
463 | return 0; | ||
464 | |||
465 | reg = get_property(bootcpu, "reg"); | ||
466 | if (!reg || (reg->val.len != sizeof(uint32_t))) | ||
467 | return 0; | ||
468 | |||
469 | /* FIXME: Sanity check node? */ | ||
470 | |||
471 | return propval_cell(reg); | ||
472 | } | ||
473 | |||
474 | static int cmp_reserve_info(const void *ax, const void *bx) | ||
475 | { | ||
476 | const struct reserve_info *a, *b; | ||
477 | |||
478 | a = *((const struct reserve_info * const *)ax); | ||
479 | b = *((const struct reserve_info * const *)bx); | ||
480 | |||
481 | if (a->re.address < b->re.address) | ||
482 | return -1; | ||
483 | else if (a->re.address > b->re.address) | ||
484 | return 1; | ||
485 | else if (a->re.size < b->re.size) | ||
486 | return -1; | ||
487 | else if (a->re.size > b->re.size) | ||
488 | return 1; | ||
489 | else | ||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | static void sort_reserve_entries(struct boot_info *bi) | ||
494 | { | ||
495 | struct reserve_info *ri, **tbl; | ||
496 | int n = 0, i = 0; | ||
497 | |||
498 | for (ri = bi->reservelist; | ||
499 | ri; | ||
500 | ri = ri->next) | ||
501 | n++; | ||
502 | |||
503 | if (n == 0) | ||
504 | return; | ||
505 | |||
506 | tbl = xmalloc(n * sizeof(*tbl)); | ||
507 | |||
508 | for (ri = bi->reservelist; | ||
509 | ri; | ||
510 | ri = ri->next) | ||
511 | tbl[i++] = ri; | ||
512 | |||
513 | qsort(tbl, n, sizeof(*tbl), cmp_reserve_info); | ||
514 | |||
515 | bi->reservelist = tbl[0]; | ||
516 | for (i = 0; i < (n-1); i++) | ||
517 | tbl[i]->next = tbl[i+1]; | ||
518 | tbl[n-1]->next = NULL; | ||
519 | |||
520 | free(tbl); | ||
521 | } | ||
522 | |||
523 | static int cmp_prop(const void *ax, const void *bx) | ||
524 | { | ||
525 | const struct property *a, *b; | ||
526 | |||
527 | a = *((const struct property * const *)ax); | ||
528 | b = *((const struct property * const *)bx); | ||
529 | |||
530 | return strcmp(a->name, b->name); | ||
531 | } | ||
532 | |||
533 | static void sort_properties(struct node *node) | ||
534 | { | ||
535 | int n = 0, i = 0; | ||
536 | struct property *prop, **tbl; | ||
537 | |||
538 | for_each_property(node, prop) | ||
539 | n++; | ||
540 | |||
541 | if (n == 0) | ||
542 | return; | ||
543 | |||
544 | tbl = xmalloc(n * sizeof(*tbl)); | ||
545 | |||
546 | for_each_property(node, prop) | ||
547 | tbl[i++] = prop; | ||
548 | |||
549 | qsort(tbl, n, sizeof(*tbl), cmp_prop); | ||
550 | |||
551 | node->proplist = tbl[0]; | ||
552 | for (i = 0; i < (n-1); i++) | ||
553 | tbl[i]->next = tbl[i+1]; | ||
554 | tbl[n-1]->next = NULL; | ||
555 | |||
556 | free(tbl); | ||
557 | } | ||
558 | |||
559 | static int cmp_subnode(const void *ax, const void *bx) | ||
560 | { | ||
561 | const struct node *a, *b; | ||
562 | |||
563 | a = *((const struct node * const *)ax); | ||
564 | b = *((const struct node * const *)bx); | ||
565 | |||
566 | return strcmp(a->name, b->name); | ||
567 | } | ||
568 | |||
569 | static void sort_subnodes(struct node *node) | ||
570 | { | ||
571 | int n = 0, i = 0; | ||
572 | struct node *subnode, **tbl; | ||
573 | |||
574 | for_each_child(node, subnode) | ||
575 | n++; | ||
576 | |||
577 | if (n == 0) | ||
578 | return; | ||
579 | |||
580 | tbl = xmalloc(n * sizeof(*tbl)); | ||
581 | |||
582 | for_each_child(node, subnode) | ||
583 | tbl[i++] = subnode; | ||
584 | |||
585 | qsort(tbl, n, sizeof(*tbl), cmp_subnode); | ||
586 | |||
587 | node->children = tbl[0]; | ||
588 | for (i = 0; i < (n-1); i++) | ||
589 | tbl[i]->next_sibling = tbl[i+1]; | ||
590 | tbl[n-1]->next_sibling = NULL; | ||
591 | |||
592 | free(tbl); | ||
593 | } | ||
594 | |||
595 | static void sort_node(struct node *node) | ||
596 | { | ||
597 | struct node *c; | ||
598 | |||
599 | sort_properties(node); | ||
600 | sort_subnodes(node); | ||
601 | for_each_child(node, c) | ||
602 | sort_node(c); | ||
603 | } | ||
604 | |||
605 | void sort_tree(struct boot_info *bi) | ||
606 | { | ||
607 | sort_reserve_entries(bi); | ||
608 | sort_node(bi->dt); | ||
609 | } | ||
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index 9641b7628b4d..2dbc874288ca 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c | |||
@@ -17,100 +17,232 @@ | |||
17 | * USA | 17 | * USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define _GNU_SOURCE | ||
21 | |||
22 | #include <stdio.h> | ||
23 | |||
20 | #include "dtc.h" | 24 | #include "dtc.h" |
21 | #include "srcpos.h" | 25 | #include "srcpos.h" |
22 | 26 | ||
23 | /* | ||
24 | * Like yylineno, this is the current open file pos. | ||
25 | */ | ||
26 | 27 | ||
27 | struct dtc_file *srcpos_file; | 28 | static char *dirname(const char *path) |
29 | { | ||
30 | const char *slash = strrchr(path, '/'); | ||
31 | |||
32 | if (slash) { | ||
33 | int len = slash - path; | ||
34 | char *dir = xmalloc(len + 1); | ||
35 | |||
36 | memcpy(dir, path, len); | ||
37 | dir[len] = '\0'; | ||
38 | return dir; | ||
39 | } | ||
40 | return NULL; | ||
41 | } | ||
42 | |||
43 | struct srcfile_state *current_srcfile; /* = NULL */ | ||
28 | 44 | ||
29 | static int dtc_open_one(struct dtc_file *file, | 45 | /* Detect infinite include recursion. */ |
30 | const char *search, | 46 | #define MAX_SRCFILE_DEPTH (100) |
31 | const char *fname) | 47 | static int srcfile_depth; /* = 0 */ |
48 | |||
49 | FILE *srcfile_relative_open(const char *fname, char **fullnamep) | ||
32 | { | 50 | { |
51 | FILE *f; | ||
33 | char *fullname; | 52 | char *fullname; |
34 | 53 | ||
35 | if (search) { | 54 | if (streq(fname, "-")) { |
36 | fullname = xmalloc(strlen(search) + strlen(fname) + 2); | 55 | f = stdin; |
37 | 56 | fullname = xstrdup("<stdin>"); | |
38 | strcpy(fullname, search); | ||
39 | strcat(fullname, "/"); | ||
40 | strcat(fullname, fname); | ||
41 | } else { | 57 | } else { |
42 | fullname = strdup(fname); | 58 | if (!current_srcfile || !current_srcfile->dir |
59 | || (fname[0] == '/')) | ||
60 | fullname = xstrdup(fname); | ||
61 | else | ||
62 | fullname = join_path(current_srcfile->dir, fname); | ||
63 | |||
64 | f = fopen(fullname, "r"); | ||
65 | if (!f) | ||
66 | die("Couldn't open \"%s\": %s\n", fname, | ||
67 | strerror(errno)); | ||
43 | } | 68 | } |
44 | 69 | ||
45 | file->file = fopen(fullname, "r"); | 70 | if (fullnamep) |
46 | if (!file->file) { | 71 | *fullnamep = fullname; |
72 | else | ||
47 | free(fullname); | 73 | free(fullname); |
48 | return 0; | ||
49 | } | ||
50 | 74 | ||
51 | file->name = fullname; | 75 | return f; |
52 | return 1; | ||
53 | } | 76 | } |
54 | 77 | ||
78 | void srcfile_push(const char *fname) | ||
79 | { | ||
80 | struct srcfile_state *srcfile; | ||
81 | |||
82 | if (srcfile_depth++ >= MAX_SRCFILE_DEPTH) | ||
83 | die("Includes nested too deeply"); | ||
84 | |||
85 | srcfile = xmalloc(sizeof(*srcfile)); | ||
86 | |||
87 | srcfile->f = srcfile_relative_open(fname, &srcfile->name); | ||
88 | srcfile->dir = dirname(srcfile->name); | ||
89 | srcfile->prev = current_srcfile; | ||
90 | |||
91 | srcfile->lineno = 1; | ||
92 | srcfile->colno = 1; | ||
93 | |||
94 | current_srcfile = srcfile; | ||
95 | } | ||
55 | 96 | ||
56 | struct dtc_file *dtc_open_file(const char *fname, | 97 | int srcfile_pop(void) |
57 | const struct search_path *search) | ||
58 | { | 98 | { |
59 | static const struct search_path default_search = { NULL, NULL, NULL }; | 99 | struct srcfile_state *srcfile = current_srcfile; |
60 | 100 | ||
61 | struct dtc_file *file; | 101 | assert(srcfile); |
62 | const char *slash; | ||
63 | 102 | ||
64 | file = xmalloc(sizeof(struct dtc_file)); | 103 | current_srcfile = srcfile->prev; |
65 | 104 | ||
66 | slash = strrchr(fname, '/'); | 105 | if (fclose(srcfile->f)) |
67 | if (slash) { | 106 | die("Error closing \"%s\": %s\n", srcfile->name, |
68 | char *dir = xmalloc(slash - fname + 1); | 107 | strerror(errno)); |
69 | 108 | ||
70 | memcpy(dir, fname, slash - fname); | 109 | /* FIXME: We allow the srcfile_state structure to leak, |
71 | dir[slash - fname] = 0; | 110 | * because it could still be referenced from a location |
72 | file->dir = dir; | 111 | * variable being carried through the parser somewhere. To |
73 | } else { | 112 | * fix this we could either allocate all the files from a |
74 | file->dir = NULL; | 113 | * table, or use a pool allocator. */ |
75 | } | ||
76 | 114 | ||
77 | if (streq(fname, "-")) { | 115 | return current_srcfile ? 1 : 0; |
78 | file->name = "stdin"; | 116 | } |
79 | file->file = stdin; | ||
80 | return file; | ||
81 | } | ||
82 | 117 | ||
83 | if (fname[0] == '/') { | 118 | /* |
84 | file->file = fopen(fname, "r"); | 119 | * The empty source position. |
85 | if (!file->file) | 120 | */ |
86 | goto fail; | ||
87 | 121 | ||
88 | file->name = strdup(fname); | 122 | struct srcpos srcpos_empty = { |
89 | return file; | 123 | .first_line = 0, |
90 | } | 124 | .first_column = 0, |
125 | .last_line = 0, | ||
126 | .last_column = 0, | ||
127 | .file = NULL, | ||
128 | }; | ||
91 | 129 | ||
92 | if (!search) | 130 | #define TAB_SIZE 8 |
93 | search = &default_search; | ||
94 | 131 | ||
95 | while (search) { | 132 | void srcpos_update(struct srcpos *pos, const char *text, int len) |
96 | if (dtc_open_one(file, search->dir, fname)) | 133 | { |
97 | return file; | 134 | int i; |
135 | |||
136 | pos->file = current_srcfile; | ||
137 | |||
138 | pos->first_line = current_srcfile->lineno; | ||
139 | pos->first_column = current_srcfile->colno; | ||
140 | |||
141 | for (i = 0; i < len; i++) | ||
142 | if (text[i] == '\n') { | ||
143 | current_srcfile->lineno++; | ||
144 | current_srcfile->colno = 1; | ||
145 | } else if (text[i] == '\t') { | ||
146 | current_srcfile->colno = | ||
147 | ALIGN(current_srcfile->colno, TAB_SIZE); | ||
148 | } else { | ||
149 | current_srcfile->colno++; | ||
150 | } | ||
151 | |||
152 | pos->last_line = current_srcfile->lineno; | ||
153 | pos->last_column = current_srcfile->colno; | ||
154 | } | ||
98 | 155 | ||
99 | if (errno != ENOENT) | 156 | struct srcpos * |
100 | goto fail; | 157 | srcpos_copy(struct srcpos *pos) |
158 | { | ||
159 | struct srcpos *pos_new; | ||
101 | 160 | ||
102 | search = search->next; | 161 | pos_new = xmalloc(sizeof(struct srcpos)); |
103 | } | 162 | memcpy(pos_new, pos, sizeof(struct srcpos)); |
163 | |||
164 | return pos_new; | ||
165 | } | ||
166 | |||
167 | |||
168 | |||
169 | void | ||
170 | srcpos_dump(struct srcpos *pos) | ||
171 | { | ||
172 | printf("file : \"%s\"\n", | ||
173 | pos->file ? (char *) pos->file : "<no file>"); | ||
174 | printf("first_line : %d\n", pos->first_line); | ||
175 | printf("first_column: %d\n", pos->first_column); | ||
176 | printf("last_line : %d\n", pos->last_line); | ||
177 | printf("last_column : %d\n", pos->last_column); | ||
178 | printf("file : %s\n", pos->file->name); | ||
179 | } | ||
104 | 180 | ||
105 | fail: | 181 | |
106 | die("Couldn't open \"%s\": %s\n", fname, strerror(errno)); | 182 | char * |
183 | srcpos_string(struct srcpos *pos) | ||
184 | { | ||
185 | const char *fname = "<no-file>"; | ||
186 | char *pos_str; | ||
187 | int rc; | ||
188 | |||
189 | if (pos) | ||
190 | fname = pos->file->name; | ||
191 | |||
192 | |||
193 | if (pos->first_line != pos->last_line) | ||
194 | rc = asprintf(&pos_str, "%s:%d.%d-%d.%d", fname, | ||
195 | pos->first_line, pos->first_column, | ||
196 | pos->last_line, pos->last_column); | ||
197 | else if (pos->first_column != pos->last_column) | ||
198 | rc = asprintf(&pos_str, "%s:%d.%d-%d", fname, | ||
199 | pos->first_line, pos->first_column, | ||
200 | pos->last_column); | ||
201 | else | ||
202 | rc = asprintf(&pos_str, "%s:%d.%d", fname, | ||
203 | pos->first_line, pos->first_column); | ||
204 | |||
205 | if (rc == -1) | ||
206 | die("Couldn't allocate in srcpos string"); | ||
207 | |||
208 | return pos_str; | ||
209 | } | ||
210 | |||
211 | void | ||
212 | srcpos_verror(struct srcpos *pos, char const *fmt, va_list va) | ||
213 | { | ||
214 | const char *srcstr; | ||
215 | |||
216 | srcstr = srcpos_string(pos); | ||
217 | |||
218 | fprintf(stdout, "Error: %s ", srcstr); | ||
219 | vfprintf(stdout, fmt, va); | ||
220 | fprintf(stdout, "\n"); | ||
107 | } | 221 | } |
108 | 222 | ||
109 | void dtc_close_file(struct dtc_file *file) | 223 | void |
224 | srcpos_error(struct srcpos *pos, char const *fmt, ...) | ||
110 | { | 225 | { |
111 | if (fclose(file->file)) | 226 | va_list va; |
112 | die("Error closing \"%s\": %s\n", file->name, strerror(errno)); | 227 | |
228 | va_start(va, fmt); | ||
229 | srcpos_verror(pos, fmt, va); | ||
230 | va_end(va); | ||
231 | } | ||
232 | |||
233 | |||
234 | void | ||
235 | srcpos_warn(struct srcpos *pos, char const *fmt, ...) | ||
236 | { | ||
237 | const char *srcstr; | ||
238 | va_list va; | ||
239 | va_start(va, fmt); | ||
240 | |||
241 | srcstr = srcpos_string(pos); | ||
242 | |||
243 | fprintf(stderr, "Warning: %s ", srcstr); | ||
244 | vfprintf(stderr, fmt, va); | ||
245 | fprintf(stderr, "\n"); | ||
113 | 246 | ||
114 | free(file->dir); | 247 | va_end(va); |
115 | free(file); | ||
116 | } | 248 | } |
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h index e17c7c04db8e..bd7966e56a53 100644 --- a/scripts/dtc/srcpos.h +++ b/scripts/dtc/srcpos.h | |||
@@ -17,69 +17,70 @@ | |||
17 | * USA | 17 | * USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* | 20 | #ifndef _SRCPOS_H_ |
21 | * Augment the standard YYLTYPE with a filenum index into an | 21 | #define _SRCPOS_H_ |
22 | * array of all opened filenames. | ||
23 | */ | ||
24 | 22 | ||
25 | #include <stdio.h> | 23 | #include <stdio.h> |
26 | 24 | ||
27 | struct dtc_file { | 25 | struct srcfile_state { |
26 | FILE *f; | ||
27 | char *name; | ||
28 | char *dir; | 28 | char *dir; |
29 | const char *name; | 29 | int lineno, colno; |
30 | FILE *file; | 30 | struct srcfile_state *prev; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #if ! defined(YYLTYPE) && ! defined(YYLTYPE_IS_DECLARED) | 33 | extern struct srcfile_state *current_srcfile; /* = NULL */ |
34 | typedef struct YYLTYPE { | 34 | |
35 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); | ||
36 | void srcfile_push(const char *fname); | ||
37 | int srcfile_pop(void); | ||
38 | |||
39 | struct srcpos { | ||
35 | int first_line; | 40 | int first_line; |
36 | int first_column; | 41 | int first_column; |
37 | int last_line; | 42 | int last_line; |
38 | int last_column; | 43 | int last_column; |
39 | struct dtc_file *file; | 44 | struct srcfile_state *file; |
40 | } YYLTYPE; | 45 | }; |
41 | |||
42 | #define YYLTYPE_IS_DECLARED 1 | ||
43 | #define YYLTYPE_IS_TRIVIAL 1 | ||
44 | #endif | ||
45 | |||
46 | /* Cater to old parser templates. */ | ||
47 | #ifndef YYID | ||
48 | #define YYID(n) (n) | ||
49 | #endif | ||
50 | 46 | ||
51 | #define YYLLOC_DEFAULT(Current, Rhs, N) \ | 47 | #define YYLTYPE struct srcpos |
52 | do \ | ||
53 | if (YYID (N)) \ | ||
54 | { \ | ||
55 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
56 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
57 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
58 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
59 | (Current).file = YYRHSLOC (Rhs, N).file; \ | ||
60 | } \ | ||
61 | else \ | ||
62 | { \ | ||
63 | (Current).first_line = (Current).last_line = \ | ||
64 | YYRHSLOC (Rhs, 0).last_line; \ | ||
65 | (Current).first_column = (Current).last_column = \ | ||
66 | YYRHSLOC (Rhs, 0).last_column; \ | ||
67 | (Current).file = YYRHSLOC (Rhs, 0).file; \ | ||
68 | } \ | ||
69 | while (YYID (0)) | ||
70 | 48 | ||
49 | #define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
50 | do { \ | ||
51 | if (N) { \ | ||
52 | (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ | ||
53 | (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ | ||
54 | (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ | ||
55 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
56 | (Current).file = YYRHSLOC(Rhs, N).file; \ | ||
57 | } else { \ | ||
58 | (Current).first_line = (Current).last_line = \ | ||
59 | YYRHSLOC(Rhs, 0).last_line; \ | ||
60 | (Current).first_column = (Current).last_column = \ | ||
61 | YYRHSLOC(Rhs, 0).last_column; \ | ||
62 | (Current).file = YYRHSLOC (Rhs, 0).file; \ | ||
63 | } \ | ||
64 | } while (0) | ||
71 | 65 | ||
72 | 66 | ||
73 | extern void yyerror(char const *); | 67 | /* |
74 | extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2))); | 68 | * Fictional source position used for IR nodes that are |
69 | * created without otherwise knowing a true source position. | ||
70 | * For example,constant definitions from the command line. | ||
71 | */ | ||
72 | extern struct srcpos srcpos_empty; | ||
75 | 73 | ||
76 | extern struct dtc_file *srcpos_file; | 74 | extern void srcpos_update(struct srcpos *pos, const char *text, int len); |
75 | extern struct srcpos *srcpos_copy(struct srcpos *pos); | ||
76 | extern char *srcpos_string(struct srcpos *pos); | ||
77 | extern void srcpos_dump(struct srcpos *pos); | ||
77 | 78 | ||
78 | struct search_path { | 79 | extern void srcpos_verror(struct srcpos *pos, char const *, va_list va) |
79 | const char *dir; /* NULL for current directory */ | 80 | __attribute__((format(printf, 2, 0))); |
80 | struct search_path *prev, *next; | 81 | extern void srcpos_error(struct srcpos *pos, char const *, ...) |
81 | }; | 82 | __attribute__((format(printf, 2, 3))); |
83 | extern void srcpos_warn(struct srcpos *pos, char const *, ...) | ||
84 | __attribute__((format(printf, 2, 3))); | ||
82 | 85 | ||
83 | extern struct dtc_file *dtc_open_file(const char *fname, | 86 | #endif /* _SRCPOS_H_ */ |
84 | const struct search_path *search); | ||
85 | extern void dtc_close_file(struct dtc_file *file); | ||
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index 1521ff11bb97..c09aafade313 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -32,8 +32,8 @@ struct boot_info *dt_from_source(const char *fname) | |||
32 | the_boot_info = NULL; | 32 | the_boot_info = NULL; |
33 | treesource_error = 0; | 33 | treesource_error = 0; |
34 | 34 | ||
35 | srcpos_file = dtc_open_file(fname, NULL); | 35 | srcfile_push(fname); |
36 | yyin = srcpos_file->file; | 36 | yyin = current_srcfile->f; |
37 | 37 | ||
38 | if (yyparse() != 0) | 38 | if (yyparse() != 0) |
39 | die("Unable to parse input tree\n"); | 39 | die("Unable to parse input tree\n"); |
@@ -63,26 +63,20 @@ static void write_propval_string(FILE *f, struct data val) | |||
63 | { | 63 | { |
64 | const char *str = val.val; | 64 | const char *str = val.val; |
65 | int i; | 65 | int i; |
66 | int newchunk = 1; | ||
67 | struct marker *m = val.markers; | 66 | struct marker *m = val.markers; |
68 | 67 | ||
69 | assert(str[val.len-1] == '\0'); | 68 | assert(str[val.len-1] == '\0'); |
70 | 69 | ||
70 | while (m && (m->offset == 0)) { | ||
71 | if (m->type == LABEL) | ||
72 | fprintf(f, "%s: ", m->ref); | ||
73 | m = m->next; | ||
74 | } | ||
75 | fprintf(f, "\""); | ||
76 | |||
71 | for (i = 0; i < (val.len-1); i++) { | 77 | for (i = 0; i < (val.len-1); i++) { |
72 | char c = str[i]; | 78 | char c = str[i]; |
73 | 79 | ||
74 | if (newchunk) { | ||
75 | while (m && (m->offset <= i)) { | ||
76 | if (m->type == LABEL) { | ||
77 | assert(m->offset == i); | ||
78 | fprintf(f, "%s: ", m->ref); | ||
79 | } | ||
80 | m = m->next; | ||
81 | } | ||
82 | fprintf(f, "\""); | ||
83 | newchunk = 0; | ||
84 | } | ||
85 | |||
86 | switch (c) { | 80 | switch (c) { |
87 | case '\a': | 81 | case '\a': |
88 | fprintf(f, "\\a"); | 82 | fprintf(f, "\\a"); |
@@ -113,7 +107,14 @@ static void write_propval_string(FILE *f, struct data val) | |||
113 | break; | 107 | break; |
114 | case '\0': | 108 | case '\0': |
115 | fprintf(f, "\", "); | 109 | fprintf(f, "\", "); |
116 | newchunk = 1; | 110 | while (m && (m->offset < i)) { |
111 | if (m->type == LABEL) { | ||
112 | assert(m->offset == (i+1)); | ||
113 | fprintf(f, "%s: ", m->ref); | ||
114 | } | ||
115 | m = m->next; | ||
116 | } | ||
117 | fprintf(f, "\""); | ||
117 | break; | 118 | break; |
118 | default: | 119 | default: |
119 | if (isprint(c)) | 120 | if (isprint(c)) |
@@ -234,10 +235,11 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level) | |||
234 | { | 235 | { |
235 | struct property *prop; | 236 | struct property *prop; |
236 | struct node *child; | 237 | struct node *child; |
238 | struct label *l; | ||
237 | 239 | ||
238 | write_prefix(f, level); | 240 | write_prefix(f, level); |
239 | if (tree->label) | 241 | for_each_label(tree->labels, l) |
240 | fprintf(f, "%s: ", tree->label); | 242 | fprintf(f, "%s: ", l->label); |
241 | if (tree->name && (*tree->name)) | 243 | if (tree->name && (*tree->name)) |
242 | fprintf(f, "%s {\n", tree->name); | 244 | fprintf(f, "%s {\n", tree->name); |
243 | else | 245 | else |
@@ -245,8 +247,8 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level) | |||
245 | 247 | ||
246 | for_each_property(tree, prop) { | 248 | for_each_property(tree, prop) { |
247 | write_prefix(f, level+1); | 249 | write_prefix(f, level+1); |
248 | if (prop->label) | 250 | for_each_label(prop->labels, l) |
249 | fprintf(f, "%s: ", prop->label); | 251 | fprintf(f, "%s: ", l->label); |
250 | fprintf(f, "%s", prop->name); | 252 | fprintf(f, "%s", prop->name); |
251 | write_propval(f, prop); | 253 | write_propval(f, prop); |
252 | } | 254 | } |
@@ -266,8 +268,10 @@ void dt_to_source(FILE *f, struct boot_info *bi) | |||
266 | fprintf(f, "/dts-v1/;\n\n"); | 268 | fprintf(f, "/dts-v1/;\n\n"); |
267 | 269 | ||
268 | for (re = bi->reservelist; re; re = re->next) { | 270 | for (re = bi->reservelist; re; re = re->next) { |
269 | if (re->label) | 271 | struct label *l; |
270 | fprintf(f, "%s: ", re->label); | 272 | |
273 | for_each_label(re->labels, l) | ||
274 | fprintf(f, "%s: ", l->label); | ||
271 | fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n", | 275 | fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n", |
272 | (unsigned long long)re->re.address, | 276 | (unsigned long long)re->re.address, |
273 | (unsigned long long)re->re.size); | 277 | (unsigned long long)re->re.size); |
diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c new file mode 100644 index 000000000000..d7ac27d2ae15 --- /dev/null +++ b/scripts/dtc/util.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of the | ||
7 | * License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
17 | * USA | ||
18 | */ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <stdarg.h> | ||
23 | #include <string.h> | ||
24 | |||
25 | #include "util.h" | ||
26 | |||
27 | char *xstrdup(const char *s) | ||
28 | { | ||
29 | int len = strlen(s) + 1; | ||
30 | char *dup = xmalloc(len); | ||
31 | |||
32 | memcpy(dup, s, len); | ||
33 | |||
34 | return dup; | ||
35 | } | ||
36 | |||
37 | char *join_path(const char *path, const char *name) | ||
38 | { | ||
39 | int lenp = strlen(path); | ||
40 | int lenn = strlen(name); | ||
41 | int len; | ||
42 | int needslash = 1; | ||
43 | char *str; | ||
44 | |||
45 | len = lenp + lenn + 2; | ||
46 | if ((lenp > 0) && (path[lenp-1] == '/')) { | ||
47 | needslash = 0; | ||
48 | len--; | ||
49 | } | ||
50 | |||
51 | str = xmalloc(len); | ||
52 | memcpy(str, path, lenp); | ||
53 | if (needslash) { | ||
54 | str[lenp] = '/'; | ||
55 | lenp++; | ||
56 | } | ||
57 | memcpy(str+lenp, name, lenn+1); | ||
58 | return str; | ||
59 | } | ||
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h new file mode 100644 index 000000000000..9cead842c11e --- /dev/null +++ b/scripts/dtc/util.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef _UTIL_H | ||
2 | #define _UTIL_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License as | ||
9 | * published by the Free Software Foundation; either version 2 of the | ||
10 | * License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
20 | * USA | ||
21 | */ | ||
22 | |||
23 | static inline void __attribute__((noreturn)) die(char * str, ...) | ||
24 | { | ||
25 | va_list ap; | ||
26 | |||
27 | va_start(ap, str); | ||
28 | fprintf(stderr, "FATAL ERROR: "); | ||
29 | vfprintf(stderr, str, ap); | ||
30 | exit(1); | ||
31 | } | ||
32 | |||
33 | static inline void *xmalloc(size_t len) | ||
34 | { | ||
35 | void *new = malloc(len); | ||
36 | |||
37 | if (!new) | ||
38 | die("malloc() failed\n"); | ||
39 | |||
40 | return new; | ||
41 | } | ||
42 | |||
43 | static inline void *xrealloc(void *p, size_t len) | ||
44 | { | ||
45 | void *new = realloc(p, len); | ||
46 | |||
47 | if (!new) | ||
48 | die("realloc() failed (len=%d)\n", len); | ||
49 | |||
50 | return new; | ||
51 | } | ||
52 | |||
53 | extern char *xstrdup(const char *s); | ||
54 | extern char *join_path(const char *path, const char *name); | ||
55 | |||
56 | #endif /* _UTIL_H */ | ||
diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 658ff42429d6..6158b867df99 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h | |||
@@ -1 +1 @@ | |||
#define DTC_VERSION "DTC 1.2.0" | #define DTC_VERSION "DTC 1.2.0-g37c0b6a0" | ||