posix file: Let the OS decide addresses to map to
Reverse the direction of the `Addr` parameter of Map(). We let mmap()
decide which address to use and return that. Given that we can set the
address for `MMIO_Range` instances during runtime, we shouldn't ever
have to force static addresses.
Change-Id: I35bfd65e7b471daae4f43a9233ce613c7f45891e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20552
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/ada/posix/hw-file.adb b/ada/posix/hw-file.adb
index 40b445d..d9b15ba 100644
--- a/ada/posix/hw-file.adb
+++ b/ada/posix/hw-file.adb
@@ -26,8 +26,8 @@
WRITE : constant := 16#02#;
function c_map
- (path : chars_ptr;
- addr : Word64;
+ (addr : out Word64;
+ path : chars_ptr;
len : Word32;
mode : Word32;
copy : int)
@@ -35,8 +35,8 @@
pragma Import (C, c_map, "hw_file_map");
procedure Map
- (Path : in String;
- Addr : in Word64;
+ (Addr : out Word64;
+ Path : in String;
Len : in Natural;
Readable : in Boolean := False;
Writable : in Boolean := False;
@@ -47,8 +47,8 @@
cpath : chars_ptr := New_String (Path);
ret : constant int := c_map
- (path => cpath,
- addr => Addr,
+ (addr => Addr,
+ path => cpath,
len => Word32 (Len),
mode => (if Readable then READ else 0) or
(if Writable then WRITE else 0),