mirror of
https://github.com/OpenAMP/libmetal.git
synced 2026-09-29 14:24:01 +08:00
lib/system/linux: pass correct offset to metal_map()
According to UIO documentation, the offset device tree property purpose is to be used "if the device’s memory is not page aligned". Quoting the same documentation: "To map the memory of mapping N, you have to use N times the page size as your offset" So wee need to pass i * getpagesize() to get the correct mapping, otherwise, we end up with all io_region pointing to the same area. Signed-off-by: Leo Sartre <sartre.l@ecagroup.com>
This commit is contained in:
@@ -238,7 +238,7 @@ static int metal_uio_dev_open(struct linux_bus *lbus, struct linux_device *ldev)
|
||||
result = (result ? result :
|
||||
metal_uio_read_map_attr(ldev, i, "size", &size));
|
||||
result = (result ? result :
|
||||
metal_map(ldev->fd, offset, size, 0, 0, &virt));
|
||||
metal_map(ldev->fd, i * getpagesize(), size, 0, 0, &virt));
|
||||
if (!result) {
|
||||
io = &ldev->device.regions[ldev->device.num_regions];
|
||||
metal_io_init(io, virt, phys, size, -1, 0, NULL);
|
||||
|
||||
Reference in New Issue
Block a user