1
/******************************************************************************
2
* Copyright (c) 2004, 2008 IBM Corporation
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
10
* IBM Corporation - initial implementation
11
*****************************************************************************/
13
#ifndef _NETDRIVER_INT_H
14
#define _NETDRIVER_INT_H
16
#include <unistd.h> /* ssize_t */
19
#if defined(__GNUC__) && !defined(UNUSED)
20
# define UNUSED __attribute__((unused))
37
mod_config_type config_type;
38
unsigned long long puid;
41
unsigned int vendor_id;
42
unsigned int device_id;
43
unsigned int revision_id;
44
unsigned int class_code;
46
unsigned int interrupt_line;
50
mod_config_type config_type;
56
#define MOD_TYPE_NETWORK 0
57
#define MOD_TYPE_OTHER 1
59
typedef int (*mod_init_t) (void);
60
typedef int (*mod_term_t) (void);
61
typedef int (*mod_socket_t)(snk_fileio_t *, int dom, int type, int proto);
62
typedef int (*mod_open_t) (snk_fileio_t *, const char *, int);
63
typedef int (*mod_read_t) (char *, int);
64
typedef int (*mod_write_t) (char *, int);
65
typedef int (*mod_ioctl_t) (int, void *);
83
#define MODULES_MAX 10
84
extern snk_module_t *snk_modules[MODULES_MAX];
86
typedef int (*print_t) (const char *, ...);
87
typedef void (*us_delay_t) (unsigned int);
88
typedef void (*ms_delay_t) (unsigned int);
89
typedef int (*pci_config_read_t) (long long puid, int size,
90
int bus, int devfn, int offset);
91
typedef int (*pci_config_write_t) (long long puid, int size,
92
int bus, int devfn, int offset, int value);
93
typedef void *(*malloc_aligned_t) (size_t, int);
94
typedef void *(*malloc_t) (size_t);
95
typedef void (*free_t) (void *);
96
typedef int (*strcmp_t) (const char *, const char *);
97
typedef int (*snk_call_t) (int, char **);
98
typedef unsigned int (*io_read_t) (void *, size_t);
99
typedef int (*io_write_t) (void *, unsigned int, size_t);
100
typedef unsigned int (*romfs_lookup_t) (const char *name, void **addr);
101
typedef void (*translate_addr_t) (unsigned long *);
103
typedef int (*k_open_t) (const char *, int);
104
typedef int (*k_close_t) (int);
105
typedef ssize_t (*k_read_t) (int, void *, size_t);
106
typedef ssize_t (*k_write_t) (int, const void *, size_t);
107
typedef int (*k_ioctl_t) (int, int, void *);
109
typedef void (*modules_remove_t) (int);
110
typedef snk_module_t *(*modules_load_t) (int);
112
typedef long (*dma_map_in_t)(void *address, long size, int cachable);
113
typedef void (*dma_map_out_t)(void *address, long devaddr, long size);
120
pci_config_read_t pci_config_read;
121
pci_config_write_t pci_config_write;
123
malloc_aligned_t k_malloc_aligned;
129
romfs_lookup_t k_romfs_lookup;
130
translate_addr_t translate_addr;
132
pci_config_t pci_conf;
133
vio_config_t vio_conf;
140
modules_remove_t modules_remove;
141
modules_load_t modules_load;
142
dma_map_in_t dma_map_in;
143
dma_map_out_t dma_map_out;
146
/* Entry of module */
147
snk_module_t *module_init(snk_kernel_t * snk_kernel_int,
148
pci_config_t * pciconf);
152
* Constants for different kinds of IOCTL requests
155
#define SIOCETHTOOL 0x1000
158
* special structure and constants for IOCTL requests of type ETHTOOL
161
#define ETHTOOL_GMAC 0x03
162
#define ETHTOOL_SMAC 0x04
163
#define ETHTOOL_VERSION 0x05
168
} ioctl_ethtool_mac_t;
173
} ioctl_ethtool_version_t;
177
* default structure and constants for IOCTL requests
180
#define IF_NAME_SIZE 0xFF
183
char if_name[IF_NAME_SIZE];
186
ioctl_ethtool_mac_t mac;
187
ioctl_ethtool_version_t version;
191
#endif /* _NETDRIVER_INT_H */