<commit_before>/**
 * \file
 * \brief Device manager for Barrelfish.
 *
 * Interacts with the SKB / PCI to start cores, drivers etc.
 *
 */

/*
 * Copyright (c) 2007-2010, ETH Zurich.
 * Copyright (c) 2015, Hewlett Packard Enterprise Development LP.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
 */

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <errors/errno.h>

#include <barrelfish/barrelfish.h>
#include <barrelfish/cpu_arch.h>
#include <barrelfish/nameservice_client.h>

#include <if/monitor_defs.h>

#include <vfs/vfs.h>
#include <pci/pci_types.h> // for pci_addr
#include <octopus/octopus.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_addr eth0 = {0xff, 0xff, 0xff};
size_t cpu_count = 0;

static void add_start_function_overrides(void)
{

    set_start_function("e10k", start_networking);
    set_start_function("net_sockets_server", start_networking);
    //set_start_function("sfn5122f", start_networking_new);
    set_start_function("sfn5122f", start_networking);
    set_start_function("rtl8029", start_networking);
    set_start_function("corectrl", start_boot_driver);
#ifdef __ARM_ARCH_7A__
    set_start_function("driverdomain", newstyle_start_function);
#endif
    set_start_function("driverdomain", default_start_function_new);
}

static void parse_arguments(int argc, char** argv, char ** add_device_db_file, size_t *cpu_count)
{
    for (int i = 1; i < argc; i++) {
        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=%" SCNu32 ":%" SCNu32 ":%" SCNu32,
                                &eth0.bus, &eth0.device, &eth0.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) {<commit_msg>kaluga: start e1000 using new driver model<commit_after>/**
 * \file
 * \brief Device manager for Barrelfish.
 *
 * Interacts with the SKB / PCI to start cores, drivers etc.
 *
 */

/*
 * Copyright (c) 2007-2010, ETH Zurich.
 * Copyright (c) 2015, Hewlett Packard Enterprise Development LP.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
 */

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <errors/errno.h>

#include <barrelfish/barrelfish.h>
#include <barrelfish/cpu_arch.h>
#include <barrelfish/nameservice_client.h>

#include <if/monitor_defs.h>

#include <vfs/vfs.h>
#include <pci/pci_types.h> // for pci_addr
#include <octopus/octopus.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_addr eth0 = {0xff, 0xff, 0xff};
size_t cpu_count = 0;

static void add_start_function_overrides(void)
{

    set_start_function("e10k", start_networking);
    set_start_function("net_sockets_server", start_networking);
    //set_start_function("sfn5122f", start_networking_new);
    set_start_function("e1000n", start_networking_new);
    set_start_function("sfn5122f", start_networking);
    set_start_function("rtl8029", start_networking);
    set_start_function("corectrl", start_boot_driver);
#ifdef __ARM_ARCH_7A__
    set_start_function("driverdomain", newstyle_start_function);
#endif
    set_start_function("driverdomain", default_start_function_new);
}

static void parse_arguments(int argc, char** argv, char ** add_device_db_file, size_t *cpu_count)
{
    for (int i = 1; i < argc; i++) {
        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=%" SCNu32 ":%" SCNu32 ":%" SCNu32,
                                &eth0.bus, &eth0.device, &eth0.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) {
{'fraction_non_alphanumeric': 0.1352881698685541, 'fraction_numerical': 0.030738119312436803, 'mean_word_length': 3.2601205857019813, 'pattern_counts': {'":': 4, '<': 35, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2310971', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1760, 'n_words': 428}