Chameleon

Chameleon Commit Details

Date:2015-05-15 19:10:54 (5 years 6 months ago)
Author:ErmaC
Commit:2683
Parents: 2682
Message:Split out devprop_add_network_template and setup_eth_builtin to networking.c
Changes:
A/trunk/i386/libsaio/networking.c
A/trunk/i386/libsaio/networking.h
M/trunk/Chameleon.xcodeproj/project.pbxproj
M/trunk/i386/libsaio/device_inject.c
M/trunk/i386/libsaio/Makefile

File differences

trunk/Chameleon.xcodeproj/project.pbxproj
1010
1111
1212
13
14
1315
1416
1517
......
32983300
32993301
33003302
3303
3304
33013305
33023306
33033307
019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = "<group>"; };
361BC70214BD977700236488 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = "<group>"; };
361BC70B14BD97C800236488 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pkg.zip; path = Icons/pkg.zip; sourceTree = "<group>"; };
36414DD01B065F880064E39A /* networking.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = networking.c; sourceTree = "<group>"; };
36414DD11B065F880064E39A /* networking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = networking.h; sourceTree = "<group>"; };
364B195E1A029963009A30BA /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = "<group>"; };
364B195F1A029963009A30BA /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = boot.png; sourceTree = "<group>"; };
364B19601A029963009A30BA /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_cdrom.png; sourceTree = "<group>"; };
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 */,
trunk/i386/libsaio/networking.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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_tbuiltin_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;
}
}
}
trunk/i386/libsaio/networking.h
1
2
3
4
5
6
7
8
9
10
11
12
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 */
trunk/i386/libsaio/Makefile
3737
3838
3939
40
40
4141
4242
4343
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))
trunk/i386/libsaio/device_inject.c
2424
2525
2626
27
2827
2928
3029
......
402401
403402
404403
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
404
#endif
uint32_tdevices_number= 1;
uint32_tbuiltin_set= 0;
DevPropString*string= NULL;
uint8_t*stringdata= NULL;
uint32_tstringlength= 0;
/* 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

Archive Download the corresponding diff file

Revision: 2683