|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13: #include "netdriver_int.h"
14:
15: extern snk_module_t snk_module_interface;
16:
17: snk_kernel_t *snk_kernel_interface = 0;
18:
19: extern int
20: check_driver( pci_config_t *pci_conf );
21:
22:
23: static void*
24: memset( void *dest, int c, size_t n )
25: {
26: while( n-- ) {
27: *( char * ) dest++ = ( char ) c;
28: }
29: return dest;
30: }
31:
32:
33: extern char __bss_start;
34: extern char __bss_size;
35:
36: snk_module_t*
37: module_init(snk_kernel_t *snk_kernel_int, pci_config_t *pciconf)
38: {
39: /* Need to clear bss, heavy linker script dependency, expert change only */
40: char *bss = &__bss_start;
41: unsigned long long bss_size = (unsigned long long) &__bss_size;
42:
43: if (((unsigned long long) bss) + bss_size >= 0xFF00000
44: || bss_size >= 0x2000000) {
45: snk_kernel_int->print("BSS size (%llu bytes) is too big!\n", bss_size);
46: return 0;
47: }
48:
49: memset(bss, 0, bss_size);
50:
51: if (snk_kernel_int->version != snk_module_interface.version) {
52: return 0;
53: }
54:
55: snk_kernel_interface = snk_kernel_int;
56:
57: /* Check if this is the right driver */
58: if (check_driver(pciconf) < 0) {
59: return 0;
60: }
61:
62: snk_module_interface.link_addr = module_init;
63: return &snk_module_interface;
64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.