|
|
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: #ifndef _NETDRIVER_INT_H ! 14: #define _NETDRIVER_INT_H ! 15: #include <stddef.h> ! 16: #include <unistd.h> /* ssize_t */ ! 17: #include <fileio.h> ! 18: ! 19: #if defined(__GNUC__) && !defined(UNUSED) ! 20: # define UNUSED __attribute__((unused)) ! 21: #else ! 22: # define UNUSED ! 23: #endif ! 24: ! 25: typedef struct { ! 26: unsigned int addr; ! 27: unsigned int size; ! 28: int type; ! 29: } bar_t; ! 30: ! 31: ! 32: typedef struct { ! 33: unsigned long long puid; ! 34: unsigned int bus; ! 35: unsigned int devfn; ! 36: unsigned int vendor_id; ! 37: unsigned int device_id; ! 38: unsigned int revision_id; ! 39: unsigned int class_code; ! 40: bar_t bars[6]; ! 41: unsigned int interrupt_line; ! 42: } pci_config_t; ! 43: ! 44: typedef struct { ! 45: unsigned int reg; ! 46: char compat[64]; ! 47: } vio_config_t; ! 48: ! 49: #define MOD_TYPE_NETWORK 0 ! 50: #define MOD_TYPE_OTHER 1 ! 51: ! 52: typedef int (*mod_init_t) (void); ! 53: typedef int (*mod_term_t) (void); ! 54: typedef int (*mod_socket_t)(snk_fileio_t *, int dom, int type, int proto); ! 55: typedef int (*mod_open_t) (snk_fileio_t *, const char *, int); ! 56: typedef int (*mod_read_t) (char *, int); ! 57: typedef int (*mod_write_t) (char *, int); ! 58: typedef int (*mod_ioctl_t) (int, void *); ! 59: ! 60: typedef struct { ! 61: int version; ! 62: int type; ! 63: int running; ! 64: void *link_addr; ! 65: mod_init_t init; ! 66: mod_term_t term; ! 67: mod_socket_t socket; ! 68: mod_open_t open; ! 69: mod_read_t read; ! 70: mod_write_t write; ! 71: mod_ioctl_t ioctl; ! 72: ! 73: char mac_addr[6]; ! 74: } snk_module_t; ! 75: ! 76: #define MODULES_MAX 10 ! 77: extern snk_module_t *snk_modules[MODULES_MAX]; ! 78: ! 79: typedef int (*print_t) (const char *, ...); ! 80: typedef void (*us_delay_t) (unsigned int); ! 81: typedef void (*ms_delay_t) (unsigned int); ! 82: typedef int (*pci_config_read_t) (long long puid, int size, ! 83: int bus, int devfn, int offset); ! 84: typedef int (*pci_config_write_t) (long long puid, int size, ! 85: int bus, int devfn, int offset, int value); ! 86: typedef void *(*malloc_aligned_t) (size_t, int); ! 87: typedef void *(*malloc_t) (size_t); ! 88: typedef void (*free_t) (void *); ! 89: typedef int (*strcmp_t) (const char *, const char *); ! 90: typedef int (*snk_call_t) (int, char **); ! 91: typedef unsigned int (*io_read_t) (void *, size_t); ! 92: typedef int (*io_write_t) (void *, unsigned int, size_t); ! 93: typedef unsigned int (*romfs_lookup_t) (const char *name, void **addr); ! 94: typedef void (*translate_addr_t) (unsigned long *); ! 95: ! 96: typedef int (*k_open_t) (const char *, int); ! 97: typedef int (*k_close_t) (int); ! 98: typedef ssize_t (*k_read_t) (int, void *, size_t); ! 99: typedef ssize_t (*k_write_t) (int, const void *, size_t); ! 100: typedef int (*k_ioctl_t) (int, int, void *); ! 101: ! 102: typedef void (*modules_remove_t) (int); ! 103: typedef snk_module_t *(*modules_load_t) (int); ! 104: ! 105: typedef struct { ! 106: int version; ! 107: print_t print; ! 108: us_delay_t us_delay; ! 109: ms_delay_t ms_delay; ! 110: pci_config_read_t pci_config_read; ! 111: pci_config_write_t pci_config_write; ! 112: malloc_t k_malloc; ! 113: malloc_aligned_t k_malloc_aligned; ! 114: free_t k_free; ! 115: strcmp_t strcmp; ! 116: snk_call_t snk_call; ! 117: io_read_t io_read; ! 118: io_write_t io_write; ! 119: romfs_lookup_t k_romfs_lookup; ! 120: translate_addr_t translate_addr; ! 121: union { ! 122: pci_config_t pci_conf; ! 123: vio_config_t vio_conf; ! 124: }; ! 125: k_open_t k_open; ! 126: k_close_t k_close; ! 127: k_read_t k_read; ! 128: k_write_t k_write; ! 129: k_ioctl_t k_ioctl; ! 130: modules_remove_t modules_remove; ! 131: modules_load_t modules_load; ! 132: } snk_kernel_t; ! 133: ! 134: /* Entry of module */ ! 135: snk_module_t *module_init(snk_kernel_t * snk_kernel_int, ! 136: pci_config_t * pciconf); ! 137: ! 138: ! 139: /* ! 140: * Constants for different kinds of IOCTL requests ! 141: */ ! 142: ! 143: #define SIOCETHTOOL 0x1000 ! 144: ! 145: /* ! 146: * special structure and constants for IOCTL requests of type ETHTOOL ! 147: */ ! 148: ! 149: #define ETHTOOL_GMAC 0x03 ! 150: #define ETHTOOL_SMAC 0x04 ! 151: #define ETHTOOL_VERSION 0x05 ! 152: ! 153: typedef struct { ! 154: int idx; ! 155: char address[6]; ! 156: } ioctl_ethtool_mac_t; ! 157: ! 158: typedef struct { ! 159: unsigned int length; ! 160: char *text; ! 161: } ioctl_ethtool_version_t; ! 162: ! 163: ! 164: /* ! 165: * default structure and constants for IOCTL requests ! 166: */ ! 167: ! 168: #define IF_NAME_SIZE 0xFF ! 169: ! 170: typedef struct { ! 171: char if_name[IF_NAME_SIZE]; ! 172: int subcmd; ! 173: union { ! 174: ioctl_ethtool_mac_t mac; ! 175: ioctl_ethtool_version_t version; ! 176: } data; ! 177: } ioctl_net_data_t; ! 178: ! 179: /* paflof */ ! 180: enum { ! 181: PAFLOF_GDEPTH, ! 182: PAFLOF_GIO_BEHAVIOR, ! 183: PAFLOF_GSTATUS, ! 184: PAFLOF_POP, ! 185: PAFLOF_PUSH, ! 186: }; ! 187: /* - clint */ ! 188: enum { ! 189: CLINT_EXECUTE ! 190: }; ! 191: ! 192: #endif /* _NETDRIVER_INT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.