summaryrefslogtreecommitdiffstats
path: root/common/resource.c
Commit message (Collapse)AuthorAgeFilesLines
* resource: add flags parameter to __request_regionAhmad Fatoum2022-08-181-6/+7
| | | | | | | | | | | | | __request_region allocates a child resource within the parent resource, which so far always had a flags field of zero. Later commits will use the flags field to mark reserved SDRAM regions, so MMU init code can take that into consideration and ensure that CPU doesn't speculate into these regions and risk aborts. Prepare for this by giving __request_region a flags parameter. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220817114244.1810531-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory: fuse overlapping memory banksAhmad Fatoum2021-06-021-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Some ARM subarchitectures read back RAM size from the SDRAM controller and use the info to register memory banks. If an overlapping memory region is already registered, e.g. via device tree /memory, this second registration will fail. This is especially annoying as it can regress after a device tree sync: - Kind soul updates upstream device tree to describe minimal available RAM across hardware variants - barebox PBL has enough info about the board to set up larger RAM size and relocates barebox to the end of the RAM - barebox proper starts with new device tree and is upset to find itself outside of registered memory Account for this by growing the existing bank if a bank to be added happens to overlap it. As a special case, if the existing bank completely contains the new memory bank, the function is a no-op. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: include region name in conflict's debug outputAhmad Fatoum2021-03-161-2/+4
| | | | | | | | | | | The iomem command does print names, but it won't list dynamically allocated and deallocated regions, like those requested during bootm. Include region name in conflict debug output to make them easier to debug. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: replace license statements with SPDX-License-IdentifiersAhmad Fatoum2020-11-271-9/+1
| | | | | | | | | | | | | For all files in common/ that already have a license text: - Replace with appropriate SPDX-License-Identifier - Remove empty comment lines around replacement - remove comment completely if only thing remaining is name of file without description Reviewed-by: Roland Hieber <rhi@pengutronix.de> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-271-3/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: fix typos found with codespellYegor Yefremov2020-03-231-1/+1
| | | | | Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: fix iomem_resource.end for 64 bit systemsPeter Mamonov2018-05-231-1/+1
| | | | | | | | Fix iomem_resource.end to cover the whole address space addressable by a variable of type resource_size_t. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let request_ioport_region return an error pointerSascha Hauer2014-09-161-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let request_iomem_region return an error pointerSascha Hauer2014-09-161-7/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let __request_region return an error pointerSascha Hauer2014-09-161-5/+18
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "common: resource: print conflicts as warning"Sascha Hauer2014-08-041-1/+1
| | | | | | | | | | | | | | On several i.MX boards we register SDRAM with the values from the SDRAM controller and also with values from the device tree. This now issues a warning each time the board is started. Revert the commit for now. A better solution might be to check if the same SDRAM region already exists before trying to register it again. This reverts commit c9e2e08edcdce4205821226817686e62dc349eab. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: resource: print conflicts as warningAlexander Aring2014-06-241-1/+1
| | | | | | | | | | | | | | | Crazy things happen if there are resource conflicts and a device probe runs dev_request_mem_region. The dev_request_mem_region returns a start pointer which is zero. The probe function doesn't check on this and probing the device on zero base address. To debug this in debug log level there are many other outputs. This patch replace the debug print to a warning printout. A conflict should normally never happen. If there is a conflict it's much easier to see it with this patch. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: Allow for I/O mapped I/OMichel Stam2014-04-081-5/+23
| | | | | | | | Rework the current framework so that I/O mapped I/O resources are also possible. Signed-off-by: Michel Stam <michel@reverze.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix format specifiersSascha Hauer2013-01-271-7/+19
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: statically initialize iomem resourceSascha Hauer2012-10-071-8/+2
| | | | | | | This gets us rid of an initcall and also has the advantage that request_iomem_region can be called at any time now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-011-13/+17
| | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add resource management functionsSascha Hauer2011-12-031-0/+121
It is time to track our memory usage. Add a simple resource management. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>