diff --git a/src/system/boot/platform/pxe_ia32/Jamfile b/src/system/boot/platform/pxe_ia32/Jamfile index 91024aee51..705ab13ee5 100644 --- a/src/system/boot/platform/pxe_ia32/Jamfile +++ b/src/system/boot/platform/pxe_ia32/Jamfile @@ -22,7 +22,6 @@ local bios_ia32_src = bios.S console.cpp serial.cpp - devices.cpp keyboard.cpp menu.cpp mmu.cpp @@ -36,6 +35,9 @@ local bios_ia32_src = KernelMergeObject boot_platform_pxe_ia32.o : pxe_stage2.S smp_trampoline.S + devices.cpp + network.cpp + pxe_undi.cpp $(bios_ia32_src) # generic diff --git a/src/system/boot/platform/pxe_ia32/devices.cpp b/src/system/boot/platform/pxe_ia32/devices.cpp new file mode 100644 index 0000000000..7301cd668c --- /dev/null +++ b/src/system/boot/platform/pxe_ia32/devices.cpp @@ -0,0 +1,84 @@ +/* + * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2006, Marcus Overhagen, marcus@overhagen.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include "bios.h" +#include "pxe_undi.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define TRACE_DEVICES +#ifdef TRACE_DEVICES +# define TRACE(x...) dprintf(x) +#else +# define TRACE(x...) +#endif + + +status_t +platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) +{ + TRACE("platform_add_boot_device\n"); + + status_t error = net_stack_init(); + if (error != B_OK) + return error; + + // init a remote disk, if possible + RemoteDisk *remoteDisk = RemoteDisk::FindAnyRemoteDisk(); + if (!remoteDisk) + return B_ENTRY_NOT_FOUND; + + devicesList->Add(remoteDisk); + return B_OK; +} + + +status_t +platform_get_boot_partition(struct stage2_args *args, Node *device, + NodeList *list, boot::Partition **_partition) +{ + TRACE("platform_get_boot_partition\n"); + NodeIterator iterator = list->GetIterator(); + boot::Partition *partition = NULL; + while ((partition = (boot::Partition *)iterator.Next()) != NULL) { + // ToDo: just take the first partition for now + *_partition = partition; + return B_OK; + } + + return B_ENTRY_NOT_FOUND; +} + + +status_t +platform_add_block_devices(stage2_args *args, NodeList *devicesList) +{ + TRACE("platform_add_block_devices\n"); + return B_OK; +} + + +status_t +platform_register_boot_device(Node *device) +{ + TRACE("platform_register_boot_device\n"); + disk_identifier &disk = gKernelArgs.boot_disk.identifier; + + disk.bus_type = UNKNOWN_BUS; + disk.device_type = UNKNOWN_DEVICE; + disk.device.unknown.size = device->Size(); + + return B_OK; +} diff --git a/src/system/boot/platform/pxe_ia32/network.cpp b/src/system/boot/platform/pxe_ia32/network.cpp new file mode 100644 index 0000000000..ac7b02edc7 --- /dev/null +++ b/src/system/boot/platform/pxe_ia32/network.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2006, Marcus Overhagen +#include +#include +#include + +#include +#include + +#include +#include + +#include "pxe_undi.h" + +#define TRACE_NETWORK +#ifdef TRACE_NETWORK +# define TRACE(x...) dprintf(x) +#else +# define TRACE(x...) +#endif + + +status_t +platform_net_stack_init() +{ + TRACE("platform_net_stack_init\n"); + + pxe_undi_init(); + + return B_OK; +} diff --git a/src/system/boot/platform/pxe_ia32/pxe_undi.cpp b/src/system/boot/platform/pxe_ia32/pxe_undi.cpp new file mode 100644 index 0000000000..d890a047ae --- /dev/null +++ b/src/system/boot/platform/pxe_ia32/pxe_undi.cpp @@ -0,0 +1,52 @@ +/* + * Copyright 2006, Marcus Overhagen +#include + +#include "pxe_undi.h" + +#define TRACE_UNDI +#ifdef TRACE_UNDI +# define TRACE(x...) dprintf(x) +#else +# define TRACE(x...) +#endif + + +struct pxe_struct +{ + uint32 signature; +}; + +pxe_struct *gPxeData; + + +pxe_struct * +pxe_undi_find_data() +{ + pxe_struct *data = NULL; + for (char *addr = (char *)0x8D000; addr < (char *)0xA0000; addr += 16) { + if (*(uint32 *)addr == 'EXP!' /* '!PXE' */) { + TRACE("found !PXE at %p\n", addr); + data = (pxe_struct *)addr; + break; + } + } + return data; +} + + +void +pxe_undi_init() +{ + TRACE("pxe_undi_init\n"); + + gPxeData = pxe_undi_find_data(); + if (!gPxeData) + panic("can't find !PXE structure"); + + +} diff --git a/src/system/boot/platform/pxe_ia32/pxe_undi.h b/src/system/boot/platform/pxe_ia32/pxe_undi.h new file mode 100644 index 0000000000..6d9a3c9bfe --- /dev/null +++ b/src/system/boot/platform/pxe_ia32/pxe_undi.h @@ -0,0 +1,6 @@ +/* + * Copyright 2006, Marcus Overhagen