363994919c8c95da50393ec05402ca90505c9b7c
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "base/inet.hh"
34 #include "cpu/exec_context.hh"
35 #include "cpu/intr_control.hh"
36 #include "dev/etherlink.hh"
37 #include "dev/sinic.hh"
38 #include "dev/pciconfigall.hh"
39 #include "mem/bus/bus.hh"
40 #include "mem/bus/dma_interface.hh"
41 #include "mem/bus/pio_interface.hh"
42 #include "mem/bus/pio_interface_impl.hh"
43 #include "mem/functional/memory_control.hh"
44 #include "mem/functional/physical.hh"
45 #include "sim/builder.hh"
46 #include "sim/debug.hh"
47 #include "sim/eventq.hh"
48 #include "sim/host.hh"
49 #include "sim/stats.hh"
50 #include "arch/vtophys.hh"
53 using namespace TheISA
;
57 const char *RxStateStrings
[] =
66 const char *TxStateStrings
[] =
76 ///////////////////////////////////////////////////////////////////////
81 : PciDev(p
), rxEnable(false), txEnable(false), clock(p
->clock
),
82 intrDelay(p
->intr_delay
), intrTick(0), cpuIntrEnable(false),
83 cpuPendingIntr(false), intrEvent(0), interface(NULL
)
87 Device::Device(Params
*p
)
88 : Base(p
), plat(p
->plat
), physmem(p
->physmem
),
89 rxFifo(p
->rx_fifo_size
), txFifo(p
->tx_fifo_size
),
90 rxKickTick(0), txKickTick(0),
91 txEvent(this), rxDmaEvent(this), txDmaEvent(this),
92 dmaReadDelay(p
->dma_read_delay
), dmaReadFactor(p
->dma_read_factor
),
93 dmaWriteDelay(p
->dma_write_delay
), dmaWriteFactor(p
->dma_write_factor
)
98 pioInterface
= newPioInterface(p
->name
+ ".pio", p
->hier
, p
->pio_bus
,
99 this, &Device::cacheAccess
);
100 pioLatency
= p
->pio_latency
* p
->pio_bus
->clockRate
;
105 dmaInterface
= new DMAInterface
<Bus
>(p
->name
+ ".dma",
110 dmaInterface
= new DMAInterface
<Bus
>(p
->name
+ ".dma",
114 } else if (p
->payload_bus
)
115 panic("must define a header bus if defining a payload bus");
125 .name(name() + ".rxBytes")
126 .desc("Bytes Received")
131 .name(name() + ".rxBandwidth")
132 .desc("Receive Bandwidth (bits/s)")
138 .name(name() + ".rxPackets")
139 .desc("Number of Packets Received")
144 .name(name() + ".rxPPS")
145 .desc("Packet Reception Rate (packets/s)")
151 .name(name() + ".rxIpPackets")
152 .desc("Number of IP Packets Received")
157 .name(name() + ".rxTcpPackets")
158 .desc("Number of Packets Received")
163 .name(name() + ".rxUdpPackets")
164 .desc("Number of UDP Packets Received")
169 .name(name() + ".rxIpChecksums")
170 .desc("Number of rx IP Checksums done by device")
176 .name(name() + ".rxTcpChecksums")
177 .desc("Number of rx TCP Checksums done by device")
183 .name(name() + ".rxUdpChecksums")
184 .desc("Number of rx UDP Checksums done by device")
190 .name(name() + ".totBandwidth")
191 .desc("Total Bandwidth (bits/s)")
197 .name(name() + ".totPackets")
198 .desc("Total Packets")
204 .name(name() + ".totBytes")
211 .name(name() + ".totPPS")
212 .desc("Total Tranmission Rate (packets/s)")
218 .name(name() + ".txBytes")
219 .desc("Bytes Transmitted")
224 .name(name() + ".txBandwidth")
225 .desc("Transmit Bandwidth (bits/s)")
231 .name(name() + ".txPackets")
232 .desc("Number of Packets Transmitted")
237 .name(name() + ".txPPS")
238 .desc("Packet Tranmission Rate (packets/s)")
244 .name(name() + ".txIpPackets")
245 .desc("Number of IP Packets Transmitted")
250 .name(name() + ".txTcpPackets")
251 .desc("Number of TCP Packets Transmitted")
256 .name(name() + ".txUdpPackets")
257 .desc("Number of Packets Transmitted")
262 .name(name() + ".txIpChecksums")
263 .desc("Number of tx IP Checksums done by device")
269 .name(name() + ".txTcpChecksums")
270 .desc("Number of tx TCP Checksums done by device")
276 .name(name() + ".txUdpChecksums")
277 .desc("Number of tx UDP Checksums done by device")
282 txBandwidth
= txBytes
* Stats::constant(8) / simSeconds
;
283 rxBandwidth
= rxBytes
* Stats::constant(8) / simSeconds
;
284 totBandwidth
= txBandwidth
+ rxBandwidth
;
285 totBytes
= txBytes
+ rxBytes
;
286 totPackets
= txPackets
+ rxPackets
;
287 txPacketRate
= txPackets
/ simSeconds
;
288 rxPacketRate
= rxPackets
/ simSeconds
;
292 * This is to write to the PCI general configuration registers
295 Device::writeConfig(int offset
, int size
, const uint8_t *data
)
298 case PCI0_BASE_ADDR0
:
299 // Need to catch writes to BARs to update the PIO interface
300 PciDev::writeConfig(offset
, size
, data
);
301 if (BARAddrs
[0] != 0) {
303 pioInterface
->addAddrRange(RangeSize(BARAddrs
[0], BARSize
[0]));
305 BARAddrs
[0] &= EV5::PAddrUncachedMask
;
310 PciDev::writeConfig(offset
, size
, data
);
315 Device::prepareIO(int cpu
, int index
)
317 int size
= virtualRegs
.size();
321 virtualRegs
.resize(index
+ 1);
322 for (int i
= size
; i
<= index
; ++i
)
323 virtualRegs
[i
].rxPacket
= rxFifo
.end();
327 Device::prepareRead(int cpu
, int index
)
329 using namespace Regs
;
330 prepareIO(cpu
, index
);
332 VirtualReg
&vnic
= virtualRegs
[index
];
334 // update rx registers
335 uint64_t rxdone
= vnic
.RxDone
;
336 rxdone
= set_RxDone_Packets(rxdone
, rxFifo
.packets());
337 regs
.RxData
= vnic
.RxData
;
338 regs
.RxDone
= rxdone
;
339 regs
.RxWait
= rxdone
;
341 // update tx regsiters
342 uint64_t txdone
= vnic
.TxDone
;
343 txdone
= set_TxDone_Packets(txdone
, txFifo
.packets());
344 txdone
= set_TxDone_Full(txdone
, txFifo
.avail() < regs
.TxMaxCopy
);
345 txdone
= set_TxDone_Low(txdone
, txFifo
.size() < regs
.TxFifoMark
);
346 regs
.TxData
= vnic
.TxData
;
347 regs
.TxDone
= txdone
;
348 regs
.TxWait
= txdone
;
352 Device::prepareWrite(int cpu
, int index
)
354 prepareIO(cpu
, index
);
358 * I/O read of device register
361 Device::read(MemReqPtr
&req
, uint8_t *data
)
363 assert(config
.command
& PCI_CMD_MSE
);
364 Fault fault
= readBar(req
, data
);
366 if (fault
->isMachineCheckFault()) {
367 panic("address does not map to a BAR pa=%#x va=%#x size=%d",
368 req
->paddr
, req
->vaddr
, req
->size
);
370 return genMachineCheckFault();
377 Device::readBar0(MemReqPtr
&req
, Addr daddr
, uint8_t *data
)
379 int cpu
= (req
->xc
->readMiscReg(TheISA::IPR_PALtemp16
) >> 8) & 0xff;
380 Addr index
= daddr
>> Regs::VirtualShift
;
381 Addr raddr
= daddr
& Regs::VirtualMask
;
383 if (!regValid(raddr
))
384 panic("invalid register: cpu=%d, da=%#x pa=%#x va=%#x size=%d",
385 cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
);
387 const Regs::Info
&info
= regInfo(raddr
);
389 panic("reading %s (write only): cpu=%d da=%#x pa=%#x va=%#x size=%d",
390 info
.name
, cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
);
392 if (req
->size
!= info
.size
)
393 panic("invalid size for reg %s: cpu=%d da=%#x pa=%#x va=%#x size=%d",
394 info
.name
, cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
);
396 prepareRead(cpu
, index
);
399 if (req
->size
== 4) {
400 uint32_t ®
= *(uint32_t *)data
;
401 reg
= regData32(raddr
);
405 if (req
->size
== 8) {
406 uint64_t ®
= *(uint64_t *)data
;
407 reg
= regData64(raddr
);
412 "read %s cpu=%d da=%#x pa=%#x va=%#x size=%d val=%#x\n",
413 info
.name
, cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
, value
);
415 // reading the interrupt status register has the side effect of
417 if (raddr
== Regs::IntrStatus
)
424 * IPR read of device register
427 Device::iprRead(Addr daddr
, int cpu
, uint64_t &result
)
429 if (!regValid(daddr
))
430 panic("invalid address: da=%#x", daddr
);
432 const Regs::Info
&info
= regInfo(daddr
);
434 panic("reading %s (write only): cpu=%d da=%#x", info
.name
, cpu
, daddr
);
436 DPRINTF(EthernetPIO
, "IPR read %s: cpu=%d da=%#x\n",
437 info
.name
, cpu
, daddr
);
442 result
= regData32(daddr
);
445 result
= regData64(daddr
);
447 DPRINTF(EthernetPIO
, "IPR read %s: cpu=%s da=%#x val=%#x\n",
448 info
.name
, cpu
, result
);
454 * I/O write of device register
457 Device::write(MemReqPtr
&req
, const uint8_t *data
)
459 assert(config
.command
& PCI_CMD_MSE
);
460 Fault fault
= writeBar(req
, data
);
462 if (fault
->isMachineCheckFault()) {
463 panic("address does not map to a BAR pa=%#x va=%#x size=%d",
464 req
->paddr
, req
->vaddr
, req
->size
);
466 return genMachineCheckFault();
473 Device::writeBar0(MemReqPtr
&req
, Addr daddr
, const uint8_t *data
)
475 int cpu
= (req
->xc
->readMiscReg(TheISA::IPR_PALtemp16
) >> 8) & 0xff;
476 Addr index
= daddr
>> Regs::VirtualShift
;
477 Addr raddr
= daddr
& Regs::VirtualMask
;
479 if (!regValid(raddr
))
480 panic("invalid address: cpu=%d da=%#x pa=%#x va=%#x size=%d",
481 cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
);
483 const Regs::Info
&info
= regInfo(raddr
);
485 panic("writing %s (read only): cpu=%d da=%#x",
486 info
.name
, cpu
, daddr
);
488 if (req
->size
!= info
.size
)
489 panic("invalid size for %s: cpu=%d da=%#x pa=%#x va=%#x size=%d",
490 info
.name
, cpu
, daddr
, req
->paddr
, req
->vaddr
, req
->size
);
492 uint32_t reg32
= *(uint32_t *)data
;
493 uint64_t reg64
= *(uint64_t *)data
;
494 VirtualReg
&vnic
= virtualRegs
[index
];
497 "write %s: cpu=%d val=%#x da=%#x pa=%#x va=%#x size=%d\n",
498 info
.name
, cpu
, info
.size
== 4 ? reg32
: reg64
,
499 daddr
, req
->paddr
, req
->vaddr
, req
->size
);
501 prepareWrite(cpu
, index
);
512 case Regs::IntrStatus
:
513 devIntrClear(regs
.IntrStatus
& reg32
);
517 devIntrChangeMask(reg32
);
521 if (Regs::get_RxDone_Busy(vnic
.RxDone
))
522 panic("receive machine busy with another request! rxState=%s",
523 RxStateStrings
[rxState
]);
525 vnic
.RxDone
= Regs::RxDone_Busy
;
527 rxList
.push_back(index
);
528 if (rxEnable
&& rxState
== rxIdle
) {
529 rxState
= rxFifoBlock
;
535 if (Regs::get_TxDone_Busy(vnic
.TxDone
))
536 panic("transmit machine busy with another request! txState=%s",
537 TxStateStrings
[txState
]);
539 vnic
.TxDone
= Regs::TxDone_Busy
;
541 if (txList
.empty() || txList
.front() != index
)
542 txList
.push_back(index
);
543 if (txEnable
&& txState
== txIdle
&& txList
.front() == index
) {
544 txState
= txFifoBlock
;
554 Device::devIntrPost(uint32_t interrupts
)
556 if ((interrupts
& Regs::Intr_Res
))
557 panic("Cannot set a reserved interrupt");
559 regs
.IntrStatus
|= interrupts
;
561 DPRINTF(EthernetIntr
,
562 "interrupt written to intStatus: intr=%#x status=%#x mask=%#x\n",
563 interrupts
, regs
.IntrStatus
, regs
.IntrMask
);
565 interrupts
= regs
.IntrStatus
& regs
.IntrMask
;
567 // Intr_RxHigh is special, we only signal it if we've emptied the fifo
568 // and then filled it above the high watermark
572 interrupts
&= ~Regs::Intr_RxHigh
;
574 // Intr_TxLow is special, we only signal it if we've filled up the fifo
575 // and then dropped below the low watermark
579 interrupts
&= ~Regs::Intr_TxLow
;
583 if ((interrupts
& Regs::Intr_NoDelay
) == 0)
590 Device::devIntrClear(uint32_t interrupts
)
592 if ((interrupts
& Regs::Intr_Res
))
593 panic("Cannot clear a reserved interrupt");
595 regs
.IntrStatus
&= ~interrupts
;
597 DPRINTF(EthernetIntr
,
598 "interrupt cleared from intStatus: intr=%x status=%x mask=%x\n",
599 interrupts
, regs
.IntrStatus
, regs
.IntrMask
);
601 if (!(regs
.IntrStatus
& regs
.IntrMask
))
606 Device::devIntrChangeMask(uint32_t newmask
)
608 if (regs
.IntrMask
== newmask
)
611 regs
.IntrMask
= newmask
;
613 DPRINTF(EthernetIntr
,
614 "interrupt mask changed: intStatus=%x intMask=%x masked=%x\n",
615 regs
.IntrStatus
, regs
.IntrMask
, regs
.IntrStatus
& regs
.IntrMask
);
617 if (regs
.IntrStatus
& regs
.IntrMask
)
618 cpuIntrPost(curTick
);
624 Base::cpuIntrPost(Tick when
)
626 // If the interrupt you want to post is later than an interrupt
627 // already scheduled, just let it post in the coming one and don't
629 // HOWEVER, must be sure that the scheduled intrTick is in the
630 // future (this was formerly the source of a bug)
632 * @todo this warning should be removed and the intrTick code should
635 assert(when
>= curTick
);
636 assert(intrTick
>= curTick
|| intrTick
== 0);
637 if (!cpuIntrEnable
) {
638 DPRINTF(EthernetIntr
, "interrupts not enabled.\n",
643 if (when
> intrTick
&& intrTick
!= 0) {
644 DPRINTF(EthernetIntr
, "don't need to schedule event...intrTick=%d\n",
650 if (intrTick
< curTick
) {
655 DPRINTF(EthernetIntr
, "going to schedule an interrupt for intrTick=%d\n",
660 intrEvent
= new IntrEvent(this, true);
661 intrEvent
->schedule(intrTick
);
667 assert(intrTick
== curTick
);
669 // Whether or not there's a pending interrupt, we don't care about
674 // Don't send an interrupt if there's already one
675 if (cpuPendingIntr
) {
676 DPRINTF(EthernetIntr
,
677 "would send an interrupt now, but there's already pending\n");
680 cpuPendingIntr
= true;
682 DPRINTF(EthernetIntr
, "posting interrupt\n");
700 cpuPendingIntr
= false;
702 DPRINTF(EthernetIntr
, "clearing cchip interrupt\n");
707 Base::cpuIntrPending() const
708 { return cpuPendingIntr
; }
711 Device::changeConfig(uint32_t newconf
)
713 uint32_t changed
= regs
.Config
^ newconf
;
717 regs
.Config
= newconf
;
719 if ((changed
& Regs::Config_IntEn
)) {
720 cpuIntrEnable
= regs
.Config
& Regs::Config_IntEn
;
722 if (regs
.IntrStatus
& regs
.IntrMask
)
723 cpuIntrPost(curTick
);
729 if ((changed
& Regs::Config_TxEn
)) {
730 txEnable
= regs
.Config
& Regs::Config_TxEn
;
735 if ((changed
& Regs::Config_RxEn
)) {
736 rxEnable
= regs
.Config
& Regs::Config_RxEn
;
743 Device::command(uint32_t command
)
745 if (command
& Regs::Command_Intr
)
746 devIntrPost(Regs::Intr_Soft
);
748 if (command
& Regs::Command_Reset
)
755 using namespace Regs
;
757 memset(®s
, 0, sizeof(regs
));
760 if (params()->rx_thread
)
761 regs
.Config
|= Config_RxThread
;
762 if (params()->tx_thread
)
763 regs
.Config
|= Config_TxThread
;
765 regs
.Config
|= Config_RSS
;
766 regs
.IntrMask
= Intr_Soft
| Intr_RxHigh
| Intr_RxPacket
| Intr_TxLow
;
767 regs
.RxMaxCopy
= params()->rx_max_copy
;
768 regs
.TxMaxCopy
= params()->tx_max_copy
;
769 regs
.RxMaxIntr
= params()->rx_max_intr
;
770 regs
.RxFifoSize
= params()->rx_fifo_size
;
771 regs
.TxFifoSize
= params()->tx_fifo_size
;
772 regs
.RxFifoMark
= params()->rx_fifo_threshold
;
773 regs
.TxFifoMark
= params()->tx_fifo_threshold
;
774 regs
.HwAddr
= params()->eaddr
;
783 rxFifoPtr
= rxFifo
.end();
788 int size
= virtualRegs
.size();
790 virtualRegs
.resize(size
);
791 for (int i
= 0; i
< size
; ++i
)
792 virtualRegs
[i
].rxPacket
= rxFifo
.end();
798 assert(rxState
== rxCopy
);
799 rxState
= rxCopyDone
;
800 physmem
->dma_write(rxDmaAddr
, (uint8_t *)rxDmaData
, rxDmaLen
);
801 DPRINTF(EthernetDMA
, "rx dma write paddr=%#x len=%d\n",
802 rxDmaAddr
, rxDmaLen
);
803 DDUMP(EthernetData
, rxDmaData
, rxDmaLen
);
811 // If the transmit state machine has a pending DMA, let it go first
812 if (txState
== txBeginCopy
)
823 DPRINTF(EthernetSM
, "receive kick rxState=%s (rxFifo.size=%d)\n",
824 RxStateStrings
[rxState
], rxFifo
.size());
826 if (rxKickTick
> curTick
) {
827 DPRINTF(EthernetSM
, "receive kick exiting, can't run till %d\n",
833 if (rxState
== rxIdle
)
836 assert(!rxList
.empty());
837 vnic
= &virtualRegs
[rxList
.front()];
839 DPRINTF(EthernetSM
, "processing rxState=%s for virtual nic %d\n",
840 RxStateStrings
[rxState
], rxList
.front());
844 if (vnic
->rxPacket
!= rxFifo
.end()) {
845 rxState
= rxBeginCopy
;
849 if (rxFifoPtr
== rxFifo
.end()) {
850 DPRINTF(EthernetSM
, "receive waiting for data. Nothing to do.\n");
854 assert(!rxFifo
.empty());
856 // Grab a new packet from the fifo.
857 vnic
->rxPacket
= rxFifoPtr
++;
858 vnic
->rxPacketOffset
= 0;
859 vnic
->rxPacketBytes
= (*vnic
->rxPacket
)->length
;
860 assert(vnic
->rxPacketBytes
);
862 vnic
->rxDoneData
= 0;
863 /* scope for variables */ {
864 IpPtr
ip(*vnic
->rxPacket
);
866 vnic
->rxDoneData
|= Regs::RxDone_IpPacket
;
868 if (cksum(ip
) != 0) {
869 DPRINTF(EthernetCksum
, "Rx IP Checksum Error\n");
870 vnic
->rxDoneData
|= Regs::RxDone_IpError
;
875 vnic
->rxDoneData
|= Regs::RxDone_TcpPacket
;
877 if (cksum(tcp
) != 0) {
878 DPRINTF(EthernetCksum
, "Rx TCP Checksum Error\n");
879 vnic
->rxDoneData
|= Regs::RxDone_TcpError
;
882 vnic
->rxDoneData
|= Regs::RxDone_UdpPacket
;
884 if (cksum(udp
) != 0) {
885 DPRINTF(EthernetCksum
, "Rx UDP Checksum Error\n");
886 vnic
->rxDoneData
|= Regs::RxDone_UdpError
;
891 rxState
= rxBeginCopy
;
895 if (dmaInterface
&& dmaInterface
->busy())
898 rxDmaAddr
= plat
->pciToDma(Regs::get_RxData_Addr(vnic
->RxData
));
899 rxDmaLen
= min
<int>(Regs::get_RxData_Len(vnic
->RxData
),
900 vnic
->rxPacketBytes
);
901 rxDmaData
= (*vnic
->rxPacket
)->data
+ vnic
->rxPacketOffset
;
905 dmaInterface
->doDMA(WriteInvalidate
, rxDmaAddr
, rxDmaLen
,
906 curTick
, &rxDmaEvent
, true);
910 if (dmaWriteDelay
!= 0 || dmaWriteFactor
!= 0) {
911 Tick factor
= ((rxDmaLen
+ ULL(63)) >> ULL(6)) * dmaWriteFactor
;
912 Tick start
= curTick
+ dmaWriteDelay
+ factor
;
913 rxDmaEvent
.schedule(start
);
921 DPRINTF(EthernetSM
, "receive machine still copying\n");
925 vnic
->RxDone
= vnic
->rxDoneData
| rxDmaLen
;
926 vnic
->RxDone
|= Regs::RxDone_Complete
;
928 if (vnic
->rxPacketBytes
== rxDmaLen
) {
929 DPRINTF(EthernetSM
, "rxKick: packet complete on vnic %d\n",
931 rxFifo
.remove(vnic
->rxPacket
);
932 vnic
->rxPacket
= rxFifo
.end();
934 vnic
->RxDone
|= Regs::RxDone_More
;
935 vnic
->rxPacketBytes
-= rxDmaLen
;
936 vnic
->rxPacketOffset
+= rxDmaLen
;
938 "rxKick: packet not complete on vnic %d: %d bytes left\n",
939 rxList
.front(), vnic
->rxPacketBytes
);
943 rxState
= rxList
.empty() ? rxIdle
: rxFifoBlock
;
945 if (rxFifo
.empty()) {
946 devIntrPost(Regs::Intr_RxEmpty
);
950 devIntrPost(Regs::Intr_RxDMA
);
954 panic("Invalid rxState!");
957 DPRINTF(EthernetSM
, "entering next rxState=%s\n",
958 RxStateStrings
[rxState
]);
964 * @todo do we want to schedule a future kick?
966 DPRINTF(EthernetSM
, "rx state machine exited rxState=%s\n",
967 RxStateStrings
[rxState
]);
973 assert(txState
== txCopy
);
974 txState
= txCopyDone
;
975 physmem
->dma_read((uint8_t *)txDmaData
, txDmaAddr
, txDmaLen
);
976 DPRINTF(EthernetDMA
, "tx dma read paddr=%#x len=%d\n",
977 txDmaAddr
, txDmaLen
);
978 DDUMP(EthernetData
, txDmaData
, txDmaLen
);
986 // If the receive state machine has a pending DMA, let it go first
987 if (rxState
== rxBeginCopy
)
996 if (txFifo
.empty()) {
997 DPRINTF(Ethernet
, "nothing to transmit\n");
1001 uint32_t interrupts
;
1002 PacketPtr packet
= txFifo
.front();
1003 if (!interface
->sendPacket(packet
)) {
1004 DPRINTF(Ethernet
, "Packet Transmit: failed txFifo available %d\n",
1011 if (DTRACE(Ethernet
)) {
1014 DPRINTF(Ethernet
, "ID is %d\n", ip
->id());
1017 DPRINTF(Ethernet
, "Src Port=%d, Dest Port=%d\n",
1018 tcp
->sport(), tcp
->dport());
1024 DDUMP(EthernetData
, packet
->data
, packet
->length
);
1025 txBytes
+= packet
->length
;
1028 DPRINTF(Ethernet
, "Packet Transmit: successful txFifo Available %d\n",
1031 interrupts
= Regs::Intr_TxPacket
;
1032 if (txFifo
.size() < regs
.TxFifoMark
)
1033 interrupts
|= Regs::Intr_TxLow
;
1034 devIntrPost(interrupts
);
1037 if (!txFifo
.empty() && !txEvent
.scheduled()) {
1038 DPRINTF(Ethernet
, "reschedule transmit\n");
1039 txEvent
.schedule(curTick
+ retryTime
);
1047 DPRINTF(EthernetSM
, "transmit kick txState=%s (txFifo.size=%d)\n",
1048 TxStateStrings
[txState
], txFifo
.size());
1050 if (txKickTick
> curTick
) {
1051 DPRINTF(EthernetSM
, "transmit kick exiting, can't run till %d\n",
1057 if (txState
== txIdle
)
1060 assert(!txList
.empty());
1061 vnic
= &virtualRegs
[txList
.front()];
1065 assert(Regs::get_TxDone_Busy(vnic
->TxData
));
1067 // Grab a new packet from the fifo.
1068 txPacket
= new PacketData(16384);
1072 if (txFifo
.avail() - txPacket
->length
<
1073 Regs::get_TxData_Len(vnic
->TxData
)) {
1074 DPRINTF(EthernetSM
, "transmit fifo full. Nothing to do.\n");
1078 txState
= txBeginCopy
;
1082 if (dmaInterface
&& dmaInterface
->busy())
1085 txDmaAddr
= plat
->pciToDma(Regs::get_TxData_Addr(vnic
->TxData
));
1086 txDmaLen
= Regs::get_TxData_Len(vnic
->TxData
);
1087 txDmaData
= txPacket
->data
+ txPacketOffset
;
1091 dmaInterface
->doDMA(Read
, txDmaAddr
, txDmaLen
,
1092 curTick
, &txDmaEvent
, true);
1096 if (dmaReadDelay
!= 0 || dmaReadFactor
!= 0) {
1097 Tick factor
= ((txDmaLen
+ ULL(63)) >> ULL(6)) * dmaReadFactor
;
1098 Tick start
= curTick
+ dmaReadDelay
+ factor
;
1099 txDmaEvent
.schedule(start
);
1107 DPRINTF(EthernetSM
, "transmit machine still copying\n");
1111 vnic
->TxDone
= txDmaLen
| Regs::TxDone_Complete
;
1112 txPacket
->length
+= txDmaLen
;
1113 if ((vnic
->TxData
& Regs::TxData_More
)) {
1114 txPacketOffset
+= txDmaLen
;
1116 devIntrPost(Regs::Intr_TxDMA
);
1120 assert(txPacket
->length
<= txFifo
.avail());
1121 if ((vnic
->TxData
& Regs::TxData_Checksum
)) {
1127 tcp
->sum(cksum(tcp
));
1134 udp
->sum(cksum(udp
));
1144 txFifo
.push(txPacket
);
1145 if (txFifo
.avail() < regs
.TxMaxCopy
) {
1146 devIntrPost(Regs::Intr_TxFull
);
1152 txState
= txList
.empty() ? txIdle
: txFifoBlock
;
1153 devIntrPost(Regs::Intr_TxDMA
);
1157 panic("Invalid txState!");
1160 DPRINTF(EthernetSM
, "entering next txState=%s\n",
1161 TxStateStrings
[txState
]);
1167 * @todo do we want to schedule a future kick?
1169 DPRINTF(EthernetSM
, "tx state machine exited txState=%s\n",
1170 TxStateStrings
[txState
]);
1174 Device::transferDone()
1176 if (txFifo
.empty()) {
1177 DPRINTF(Ethernet
, "transfer complete: txFifo empty...nothing to do\n");
1181 DPRINTF(Ethernet
, "transfer complete: data in txFifo...schedule xmit\n");
1183 if (txEvent
.scheduled())
1184 txEvent
.reschedule(curTick
+ cycles(1));
1186 txEvent
.schedule(curTick
+ cycles(1));
1190 Device::rxFilter(const PacketPtr
&packet
)
1192 if (!Regs::get_Config_Filter(regs
.Config
))
1195 panic("receive filter not implemented\n");
1201 EthHdr
*eth
= packet
->eth();
1202 if (eth
->unicast()) {
1203 // If we're accepting all unicast addresses
1207 // If we make a perfect match
1208 if (acceptPerfect
&& params
->eaddr
== eth
.dst())
1211 if (acceptArp
&& eth
->type() == ETH_TYPE_ARP
)
1214 } else if (eth
->broadcast()) {
1215 // if we're accepting broadcasts
1216 if (acceptBroadcast
)
1219 } else if (eth
->multicast()) {
1220 // if we're accepting all multicasts
1221 if (acceptMulticast
)
1227 DPRINTF(Ethernet
, "rxFilter drop\n");
1228 DDUMP(EthernetData
, packet
->data
, packet
->length
);
1235 Device::recvPacket(PacketPtr packet
)
1237 rxBytes
+= packet
->length
;
1240 DPRINTF(Ethernet
, "Receiving packet from wire, rxFifo Available is %d\n",
1244 DPRINTF(Ethernet
, "receive disabled...packet dropped\n");
1248 if (rxFilter(packet
)) {
1249 DPRINTF(Ethernet
, "packet filtered...dropped\n");
1253 if (rxFifo
.size() >= regs
.RxFifoMark
)
1254 devIntrPost(Regs::Intr_RxHigh
);
1256 if (!rxFifo
.push(packet
)) {
1258 "packet will not fit in receive buffer...packet dropped\n");
1262 // If we were at the last element, back up one ot go to the new
1263 // last element of the list.
1264 if (rxFifoPtr
== rxFifo
.end())
1267 devIntrPost(Regs::Intr_RxPacket
);
1272 //=====================================================================
1276 Base::serialize(ostream
&os
)
1278 // Serialize the PciDev base class
1279 PciDev::serialize(os
);
1281 SERIALIZE_SCALAR(rxEnable
);
1282 SERIALIZE_SCALAR(txEnable
);
1283 SERIALIZE_SCALAR(cpuIntrEnable
);
1286 * Keep track of pending interrupt status.
1288 SERIALIZE_SCALAR(intrTick
);
1289 SERIALIZE_SCALAR(cpuPendingIntr
);
1290 Tick intrEventTick
= 0;
1292 intrEventTick
= intrEvent
->when();
1293 SERIALIZE_SCALAR(intrEventTick
);
1297 Base::unserialize(Checkpoint
*cp
, const std::string
§ion
)
1299 // Unserialize the PciDev base class
1300 PciDev::unserialize(cp
, section
);
1302 UNSERIALIZE_SCALAR(rxEnable
);
1303 UNSERIALIZE_SCALAR(txEnable
);
1304 UNSERIALIZE_SCALAR(cpuIntrEnable
);
1307 * Keep track of pending interrupt status.
1309 UNSERIALIZE_SCALAR(intrTick
);
1310 UNSERIALIZE_SCALAR(cpuPendingIntr
);
1312 UNSERIALIZE_SCALAR(intrEventTick
);
1313 if (intrEventTick
) {
1314 intrEvent
= new IntrEvent(this, true);
1315 intrEvent
->schedule(intrEventTick
);
1320 Device::serialize(ostream
&os
)
1322 // Serialize the PciDev base class
1323 Base::serialize(os
);
1325 if (rxState
== rxCopy
)
1326 panic("can't serialize with an in flight dma request rxState=%s",
1327 RxStateStrings
[rxState
]);
1329 if (txState
== txCopy
)
1330 panic("can't serialize with an in flight dma request txState=%s",
1331 TxStateStrings
[txState
]);
1334 * Serialize the device registers
1336 SERIALIZE_SCALAR(regs
.Config
);
1337 SERIALIZE_SCALAR(regs
.IntrStatus
);
1338 SERIALIZE_SCALAR(regs
.IntrMask
);
1339 SERIALIZE_SCALAR(regs
.RxMaxCopy
);
1340 SERIALIZE_SCALAR(regs
.TxMaxCopy
);
1341 SERIALIZE_SCALAR(regs
.RxMaxIntr
);
1342 SERIALIZE_SCALAR(regs
.RxData
);
1343 SERIALIZE_SCALAR(regs
.RxDone
);
1344 SERIALIZE_SCALAR(regs
.TxData
);
1345 SERIALIZE_SCALAR(regs
.TxDone
);
1348 * Serialize the virtual nic state
1350 int virtualRegsSize
= virtualRegs
.size();
1351 SERIALIZE_SCALAR(virtualRegsSize
);
1352 for (int i
= 0; i
< virtualRegsSize
; ++i
) {
1353 VirtualReg
*vnic
= &virtualRegs
[i
];
1355 string reg
= csprintf("vnic%d", i
);
1356 paramOut(os
, reg
+ ".RxData", vnic
->RxData
);
1357 paramOut(os
, reg
+ ".RxDone", vnic
->RxDone
);
1358 paramOut(os
, reg
+ ".TxData", vnic
->TxData
);
1359 paramOut(os
, reg
+ ".TxDone", vnic
->TxDone
);
1361 PacketFifo::iterator rxFifoPtr
;
1363 bool rxPacketExists
= vnic
->rxPacket
!= rxFifo
.end();
1364 paramOut(os
, reg
+ ".rxPacketExists", rxPacketExists
);
1365 if (rxPacketExists
) {
1367 PacketFifo::iterator i
= rxFifo
.begin();
1368 while (i
!= vnic
->rxPacket
) {
1369 assert(i
!= rxFifo
.end());
1374 paramOut(os
, reg
+ ".rxPacket", rxPacket
);
1375 paramOut(os
, reg
+ ".rxPacketOffset", vnic
->rxPacketOffset
);
1376 paramOut(os
, reg
+ ".rxPacketBytes", vnic
->rxPacketBytes
);
1378 paramOut(os
, reg
+ ".rxDoneData", vnic
->rxDoneData
);
1381 VirtualList::iterator i
, end
;
1384 int rxListSize
= rxList
.size();
1385 SERIALIZE_SCALAR(rxListSize
);
1386 for (count
= 0, i
= rxList
.begin(), end
= rxList
.end(); i
!= end
; ++i
)
1387 paramOut(os
, csprintf("rxList%d", count
++), *i
);
1389 int txListSize
= txList
.size();
1390 SERIALIZE_SCALAR(txListSize
);
1391 for (count
= 0, i
= txList
.begin(), end
= txList
.end(); i
!= end
; ++i
)
1392 paramOut(os
, csprintf("txList%d", count
++), *i
);
1395 * Serialize rx state machine
1397 int rxState
= this->rxState
;
1398 SERIALIZE_SCALAR(rxState
);
1399 SERIALIZE_SCALAR(rxEmpty
);
1400 rxFifo
.serialize("rxFifo", os
);
1403 * Serialize tx state machine
1405 int txState
= this->txState
;
1406 SERIALIZE_SCALAR(txState
);
1407 SERIALIZE_SCALAR(txFull
);
1408 txFifo
.serialize("txFifo", os
);
1409 bool txPacketExists
= txPacket
;
1410 SERIALIZE_SCALAR(txPacketExists
);
1411 if (txPacketExists
) {
1412 txPacket
->serialize("txPacket", os
);
1413 SERIALIZE_SCALAR(txPacketOffset
);
1414 SERIALIZE_SCALAR(txPacketBytes
);
1418 * If there's a pending transmit, store the time so we can
1419 * reschedule it later
1421 Tick transmitTick
= txEvent
.scheduled() ? txEvent
.when() - curTick
: 0;
1422 SERIALIZE_SCALAR(transmitTick
);
1426 Device::unserialize(Checkpoint
*cp
, const std::string
§ion
)
1428 // Unserialize the PciDev base class
1429 Base::unserialize(cp
, section
);
1432 * Unserialize the device registers
1434 UNSERIALIZE_SCALAR(regs
.Config
);
1435 UNSERIALIZE_SCALAR(regs
.IntrStatus
);
1436 UNSERIALIZE_SCALAR(regs
.IntrMask
);
1437 UNSERIALIZE_SCALAR(regs
.RxMaxCopy
);
1438 UNSERIALIZE_SCALAR(regs
.TxMaxCopy
);
1439 UNSERIALIZE_SCALAR(regs
.RxMaxIntr
);
1440 UNSERIALIZE_SCALAR(regs
.RxData
);
1441 UNSERIALIZE_SCALAR(regs
.RxDone
);
1442 UNSERIALIZE_SCALAR(regs
.TxData
);
1443 UNSERIALIZE_SCALAR(regs
.TxDone
);
1446 UNSERIALIZE_SCALAR(rxListSize
);
1448 for (int i
= 0; i
< rxListSize
; ++i
) {
1450 paramIn(cp
, section
, csprintf("rxList%d", i
), value
);
1451 rxList
.push_back(value
);
1455 UNSERIALIZE_SCALAR(txListSize
);
1457 for (int i
= 0; i
< txListSize
; ++i
) {
1459 paramIn(cp
, section
, csprintf("txList%d", i
), value
);
1460 txList
.push_back(value
);
1464 * Unserialize rx state machine
1467 UNSERIALIZE_SCALAR(rxState
);
1468 UNSERIALIZE_SCALAR(rxEmpty
);
1469 this->rxState
= (RxState
) rxState
;
1470 rxFifo
.unserialize("rxFifo", cp
, section
);
1473 * Unserialize tx state machine
1476 UNSERIALIZE_SCALAR(txState
);
1477 UNSERIALIZE_SCALAR(txFull
);
1478 this->txState
= (TxState
) txState
;
1479 txFifo
.unserialize("txFifo", cp
, section
);
1480 bool txPacketExists
;
1481 UNSERIALIZE_SCALAR(txPacketExists
);
1483 if (txPacketExists
) {
1484 txPacket
= new PacketData(16384);
1485 txPacket
->unserialize("txPacket", cp
, section
);
1486 UNSERIALIZE_SCALAR(txPacketOffset
);
1487 UNSERIALIZE_SCALAR(txPacketBytes
);
1491 * unserialize the virtual nic registers/state
1493 * this must be done after the unserialization of the rxFifo
1494 * because the packet iterators depend on the fifo being populated
1496 int virtualRegsSize
;
1497 UNSERIALIZE_SCALAR(virtualRegsSize
);
1498 virtualRegs
.clear();
1499 virtualRegs
.resize(virtualRegsSize
);
1500 for (int i
= 0; i
< virtualRegsSize
; ++i
) {
1501 VirtualReg
*vnic
= &virtualRegs
[i
];
1502 string reg
= csprintf("vnic%d", i
);
1504 paramIn(cp
, section
, reg
+ ".RxData", vnic
->RxData
);
1505 paramIn(cp
, section
, reg
+ ".RxDone", vnic
->RxDone
);
1506 paramIn(cp
, section
, reg
+ ".TxData", vnic
->TxData
);
1507 paramIn(cp
, section
, reg
+ ".TxDone", vnic
->TxDone
);
1509 bool rxPacketExists
;
1510 paramIn(cp
, section
, reg
+ ".rxPacketExists", rxPacketExists
);
1511 if (rxPacketExists
) {
1513 paramIn(cp
, section
, reg
+ ".rxPacket", rxPacket
);
1514 vnic
->rxPacket
= rxFifo
.begin();
1518 paramIn(cp
, section
, reg
+ ".rxPacketOffset",
1519 vnic
->rxPacketOffset
);
1520 paramIn(cp
, section
, reg
+ ".rxPacketBytes", vnic
->rxPacketBytes
);
1522 vnic
->rxPacket
= rxFifo
.end();
1524 paramIn(cp
, section
, reg
+ ".rxDoneData", vnic
->rxDoneData
);
1528 * If there's a pending transmit, reschedule it now
1531 UNSERIALIZE_SCALAR(transmitTick
);
1533 txEvent
.schedule(curTick
+ transmitTick
);
1536 * re-add addrRanges to bus bridges
1539 pioInterface
->addAddrRange(RangeSize(BARAddrs
[0], BARSize
[0]));
1540 pioInterface
->addAddrRange(RangeSize(BARAddrs
[1], BARSize
[1]));
1545 Device::cacheAccess(MemReqPtr
&req
)
1549 if (!getBAR(req
->paddr
, daddr
, bar
))
1550 panic("address does not map to a BAR pa=%#x va=%#x size=%d",
1551 req
->paddr
, req
->vaddr
, req
->size
);
1553 DPRINTF(EthernetPIO
, "timing %s to paddr=%#x bar=%d daddr=%#x\n",
1554 req
->cmd
.toString(), req
->paddr
, bar
, daddr
);
1556 return curTick
+ pioLatency
;
1559 BEGIN_DECLARE_SIM_OBJECT_PARAMS(Interface
)
1561 SimObjectParam
<EtherInt
*> peer
;
1562 SimObjectParam
<Device
*> device
;
1564 END_DECLARE_SIM_OBJECT_PARAMS(Interface
)
1566 BEGIN_INIT_SIM_OBJECT_PARAMS(Interface
)
1568 INIT_PARAM_DFLT(peer
, "peer interface", NULL
),
1569 INIT_PARAM(device
, "Ethernet device of this interface")
1571 END_INIT_SIM_OBJECT_PARAMS(Interface
)
1573 CREATE_SIM_OBJECT(Interface
)
1575 Interface
*dev_int
= new Interface(getInstanceName(), device
);
1577 EtherInt
*p
= (EtherInt
*)peer
;
1579 dev_int
->setPeer(p
);
1580 p
->setPeer(dev_int
);
1586 REGISTER_SIM_OBJECT("SinicInt", Interface
)
1589 BEGIN_DECLARE_SIM_OBJECT_PARAMS(Device
)
1594 SimObjectParam
<MemoryController
*> mmu
;
1595 SimObjectParam
<PhysicalMemory
*> physmem
;
1596 SimObjectParam
<PciConfigAll
*> configspace
;
1597 SimObjectParam
<PciConfigData
*> configdata
;
1598 SimObjectParam
<Platform
*> platform
;
1599 Param
<uint32_t> pci_bus
;
1600 Param
<uint32_t> pci_dev
;
1601 Param
<uint32_t> pci_func
;
1603 SimObjectParam
<HierParams
*> hier
;
1604 SimObjectParam
<Bus
*> pio_bus
;
1605 SimObjectParam
<Bus
*> dma_bus
;
1606 SimObjectParam
<Bus
*> payload_bus
;
1607 Param
<Tick
> dma_read_delay
;
1608 Param
<Tick
> dma_read_factor
;
1609 Param
<Tick
> dma_write_delay
;
1610 Param
<Tick
> dma_write_factor
;
1611 Param
<bool> dma_no_allocate
;
1612 Param
<Tick
> pio_latency
;
1613 Param
<Tick
> intr_delay
;
1615 Param
<Tick
> rx_delay
;
1616 Param
<Tick
> tx_delay
;
1617 Param
<uint32_t> rx_max_copy
;
1618 Param
<uint32_t> tx_max_copy
;
1619 Param
<uint32_t> rx_max_intr
;
1620 Param
<uint32_t> rx_fifo_size
;
1621 Param
<uint32_t> tx_fifo_size
;
1622 Param
<uint32_t> rx_fifo_threshold
;
1623 Param
<uint32_t> tx_fifo_threshold
;
1625 Param
<bool> rx_filter
;
1626 Param
<string
> hardware_address
;
1627 Param
<bool> rx_thread
;
1628 Param
<bool> tx_thread
;
1631 END_DECLARE_SIM_OBJECT_PARAMS(Device
)
1633 BEGIN_INIT_SIM_OBJECT_PARAMS(Device
)
1635 INIT_PARAM(clock
, "State machine cycle time"),
1637 INIT_PARAM(addr
, "Device Address"),
1638 INIT_PARAM(mmu
, "Memory Controller"),
1639 INIT_PARAM(physmem
, "Physical Memory"),
1640 INIT_PARAM(configspace
, "PCI Configspace"),
1641 INIT_PARAM(configdata
, "PCI Config data"),
1642 INIT_PARAM(platform
, "Platform"),
1643 INIT_PARAM(pci_bus
, "PCI bus"),
1644 INIT_PARAM(pci_dev
, "PCI device number"),
1645 INIT_PARAM(pci_func
, "PCI function code"),
1647 INIT_PARAM(hier
, "Hierarchy global variables"),
1648 INIT_PARAM(pio_bus
, ""),
1649 INIT_PARAM(dma_bus
, ""),
1650 INIT_PARAM(payload_bus
, "The IO Bus to attach to for payload"),
1651 INIT_PARAM(dma_read_delay
, "fixed delay for dma reads"),
1652 INIT_PARAM(dma_read_factor
, "multiplier for dma reads"),
1653 INIT_PARAM(dma_write_delay
, "fixed delay for dma writes"),
1654 INIT_PARAM(dma_write_factor
, "multiplier for dma writes"),
1655 INIT_PARAM(dma_no_allocate
, "Should we allocat on read in cache"),
1656 INIT_PARAM(pio_latency
, "Programmed IO latency in bus cycles"),
1657 INIT_PARAM(intr_delay
, "Interrupt Delay"),
1659 INIT_PARAM(rx_delay
, "Receive Delay"),
1660 INIT_PARAM(tx_delay
, "Transmit Delay"),
1661 INIT_PARAM(rx_max_copy
, "rx max copy"),
1662 INIT_PARAM(tx_max_copy
, "rx max copy"),
1663 INIT_PARAM(rx_max_intr
, "rx max intr"),
1664 INIT_PARAM(rx_fifo_size
, "max size in bytes of rxFifo"),
1665 INIT_PARAM(tx_fifo_size
, "max size in bytes of txFifo"),
1666 INIT_PARAM(rx_fifo_threshold
, "max size in bytes of rxFifo"),
1667 INIT_PARAM(tx_fifo_threshold
, "max size in bytes of txFifo"),
1669 INIT_PARAM(rx_filter
, "Enable Receive Filter"),
1670 INIT_PARAM(hardware_address
, "Ethernet Hardware Address"),
1671 INIT_PARAM(rx_thread
, ""),
1672 INIT_PARAM(tx_thread
, ""),
1675 END_INIT_SIM_OBJECT_PARAMS(Device
)
1678 CREATE_SIM_OBJECT(Device
)
1680 Device::Params
*params
= new Device::Params
;
1682 params
->name
= getInstanceName();
1684 params
->clock
= clock
;
1687 params
->physmem
= physmem
;
1688 params
->configSpace
= configspace
;
1689 params
->configData
= configdata
;
1690 params
->plat
= platform
;
1691 params
->busNum
= pci_bus
;
1692 params
->deviceNum
= pci_dev
;
1693 params
->functionNum
= pci_func
;
1695 params
->hier
= hier
;
1696 params
->pio_bus
= pio_bus
;
1697 params
->header_bus
= dma_bus
;
1698 params
->payload_bus
= payload_bus
;
1699 params
->dma_read_delay
= dma_read_delay
;
1700 params
->dma_read_factor
= dma_read_factor
;
1701 params
->dma_write_delay
= dma_write_delay
;
1702 params
->dma_write_factor
= dma_write_factor
;
1703 params
->dma_no_allocate
= dma_no_allocate
;
1704 params
->pio_latency
= pio_latency
;
1705 params
->intr_delay
= intr_delay
;
1707 params
->tx_delay
= tx_delay
;
1708 params
->rx_delay
= rx_delay
;
1709 params
->rx_max_copy
= rx_max_copy
;
1710 params
->tx_max_copy
= tx_max_copy
;
1711 params
->rx_max_intr
= rx_max_intr
;
1712 params
->rx_fifo_size
= rx_fifo_size
;
1713 params
->tx_fifo_size
= tx_fifo_size
;
1714 params
->rx_fifo_threshold
= rx_fifo_threshold
;
1715 params
->tx_fifo_threshold
= tx_fifo_threshold
;
1717 params
->rx_filter
= rx_filter
;
1718 params
->eaddr
= hardware_address
;
1719 params
->rx_thread
= rx_thread
;
1720 params
->tx_thread
= tx_thread
;
1723 return new Device(params
);
1726 REGISTER_SIM_OBJECT("Sinic", Device
)
1728 /* namespace Sinic */ }