RealView.py (13996:8a567118e670) RealView.py (14153:03d1ad4167b0)
1# Copyright (c) 2009-2018 ARM Limited
1# Copyright (c) 2009-2019 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated

--- 111 unchanged lines hidden (view full) ---

121 int_base = Param.Unsigned("PCI interrupt base")
122 int_count = Param.Unsigned("Maximum number of interrupts used by this host")
123
124 # This python parameter can be used in configuration scripts to turn
125 # on/off the fdt dma-coherent flag when doing dtb autogeneration
126 _dma_coherent = True
127
128 def generateDeviceTree(self, state):
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated

--- 111 unchanged lines hidden (view full) ---

121 int_base = Param.Unsigned("PCI interrupt base")
122 int_count = Param.Unsigned("Maximum number of interrupts used by this host")
123
124 # This python parameter can be used in configuration scripts to turn
125 # on/off the fdt dma-coherent flag when doing dtb autogeneration
126 _dma_coherent = True
127
128 def generateDeviceTree(self, state):
129 local_state = FdtState(addr_cells=3, size_cells=2, cpu_cells=1)
130 intterrupt_cells = 1
129 local_state = FdtState(
130 addr_cells=3, size_cells=2,
131 cpu_cells=1, interrupt_cells=1)
131
132 node = FdtNode("pci")
133
134 if int(self.conf_device_bits) == 8:
135 node.appendCompatible("pci-host-cam-generic")
136 elif int(self.conf_device_bits) == 12:
137 node.appendCompatible("pci-host-ecam-generic")
138 else:
139 m5.fatal("No compatibility string for the set conf_device_width")
140
141 node.append(FdtPropertyStrings("device_type", ["pci"]))
142
143 # Cell sizes of child nodes/peripherals
144 node.append(local_state.addrCellsProperty())
145 node.append(local_state.sizeCellsProperty())
132
133 node = FdtNode("pci")
134
135 if int(self.conf_device_bits) == 8:
136 node.appendCompatible("pci-host-cam-generic")
137 elif int(self.conf_device_bits) == 12:
138 node.appendCompatible("pci-host-ecam-generic")
139 else:
140 m5.fatal("No compatibility string for the set conf_device_width")
141
142 node.append(FdtPropertyStrings("device_type", ["pci"]))
143
144 # Cell sizes of child nodes/peripherals
145 node.append(local_state.addrCellsProperty())
146 node.append(local_state.sizeCellsProperty())
146 node.append(FdtPropertyWords("#interrupt-cells", intterrupt_cells))
147 node.append(local_state.interruptCellsProperty())
147 # PCI address for CPU
148 node.append(FdtPropertyWords("reg",
149 state.addrCells(self.conf_base) +
150 state.sizeCells(self.conf_size) ))
151
152 # Ranges mapping
153 # For now some of this is hard coded, because the PCI module does not
154 # have a proper full understanding of the memory map, but adapting the

--- 7 unchanged lines hidden (view full) ---

162
163 # AXI memory address range
164 ranges += self.pciFdtAddr(space=2, addr=0)
165 ranges += state.addrCells(0x40000000) # Fixed offset
166 ranges += local_state.sizeCells(0x40000000) # Fixed size
167 node.append(FdtPropertyWords("ranges", ranges))
168
169 if str(self.int_policy) == 'ARM_PCI_INT_DEV':
148 # PCI address for CPU
149 node.append(FdtPropertyWords("reg",
150 state.addrCells(self.conf_base) +
151 state.sizeCells(self.conf_size) ))
152
153 # Ranges mapping
154 # For now some of this is hard coded, because the PCI module does not
155 # have a proper full understanding of the memory map, but adapting the

--- 7 unchanged lines hidden (view full) ---

163
164 # AXI memory address range
165 ranges += self.pciFdtAddr(space=2, addr=0)
166 ranges += state.addrCells(0x40000000) # Fixed offset
167 ranges += local_state.sizeCells(0x40000000) # Fixed size
168 node.append(FdtPropertyWords("ranges", ranges))
169
170 if str(self.int_policy) == 'ARM_PCI_INT_DEV':
170 int_phandle = state.phandle(self._parent.unproxy(self).gic)
171 gic = self._parent.unproxy(self).gic
172 int_phandle = state.phandle(gic)
171 # Interrupt mapping
172 interrupts = []
173 # Interrupt mapping
174 interrupts = []
175
176 # child interrupt specifier
177 child_interrupt = local_state.interruptCells(0x0)
178
179 # parent unit address
180 parent_addr = gic._state.addrCells(0x0)
181
173 for i in range(int(self.int_count)):
182 for i in range(int(self.int_count)):
183 parent_interrupt = gic.interruptCells(0,
184 int(self.int_base) - 32 + i, 1)
185
174 interrupts += self.pciFdtAddr(device=i, addr=0) + \
186 interrupts += self.pciFdtAddr(device=i, addr=0) + \
175 [0x0, int_phandle, 0, int(self.int_base) - 32 + i, 1]
187 child_interrupt + [int_phandle] + parent_addr + \
188 parent_interrupt
176
177 node.append(FdtPropertyWords("interrupt-map", interrupts))
178
179 int_count = int(self.int_count)
180 if int_count & (int_count - 1):
181 fatal("PCI interrupt count should be power of 2")
182
183 intmask = self.pciFdtAddr(device=int_count - 1, addr=0) + [0x0]

--- 927 unchanged lines hidden ---
189
190 node.append(FdtPropertyWords("interrupt-map", interrupts))
191
192 int_count = int(self.int_count)
193 if int_count & (int_count - 1):
194 fatal("PCI interrupt count should be power of 2")
195
196 intmask = self.pciFdtAddr(device=int_count - 1, addr=0) + [0x0]

--- 927 unchanged lines hidden ---