Index: trunk/Chameleon.xcodeproj/project.pbxproj =================================================================== --- trunk/Chameleon.xcodeproj/project.pbxproj (revision 2682) +++ trunk/Chameleon.xcodeproj/project.pbxproj (revision 2683) @@ -10,6 +10,8 @@ 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = ""; }; 361BC70214BD977700236488 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = ""; }; 361BC70B14BD97C800236488 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pkg.zip; path = Icons/pkg.zip; sourceTree = ""; }; + 36414DD01B065F880064E39A /* networking.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = networking.c; sourceTree = ""; }; + 36414DD11B065F880064E39A /* networking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = networking.h; sourceTree = ""; }; 364B195E1A029963009A30BA /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; 364B195F1A029963009A30BA /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = boot.png; sourceTree = ""; }; 364B19601A029963009A30BA /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_cdrom.png; sourceTree = ""; }; @@ -3298,6 +3300,8 @@ 3685F4181A1D60CF0036A800 /* msdos.h */, 3685F4191A1D60CF0036A800 /* nbp_cmd.h */, 3685F41A1A1D60CF0036A800 /* nbp.c */, + 36414DD01B065F880064E39A /* networking.c */, + 36414DD11B065F880064E39A /* networking.h */, 3685F41B1A1D60CF0036A800 /* ntfs_private.h */, 3685F41C1A1D60CF0036A800 /* ntfs.c */, 3685F41D1A1D60CF0036A800 /* ntfs.h */, Index: trunk/i386/libsaio/networking.c =================================================================== --- trunk/i386/libsaio/networking.c (revision 0) +++ trunk/i386/libsaio/networking.c (revision 2683) @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2009 Evan Lojewski. All rights reserved. + * + * Merge into file from module compcept by ErmaC and Marchrius + * + */ + +#include "boot.h" +#include "bootstruct.h" +#include "pci.h" +#include "platform.h" +#include "device_inject.h" +#include "networking.h" + +#ifndef DEBUG_NETWORKING + #define DEBUG_NETWORKING 0 +#endif + +#if DEBUG_NETWORKING + #define DBG(x...) printf(x) +#else + #define DBG(x...) +#endif + +uint32_t builtin_set = 0; +extern uint32_t devices_number; + +int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id) +{ + if(!device) + { + return 0; + } + + uint8_t builtin = 0x0; + if((vendor_id != 0x168c) && (builtin_set == 0)) + { + builtin_set = 1; + builtin = 0x01; + } + + if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1)) + { + return 0; + } + + devices_number++; + return 1; +} + +void setup_eth_builtin(pci_dt_t *eth_dev) +{ + char *devicepath = get_pci_dev_path(eth_dev); + DevPropDevice *device = NULL; + + verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); + + if(!string) + { + string = devprop_create_string(); + } + + device = devprop_add_device(string, devicepath); + if(device) + { + verbose("Setting up lan keys\n"); + devprop_add_network_template(device, eth_dev->vendor_id); + stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); + if(stringdata) + { + memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); + stringlength = string->length; + } + } +} + Index: trunk/i386/libsaio/networking.h =================================================================== --- trunk/i386/libsaio/networking.h (revision 0) +++ trunk/i386/libsaio/networking.h (revision 2683) @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2009 Evan Lojewski. All rights reserved. + * + * Merge into file from module compcept by ErmaC and Marchrius + * + */ + +#ifndef __LIBSAIO_NETWORKING_H +#define __LIBSAIO_NETWORKING_H + +void setup_eth_builtin(pci_dt_t *eth_dev); + +#endif /* !__LIBSAIO_NETWORKING_H */ Index: trunk/i386/libsaio/Makefile =================================================================== --- trunk/i386/libsaio/Makefile (revision 2682) +++ trunk/i386/libsaio/Makefile (revision 2683) @@ -37,7 +37,7 @@ smbios.o smbios_getters.o smbios_decode.o \ fake_efi.o ext2fs.o \ hpet.o dram_controllers.o spd.o usb.o pci_setup.o \ - device_inject.o nvidia_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \ + device_inject.o networking.o nvidia_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \ convert.o aml_generator.o console.o exfat.o base64-decode.o SAIO_OBJS := $(addprefix $(OBJROOT)/, $(SAIO_OBJS)) Index: trunk/i386/libsaio/device_inject.c =================================================================== --- trunk/i386/libsaio/device_inject.c (revision 2682) +++ trunk/i386/libsaio/device_inject.c (revision 2683) @@ -24,7 +24,6 @@ #endif uint32_t devices_number = 1; -uint32_t builtin_set = 0; DevPropString *string = NULL; uint8_t *stringdata = NULL; uint32_t stringlength = 0; @@ -402,51 +401,4 @@ /* a fine place for this code */ -int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id) -{ - if(!device) - { - return 0; - } - - uint8_t builtin = 0x0; - if((vendor_id != 0x168c) && (builtin_set == 0)) - { - builtin_set = 1; - builtin = 0x01; - } - - if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1)) - { - return 0; - } - - devices_number++; - return 1; -} - -void setup_eth_builtin(pci_dt_t *eth_dev) -{ - char *devicepath = get_pci_dev_path(eth_dev); - DevPropDevice *device = NULL; - - verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); - - if(!string) - { - string = devprop_create_string(); - } - - device = devprop_add_device(string, devicepath); - if(device) - { - verbose("Setting up lan keys\n"); - devprop_add_network_template(device, eth_dev->vendor_id); - stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); - if(stringdata) - { - memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); - stringlength = string->length; - } - } -} +// (devprop_add_network_template) and (setup_eth_builtin) moved to i386/libsaio/networking.c