#include <if/monitor_blocking_rpcclient_defs.h>
#endif
+#ifdef __x86__
+#include <pci/pci.h>
+#endif
+
#include "kaluga.h"
#ifdef __x86__
assert(driver != NULL);
errval_t err = SYS_ERR_OK;
+ uint64_t vendor_id, device_id, bus, dev, fun;
+
+ /* check if we are using the supplied pci address of eth0 */
+ if (eth0.bus != 0xff || eth0.device != 0xff || eth0.function != 0xff) {
+ err = oct_read(record, "_ { bus: %d, device: %d, function: %d, vendor: %d, device_id: %d }",
+ &bus, &dev, &fun, &vendor_id, &device_id);
+ assert(err_is_ok(err));
+
+ if ((eth0.bus != (uint8_t)bus)
+ | (eth0.device != (uint8_t)dev)
+ | (eth0.function != (uint8_t)fun)) {
+ KALUGA_DEBUG("start_networking: skipping card %" PRIu64 ":% "PRIu64 ":% "
+ PRIu64"\n", bus, dev, fun);
+ return KALUGA_ERR_DRIVER_NOT_AUTO;
+ }
+ }
+
if (is_started(driver)) {
return KALUGA_ERR_DRIVER_ALREADY_STARTED;
}
KALUGA_DEBUG("NGD_mng not found or not declared as auto.");
return KALUGA_ERR_DRIVER_NOT_AUTO;
}
+
err = default_start_function(core, driver, record);
- //err = spawn_program(core, driver->path, driver->argv + 1, environ, 0,
- // get_did_ptr(driver));
if (err_is_fail(err)) {
DEBUG_ERR(err, "Spawning %s failed.", driver->path);
return err;
#include <if/monitor_defs.h>
#include <vfs/vfs.h>
+#include <pci/pci.h> // for pci_addr
#include <octopus/octopus.h>
#include <skb/skb.h>
#include <thc/thc.h>
#include <trace/trace.h>
-
#include "kaluga.h"
+
coreid_t my_core_id = 0; // Core ID
uint32_t my_arch_id = 0; // APIC ID
+struct pci_address eth0 = {0xff, 0xff, 0xff};
static void add_start_function_overrides(void)
{
static void parse_arguments(int argc, char** argv)
{
for (int i = 1; i < argc; i++) {
- if (strncmp(argv[i], "apicid=", sizeof("apicid")) == 0) {
- my_arch_id = strtol(argv[i] + sizeof("apicid"), NULL, 10);
+ if (strncmp(argv[i], "apicid=", 7) == 0) {
+ my_arch_id = strtol(argv[i] + 7, NULL, 10);
+ } else if (strncmp(argv[i], "eth0=", 5) == 0) {
+ int parsed = sscanf(argv[i], "eth0=%" SCNu8 ":%" SCNu8 ":%" SCNu8,
+ ð0.bus, ð0.device, ð0.function);
+ printf("Kaluga using eth0=%u:%u:%u as network device\n", eth0.bus,
+ eth0.device, eth0.function);
+ if (parsed != 3) {
+ eth0.bus = 0xff;
+ eth0.device = 0xff;
+ eth0.function = 0xff;
+ }
} else if (strcmp(argv[i], "boot") == 0) {
// ignored
}