aboutsummaryrefslogtreecommitdiff
path: root/libmachdev/ds_routines.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2020-07-25 11:18:44 +1000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-25 13:09:31 +0200
commit67c9d475e7204296ca9bcfbd08a896df1a87e74a (patch)
tree2a1d624c891740becfb2b95dd547dba4aa779036 /libmachdev/ds_routines.c
parent1bb4fdc3a2c725276d457d2fa7cd1962d3e232d6 (diff)
downloadhurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.tar.gz
hurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.tar.bz2
hurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.zip
libmachdev: Add resume for bootstrap server
machdev users can now pass along a port to the next translator in the bootstrap chain (bootstrap_resume_task), that they'll get from their command line set by the bootloader. machdev will then call task_resume on it as appropriate. It will also have the opportunity to get fsys_getpriv calls, and thus redirect the device master port, thus having the opportunity to expose its devices on the device master port, as if they were handled by the kernel. Message-Id: <20200725011847.186969-1-damien@zamaudio.com>
Diffstat (limited to 'libmachdev/ds_routines.c')
-rw-r--r--libmachdev/ds_routines.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index da5e47e2..53e0c080 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -65,6 +65,7 @@
#include <hurd.h>
#include <mach.h>
+#include <device/device.h> /* fallback to kernel device */
#include "device_S.h"
#include "notify_S.h"
@@ -94,7 +95,8 @@ ds_device_open (mach_port_t open_port, mach_port_t reply_port,
char *name, device_t *devp, mach_msg_type_name_t *devicePoly)
{
int i;
- io_return_t err;
+ mach_port_t dev_master;
+ io_return_t err = D_NO_SUCH_DEVICE;
/* Open must be called on the master device port. */
if (!machdev_is_master_device (open_port))
@@ -108,11 +110,18 @@ ds_device_open (mach_port_t open_port, mach_port_t reply_port,
for (i = 0; i < num_emul; i++)
{
err = (*emulation_list[i]->open) (reply_port, reply_port_type,
- mode, name, devp, devicePoly);
+ mode, name, devp, devicePoly);
if (err != D_NO_SUCH_DEVICE)
- break;
+ break;
}
+ /* Fall back to opening kernel device master */
+ if (err)
+ {
+ get_privileged_ports(NULL, &dev_master);
+ err = device_open (dev_master, mode, name, devp);
+ *devicePoly = MACH_MSG_TYPE_MOVE_SEND;
+ }
return err;
}