1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 84 unchanged lines hidden (view full) ---

93 // Event and function to deal with RDTR timer expiring
94 void rdtrProcess() {
95 rxDescCache.writeback(0);
96 DPRINTF(EthernetIntr,
97 "Posting RXT interrupt because RDTR timer expired\n");
98 postInterrupt(iGbReg::IT_RXT);
99 }
100
101 //friend class EventWrapper<IGbE, &IGbE::rdtrProcess>;
102 EventWrapper<IGbE, &IGbE::rdtrProcess> rdtrEvent;
101 EventFunctionWrapper rdtrEvent;
102
103 // Event and function to deal with RADV timer expiring
104 void radvProcess() {
105 rxDescCache.writeback(0);
106 DPRINTF(EthernetIntr,
107 "Posting RXT interrupt because RADV timer expired\n");
108 postInterrupt(iGbReg::IT_RXT);
109 }
110
112 //friend class EventWrapper<IGbE, &IGbE::radvProcess>;
113 EventWrapper<IGbE, &IGbE::radvProcess> radvEvent;
111 EventFunctionWrapper radvEvent;
112
113 // Event and function to deal with TADV timer expiring
114 void tadvProcess() {
115 txDescCache.writeback(0);
116 DPRINTF(EthernetIntr,
117 "Posting TXDW interrupt because TADV timer expired\n");
118 postInterrupt(iGbReg::IT_TXDW);
119 }
120
123 //friend class EventWrapper<IGbE, &IGbE::tadvProcess>;
124 EventWrapper<IGbE, &IGbE::tadvProcess> tadvEvent;
121 EventFunctionWrapper tadvEvent;
122
123 // Event and function to deal with TIDV timer expiring
124 void tidvProcess() {
125 txDescCache.writeback(0);
126 DPRINTF(EthernetIntr,
127 "Posting TXDW interrupt because TIDV timer expired\n");
128 postInterrupt(iGbReg::IT_TXDW);
129 }
133 //friend class EventWrapper<IGbE, &IGbE::tidvProcess>;
134 EventWrapper<IGbE, &IGbE::tidvProcess> tidvEvent;
130 EventFunctionWrapper tidvEvent;
131
132 // Main event to tick the device
133 void tick();
138 //friend class EventWrapper<IGbE, &IGbE::tick>;
139 EventWrapper<IGbE, &IGbE::tick> tickEvent;
134 EventFunctionWrapper tickEvent;
135
136
137 uint64_t macAddr;
138
139 void rxStateMachine();
140 void txStateMachine();
141 void txWire();
142

--- 9 unchanged lines hidden (view full) ---

152 */
153 void chkInterrupt();
154
155 /** Send an interrupt to the cpu
156 */
157 void delayIntEvent();
158 void cpuPostInt();
159 // Event to moderate interrupts
165 EventWrapper<IGbE, &IGbE::delayIntEvent> interEvent;
160 EventFunctionWrapper interEvent;
161
162 /** Clear the interupt line to the cpu
163 */
164 void cpuClearInt();
165
166 Tick intClock() { return SimClock::Int::ns * 1024; }
167
168 /** This function is used to restart the clock so it can handle things like

--- 105 unchanged lines hidden (view full) ---

274 /** If the address/len/head change when we've got descriptors that are
275 * dirty that is very bad. This function checks that we don't and if we
276 * do panics.
277 */
278 void areaChanged();
279
280 void writeback(Addr aMask);
281 void writeback1();
287 EventWrapper<DescCache, &DescCache::writeback1> wbDelayEvent;
282 EventFunctionWrapper wbDelayEvent;
283
284 /** Fetch a chunk of descriptors into the descriptor cache.
285 * Calls fetchComplete when the memory system returns the data
286 */
287 void fetchDescriptors();
288 void fetchDescriptors1();
294 EventWrapper<DescCache, &DescCache::fetchDescriptors1> fetchDelayEvent;
289 EventFunctionWrapper fetchDelayEvent;
290
291 /** Called by event when dma to read descriptors is completed
292 */
293 void fetchComplete();
299 EventWrapper<DescCache, &DescCache::fetchComplete> fetchEvent;
294 EventFunctionWrapper fetchEvent;
295
296 /** Called by event when dma to writeback descriptors is completed
297 */
298 void wbComplete();
304 EventWrapper<DescCache, &DescCache::wbComplete> wbEvent;
299 EventFunctionWrapper wbEvent;
300
301 /* Return the number of descriptors left in the ring, so the device has
302 * a way to figure out if it needs to interrupt.
303 */
304 unsigned
305 descLeft() const
306 {
307 unsigned left = unusedCache.size();

--- 66 unchanged lines hidden (view full) ---

374 */
375 void pktComplete();
376
377 /** Check if the dma on the packet has completed and RX state machine
378 * can continue
379 */
380 bool packetDone();
381
387 EventWrapper<RxDescCache, &RxDescCache::pktComplete> pktEvent;
382 EventFunctionWrapper pktEvent;
383
384 // Event to handle issuing header and data write at the same time
385 // and only callking pktComplete() when both are completed
386 void pktSplitDone();
392 EventWrapper<RxDescCache, &RxDescCache::pktSplitDone> pktHdrEvent;
393 EventWrapper<RxDescCache, &RxDescCache::pktSplitDone> pktDataEvent;
387 EventFunctionWrapper pktHdrEvent;
388 EventFunctionWrapper pktDataEvent;
389
390 bool hasOutstandingEvents() override;
391
392 void serialize(CheckpointOut &cp) const override;
393 void unserialize(CheckpointIn &cp) override;
394 };
395 friend class RxDescCache;
396

--- 77 unchanged lines hidden (view full) ---

474 * @return packet can't be sent out because it's a multi-descriptor
475 * packet
476 */
477 bool packetMultiDesc() { return pktMultiDesc;}
478
479 /** Called by event when dma to write packet is completed
480 */
481 void pktComplete();
487 EventWrapper<TxDescCache, &TxDescCache::pktComplete> pktEvent;
482 EventFunctionWrapper pktEvent;
483
484 void headerComplete();
490 EventWrapper<TxDescCache, &TxDescCache::headerComplete> headerEvent;
485 EventFunctionWrapper headerEvent;
486
487
488 void completionWriteback(Addr a, bool enabled) {
489 DPRINTF(EthernetDesc,
490 "Completion writeback Addr: %#x enabled: %d\n",
491 a, enabled);
492 completionAddress = a;
493 completionEnabled = enabled;
494 }
495
496 bool hasOutstandingEvents() override;
497
498 void nullCallback() {
499 DPRINTF(EthernetDesc, "Completion writeback complete\n");
500 }
506 EventWrapper<TxDescCache, &TxDescCache::nullCallback> nullEvent;
501 EventFunctionWrapper nullEvent;
502
503 void serialize(CheckpointOut &cp) const override;
504 void unserialize(CheckpointIn &cp) override;
505 };
506
507 friend class TxDescCache;
508
509 TxDescCache txDescCache;

--- 47 unchanged lines hidden ---