summaryrefslogtreecommitdiff
path: root/pci-arbiter/main.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2021-03-16 16:47:15 +1100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-03-16 19:36:11 +0100
commitac1e123e56a2757cb3332e464fff6b23c36fdec1 (patch)
treeac9d54a57ac9feb2acc47bcfff9201fbe0e3bc53 /pci-arbiter/main.c
parentb901dab073de26f9052a0c69872c1f3d4f15eea7 (diff)
machdev,rump,pci: Rework bootstrap
* libmachdev/trivfs_server.c (bootstrapped): Rename to bootstrapping. (trivfs_S_fsys_startup): Call fsys_startup on the bootstrap port. (essential_task): New function. (trivfs_S_fsys_init): Call fsys_init on the bootstrap port. Configure proc. Mark us as essential when bootstrapping even without a devnode. (arrange_shutdown_notification): Do not configure proc. (machdev_trivfs_init): Always get the bootstrap port from the kernel, leave it MACH_PORT_NULL if unavailable. Call fsys_getpriv on it if it is. * pci-arbiter/Makefile (SRCS): Remove startup.c. * pci-arbiter/startup.c: Delete file. * pci-arbiter/startup.h: Delete file. * pci-arbiter/main.c: Do not include "startup.h" (pci_device_shutdown): Do not try to lokup the dosync_handle. (pcifs_startup): Always create the pci_control_port right on the control port. (main): Call machdev_device_init after machdev_trivfs_init. Do not call arrange_shutdown_notification. * rumpdisk/main.c (netfs_server_name): Don't pretend to be the arbiter anymore (main): Call machdev_device_init after machdev_trivfs_init. Message-Id: <20210316054715.788725-1-damien@zamaudio.com>
Diffstat (limited to 'pci-arbiter/main.c')
-rw-r--r--pci-arbiter/main.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c
index efb9f65c..1815994a 100644
--- a/pci-arbiter/main.c
+++ b/pci-arbiter/main.c
@@ -43,7 +43,6 @@
#include <pciaccess.h>
#include <pthread.h>
#include "pcifs.h"
-#include "startup.h"
struct pcifs *fs;
volatile struct mapped_time_value *pcifs_maptime;
@@ -106,17 +105,9 @@ pci_device_close (void *d)
static void
pci_device_shutdown (mach_port_t dosync_handle)
{
- struct port_info *inpi = ports_lookup_port (netfs_port_bucket, dosync_handle,
- pci_shutdown_notify_class);
-
- if (!inpi)
- return;
-
// Free all libpciaccess resources
pci_system_cleanup ();
- ports_port_deref (inpi);
-
ports_destroy_right (&pci_control_port);
netfs_shutdown (FSYS_GOAWAY_FORCE);
@@ -192,15 +183,17 @@ pcifs_startup(mach_port_t bootstrap, int flags)
err = ports_create_port (netfs_control_class, netfs_port_bucket,
sizeof (struct port_info), &newpi);
- if (!err)
+ if (err)
+ error (11, err, "Translator startup failure: pcifs_startup");
+
+ pci_control_port = ports_get_send_right (newpi);
+
+ if (bootstrap != MACH_PORT_NULL)
{
- pci_control_port = ports_get_send_right (newpi);
err = fsys_startup (bootstrap, flags, pci_control_port, MACH_MSG_TYPE_COPY_SEND,
- &realnode);
+ &realnode);
assert_perror_backtrace (err);
}
- if (err)
- error (11, err, "Translator startup failure: fsys_startup");
return realnode;
}
@@ -221,8 +214,8 @@ main (int argc, char **argv)
if (disk_server_task != MACH_PORT_NULL)
{
machdev_register (&pci_arbiter_emulation_ops);
- machdev_device_init ();
machdev_trivfs_init (disk_server_task, "pci", "/servers/bus/pci", &bootstrap);
+ machdev_device_init ();
err = pthread_create (&t, NULL, machdev_server, NULL);
if (err)
error (1, err, "Creating machdev thread");
@@ -278,12 +271,6 @@ main (int argc, char **argv)
error (1, err, "Creating netfs loop thread");
pthread_detach (nt);
- /*
- * Ask init to tell us when the system is going down,
- * so we can try to be friendly to our correspondents on the network.
- */
- arrange_shutdown_notification ();
-
/* Let the other threads do their job */
pthread_exit(NULL);
/* Never reached */