|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1995-1996 NeXT Software, Inc.
27: *
28: * Interface definition for the DECchip 2104x
29: *
30: * HISTORY
31: *
32: * 26-Apr-95 Rakesh Dubey (rdubey) at NeXT
33: * Created.
34: * 11-Oct-95 Dieter Siegmund (dieter) at NeXT
35: * Added performance hooks; changed transmit interrupt
36: * to only interrupt every N / 2 times, where N is the
37: * number of transmit descriptors. This reduces the
38: * number of interrupts taken, and the amount of CPU
39: * used by the driver.
40: * 11-Dec-95 Dieter Siegmund (dieter) at NeXT
41: * Re-named 2104x.h, split out 21040 and 21041 personalities.
42: * 07-Feb-96 Dieter Siegmund (dieter) at NeXT
43: * Fixed multicast.
44: */
45:
46: //#define PERF
47: #ifdef PERF
48: #import "perfDevice.h"
49: #import "netEvents.h"
50: #define OUR_PRODUCER_NAME "DECchip21040"
51: #endif PERF
52:
53: #import <driverkit/kernelDriver.h>
54: #import <driverkit/align.h>
55: #import <driverkit/interruptMsg.h>
56: #import <driverkit/IOEthernet.h>
57: #import <driverkit/IONetbufQueue.h>
58: #import <driverkit/ppc/directDevice.h>
59: #import <driverkit/ppc/IOPCIDevice.h>
60: #import <driverkit/ppc/IOPPCDeviceDescription.h>
61: #import <driverkit/generalFuncs.h>
62: #import <driverkit/IOPower.h>
63: #import <net/etherdefs.h>
64: #import <string.h>
65: #import <driverkit/IOEthernetPrivate.h> /* Needed for MC-setup */
66:
67: #undef DEBUG
68:
69: #import "DECchip2104xShared.h"
70: #import "DECchip2104xRegisters.h"
71:
72: typedef unsigned long IOPPCAddress;
73:
74: @interface DECchip2104x:IOEthernet <IOPower>
75: {
76: IOPPCAddress ioBase;
77: unsigned short irq;
78: enet_addr_t myAddress;
79: IONetwork *networkInterface;
80: IONetbufQueue *transmitQueue;
81: BOOL isPromiscuous;
82: BOOL multicastEnabled;
83: BOOL isInterruptMasked;
84:
85: BOOL resetAndEnabled;
86:
87: netbuf_t txNetbuf[DEC_21X40_TX_RING_LENGTH];
88: netbuf_t rxNetbuf[DEC_21X40_RX_RING_LENGTH];
89:
90: rxDescriptorStruct *rxRing; /* RX descriptor ring ptr */
91: txDescriptorStruct *txRing; /* TX descriptor ring ptr */
92:
93: unsigned int txPutIndex; /* Transmit ring descriptor index */
94: unsigned int txDoneIndex;
95: unsigned int txNumFree;
96: unsigned int txIntCount; /* used to decide when to do tx int */
97: unsigned int rxDoneIndex; /* Receive ring descriptor index */
98:
99: netbuf_t KDB_txBuf;
100:
101: void *memoryPtr;
102: unsigned int memorySize;
103:
104: setupBuffer_t *setupBuffer;
105: unsigned long setupBufferPhysical;
106:
107: connector_t connector;
108:
109: csrRegUnion interruptMask;
110: csrRegUnion operationMode;
111: #ifdef PERF
112: perfQueue_t * perfQ;
113: perfProducerId_t ourProducerId;
114: perfEventHdr_t ev_p;
115: #endif PERF
116: }
117:
118: + (BOOL)probe:(IOPCIDevice *)devDesc;
119: - initFromDeviceDescription:(IODeviceDescription *)devDesc;
120:
121: - free;
122: - (void)serviceTransmitQueue;
123: - (void)transmit:(netbuf_t)pkt;
124: - (BOOL)resetAndEnable:(BOOL)enable;
125:
126: - (void)interruptOccurred;
127: - (void)timeoutOccurred;
128:
129: - (BOOL)enableMulticastMode;
130: - (void)disableMulticastMode;
131: - (void)addMulticastAddress:(enet_addr_t *)addr;
132: - (void)removeMulticastAddress:(enet_addr_t *)addr;
133:
134: - (BOOL)enablePromiscuousMode;
135: - (void)disablePromiscuousMode;
136:
137: - (void)selectInterface;
138: - (void)getStationAddress:(enet_addr_t *)ea;
139:
140: /*
141: * Queue interface
142: */
143: - (int) transmitQueueSize;
144: - (int) transmitQueueCount;
145: - (int) pendingTransmitCount;
146:
147: /*
148: * Power management methods.
149: */
150: - (IOReturn)getPowerState:(PMPowerState *)state_p;
151: - (IOReturn)setPowerState:(PMPowerState)state;
152: - (IOReturn)getPowerManagement:(PMPowerManagementState *)state_p;
153: - (IOReturn)setPowerManagement:(PMPowerManagementState)state;
154:
155: @end
156:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.