diff options
author | Joan Lledó <jlledom@member.fsf.org> | 2022-08-15 18:15:20 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-15 20:33:03 +0200 |
commit | 8171d2aa48184a4d1ed1299e1c87f1b898371688 (patch) | |
tree | 3fae659c5065eccf4a45864fca2e0038d76c4465 /pci-arbiter/device_map.c | |
parent | b6509385bb1dd2a6d47401465bfb98b6339c5c2b (diff) | |
download | hurd-8171d2aa48184a4d1ed1299e1c87f1b898371688.tar.gz hurd-8171d2aa48184a4d1ed1299e1c87f1b898371688.tar.bz2 hurd-8171d2aa48184a4d1ed1299e1c87f1b898371688.zip |
Implement mapping for ROM files
* pci-arbiter/device_map.h:
* pci-arbiter/device_map.c:
* New function: device_map_rom
* Copies the whole rom in the arbiter space.
* pci-arbiter/pcifs.h:
* struct pcifs_dirent:
* New field to store the mapping address for each device rom.
o pci-arbiter/func_files.h:
* pci-arbiter/func_files.c:
* read_rom_file:
* Retrieves the rom contents from the local space instead of
libpciaccess.
* pci-arbiter/netfs_impl.c:
* netfs_attempt_read:get_filemap_region
* Update call to read_rom_file.
* get_filemap_region:
* Uses the old code at netfs_get_filemap to get a proxy to
the device memory region.
* get_filemap_rom:
* Returns a proxy to the locally mapped device rom.
* netfs_get_filemap:
* Checks the requested file to map and calls get_filemap_rom,
get_filemap_region or returns en error.
Message-Id: <20220815161520.6059-2-jlledom@mailfence.com>
Diffstat (limited to 'pci-arbiter/device_map.c')
-rw-r--r-- | pci-arbiter/device_map.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pci-arbiter/device_map.c b/pci-arbiter/device_map.c index 1627746d..284d6e93 100644 --- a/pci-arbiter/device_map.c +++ b/pci-arbiter/device_map.c @@ -47,3 +47,26 @@ device_map_region (struct pci_device *device, struct pci_mem_region *region, return err; } + +error_t +device_map_rom (struct pci_device *device, void **addr) +{ + error_t err = 0; + vm_address_t fullrom; + + if (*addr == 0) + { + err = vm_allocate (mach_task_self (), &fullrom, device->rom_size, 1); + if (err) + return ENOMEM; + + err = pci_device_read_rom (device, (void *) fullrom); + if (err) + return err; + + /* Return */ + *addr = (void *) fullrom; + } + + return err; +} |