|
|
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) 1998-1999 by Apple Computer, Inc., All rights reserved.
27: *
28: * Interface definition for the BMac Ethernet Controller
29: *
30: * HISTORY
31: *
32: */
33:
34: #import <driverkit/kernelDriver.h>
35: #import <driverkit/IOEthernet.h>
36: #import <driverkit/IONetbufQueue.h>
37: #import <driverkit/ppc/IOTreeDevice.h>
38: #import <driverkit/ppc/IODBDMA.h>
39: #import <driverkit/generalFuncs.h>
40: #import <driverkit/IOPower.h>
41: #import <machdep/ppc/proc_reg.h> /* eieio */
42: #import <bsd/net/etherdefs.h>
43: #import <bsd/sys/systm.h> /* bcopy */
44: #import <driverkit/IOEthernetPrivate.h> /* debugger methods */
45: #import <kern/kdebug.h> /* Performance tracepoints */
46:
47: //#define IOLog kprintf
48:
49: #import "BMacEnetRegisters.h"
50:
51: typedef void * IOPPCAddress;
52:
53: typedef struct enet_dma_cmd_t
54: {
55: IODBDMADescriptor desc_seg[2];
56: } enet_dma_cmd_t;
57:
58: typedef struct enet_txdma_cmd_t
59: {
60: IODBDMADescriptor desc_seg[3];
61: } enet_txdma_cmd_t;
62:
63:
64: @interface BMacEnet:IOEthernet <IOPower>
65: {
66: volatile IOPPCAddress ioBaseHeathrow;
67: volatile IOPPCAddress ioBaseEnet;
68: volatile IODBDMAChannelRegisters *ioBaseEnetRxDMA;
69: volatile IODBDMAChannelRegisters *ioBaseEnetTxDMA;
70:
71: enet_addr_t myAddress;
72: IONetwork *networkInterface;
73: IONetbufQueue *transmitQueue;
74: BOOL isPromiscuous;
75: BOOL multicastEnabled;
76: BOOL isFullDuplex;
77:
78: BOOL resetAndEnabled;
79: unsigned int enetAddressOffset;
80:
81: unsigned long chipId;
82:
83: unsigned long phyType;
84: unsigned long phyMIIDelay;
85: unsigned char phyId;
86: unsigned char sromAddressBits;
87:
88: unsigned short phyStatusPrev;
89:
90: netbuf_t txNetbuf[TX_RING_LENGTH];
91: netbuf_t rxNetbuf[RX_RING_LENGTH];
92:
93: unsigned int txCommandHead; /* Transmit ring descriptor index */
94: unsigned int txCommandTail;
95: unsigned int txMaxCommand;
96: unsigned int rxCommandHead; /* Receive ring descriptor index */
97: unsigned int rxCommandTail;
98: unsigned int rxMaxCommand;
99:
100: unsigned char * dmaCommands;
101: enet_txdma_cmd_t * txDMACommands; /* TX descriptor ring ptr */
102: unsigned int txDMACommandsPhys;
103:
104: enet_dma_cmd_t * rxDMACommands; /* RX descriptor ring ptr */
105: unsigned int rxDMACommandsPhys;
106:
107: u_int32_t txWDInterrupts;
108: u_int32_t txWDCount;
109:
110: netbuf_t debuggerPkt;
111: u_int32_t debuggerPktSize;
112: u_int32_t debuggerLockCount;
113:
114: u_int16_t statReg; /* Current STAT register contents */
115:
116: u_int16_t hashTableUseCount[64];
117: u_int16_t hashTableMask[4];
118:
119: }
120:
121: + (BOOL)probe:devDesc;
122: - initFromDeviceDescription:devDesc;
123:
124: - free;
125: - (void)transmit:(netbuf_t)pkt;
126: - (void)serviceTransmitQueue;
127: - (BOOL)resetAndEnable:(BOOL)enable;
128:
129: - (void)interruptOccurredAt:(int)irqNum;
130: - (void)timeoutOccurred;
131:
132: - (BOOL)enableMulticastMode;
133: - (void)disableMulticastMode;
134: - (BOOL)enablePromiscuousMode;
135: - (void)disablePromiscuousMode;
136:
137: /*
138: * Kernel Debugger
139: */
140: - (void)sendPacket:(void *)pkt length:(unsigned int)pkt_len;
141: - (void)receivePacket:(void *)pkt length:(unsigned int *)pkt_len timeout:(unsigned int)timeout;
142:
143: /*
144: * Power management methods.
145: */
146: - (IOReturn)getPowerState:(PMPowerState *)state_p;
147: - (IOReturn)setPowerState:(PMPowerState)state;
148: - (IOReturn)getPowerManagement:(PMPowerManagementState *)state_p;
149: - (IOReturn)setPowerManagement:(PMPowerManagementState)state;
150:
151: /*
152: * Queue interface
153: */
154: - (int) transmitQueueSize;
155: - (int) transmitQueueCount;
156:
157: @end
158:
159: /*
160: * Performance tracepoints
161: *
162: * DBG_BMAC_RXIRQ - Receive ISR run time
163: * DBG_BMAC_TXIRQ - Transmit ISR run time
164: * DBG_BMAC_TXQUEUE - Transmit packet passed from network stack
165: * DBG_BMAC_TXCOMPLETE - Transmit packet sent
166: * DBG_BMAC_RXCOMPLETE - Receive packet passed to network stack
167: */
168: #define DBG_BMAC_ENET 0x0900
169: #define DBG_BMAC_RXIRQ DRVDBG_CODE(DBG_DRVNETWORK,(DBG_BMAC_ENET+1))
170: #define DBG_BMAC_TXIRQ DRVDBG_CODE(DBG_DRVNETWORK,(DBG_BMAC_ENET+2))
171: #define DBG_BMAC_TXQUEUE DRVDBG_CODE(DBG_DRVNETWORK,(DBG_BMAC_ENET+3))
172: #define DBG_BMAC_TXCOMPLETE DRVDBG_CODE(DBG_DRVNETWORK,(DBG_BMAC_ENET+4))
173: #define DBG_BMAC_RXCOMPLETE DRVDBG_CODE(DBG_DRVNETWORK,(DBG_BMAC_ENET+5))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.