2004-03-12 17:04:58 +01:00
|
|
|
/*
|
2005-06-05 11:16:00 +02:00
|
|
|
* Copyright (c) 2004-2005 The Regents of The University of Michigan
|
2004-03-12 17:04:58 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2005-06-05 07:22:21 +02:00
|
|
|
/** @file
|
2004-03-12 17:04:58 +01:00
|
|
|
* Device module for modelling the National Semiconductor
|
|
|
|
* DP83820 ethernet controller. Does not support priority queueing
|
|
|
|
*/
|
|
|
|
#include <cstdio>
|
|
|
|
#include <deque>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/inet.hh"
|
|
|
|
#include "cpu/exec_context.hh"
|
|
|
|
#include "dev/etherlink.hh"
|
2004-07-27 05:10:20 +02:00
|
|
|
#include "dev/ns_gige.hh"
|
|
|
|
#include "dev/pciconfigall.hh"
|
2004-04-22 00:23:41 +02:00
|
|
|
#include "mem/bus/bus.hh"
|
|
|
|
#include "mem/bus/dma_interface.hh"
|
|
|
|
#include "mem/bus/pio_interface.hh"
|
|
|
|
#include "mem/bus/pio_interface_impl.hh"
|
2005-06-05 02:50:10 +02:00
|
|
|
#include "mem/functional/memory_control.hh"
|
|
|
|
#include "mem/functional/physical.hh"
|
2004-03-12 17:04:58 +01:00
|
|
|
#include "sim/builder.hh"
|
2004-07-30 17:33:45 +02:00
|
|
|
#include "sim/debug.hh"
|
2004-03-12 17:04:58 +01:00
|
|
|
#include "sim/host.hh"
|
2004-11-14 03:13:25 +01:00
|
|
|
#include "sim/stats.hh"
|
2006-02-27 11:35:43 +01:00
|
|
|
#include "arch/vtophys.hh"
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
const char *NsRxStateStrings[] =
|
|
|
|
{
|
|
|
|
"rxIdle",
|
|
|
|
"rxDescRefr",
|
|
|
|
"rxDescRead",
|
|
|
|
"rxFifoBlock",
|
|
|
|
"rxFragWrite",
|
|
|
|
"rxDescWrite",
|
|
|
|
"rxAdvance"
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *NsTxStateStrings[] =
|
|
|
|
{
|
|
|
|
"txIdle",
|
|
|
|
"txDescRefr",
|
|
|
|
"txDescRead",
|
|
|
|
"txFifoBlock",
|
|
|
|
"txFragRead",
|
|
|
|
"txDescWrite",
|
|
|
|
"txAdvance"
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *NsDmaState[] =
|
|
|
|
{
|
|
|
|
"dmaIdle",
|
|
|
|
"dmaReading",
|
|
|
|
"dmaWriting",
|
|
|
|
"dmaReadWaiting",
|
|
|
|
"dmaWriteWaiting"
|
|
|
|
};
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
using namespace std;
|
2004-10-23 22:18:44 +02:00
|
|
|
using namespace Net;
|
Changes to untemplate StaticInst and StaticInstPtr, change the isa to a namespace instead of a class, an improvement to the architecture specific header file selection system, and fixed up a few include paths.
arch/alpha/alpha_linux_process.cc:
Added using directive for AlphaISA namespace
arch/alpha/alpha_memory.hh:
arch/alpha/isa/branch.isa:
cpu/pc_event.hh:
Added typedefs for Addr
arch/alpha/alpha_tru64_process.cc:
arch/alpha/arguments.cc:
Added using directive for AlphaISA
arch/alpha/ev5.hh:
Added an include of arch/alpha/isa_traits.hh, and a using directive for the AlphaISA namespace.
arch/alpha/faults.hh:
Added a typedef for the Addr type, and changed the formatting of the faults slightly.
arch/alpha/isa/main.isa:
Untemplatized StaticInst, added a using for namespace AlphaISA to show up in decoder.cc and the exec.ccs, relocated makeNop to decoder.hh
arch/alpha/isa/mem.isa:
Untemplatized StaticInst and StaticInstPtr
arch/alpha/isa/pal.isa:
cpu/base_dyn_inst.cc:
Untemplatized StaticInstPtr
arch/alpha/isa_traits.hh:
Changed variables to be externs instead of static since they are part of a namespace and not a class.
arch/alpha/stacktrace.cc:
Untemplatized StaticInstPtr, and added a using directive for AlphaISA.
arch/alpha/stacktrace.hh:
Added some typedefs for Addr and MachInst, and untemplatized StaticInstPtr
arch/alpha/vtophys.cc:
Added a using directive for AlphaISA
arch/alpha/vtophys.hh:
Added the AlphaISA namespace specifier where needed
arch/isa_parser.py:
Changed the placement of the definition of the decodeInst function to be outside the namespaceInst namespace.
base/loader/object_file.hh:
cpu/o3/bpred_unit.hh:
Added a typedef for Addr
base/loader/symtab.hh:
Added a typedef for Addr, and added a TheISA to Addr in another typedef
base/remote_gdb.cc:
Added a using namespace TheISA, and untemplatized StaticInstPtr
base/remote_gdb.hh:
Added typedefs for Addr and MachInst
cpu/base.cc:
Added TheISA specifier to some variables exported from the isa.
cpu/base.hh:
Added a typedef for Addr, and TheISA to some variables from the ISA
cpu/base_dyn_inst.hh:
Untemplatized StaticInstPtr, and added TheISA specifier to some variables from the ISA.
cpu/exec_context.hh:
Added some typedefs for types from the isa, and added TheISA specifier to some variables from the isa
cpu/exetrace.hh:
Added typedefs for some types from the ISA, and untemplatized StaticInstPtr
cpu/memtest/memtest.cc:
cpu/o3/btb.cc:
dev/baddev.cc:
dev/ide_ctrl.cc:
dev/ide_disk.cc:
dev/isa_fake.cc:
dev/ns_gige.cc:
dev/pciconfigall.cc:
dev/platform.cc:
dev/sinic.cc:
dev/uart8250.cc:
kern/freebsd/freebsd_system.cc:
kern/linux/linux_system.cc:
kern/system_events.cc:
kern/tru64/dump_mbuf.cc:
kern/tru64/tru64_events.cc:
sim/process.cc:
sim/pseudo_inst.cc:
sim/system.cc:
Added using namespace TheISA
cpu/memtest/memtest.hh:
cpu/trace/opt_cpu.hh:
cpu/trace/reader/itx_reader.hh:
dev/ide_disk.hh:
dev/pcidev.hh:
dev/platform.hh:
dev/tsunami.hh:
sim/system.hh:
sim/vptr.hh:
Added typedef for Addr
cpu/o3/2bit_local_pred.hh:
Changed the include to use arch/isa_traits.hh instead of arch/alpha/isa_traits.hh. Added typedef for Addr
cpu/o3/alpha_cpu.hh:
Added typedefs for Addr and IntReg
cpu/o3/alpha_cpu_impl.hh:
Added this-> to setNextPC to fix a problem since it didn't depend on template parameters any more. Removed "typename" where it was no longer needed.
cpu/o3/alpha_dyn_inst.hh:
Cleaned up some typedefs, and untemplatized StaticInst
cpu/o3/alpha_dyn_inst_impl.hh:
untemplatized StaticInstPtr
cpu/o3/alpha_impl.hh:
Fixed up a typedef of MachInst
cpu/o3/bpred_unit_impl.hh:
Added a using TheISA::MachInst to a function
cpu/o3/btb.hh:
Changed an include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr
cpu/o3/commit.hh:
Removed a typedef of Impl::ISA as ISA, since TheISA takes care of this now.
cpu/o3/cpu.cc:
Cleaned up namespace issues
cpu/o3/cpu.hh:
Cleaned up namespace usage
cpu/o3/decode.hh:
Removed typedef of ISA, and changed it to TheISA
cpu/o3/fetch.hh:
Fized up typedefs, and changed ISA to TheISA
cpu/o3/free_list.hh:
Changed include of arch/alpha/isa_traits.hh to arch/isa_traits.hh
cpu/o3/iew.hh:
Removed typedef of ISA
cpu/o3/iew_impl.hh:
Added TheISA namespace specifier to MachInst
cpu/o3/ras.hh:
Changed include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr.
cpu/o3/regfile.hh:
Changed ISA to TheISA, and added some typedefs for Addr, IntReg, FloatReg, and MiscRegFile
cpu/o3/rename.hh:
Changed ISA to TheISA, and added a typedef for RegIndex
cpu/o3/rename_map.hh:
Added an include for arch/isa_traits.hh, and a typedef for RegIndex
cpu/o3/rob.hh:
Added a typedef for RegIndex
cpu/o3/store_set.hh:
cpu/o3/tournament_pred.hh:
Changed an include of arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef of Addr
cpu/ozone/cpu.hh:
Changed ISA into TheISA, and untemplatized StaticInst
cpu/pc_event.cc:
Added namespace specifier TheISA to Addr types
cpu/profile.hh:
kern/kernel_stats.hh:
Added typedef for Addr, and untemplatized StaticInstPtr
cpu/simple/cpu.cc:
Changed using directive from LittleEndianGuest to AlphaISA, which will contain both namespaces. Added TheISA where needed, and untemplatized StaticInst
cpu/simple/cpu.hh:
Added a typedef for MachInst, and untemplatized StaticInst
cpu/static_inst.cc:
Untemplatized StaticInst
cpu/static_inst.hh:
Untemplatized StaticInst by using the TheISA namespace
dev/alpha_console.cc:
Added using namespace AlphaISA
dev/simple_disk.hh:
Added typedef for Addr and fixed up some formatting
dev/sinicreg.hh:
Added TheISA namespace specifier where needed
dev/tsunami.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Added using namespace TheISA. It might be better for it to be AlphaISA
dev/tsunami_cchip.cc:
Added typedef for TheISA. It might be better for it to be AlphaISA
kern/linux/aligned.hh:
sim/pseudo_inst.hh:
Added TheISA namespace specifier to Addr
kern/linux/linux_threadinfo.hh:
Added typedef for Addr, and TheISA namespace specifier to StackPointerReg
kern/tru64/mbuf.hh:
Added TheISA to Addr type in structs
sim/process.hh:
Added typedefs of Addr, RegFile, and MachInst
sim/syscall_emul.cc:
Added using namespace TheISA, and a cast of VMPageSize to the int type
sim/syscall_emul.hh:
Added typecast for Addr, and TheISA namespace specifier for where needed
--HG--
extra : convert_revision : 91d4f6ca33a73b21c1f1771d74bfdea3b80eff45
2006-02-19 08:34:37 +01:00
|
|
|
using namespace TheISA;
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2004-05-25 21:59:54 +02:00
|
|
|
// NSGigE PCI Device
|
2004-03-12 17:04:58 +01:00
|
|
|
//
|
2004-11-13 21:45:22 +01:00
|
|
|
NSGigE::NSGigE(Params *p)
|
|
|
|
: PciDev(p), ioEnable(false),
|
|
|
|
txFifo(p->tx_fifo_size), rxFifo(p->rx_fifo_size),
|
2004-06-11 21:26:21 +02:00
|
|
|
txPacket(0), rxPacket(0), txPacketBufPtr(NULL), rxPacketBufPtr(NULL),
|
2005-06-02 03:44:00 +02:00
|
|
|
txXferLen(0), rxXferLen(0), clock(p->clock),
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
txState(txIdle), txEnable(false), CTDD(false),
|
2004-04-22 00:23:41 +02:00
|
|
|
txFragPtr(0), txDescCnt(0), txDmaState(dmaIdle), rxState(rxIdle),
|
2004-11-13 21:45:22 +01:00
|
|
|
rxEnable(false), CRDD(false), rxPktBytes(0),
|
2004-04-22 00:23:41 +02:00
|
|
|
rxFragPtr(0), rxDescCnt(0), rxDmaState(dmaIdle), extstsEnable(false),
|
2005-08-13 00:30:35 +02:00
|
|
|
eepromState(eepromStart), rxDmaReadEvent(this), rxDmaWriteEvent(this),
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaReadEvent(this), txDmaWriteEvent(this),
|
2004-11-13 21:45:22 +01:00
|
|
|
dmaDescFree(p->dma_desc_free), dmaDataFree(p->dma_data_free),
|
|
|
|
txDelay(p->tx_delay), rxDelay(p->rx_delay),
|
2005-06-27 23:02:40 +02:00
|
|
|
rxKickTick(0), rxKickEvent(this), txKickTick(0), txKickEvent(this),
|
2004-11-13 21:45:22 +01:00
|
|
|
txEvent(this), rxFilterEnable(p->rx_filter), acceptBroadcast(false),
|
2004-04-22 00:23:41 +02:00
|
|
|
acceptMulticast(false), acceptUnicast(false),
|
2005-08-13 00:30:35 +02:00
|
|
|
acceptPerfect(false), acceptArp(false), multicastHashEnable(false),
|
2004-11-13 21:45:22 +01:00
|
|
|
physmem(p->pmem), intrTick(0), cpuPendingIntr(false),
|
2004-07-13 04:58:22 +02:00
|
|
|
intrEvent(0), interface(0)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2005-11-20 22:57:53 +01:00
|
|
|
if (p->pio_bus) {
|
2005-08-23 17:45:52 +02:00
|
|
|
pioInterface = newPioInterface(name() + ".pio", p->hier,
|
2005-11-20 22:57:53 +01:00
|
|
|
p->pio_bus, this,
|
2004-05-25 21:59:54 +02:00
|
|
|
&NSGigE::cacheAccess);
|
2005-11-20 22:57:53 +01:00
|
|
|
pioLatency = p->pio_latency * p->pio_bus->clockRate;
|
|
|
|
}
|
2004-06-04 21:12:27 +02:00
|
|
|
|
2005-11-20 22:57:53 +01:00
|
|
|
if (p->header_bus) {
|
2004-11-13 21:45:22 +01:00
|
|
|
if (p->payload_bus)
|
|
|
|
dmaInterface = new DMAInterface<Bus>(name() + ".dma",
|
|
|
|
p->header_bus,
|
2005-04-30 03:01:43 +02:00
|
|
|
p->payload_bus, 1,
|
|
|
|
p->dma_no_allocate);
|
2004-04-22 00:23:41 +02:00
|
|
|
else
|
2004-11-13 21:45:22 +01:00
|
|
|
dmaInterface = new DMAInterface<Bus>(name() + ".dma",
|
|
|
|
p->header_bus,
|
2005-04-30 03:01:43 +02:00
|
|
|
p->header_bus, 1,
|
|
|
|
p->dma_no_allocate);
|
2005-11-20 22:57:53 +01:00
|
|
|
} else if (p->payload_bus)
|
|
|
|
panic("Must define a header bus if defining a payload bus");
|
2004-04-22 00:23:41 +02:00
|
|
|
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
intrDelay = p->intr_delay;
|
2004-11-13 21:45:22 +01:00
|
|
|
dmaReadDelay = p->dma_read_delay;
|
|
|
|
dmaWriteDelay = p->dma_write_delay;
|
|
|
|
dmaReadFactor = p->dma_read_factor;
|
|
|
|
dmaWriteFactor = p->dma_write_factor;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
regsReset();
|
2004-11-13 21:45:22 +01:00
|
|
|
memcpy(&rom.perfectMatch, p->eaddr.bytes(), ETH_ADDR_LEN);
|
2005-10-12 19:39:40 +02:00
|
|
|
|
|
|
|
memset(&rxDesc32, 0, sizeof(rxDesc32));
|
|
|
|
memset(&txDesc32, 0, sizeof(txDesc32));
|
|
|
|
memset(&rxDesc64, 0, sizeof(rxDesc64));
|
|
|
|
memset(&txDesc64, 0, sizeof(txDesc64));
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::~NSGigE()
|
2004-03-12 17:04:58 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::regStats()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
txBytes
|
|
|
|
.name(name() + ".txBytes")
|
|
|
|
.desc("Bytes Transmitted")
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
rxBytes
|
|
|
|
.name(name() + ".rxBytes")
|
|
|
|
.desc("Bytes Received")
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
txPackets
|
|
|
|
.name(name() + ".txPackets")
|
|
|
|
.desc("Number of Packets Transmitted")
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
rxPackets
|
|
|
|
.name(name() + ".rxPackets")
|
|
|
|
.desc("Number of Packets Received")
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
txIpChecksums
|
|
|
|
.name(name() + ".txIpChecksums")
|
2004-07-04 22:47:07 +02:00
|
|
|
.desc("Number of tx IP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
rxIpChecksums
|
|
|
|
.name(name() + ".rxIpChecksums")
|
2004-07-04 22:47:07 +02:00
|
|
|
.desc("Number of rx IP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
txTcpChecksums
|
|
|
|
.name(name() + ".txTcpChecksums")
|
2004-07-04 22:47:07 +02:00
|
|
|
.desc("Number of tx TCP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
rxTcpChecksums
|
|
|
|
.name(name() + ".rxTcpChecksums")
|
2004-07-04 22:47:07 +02:00
|
|
|
.desc("Number of rx TCP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
txUdpChecksums
|
|
|
|
.name(name() + ".txUdpChecksums")
|
|
|
|
.desc("Number of tx UDP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
rxUdpChecksums
|
|
|
|
.name(name() + ".rxUdpChecksums")
|
|
|
|
.desc("Number of rx UDP Checksums done by device")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaReads
|
|
|
|
.name(name() + ".descDMAReads")
|
|
|
|
.desc("Number of descriptors the device read w/ DMA")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
descDmaWrites
|
|
|
|
.name(name() + ".descDMAWrites")
|
|
|
|
.desc("Number of descriptors the device wrote w/ DMA")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
descDmaRdBytes
|
|
|
|
.name(name() + ".descDmaReadBytes")
|
|
|
|
.desc("number of descriptor bytes read w/ DMA")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
descDmaWrBytes
|
|
|
|
.name(name() + ".descDmaWriteBytes")
|
|
|
|
.desc("number of descriptor bytes write w/ DMA")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
txBandwidth
|
|
|
|
.name(name() + ".txBandwidth")
|
|
|
|
.desc("Transmit Bandwidth (bits/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
rxBandwidth
|
|
|
|
.name(name() + ".rxBandwidth")
|
|
|
|
.desc("Receive Bandwidth (bits/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2005-01-20 00:40:02 +01:00
|
|
|
totBandwidth
|
|
|
|
.name(name() + ".totBandwidth")
|
|
|
|
.desc("Total Bandwidth (bits/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(totBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
totPackets
|
|
|
|
.name(name() + ".totPackets")
|
|
|
|
.desc("Total Packets")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(totBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
totBytes
|
|
|
|
.name(name() + ".totBytes")
|
|
|
|
.desc("Total Bytes")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(totBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
totPacketRate
|
|
|
|
.name(name() + ".totPPS")
|
|
|
|
.desc("Total Tranmission Rate (packets/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(totBytes)
|
|
|
|
;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
txPacketRate
|
|
|
|
.name(name() + ".txPPS")
|
|
|
|
.desc("Packet Tranmission Rate (packets/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(txBytes)
|
|
|
|
;
|
|
|
|
|
|
|
|
rxPacketRate
|
|
|
|
.name(name() + ".rxPPS")
|
|
|
|
.desc("Packet Reception Rate (packets/s)")
|
|
|
|
.precision(0)
|
|
|
|
.prereq(rxBytes)
|
|
|
|
;
|
|
|
|
|
2004-11-18 21:46:01 +01:00
|
|
|
postedSwi
|
|
|
|
.name(name() + ".postedSwi")
|
|
|
|
.desc("number of software interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalSwi
|
|
|
|
.name(name() + ".totalSwi")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of Swi written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedSwi
|
|
|
|
.name(name() + ".coalescedSwi")
|
|
|
|
.desc("average number of Swi's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedRxIdle
|
|
|
|
.name(name() + ".postedRxIdle")
|
|
|
|
.desc("number of rxIdle interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalRxIdle
|
|
|
|
.name(name() + ".totalRxIdle")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of RxIdle written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedRxIdle
|
|
|
|
.name(name() + ".coalescedRxIdle")
|
|
|
|
.desc("average number of RxIdle's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedRxOk
|
|
|
|
.name(name() + ".postedRxOk")
|
|
|
|
.desc("number of RxOk interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalRxOk
|
|
|
|
.name(name() + ".totalRxOk")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of RxOk written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedRxOk
|
|
|
|
.name(name() + ".coalescedRxOk")
|
|
|
|
.desc("average number of RxOk's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedRxDesc
|
|
|
|
.name(name() + ".postedRxDesc")
|
|
|
|
.desc("number of RxDesc interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalRxDesc
|
|
|
|
.name(name() + ".totalRxDesc")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of RxDesc written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedRxDesc
|
|
|
|
.name(name() + ".coalescedRxDesc")
|
|
|
|
.desc("average number of RxDesc's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedTxOk
|
|
|
|
.name(name() + ".postedTxOk")
|
|
|
|
.desc("number of TxOk interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalTxOk
|
|
|
|
.name(name() + ".totalTxOk")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of TxOk written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedTxOk
|
|
|
|
.name(name() + ".coalescedTxOk")
|
|
|
|
.desc("average number of TxOk's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedTxIdle
|
|
|
|
.name(name() + ".postedTxIdle")
|
|
|
|
.desc("number of TxIdle interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalTxIdle
|
|
|
|
.name(name() + ".totalTxIdle")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of TxIdle written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedTxIdle
|
|
|
|
.name(name() + ".coalescedTxIdle")
|
|
|
|
.desc("average number of TxIdle's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedTxDesc
|
|
|
|
.name(name() + ".postedTxDesc")
|
|
|
|
.desc("number of TxDesc interrupts posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalTxDesc
|
|
|
|
.name(name() + ".totalTxDesc")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of TxDesc written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedTxDesc
|
|
|
|
.name(name() + ".coalescedTxDesc")
|
|
|
|
.desc("average number of TxDesc's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedRxOrn
|
|
|
|
.name(name() + ".postedRxOrn")
|
|
|
|
.desc("number of RxOrn posted to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
totalRxOrn
|
|
|
|
.name(name() + ".totalRxOrn")
|
2005-10-12 19:53:10 +02:00
|
|
|
.desc("total number of RxOrn written to ISR")
|
2004-11-18 21:46:01 +01:00
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedRxOrn
|
|
|
|
.name(name() + ".coalescedRxOrn")
|
|
|
|
.desc("average number of RxOrn's coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedTotal
|
|
|
|
.name(name() + ".coalescedTotal")
|
|
|
|
.desc("average number of interrupts coalesced into each post")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
postedInterrupts
|
|
|
|
.name(name() + ".postedInterrupts")
|
|
|
|
.desc("number of posts to CPU")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
droppedPackets
|
|
|
|
.name(name() + ".droppedPackets")
|
|
|
|
.desc("number of packets dropped")
|
|
|
|
.precision(0)
|
|
|
|
;
|
|
|
|
|
|
|
|
coalescedSwi = totalSwi / postedInterrupts;
|
|
|
|
coalescedRxIdle = totalRxIdle / postedInterrupts;
|
|
|
|
coalescedRxOk = totalRxOk / postedInterrupts;
|
|
|
|
coalescedRxDesc = totalRxDesc / postedInterrupts;
|
|
|
|
coalescedTxOk = totalTxOk / postedInterrupts;
|
|
|
|
coalescedTxIdle = totalTxIdle / postedInterrupts;
|
|
|
|
coalescedTxDesc = totalTxDesc / postedInterrupts;
|
|
|
|
coalescedRxOrn = totalRxOrn / postedInterrupts;
|
|
|
|
|
2005-06-20 04:13:31 +02:00
|
|
|
coalescedTotal = (totalSwi + totalRxIdle + totalRxOk + totalRxDesc +
|
|
|
|
totalTxOk + totalTxIdle + totalTxDesc +
|
|
|
|
totalRxOrn) / postedInterrupts;
|
2004-11-18 21:46:01 +01:00
|
|
|
|
2004-05-21 19:39:20 +02:00
|
|
|
txBandwidth = txBytes * Stats::constant(8) / simSeconds;
|
|
|
|
rxBandwidth = rxBytes * Stats::constant(8) / simSeconds;
|
2005-01-20 00:40:02 +01:00
|
|
|
totBandwidth = txBandwidth + rxBandwidth;
|
|
|
|
totBytes = txBytes + rxBytes;
|
|
|
|
totPackets = txPackets + rxPackets;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
txPacketRate = txPackets / simSeconds;
|
|
|
|
rxPacketRate = rxPackets / simSeconds;
|
|
|
|
}
|
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
/**
|
|
|
|
* This is to read the PCI general configuration registers
|
|
|
|
*/
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2005-08-15 22:59:58 +02:00
|
|
|
NSGigE::readConfig(int offset, int size, uint8_t *data)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
if (offset < PCI_DEVICE_SPECIFIC)
|
2005-08-15 22:59:58 +02:00
|
|
|
PciDev::readConfig(offset, size, data);
|
2004-06-04 21:12:27 +02:00
|
|
|
else
|
|
|
|
panic("Device specific PCI config space not implemented!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
/**
|
|
|
|
* This is to write to the PCI general configuration registers
|
|
|
|
*/
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2005-08-15 22:59:58 +02:00
|
|
|
NSGigE::writeConfig(int offset, int size, const uint8_t* data)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
if (offset < PCI_DEVICE_SPECIFIC)
|
2005-08-15 22:59:58 +02:00
|
|
|
PciDev::writeConfig(offset, size, data);
|
2004-03-12 17:04:58 +01:00
|
|
|
else
|
2004-06-04 21:12:27 +02:00
|
|
|
panic("Device specific PCI config space not implemented!\n");
|
|
|
|
|
|
|
|
// Need to catch writes to BARs to update the PIO interface
|
|
|
|
switch (offset) {
|
2004-07-27 05:10:20 +02:00
|
|
|
// seems to work fine without all these PCI settings, but i
|
|
|
|
// put in the IO to double check, an assertion will fail if we
|
|
|
|
// need to properly implement it
|
2004-06-12 20:24:20 +02:00
|
|
|
case PCI_COMMAND:
|
|
|
|
if (config.data[offset] & PCI_CMD_IOSE)
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
ioEnable = true;
|
2004-06-12 20:24:20 +02:00
|
|
|
else
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
ioEnable = false;
|
|
|
|
|
2004-06-12 20:24:20 +02:00
|
|
|
#if 0
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
if (config.data[offset] & PCI_CMD_BME) {
|
|
|
|
bmEnabled = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bmEnabled = false;
|
|
|
|
}
|
2004-06-12 20:24:20 +02:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
if (config.data[offset] & PCI_CMD_MSE) {
|
|
|
|
memEnable = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
memEnable = false;
|
|
|
|
}
|
2004-06-12 20:24:20 +02:00
|
|
|
#endif
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
break;
|
2004-06-12 20:24:20 +02:00
|
|
|
|
2004-06-04 21:12:27 +02:00
|
|
|
case PCI0_BASE_ADDR0:
|
|
|
|
if (BARAddrs[0] != 0) {
|
|
|
|
if (pioInterface)
|
2004-10-22 07:34:40 +02:00
|
|
|
pioInterface->addAddrRange(RangeSize(BARAddrs[0], BARSize[0]));
|
2004-06-10 19:30:58 +02:00
|
|
|
|
2004-11-13 20:01:38 +01:00
|
|
|
BARAddrs[0] &= EV5::PAddrUncachedMask;
|
2004-06-10 19:30:58 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PCI0_BASE_ADDR1:
|
|
|
|
if (BARAddrs[1] != 0) {
|
|
|
|
if (pioInterface)
|
2004-10-22 07:34:40 +02:00
|
|
|
pioInterface->addAddrRange(RangeSize(BARAddrs[1], BARSize[1]));
|
2004-06-10 19:30:58 +02:00
|
|
|
|
2004-11-13 20:01:38 +01:00
|
|
|
BARAddrs[1] &= EV5::PAddrUncachedMask;
|
2004-06-04 21:12:27 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
/**
|
|
|
|
* This reads the device registers, which are detailed in the NS83820
|
|
|
|
* spec sheet
|
|
|
|
*/
|
2006-02-22 02:10:40 +01:00
|
|
|
Fault
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::read(MemReqPtr &req, uint8_t *data)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
assert(ioEnable);
|
2004-06-12 20:24:20 +02:00
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
//The mask is to give you only the offset into the device register file
|
2004-04-22 00:23:41 +02:00
|
|
|
Addr daddr = req->paddr & 0xfff;
|
|
|
|
DPRINTF(EthernetPIO, "read da=%#x pa=%#x va=%#x size=%d\n",
|
|
|
|
daddr, req->paddr, req->vaddr, req->size);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// there are some reserved registers, you can see ns_gige_reg.h and
|
|
|
|
// the spec sheet for details
|
2004-04-22 00:23:41 +02:00
|
|
|
if (daddr > LAST && daddr <= RESERVED) {
|
2004-03-12 17:04:58 +01:00
|
|
|
panic("Accessing reserved register");
|
2004-04-22 00:23:41 +02:00
|
|
|
} else if (daddr > RESERVED && daddr <= 0x3FC) {
|
2005-08-15 22:59:58 +02:00
|
|
|
readConfig(daddr & 0xff, req->size, data);
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else if (daddr >= MIB_START && daddr <= MIB_END) {
|
|
|
|
// don't implement all the MIB's. hopefully the kernel
|
|
|
|
// doesn't actually DEPEND upon their values
|
2004-04-22 00:43:39 +02:00
|
|
|
// MIB are just hardware stats keepers
|
2004-04-22 00:23:41 +02:00
|
|
|
uint32_t ® = *(uint32_t *) data;
|
|
|
|
reg = 0;
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else if (daddr > 0x3FC)
|
|
|
|
panic("Something is messed up!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
switch (req->size) {
|
|
|
|
case sizeof(uint32_t):
|
|
|
|
{
|
|
|
|
uint32_t ® = *(uint32_t *)data;
|
2005-08-18 19:29:40 +02:00
|
|
|
uint16_t rfaddr;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
switch (daddr) {
|
|
|
|
case CR:
|
|
|
|
reg = regs.command;
|
2004-04-22 00:43:39 +02:00
|
|
|
//these are supposed to be cleared on a read
|
2004-03-12 17:04:58 +01:00
|
|
|
reg &= ~(CR_RXD | CR_TXD | CR_TXR | CR_RXR);
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case CFGR:
|
2004-03-12 17:04:58 +01:00
|
|
|
reg = regs.config;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MEAR:
|
|
|
|
reg = regs.mear;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PTSCR:
|
|
|
|
reg = regs.ptscr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ISR:
|
|
|
|
reg = regs.isr;
|
2004-05-18 20:30:17 +02:00
|
|
|
devIntrClear(ISR_ALL);
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IMR:
|
|
|
|
reg = regs.imr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IER:
|
|
|
|
reg = regs.ier;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IHR:
|
|
|
|
reg = regs.ihr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TXDP:
|
|
|
|
reg = regs.txdp;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TXDP_HI:
|
|
|
|
reg = regs.txdp_hi;
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case TX_CFG:
|
2004-03-12 17:04:58 +01:00
|
|
|
reg = regs.txcfg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GPIOR:
|
|
|
|
reg = regs.gpior;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RXDP:
|
|
|
|
reg = regs.rxdp;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RXDP_HI:
|
|
|
|
reg = regs.rxdp_hi;
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case RX_CFG:
|
2004-03-12 17:04:58 +01:00
|
|
|
reg = regs.rxcfg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PQCR:
|
|
|
|
reg = regs.pqcr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WCSR:
|
|
|
|
reg = regs.wcsr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCR:
|
|
|
|
reg = regs.pcr;
|
|
|
|
break;
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// see the spec sheet for how RFCR and RFDR work
|
|
|
|
// basically, you write to RFCR to tell the machine
|
|
|
|
// what you want to do next, then you act upon RFDR,
|
|
|
|
// and the device will be prepared b/c of what you
|
|
|
|
// wrote to RFCR
|
2004-03-12 17:04:58 +01:00
|
|
|
case RFCR:
|
|
|
|
reg = regs.rfcr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RFDR:
|
2005-08-18 19:29:40 +02:00
|
|
|
rfaddr = (uint16_t)(regs.rfcr & RFCR_RFADDR);
|
2005-08-13 00:30:35 +02:00
|
|
|
switch (rfaddr) {
|
|
|
|
// Read from perfect match ROM octets
|
2004-03-12 17:04:58 +01:00
|
|
|
case 0x000:
|
2004-04-22 00:23:41 +02:00
|
|
|
reg = rom.perfectMatch[1];
|
|
|
|
reg = reg << 8;
|
|
|
|
reg += rom.perfectMatch[0];
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
case 0x002:
|
2004-04-22 00:23:41 +02:00
|
|
|
reg = rom.perfectMatch[3] << 8;
|
|
|
|
reg += rom.perfectMatch[2];
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
case 0x004:
|
2004-04-22 00:23:41 +02:00
|
|
|
reg = rom.perfectMatch[5] << 8;
|
|
|
|
reg += rom.perfectMatch[4];
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
default:
|
2005-08-13 00:30:35 +02:00
|
|
|
// Read filter hash table
|
|
|
|
if (rfaddr >= FHASH_ADDR &&
|
|
|
|
rfaddr < FHASH_ADDR + FHASH_SIZE) {
|
|
|
|
|
|
|
|
// Only word-aligned reads supported
|
|
|
|
if (rfaddr % 2)
|
|
|
|
panic("unaligned read from filter hash table!");
|
|
|
|
|
|
|
|
reg = rom.filterHash[rfaddr - FHASH_ADDR + 1] << 8;
|
|
|
|
reg += rom.filterHash[rfaddr - FHASH_ADDR];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-08-18 19:29:40 +02:00
|
|
|
panic("reading RFDR for something other than pattern"
|
|
|
|
" matching or hashing! %#x\n", rfaddr);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SRR:
|
|
|
|
reg = regs.srr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MIBC:
|
|
|
|
reg = regs.mibc;
|
|
|
|
reg &= ~(MIBC_MIBS | MIBC_ACLR);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VRCR:
|
|
|
|
reg = regs.vrcr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VTCR:
|
|
|
|
reg = regs.vtcr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VDR:
|
|
|
|
reg = regs.vdr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CCSR:
|
|
|
|
reg = regs.ccsr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TBICR:
|
|
|
|
reg = regs.tbicr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TBISR:
|
|
|
|
reg = regs.tbisr;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TANAR:
|
|
|
|
reg = regs.tanar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TANLPAR:
|
|
|
|
reg = regs.tanlpar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TANER:
|
|
|
|
reg = regs.taner;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TESR:
|
|
|
|
reg = regs.tesr;
|
|
|
|
break;
|
|
|
|
|
2005-04-25 03:32:32 +02:00
|
|
|
case M5REG:
|
2005-10-19 03:01:05 +02:00
|
|
|
reg = 0;
|
2005-11-25 19:33:36 +01:00
|
|
|
if (params()->rx_thread)
|
|
|
|
reg |= M5REG_RX_THREAD;
|
|
|
|
if (params()->tx_thread)
|
|
|
|
reg |= M5REG_TX_THREAD;
|
2005-04-25 03:32:32 +02:00
|
|
|
break;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
default:
|
2004-07-30 17:33:45 +02:00
|
|
|
panic("reading unimplemented register: addr=%#x", daddr);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-05-26 19:06:32 +02:00
|
|
|
DPRINTF(EthernetPIO, "read from %#x: data=%d data=%#x\n",
|
|
|
|
daddr, reg, reg);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("accessing register with invalid size: addr=%#x, size=%d",
|
|
|
|
daddr, req->size);
|
|
|
|
}
|
|
|
|
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2006-02-22 02:10:40 +01:00
|
|
|
Fault
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::write(MemReqPtr &req, const uint8_t *data)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
assert(ioEnable);
|
2004-06-12 20:24:20 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
Addr daddr = req->paddr & 0xfff;
|
|
|
|
DPRINTF(EthernetPIO, "write da=%#x pa=%#x va=%#x size=%d\n",
|
|
|
|
daddr, req->paddr, req->vaddr, req->size);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (daddr > LAST && daddr <= RESERVED) {
|
2004-03-12 17:04:58 +01:00
|
|
|
panic("Accessing reserved register");
|
2004-04-22 00:23:41 +02:00
|
|
|
} else if (daddr > RESERVED && daddr <= 0x3FC) {
|
2005-08-15 22:59:58 +02:00
|
|
|
writeConfig(daddr & 0xff, req->size, data);
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else if (daddr > 0x3FC)
|
|
|
|
panic("Something is messed up!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
if (req->size == sizeof(uint32_t)) {
|
|
|
|
uint32_t reg = *(uint32_t *)data;
|
2005-08-18 19:29:40 +02:00
|
|
|
uint16_t rfaddr;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
DPRINTF(EthernetPIO, "write data=%d data=%#x\n", reg, reg);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
switch (daddr) {
|
|
|
|
case CR:
|
|
|
|
regs.command = reg;
|
2004-07-30 17:29:45 +02:00
|
|
|
if (reg & CR_TXD) {
|
|
|
|
txEnable = false;
|
2004-03-12 17:04:58 +01:00
|
|
|
} else if (reg & CR_TXE) {
|
2006-02-21 05:41:50 +01:00
|
|
|
txEnable = true;
|
2004-07-30 17:29:45 +02:00
|
|
|
|
2006-02-21 05:41:50 +01:00
|
|
|
// the kernel is enabling the transmit machine
|
|
|
|
if (txState == txIdle)
|
|
|
|
txKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-07-30 17:29:45 +02:00
|
|
|
if (reg & CR_RXD) {
|
|
|
|
rxEnable = false;
|
2004-03-12 17:04:58 +01:00
|
|
|
} else if (reg & CR_RXE) {
|
2006-02-21 05:41:50 +01:00
|
|
|
rxEnable = true;
|
2004-07-30 17:29:45 +02:00
|
|
|
|
2006-02-21 05:41:50 +01:00
|
|
|
if (rxState == rxIdle)
|
|
|
|
rxKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (reg & CR_TXR)
|
|
|
|
txReset();
|
|
|
|
|
|
|
|
if (reg & CR_RXR)
|
|
|
|
rxReset();
|
|
|
|
|
|
|
|
if (reg & CR_SWI)
|
|
|
|
devIntrPost(ISR_SWI);
|
|
|
|
|
|
|
|
if (reg & CR_RST) {
|
|
|
|
txReset();
|
|
|
|
rxReset();
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
regsReset();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case CFGR:
|
|
|
|
if (reg & CFGR_LNKSTS ||
|
|
|
|
reg & CFGR_SPDSTS ||
|
|
|
|
reg & CFGR_DUPSTS ||
|
|
|
|
reg & CFGR_RESERVED ||
|
|
|
|
reg & CFGR_T64ADDR ||
|
|
|
|
reg & CFGR_PCI64_DET)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
// First clear all writable bits
|
|
|
|
regs.config &= CFGR_LNKSTS | CFGR_SPDSTS | CFGR_DUPSTS |
|
|
|
|
CFGR_RESERVED | CFGR_T64ADDR |
|
|
|
|
CFGR_PCI64_DET;
|
|
|
|
// Now set the appropriate writable bits
|
2005-05-29 03:54:32 +02:00
|
|
|
regs.config |= reg & ~(CFGR_LNKSTS | CFGR_SPDSTS | CFGR_DUPSTS |
|
2005-06-27 23:02:40 +02:00
|
|
|
CFGR_RESERVED | CFGR_T64ADDR |
|
|
|
|
CFGR_PCI64_DET);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// all these #if 0's are because i don't THINK the kernel needs to
|
|
|
|
// have these implemented. if there is a problem relating to one of
|
|
|
|
// these, you may need to add functionality in.
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_TBI_EN) ;
|
|
|
|
if (reg & CFGR_MODE_1000) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_AUTO_1000)
|
|
|
|
panic("CFGR_AUTO_1000 not implemented!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_PINT_DUPSTS ||
|
|
|
|
reg & CFGR_PINT_LNKSTS ||
|
|
|
|
reg & CFGR_PINT_SPDSTS)
|
2004-07-27 05:10:20 +02:00
|
|
|
;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_TMRTEST) ;
|
|
|
|
if (reg & CFGR_MRM_DIS) ;
|
|
|
|
if (reg & CFGR_MWI_DIS) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (reg & CFGR_T64ADDR) ;
|
|
|
|
// panic("CFGR_T64ADDR is read only register!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_PCI64_DET)
|
|
|
|
panic("CFGR_PCI64_DET is read only register!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_DATA64_EN) ;
|
|
|
|
if (reg & CFGR_M64ADDR) ;
|
|
|
|
if (reg & CFGR_PHY_RST) ;
|
|
|
|
if (reg & CFGR_PHY_DIS) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & CFGR_EXTSTS_EN)
|
2004-03-12 17:04:58 +01:00
|
|
|
extstsEnable = true;
|
|
|
|
else
|
|
|
|
extstsEnable = false;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (reg & CFGR_REQALG) ;
|
|
|
|
if (reg & CFGR_SB) ;
|
|
|
|
if (reg & CFGR_POW) ;
|
|
|
|
if (reg & CFGR_EXD) ;
|
|
|
|
if (reg & CFGR_PESEL) ;
|
|
|
|
if (reg & CFGR_BROM_DIS) ;
|
|
|
|
if (reg & CFGR_EXT_125) ;
|
|
|
|
if (reg & CFGR_BEM) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MEAR:
|
2005-08-13 00:30:35 +02:00
|
|
|
// Clear writable bits
|
|
|
|
regs.mear &= MEAR_EEDO;
|
|
|
|
// Set appropriate writable bits
|
|
|
|
regs.mear |= reg & ~MEAR_EEDO;
|
|
|
|
|
|
|
|
// FreeBSD uses the EEPROM to read PMATCH (for the MAC address)
|
|
|
|
// even though it could get it through RFDR
|
|
|
|
if (reg & MEAR_EESEL) {
|
|
|
|
// Rising edge of clock
|
|
|
|
if (reg & MEAR_EECLK && !eepromClk)
|
|
|
|
eepromKick();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eepromState = eepromStart;
|
|
|
|
regs.mear &= ~MEAR_EEDI;
|
|
|
|
}
|
|
|
|
|
|
|
|
eepromClk = reg & MEAR_EECLK;
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// since phy is completely faked, MEAR_MD* don't matter
|
2004-03-12 17:04:58 +01:00
|
|
|
if (reg & MEAR_MDIO) ;
|
|
|
|
if (reg & MEAR_MDDIR) ;
|
|
|
|
if (reg & MEAR_MDC) ;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PTSCR:
|
2004-04-22 00:23:41 +02:00
|
|
|
regs.ptscr = reg & ~(PTSCR_RBIST_RDONLY);
|
2004-07-27 05:10:20 +02:00
|
|
|
// these control BISTs for various parts of chip - we
|
|
|
|
// don't care or do just fake that the BIST is done
|
2004-04-22 00:23:41 +02:00
|
|
|
if (reg & PTSCR_RBIST_EN)
|
|
|
|
regs.ptscr |= PTSCR_RBIST_DONE;
|
|
|
|
if (reg & PTSCR_EEBIST_EN)
|
|
|
|
regs.ptscr &= ~PTSCR_EEBIST_EN;
|
|
|
|
if (reg & PTSCR_EELOAD_EN)
|
|
|
|
regs.ptscr &= ~PTSCR_EELOAD_EN;
|
2004-03-12 17:04:58 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ISR: /* writing to the ISR has no effect */
|
|
|
|
panic("ISR is a read only register!\n");
|
|
|
|
|
|
|
|
case IMR:
|
|
|
|
regs.imr = reg;
|
|
|
|
devIntrChangeMask();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IER:
|
|
|
|
regs.ier = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IHR:
|
|
|
|
regs.ihr = reg;
|
|
|
|
/* not going to implement real interrupt holdoff */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TXDP:
|
|
|
|
regs.txdp = (reg & 0xFFFFFFFC);
|
|
|
|
assert(txState == txIdle);
|
|
|
|
CTDD = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TXDP_HI:
|
|
|
|
regs.txdp_hi = reg;
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case TX_CFG:
|
2004-03-12 17:04:58 +01:00
|
|
|
regs.txcfg = reg;
|
|
|
|
#if 0
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & TX_CFG_CSI) ;
|
|
|
|
if (reg & TX_CFG_HBI) ;
|
|
|
|
if (reg & TX_CFG_MLB) ;
|
|
|
|
if (reg & TX_CFG_ATP) ;
|
|
|
|
if (reg & TX_CFG_ECRETRY) {
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* this could easily be implemented, but considering
|
|
|
|
* the network is just a fake pipe, wouldn't make
|
|
|
|
* sense to do this
|
|
|
|
*/
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & TX_CFG_BRST_DIS) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
#endif
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
#if 0
|
2004-04-22 00:23:41 +02:00
|
|
|
/* we handle our own DMA, ignore the kernel's exhortations */
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & TX_CFG_MXDMA) ;
|
2004-07-27 05:10:20 +02:00
|
|
|
#endif
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// also, we currently don't care about fill/drain
|
|
|
|
// thresholds though this may change in the future with
|
|
|
|
// more realistic networks or a driver which changes it
|
|
|
|
// according to feedback
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GPIOR:
|
2005-08-13 00:30:35 +02:00
|
|
|
// Only write writable bits
|
|
|
|
regs.gpior &= GPIOR_UNUSED | GPIOR_GP5_IN | GPIOR_GP4_IN
|
|
|
|
| GPIOR_GP3_IN | GPIOR_GP2_IN | GPIOR_GP1_IN;
|
|
|
|
regs.gpior |= reg & ~(GPIOR_UNUSED | GPIOR_GP5_IN | GPIOR_GP4_IN
|
|
|
|
| GPIOR_GP3_IN | GPIOR_GP2_IN | GPIOR_GP1_IN);
|
2004-03-12 17:04:58 +01:00
|
|
|
/* these just control general purpose i/o pins, don't matter */
|
|
|
|
break;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case RXDP:
|
|
|
|
regs.rxdp = reg;
|
2004-07-30 17:29:45 +02:00
|
|
|
CRDD = false;
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RXDP_HI:
|
|
|
|
regs.rxdp_hi = reg;
|
|
|
|
break;
|
|
|
|
|
2005-05-29 03:54:32 +02:00
|
|
|
case RX_CFG:
|
2004-03-12 17:04:58 +01:00
|
|
|
regs.rxcfg = reg;
|
|
|
|
#if 0
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & RX_CFG_AEP) ;
|
|
|
|
if (reg & RX_CFG_ARP) ;
|
|
|
|
if (reg & RX_CFG_STRIPCRC) ;
|
|
|
|
if (reg & RX_CFG_RX_RD) ;
|
|
|
|
if (reg & RX_CFG_ALP) ;
|
|
|
|
if (reg & RX_CFG_AIRL) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/* we handle our own DMA, ignore what kernel says about it */
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & RX_CFG_MXDMA) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
//also, we currently don't care about fill/drain thresholds
|
|
|
|
//though this may change in the future with more realistic
|
|
|
|
//networks or a driver which changes it according to feedback
|
2005-05-29 03:54:32 +02:00
|
|
|
if (reg & (RX_CFG_DRTH | RX_CFG_DRTH0)) ;
|
2004-03-12 17:04:58 +01:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PQCR:
|
|
|
|
/* there is no priority queueing used in the linux 2.6 driver */
|
|
|
|
regs.pqcr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WCSR:
|
|
|
|
/* not going to implement wake on LAN */
|
|
|
|
regs.wcsr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCR:
|
|
|
|
/* not going to implement pause control */
|
|
|
|
regs.pcr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RFCR:
|
|
|
|
regs.rfcr = reg;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
rxFilterEnable = (reg & RFCR_RFEN) ? true : false;
|
|
|
|
acceptBroadcast = (reg & RFCR_AAB) ? true : false;
|
|
|
|
acceptMulticast = (reg & RFCR_AAM) ? true : false;
|
|
|
|
acceptUnicast = (reg & RFCR_AAU) ? true : false;
|
|
|
|
acceptPerfect = (reg & RFCR_APM) ? true : false;
|
|
|
|
acceptArp = (reg & RFCR_AARP) ? true : false;
|
2005-08-13 00:30:35 +02:00
|
|
|
multicastHashEnable = (reg & RFCR_MHEN) ? true : false;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
#if 0
|
|
|
|
if (reg & RFCR_APAT)
|
|
|
|
panic("RFCR_APAT not implemented!\n");
|
|
|
|
#endif
|
2005-08-13 00:30:35 +02:00
|
|
|
if (reg & RFCR_UHEN)
|
|
|
|
panic("Unicast hash filtering not used by drivers!\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
if (reg & RFCR_ULM)
|
|
|
|
panic("RFCR_ULM not implemented!\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RFDR:
|
2005-08-18 19:29:40 +02:00
|
|
|
rfaddr = (uint16_t)(regs.rfcr & RFCR_RFADDR);
|
2005-08-13 00:30:35 +02:00
|
|
|
switch (rfaddr) {
|
|
|
|
case 0x000:
|
|
|
|
rom.perfectMatch[0] = (uint8_t)reg;
|
|
|
|
rom.perfectMatch[1] = (uint8_t)(reg >> 8);
|
|
|
|
break;
|
|
|
|
case 0x002:
|
|
|
|
rom.perfectMatch[2] = (uint8_t)reg;
|
|
|
|
rom.perfectMatch[3] = (uint8_t)(reg >> 8);
|
|
|
|
break;
|
|
|
|
case 0x004:
|
|
|
|
rom.perfectMatch[4] = (uint8_t)reg;
|
|
|
|
rom.perfectMatch[5] = (uint8_t)(reg >> 8);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
|
|
|
|
if (rfaddr >= FHASH_ADDR &&
|
|
|
|
rfaddr < FHASH_ADDR + FHASH_SIZE) {
|
|
|
|
|
|
|
|
// Only word-aligned writes supported
|
|
|
|
if (rfaddr % 2)
|
|
|
|
panic("unaligned write to filter hash table!");
|
|
|
|
|
|
|
|
rom.filterHash[rfaddr - FHASH_ADDR] = (uint8_t)reg;
|
|
|
|
rom.filterHash[rfaddr - FHASH_ADDR + 1]
|
|
|
|
= (uint8_t)(reg >> 8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
panic("writing RFDR for something other than pattern matching\
|
|
|
|
or hashing! %#x\n", rfaddr);
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
case BRAR:
|
2005-08-13 00:30:35 +02:00
|
|
|
regs.brar = reg;
|
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
case BRDR:
|
|
|
|
panic("the driver never uses BRDR, something is wrong!\n");
|
|
|
|
|
|
|
|
case SRR:
|
|
|
|
panic("SRR is read only register!\n");
|
|
|
|
|
|
|
|
case MIBC:
|
|
|
|
panic("the driver never uses MIBC, something is wrong!\n");
|
|
|
|
|
|
|
|
case VRCR:
|
|
|
|
regs.vrcr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VTCR:
|
|
|
|
regs.vtcr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VDR:
|
|
|
|
panic("the driver never uses VDR, something is wrong!\n");
|
|
|
|
|
|
|
|
case CCSR:
|
|
|
|
/* not going to implement clockrun stuff */
|
|
|
|
regs.ccsr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TBICR:
|
|
|
|
regs.tbicr = reg;
|
|
|
|
if (reg & TBICR_MR_LOOPBACK)
|
|
|
|
panic("TBICR_MR_LOOPBACK never used, something wrong!\n");
|
|
|
|
|
|
|
|
if (reg & TBICR_MR_AN_ENABLE) {
|
|
|
|
regs.tanlpar = regs.tanar;
|
|
|
|
regs.tbisr |= (TBISR_MR_AN_COMPLETE | TBISR_MR_LINK_STATUS);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (reg & TBICR_MR_RESTART_AN) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TBISR:
|
|
|
|
panic("TBISR is read only register!\n");
|
|
|
|
|
|
|
|
case TANAR:
|
2005-08-13 00:30:35 +02:00
|
|
|
// Only write the writable bits
|
|
|
|
regs.tanar &= TANAR_RF1 | TANAR_RF2 | TANAR_UNUSED;
|
|
|
|
regs.tanar |= reg & ~(TANAR_RF1 | TANAR_RF2 | TANAR_UNUSED);
|
|
|
|
|
|
|
|
// Pause capability unimplemented
|
|
|
|
#if 0
|
|
|
|
if (reg & TANAR_PS2) ;
|
|
|
|
if (reg & TANAR_PS1) ;
|
|
|
|
#endif
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TANLPAR:
|
|
|
|
panic("this should only be written to by the fake phy!\n");
|
|
|
|
|
|
|
|
case TANER:
|
|
|
|
panic("TANER is read only register!\n");
|
|
|
|
|
|
|
|
case TESR:
|
|
|
|
regs.tesr = reg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2004-07-27 05:10:20 +02:00
|
|
|
panic("invalid register access daddr=%#x", daddr);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-07-27 05:10:20 +02:00
|
|
|
} else {
|
2004-03-12 17:04:58 +01:00
|
|
|
panic("Invalid Request Size");
|
2004-07-27 05:10:20 +02:00
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::devIntrPost(uint32_t interrupts)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
if (interrupts & ISR_RESERVE)
|
|
|
|
panic("Cannot set a reserved interrupt");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-08-11 16:14:26 +02:00
|
|
|
if (interrupts & ISR_NOIMPL)
|
|
|
|
warn("interrupt not implemented %#x\n", interrupts);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-09-19 03:22:57 +02:00
|
|
|
interrupts &= ISR_IMPL;
|
2004-08-11 16:14:26 +02:00
|
|
|
regs.isr |= interrupts;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-11-18 21:46:01 +01:00
|
|
|
if (interrupts & regs.imr) {
|
|
|
|
if (interrupts & ISR_SWI) {
|
|
|
|
totalSwi++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_RXIDLE) {
|
|
|
|
totalRxIdle++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_RXOK) {
|
|
|
|
totalRxOk++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_RXDESC) {
|
|
|
|
totalRxDesc++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_TXOK) {
|
|
|
|
totalTxOk++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_TXIDLE) {
|
|
|
|
totalTxIdle++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_TXDESC) {
|
|
|
|
totalTxDesc++;
|
|
|
|
}
|
|
|
|
if (interrupts & ISR_RXORN) {
|
|
|
|
totalRxOrn++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-11 16:14:26 +02:00
|
|
|
DPRINTF(EthernetIntr,
|
|
|
|
"interrupt written to ISR: intr=%#x isr=%#x imr=%#x\n",
|
|
|
|
interrupts, regs.isr, regs.imr);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if ((regs.isr & regs.imr)) {
|
|
|
|
Tick when = curTick;
|
2005-09-19 03:22:57 +02:00
|
|
|
if ((regs.isr & regs.imr & ISR_NODELAY) == 0)
|
2004-04-22 00:23:41 +02:00
|
|
|
when += intrDelay;
|
|
|
|
cpuIntrPost(when);
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-11-18 21:46:01 +01:00
|
|
|
/* writing this interrupt counting stats inside this means that this function
|
|
|
|
is now limited to being used to clear all interrupts upon the kernel
|
|
|
|
reading isr and servicing. just telling you in case you were thinking
|
|
|
|
of expanding use.
|
|
|
|
*/
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::devIntrClear(uint32_t interrupts)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
if (interrupts & ISR_RESERVE)
|
|
|
|
panic("Cannot clear a reserved interrupt");
|
|
|
|
|
2004-11-18 21:46:01 +01:00
|
|
|
if (regs.isr & regs.imr & ISR_SWI) {
|
|
|
|
postedSwi++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_RXIDLE) {
|
|
|
|
postedRxIdle++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_RXOK) {
|
|
|
|
postedRxOk++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_RXDESC) {
|
|
|
|
postedRxDesc++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_TXOK) {
|
|
|
|
postedTxOk++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_TXIDLE) {
|
|
|
|
postedTxIdle++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_TXDESC) {
|
|
|
|
postedTxDesc++;
|
|
|
|
}
|
|
|
|
if (regs.isr & regs.imr & ISR_RXORN) {
|
|
|
|
postedRxOrn++;
|
|
|
|
}
|
|
|
|
|
2005-09-19 03:22:57 +02:00
|
|
|
if (regs.isr & regs.imr & ISR_IMPL)
|
2004-11-18 21:46:01 +01:00
|
|
|
postedInterrupts++;
|
|
|
|
|
2004-08-11 16:14:26 +02:00
|
|
|
interrupts &= ~ISR_NOIMPL;
|
|
|
|
regs.isr &= ~interrupts;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
DPRINTF(EthernetIntr,
|
|
|
|
"interrupt cleared from ISR: intr=%x isr=%x imr=%x\n",
|
2004-05-26 19:06:32 +02:00
|
|
|
interrupts, regs.isr, regs.imr);
|
2004-07-30 17:33:45 +02:00
|
|
|
|
|
|
|
if (!(regs.isr & regs.imr))
|
|
|
|
cpuIntrClear();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::devIntrChangeMask()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetIntr, "interrupt mask changed: isr=%x imr=%x masked=%x\n",
|
|
|
|
regs.isr, regs.imr, regs.isr & regs.imr);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
if (regs.isr & regs.imr)
|
2004-04-22 00:23:41 +02:00
|
|
|
cpuIntrPost(curTick);
|
2004-03-12 17:04:58 +01:00
|
|
|
else
|
|
|
|
cpuIntrClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::cpuIntrPost(Tick when)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-07-27 05:10:20 +02:00
|
|
|
// If the interrupt you want to post is later than an interrupt
|
|
|
|
// already scheduled, just let it post in the coming one and don't
|
|
|
|
// schedule another.
|
|
|
|
// HOWEVER, must be sure that the scheduled intrTick is in the
|
|
|
|
// future (this was formerly the source of a bug)
|
2004-07-30 17:29:45 +02:00
|
|
|
/**
|
|
|
|
* @todo this warning should be removed and the intrTick code should
|
|
|
|
* be fixed.
|
|
|
|
*/
|
2004-08-20 17:40:57 +02:00
|
|
|
assert(when >= curTick);
|
|
|
|
assert(intrTick >= curTick || intrTick == 0);
|
|
|
|
if (when > intrTick && intrTick != 0) {
|
|
|
|
DPRINTF(EthernetIntr, "don't need to schedule event...intrTick=%d\n",
|
|
|
|
intrTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
return;
|
2004-08-20 17:40:57 +02:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
intrTick = when;
|
2004-08-20 17:40:57 +02:00
|
|
|
if (intrTick < curTick) {
|
|
|
|
debug_break();
|
|
|
|
intrTick = curTick;
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
|
2004-08-20 17:40:57 +02:00
|
|
|
DPRINTF(EthernetIntr, "going to schedule an interrupt for intrTick=%d\n",
|
|
|
|
intrTick);
|
|
|
|
|
|
|
|
if (intrEvent)
|
|
|
|
intrEvent->squash();
|
|
|
|
intrEvent = new IntrEvent(this, true);
|
|
|
|
intrEvent->schedule(intrTick);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::cpuInterrupt()
|
2004-04-22 00:23:41 +02:00
|
|
|
{
|
2004-08-20 17:40:57 +02:00
|
|
|
assert(intrTick == curTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
// Whether or not there's a pending interrupt, we don't care about
|
|
|
|
// it anymore
|
|
|
|
intrEvent = 0;
|
|
|
|
intrTick = 0;
|
|
|
|
|
2004-08-20 17:40:57 +02:00
|
|
|
// Don't send an interrupt if there's already one
|
|
|
|
if (cpuPendingIntr) {
|
|
|
|
DPRINTF(EthernetIntr,
|
|
|
|
"would send an interrupt now, but there's already pending\n");
|
|
|
|
} else {
|
|
|
|
// Send interrupt
|
|
|
|
cpuPendingIntr = true;
|
2004-08-11 16:14:26 +02:00
|
|
|
|
2004-11-13 21:45:22 +01:00
|
|
|
DPRINTF(EthernetIntr, "posting interrupt\n");
|
|
|
|
intrPost();
|
2004-08-20 17:40:57 +02:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::cpuIntrClear()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-07-27 05:10:20 +02:00
|
|
|
if (!cpuPendingIntr)
|
|
|
|
return;
|
|
|
|
|
2004-08-20 17:40:57 +02:00
|
|
|
if (intrEvent) {
|
|
|
|
intrEvent->squash();
|
|
|
|
intrEvent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
intrTick = 0;
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
cpuPendingIntr = false;
|
2004-08-11 16:14:26 +02:00
|
|
|
|
2004-11-13 21:45:22 +01:00
|
|
|
DPRINTF(EthernetIntr, "clearing interrupt\n");
|
|
|
|
intrClear();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::cpuIntrPending() const
|
2004-03-12 17:04:58 +01:00
|
|
|
{ return cpuPendingIntr; }
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txReset()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
DPRINTF(Ethernet, "transmit reset\n");
|
|
|
|
|
|
|
|
CTDD = false;
|
2004-07-30 17:29:45 +02:00
|
|
|
txEnable = false;;
|
2004-04-22 00:23:41 +02:00
|
|
|
txFragPtr = 0;
|
|
|
|
assert(txDescCnt == 0);
|
2004-03-12 17:04:58 +01:00
|
|
|
txFifo.clear();
|
|
|
|
txState = txIdle;
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(txDmaState == dmaIdle);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxReset()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
DPRINTF(Ethernet, "receive reset\n");
|
|
|
|
|
|
|
|
CRDD = false;
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxPktBytes == 0);
|
2004-07-30 17:29:45 +02:00
|
|
|
rxEnable = false;
|
2004-04-22 00:23:41 +02:00
|
|
|
rxFragPtr = 0;
|
|
|
|
assert(rxDescCnt == 0);
|
|
|
|
assert(rxDmaState == dmaIdle);
|
2004-03-12 17:04:58 +01:00
|
|
|
rxFifo.clear();
|
|
|
|
rxState = rxIdle;
|
|
|
|
}
|
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
void
|
|
|
|
NSGigE::regsReset()
|
2004-06-11 21:26:21 +02:00
|
|
|
{
|
|
|
|
memset(®s, 0, sizeof(regs));
|
2005-06-28 00:08:42 +02:00
|
|
|
regs.config = (CFGR_LNKSTS | CFGR_TBI_EN | CFGR_MODE_1000);
|
2005-08-13 00:30:35 +02:00
|
|
|
regs.mear = 0x12;
|
2004-08-11 16:14:26 +02:00
|
|
|
regs.txcfg = 0x120; // set drain threshold to 1024 bytes and
|
|
|
|
// fill threshold to 32 bytes
|
|
|
|
regs.rxcfg = 0x4; // set drain threshold to 16 bytes
|
|
|
|
regs.srr = 0x0103; // set the silicon revision to rev B or 0x103
|
|
|
|
regs.mibc = MIBC_FRZ;
|
|
|
|
regs.vdr = 0x81; // set the vlan tag type to 802.1q
|
|
|
|
regs.tesr = 0xc000; // TBI capable of both full and half duplex
|
2005-08-13 00:30:35 +02:00
|
|
|
regs.brar = 0xffffffff;
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
|
|
|
extstsEnable = false;
|
|
|
|
acceptBroadcast = false;
|
|
|
|
acceptMulticast = false;
|
|
|
|
acceptUnicast = false;
|
|
|
|
acceptPerfect = false;
|
|
|
|
acceptArp = false;
|
2004-06-11 21:26:21 +02:00
|
|
|
}
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxDmaReadCopy()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxDmaState == dmaReading);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-30 17:09:03 +02:00
|
|
|
physmem->dma_read((uint8_t *)rxDmaData, rxDmaAddr, rxDmaLen);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaState = dmaIdle;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
DPRINTF(EthernetDMA, "rx dma read paddr=%#x len=%d\n",
|
|
|
|
rxDmaAddr, rxDmaLen);
|
|
|
|
DDUMP(EthernetDMA, rxDmaData, rxDmaLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::doRxDmaRead()
|
2004-04-22 00:23:41 +02:00
|
|
|
{
|
|
|
|
assert(rxDmaState == dmaIdle || rxDmaState == dmaReadWaiting);
|
|
|
|
rxDmaState = dmaReading;
|
|
|
|
|
|
|
|
if (dmaInterface && !rxDmaFree) {
|
|
|
|
if (dmaInterface->busy())
|
|
|
|
rxDmaState = dmaReadWaiting;
|
|
|
|
else
|
|
|
|
dmaInterface->doDMA(Read, rxDmaAddr, rxDmaLen, curTick,
|
2004-07-06 23:55:16 +02:00
|
|
|
&rxDmaReadEvent, true);
|
2004-04-22 00:23:41 +02:00
|
|
|
return true;
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (dmaReadDelay == 0 && dmaReadFactor == 0) {
|
|
|
|
rxDmaReadCopy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tick factor = ((rxDmaLen + ULL(63)) >> ULL(6)) * dmaReadFactor;
|
|
|
|
Tick start = curTick + dmaReadDelay + factor;
|
|
|
|
rxDmaReadEvent.schedule(start);
|
|
|
|
return true;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxDmaReadDone()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxDmaState == dmaReading);
|
|
|
|
rxDmaReadCopy();
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
// If the transmit state machine has a pending DMA, let it go first
|
|
|
|
if (txDmaState == dmaReadWaiting || txDmaState == dmaWriteWaiting)
|
|
|
|
txKick();
|
|
|
|
|
|
|
|
rxKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxDmaWriteCopy()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxDmaState == dmaWriting);
|
|
|
|
|
2004-07-30 17:09:03 +02:00
|
|
|
physmem->dma_write(rxDmaAddr, (uint8_t *)rxDmaData, rxDmaLen);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaState = dmaIdle;
|
|
|
|
|
|
|
|
DPRINTF(EthernetDMA, "rx dma write paddr=%#x len=%d\n",
|
|
|
|
rxDmaAddr, rxDmaLen);
|
|
|
|
DDUMP(EthernetDMA, rxDmaData, rxDmaLen);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
bool
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::doRxDmaWrite()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxDmaState == dmaIdle || rxDmaState == dmaWriteWaiting);
|
|
|
|
rxDmaState = dmaWriting;
|
|
|
|
|
|
|
|
if (dmaInterface && !rxDmaFree) {
|
|
|
|
if (dmaInterface->busy())
|
|
|
|
rxDmaState = dmaWriteWaiting;
|
|
|
|
else
|
|
|
|
dmaInterface->doDMA(WriteInvalidate, rxDmaAddr, rxDmaLen, curTick,
|
2004-07-06 23:55:16 +02:00
|
|
|
&rxDmaWriteEvent, true);
|
2004-04-22 00:23:41 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dmaWriteDelay == 0 && dmaWriteFactor == 0) {
|
|
|
|
rxDmaWriteCopy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tick factor = ((rxDmaLen + ULL(63)) >> ULL(6)) * dmaWriteFactor;
|
|
|
|
Tick start = curTick + dmaWriteDelay + factor;
|
|
|
|
rxDmaWriteEvent.schedule(start);
|
|
|
|
return true;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxDmaWriteDone()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxDmaState == dmaWriting);
|
|
|
|
rxDmaWriteCopy();
|
|
|
|
|
|
|
|
// If the transmit state machine has a pending DMA, let it go first
|
|
|
|
if (txDmaState == dmaReadWaiting || txDmaState == dmaWriteWaiting)
|
|
|
|
txKick();
|
|
|
|
|
|
|
|
rxKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::rxKick()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2005-10-12 19:39:40 +02:00
|
|
|
bool is64bit = (bool)(regs.config & CFGR_M64ADDR);
|
|
|
|
|
|
|
|
DPRINTF(EthernetSM,
|
|
|
|
"receive kick rxState=%s (rxBuf.size=%d) %d-bit\n",
|
|
|
|
NsRxStateStrings[rxState], rxFifo.size(), is64bit ? 64 : 32);
|
|
|
|
|
|
|
|
Addr link, bufptr;
|
|
|
|
uint32_t &cmdsts = is64bit ? rxDesc64.cmdsts : rxDesc32.cmdsts;
|
|
|
|
uint32_t &extsts = is64bit ? rxDesc64.extsts : rxDesc32.extsts;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2005-06-27 23:02:40 +02:00
|
|
|
next:
|
|
|
|
if (clock) {
|
|
|
|
if (rxKickTick > curTick) {
|
|
|
|
DPRINTF(EthernetSM, "receive kick exiting, can't run till %d\n",
|
|
|
|
rxKickTick);
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go to the next state machine clock tick.
|
|
|
|
rxKickTick = curTick + cycles(1);
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(rxDmaState) {
|
|
|
|
case dmaReadWaiting:
|
|
|
|
if (doRxDmaRead())
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
case dmaWriteWaiting:
|
|
|
|
if (doRxDmaWrite())
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
link = is64bit ? (Addr)rxDesc64.link : (Addr)rxDesc32.link;
|
|
|
|
bufptr = is64bit ? (Addr)rxDesc64.bufptr : (Addr)rxDesc32.bufptr;
|
|
|
|
|
2004-04-22 00:43:39 +02:00
|
|
|
// see state machine from spec for details
|
2004-07-27 05:10:20 +02:00
|
|
|
// the way this works is, if you finish work on one state and can
|
|
|
|
// go directly to another, you do that through jumping to the
|
|
|
|
// label "next". however, if you have intermediate work, like DMA
|
|
|
|
// so that you can't go to the next state yet, you go to exit and
|
|
|
|
// exit the loop. however, when the DMA is done it will trigger
|
|
|
|
// an event and come back to this loop.
|
2004-04-22 00:23:41 +02:00
|
|
|
switch (rxState) {
|
|
|
|
case rxIdle:
|
2004-07-30 17:29:45 +02:00
|
|
|
if (!rxEnable) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "Receive Disabled! Nothing to do.\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CRDD) {
|
|
|
|
rxState = rxDescRefr;
|
|
|
|
|
|
|
|
rxDmaAddr = regs.rxdp & 0x3fffffff;
|
2005-10-12 19:39:40 +02:00
|
|
|
rxDmaData =
|
|
|
|
is64bit ? (void *)&rxDesc64.link : (void *)&rxDesc32.link;
|
|
|
|
rxDmaLen = is64bit ? sizeof(rxDesc64.link) : sizeof(rxDesc32.link);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaFree = dmaDescFree;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaReads++;
|
|
|
|
descDmaRdBytes += rxDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doRxDmaRead())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
} else {
|
|
|
|
rxState = rxDescRead;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
rxDmaAddr = regs.rxdp & 0x3fffffff;
|
2005-10-12 19:39:40 +02:00
|
|
|
rxDmaData = is64bit ? (void *)&rxDesc64 : (void *)&rxDesc32;
|
|
|
|
rxDmaLen = is64bit ? sizeof(rxDesc64) : sizeof(rxDesc32);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaFree = dmaDescFree;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaReads++;
|
|
|
|
descDmaRdBytes += rxDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doRxDmaRead())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case rxDescRefr:
|
|
|
|
if (rxDmaState != dmaIdle)
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
rxState = rxAdvance;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case rxDescRead:
|
|
|
|
if (rxDmaState != dmaIdle)
|
|
|
|
goto exit;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
DPRINTF(EthernetDesc, "rxDesc: addr=%08x read descriptor\n",
|
2004-07-30 17:33:45 +02:00
|
|
|
regs.rxdp & 0x3fffffff);
|
|
|
|
DPRINTF(EthernetDesc,
|
2005-10-12 19:39:40 +02:00
|
|
|
"rxDesc: link=%#x bufptr=%#x cmdsts=%08x extsts=%08x\n",
|
|
|
|
link, bufptr, cmdsts, extsts);
|
2004-05-26 19:06:32 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (cmdsts & CMDSTS_OWN) {
|
2004-07-30 17:29:45 +02:00
|
|
|
devIntrPost(ISR_RXIDLE);
|
2004-03-12 17:04:58 +01:00
|
|
|
rxState = rxIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
} else {
|
|
|
|
rxState = rxFifoBlock;
|
2005-10-12 19:39:40 +02:00
|
|
|
rxFragPtr = bufptr;
|
|
|
|
rxDescCnt = cmdsts & CMDSTS_LEN_MASK;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case rxFifoBlock:
|
|
|
|
if (!rxPacket) {
|
|
|
|
/**
|
|
|
|
* @todo in reality, we should be able to start processing
|
|
|
|
* the packet as it arrives, and not have to wait for the
|
|
|
|
* full packet ot be in the receive fifo.
|
|
|
|
*/
|
|
|
|
if (rxFifo.empty())
|
|
|
|
goto exit;
|
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "****processing receive of new packet****\n");
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
// If we don't have a packet, grab a new one from the fifo.
|
|
|
|
rxPacket = rxFifo.front();
|
|
|
|
rxPktBytes = rxPacket->length;
|
|
|
|
rxPacketBufPtr = rxPacket->data;
|
|
|
|
|
2004-07-21 21:44:57 +02:00
|
|
|
#if TRACING_ON
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
if (DTRACE(Ethernet)) {
|
2004-10-23 22:18:44 +02:00
|
|
|
IpPtr ip(rxPacket);
|
2004-09-20 16:43:53 +02:00
|
|
|
if (ip) {
|
|
|
|
DPRINTF(Ethernet, "ID is %d\n", ip->id());
|
2004-10-23 22:18:44 +02:00
|
|
|
TcpPtr tcp(ip);
|
2004-09-20 16:43:53 +02:00
|
|
|
if (tcp) {
|
2005-03-16 19:55:58 +01:00
|
|
|
DPRINTF(Ethernet,
|
|
|
|
"Src Port=%d, Dest Port=%d, Seq=%d, Ack=%d\n",
|
|
|
|
tcp->sport(), tcp->dport(), tcp->seq(),
|
|
|
|
tcp->ack());
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-07-21 21:44:57 +02:00
|
|
|
#endif
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
// sanity check - i think the driver behaves like this
|
|
|
|
assert(rxDescCnt >= rxPktBytes);
|
2004-11-13 22:52:08 +01:00
|
|
|
rxFifo.pop();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
// dont' need the && rxDescCnt > 0 if driver sanity check
|
|
|
|
// above holds
|
2004-04-22 00:23:41 +02:00
|
|
|
if (rxPktBytes > 0) {
|
|
|
|
rxState = rxFragWrite;
|
2004-07-27 05:10:20 +02:00
|
|
|
// don't need min<>(rxPktBytes,rxDescCnt) if above sanity
|
|
|
|
// check holds
|
2004-04-22 00:23:41 +02:00
|
|
|
rxXferLen = rxPktBytes;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaAddr = rxFragPtr & 0x3fffffff;
|
|
|
|
rxDmaData = rxPacketBufPtr;
|
|
|
|
rxDmaLen = rxXferLen;
|
|
|
|
rxDmaFree = dmaDataFree;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doRxDmaWrite())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
} else {
|
|
|
|
rxState = rxDescWrite;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
//if (rxPktBytes == 0) { /* packet is done */
|
|
|
|
assert(rxPktBytes == 0);
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "done with receiving packet\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts |= CMDSTS_OWN;
|
|
|
|
cmdsts &= ~CMDSTS_MORE;
|
|
|
|
cmdsts |= CMDSTS_OK;
|
|
|
|
cmdsts &= 0xffff0000;
|
|
|
|
cmdsts += rxPacket->length; //i.e. set CMDSTS_SIZE
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
#if 0
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* all the driver uses these are for its own stats keeping
|
|
|
|
* which we don't care about, aren't necessary for
|
|
|
|
* functionality and doing this would just slow us down.
|
|
|
|
* if they end up using this in a later version for
|
|
|
|
* functional purposes, just undef
|
|
|
|
*/
|
2004-03-12 17:04:58 +01:00
|
|
|
if (rxFilterEnable) {
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts &= ~CMDSTS_DEST_MASK;
|
2004-10-23 22:18:44 +02:00
|
|
|
const EthAddr &dst = rxFifoFront()->dst();
|
|
|
|
if (dst->unicast())
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts |= CMDSTS_DEST_SELF;
|
2004-10-23 22:18:44 +02:00
|
|
|
if (dst->multicast())
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts |= CMDSTS_DEST_MULTI;
|
2004-10-23 22:18:44 +02:00
|
|
|
if (dst->broadcast())
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts |= CMDSTS_DEST_MASK;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
#endif
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
IpPtr ip(rxPacket);
|
|
|
|
if (extstsEnable && ip) {
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_IPPKT;
|
2004-09-20 16:43:53 +02:00
|
|
|
rxIpChecksums++;
|
2004-10-23 22:18:44 +02:00
|
|
|
if (cksum(ip) != 0) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetCksum, "Rx IP Checksum Error\n");
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_IPERR;
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
}
|
2004-10-23 22:18:44 +02:00
|
|
|
TcpPtr tcp(ip);
|
|
|
|
UdpPtr udp(ip);
|
|
|
|
if (tcp) {
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_TCPPKT;
|
2004-09-20 16:43:53 +02:00
|
|
|
rxTcpChecksums++;
|
2004-10-23 22:18:44 +02:00
|
|
|
if (cksum(tcp) != 0) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetCksum, "Rx TCP Checksum Error\n");
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_TCPERR;
|
2004-07-04 22:47:07 +02:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
}
|
2004-10-23 22:18:44 +02:00
|
|
|
} else if (udp) {
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_UDPPKT;
|
2004-09-20 16:43:53 +02:00
|
|
|
rxUdpChecksums++;
|
2004-10-23 22:18:44 +02:00
|
|
|
if (cksum(udp) != 0) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetCksum, "Rx UDP Checksum Error\n");
|
2005-10-12 19:39:40 +02:00
|
|
|
extsts |= EXTSTS_UDPERR;
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
}
|
2004-05-26 19:06:32 +02:00
|
|
|
rxPacket = 0;
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* the driver seems to always receive into desc buffers
|
|
|
|
* of size 1514, so you never have a pkt that is split
|
|
|
|
* into multiple descriptors on the receive side, so
|
|
|
|
* i don't implement that case, hence the assert above.
|
|
|
|
*/
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
DPRINTF(EthernetDesc,
|
2005-10-12 19:39:40 +02:00
|
|
|
"rxDesc: addr=%08x writeback cmdsts extsts\n",
|
2004-07-30 17:33:45 +02:00
|
|
|
regs.rxdp & 0x3fffffff);
|
|
|
|
DPRINTF(EthernetDesc,
|
2005-10-12 19:39:40 +02:00
|
|
|
"rxDesc: link=%#x bufptr=%#x cmdsts=%08x extsts=%08x\n",
|
|
|
|
link, bufptr, cmdsts, extsts);
|
2004-05-26 19:06:32 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
rxDmaAddr = regs.rxdp & 0x3fffffff;
|
|
|
|
rxDmaData = &cmdsts;
|
|
|
|
if (is64bit) {
|
|
|
|
rxDmaAddr += offsetof(ns_desc64, cmdsts);
|
|
|
|
rxDmaLen = sizeof(rxDesc64.cmdsts) + sizeof(rxDesc64.extsts);
|
|
|
|
} else {
|
|
|
|
rxDmaAddr += offsetof(ns_desc32, cmdsts);
|
|
|
|
rxDmaLen = sizeof(rxDesc32.cmdsts) + sizeof(rxDesc32.extsts);
|
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaFree = dmaDescFree;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaWrites++;
|
|
|
|
descDmaWrBytes += rxDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doRxDmaWrite())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case rxFragWrite:
|
|
|
|
if (rxDmaState != dmaIdle)
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
rxPacketBufPtr += rxXferLen;
|
|
|
|
rxFragPtr += rxXferLen;
|
|
|
|
rxPktBytes -= rxXferLen;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
rxState = rxFifoBlock;
|
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case rxDescWrite:
|
|
|
|
if (rxDmaState != dmaIdle)
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
assert(cmdsts & CMDSTS_OWN);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(rxPacket == 0);
|
|
|
|
devIntrPost(ISR_RXOK);
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (cmdsts & CMDSTS_INTR)
|
2004-04-22 00:23:41 +02:00
|
|
|
devIntrPost(ISR_RXDESC);
|
|
|
|
|
2004-07-30 17:29:45 +02:00
|
|
|
if (!rxEnable) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "Halting the RX state machine\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
rxState = rxIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else
|
|
|
|
rxState = rxAdvance;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case rxAdvance:
|
2005-10-12 19:39:40 +02:00
|
|
|
if (link == 0) {
|
2004-07-30 17:29:45 +02:00
|
|
|
devIntrPost(ISR_RXIDLE);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxState = rxIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
CRDD = true;
|
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else {
|
2005-09-29 23:09:53 +02:00
|
|
|
if (rxDmaState != dmaIdle)
|
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
rxState = rxDescRead;
|
2005-10-12 19:39:40 +02:00
|
|
|
regs.rxdp = link;
|
2004-04-22 00:23:41 +02:00
|
|
|
CRDD = false;
|
|
|
|
|
|
|
|
rxDmaAddr = regs.rxdp & 0x3fffffff;
|
2005-10-12 19:39:40 +02:00
|
|
|
rxDmaData = is64bit ? (void *)&rxDesc64 : (void *)&rxDesc32;
|
|
|
|
rxDmaLen = is64bit ? sizeof(rxDesc64) : sizeof(rxDesc32);
|
2004-04-22 00:23:41 +02:00
|
|
|
rxDmaFree = dmaDescFree;
|
|
|
|
|
|
|
|
if (doRxDmaRead())
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("Invalid rxState!");
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "entering next rxState=%s\n",
|
2004-04-22 00:23:41 +02:00
|
|
|
NsRxStateStrings[rxState]);
|
|
|
|
goto next;
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/**
|
|
|
|
* @todo do we want to schedule a future kick?
|
|
|
|
*/
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "rx state machine exited rxState=%s\n",
|
2004-04-22 00:23:41 +02:00
|
|
|
NsRxStateStrings[rxState]);
|
2005-06-27 23:02:40 +02:00
|
|
|
|
|
|
|
if (clock && !rxKickEvent.scheduled())
|
|
|
|
rxKickEvent.schedule(rxKickTick);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::transmit()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
if (txFifo.empty()) {
|
|
|
|
DPRINTF(Ethernet, "nothing to transmit\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(Ethernet, "Attempt Pkt Transmit: txFifo length=%d\n",
|
2004-11-13 22:52:08 +01:00
|
|
|
txFifo.size());
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
if (interface->sendPacket(txFifo.front())) {
|
2004-07-21 21:44:57 +02:00
|
|
|
#if TRACING_ON
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
if (DTRACE(Ethernet)) {
|
2004-10-23 22:18:44 +02:00
|
|
|
IpPtr ip(txFifo.front());
|
2004-09-20 16:43:53 +02:00
|
|
|
if (ip) {
|
|
|
|
DPRINTF(Ethernet, "ID is %d\n", ip->id());
|
2004-10-23 22:18:44 +02:00
|
|
|
TcpPtr tcp(ip);
|
2004-09-20 16:43:53 +02:00
|
|
|
if (tcp) {
|
2005-03-16 19:55:58 +01:00
|
|
|
DPRINTF(Ethernet,
|
|
|
|
"Src Port=%d, Dest Port=%d, Seq=%d, Ack=%d\n",
|
2005-10-12 19:39:40 +02:00
|
|
|
tcp->sport(), tcp->dport(), tcp->seq(),
|
|
|
|
tcp->ack());
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-07-21 21:44:57 +02:00
|
|
|
#endif
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2005-03-16 19:55:58 +01:00
|
|
|
DDUMP(EthernetData, txFifo.front()->data, txFifo.front()->length);
|
2004-03-12 17:04:58 +01:00
|
|
|
txBytes += txFifo.front()->length;
|
|
|
|
txPackets++;
|
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
DPRINTF(Ethernet, "Successful Xmit! now txFifoAvail is %d\n",
|
2004-11-13 22:52:08 +01:00
|
|
|
txFifo.avail());
|
|
|
|
txFifo.pop();
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* normally do a writeback of the descriptor here, and ONLY
|
|
|
|
* after that is done, send this interrupt. but since our
|
|
|
|
* stuff never actually fails, just do this interrupt here,
|
|
|
|
* otherwise the code has to stray from this nice format.
|
|
|
|
* besides, it's functionally the same.
|
|
|
|
*/
|
2004-04-22 00:23:41 +02:00
|
|
|
devIntrPost(ISR_TXOK);
|
2004-07-27 05:10:20 +02:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
if (!txFifo.empty() && !txEvent.scheduled()) {
|
|
|
|
DPRINTF(Ethernet, "reschedule transmit\n");
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
txEvent.schedule(curTick + retryTime);
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txDmaReadCopy()
|
2004-04-22 00:23:41 +02:00
|
|
|
{
|
|
|
|
assert(txDmaState == dmaReading);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-30 17:17:20 +02:00
|
|
|
physmem->dma_read((uint8_t *)txDmaData, txDmaAddr, txDmaLen);
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaState = dmaIdle;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
DPRINTF(EthernetDMA, "tx dma read paddr=%#x len=%d\n",
|
|
|
|
txDmaAddr, txDmaLen);
|
|
|
|
DDUMP(EthernetDMA, txDmaData, txDmaLen);
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
bool
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::doTxDmaRead()
|
2004-04-22 00:23:41 +02:00
|
|
|
{
|
|
|
|
assert(txDmaState == dmaIdle || txDmaState == dmaReadWaiting);
|
|
|
|
txDmaState = dmaReading;
|
|
|
|
|
|
|
|
if (dmaInterface && !txDmaFree) {
|
|
|
|
if (dmaInterface->busy())
|
|
|
|
txDmaState = dmaReadWaiting;
|
|
|
|
else
|
|
|
|
dmaInterface->doDMA(Read, txDmaAddr, txDmaLen, curTick,
|
2004-07-06 23:55:16 +02:00
|
|
|
&txDmaReadEvent, true);
|
2004-04-22 00:23:41 +02:00
|
|
|
return true;
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (dmaReadDelay == 0 && dmaReadFactor == 0.0) {
|
|
|
|
txDmaReadCopy();
|
|
|
|
return false;
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
Tick factor = ((txDmaLen + ULL(63)) >> ULL(6)) * dmaReadFactor;
|
|
|
|
Tick start = curTick + dmaReadDelay + factor;
|
|
|
|
txDmaReadEvent.schedule(start);
|
|
|
|
return true;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txDmaReadDone()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(txDmaState == dmaReading);
|
|
|
|
txDmaReadCopy();
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
// If the receive state machine has a pending DMA, let it go first
|
|
|
|
if (rxDmaState == dmaReadWaiting || rxDmaState == dmaWriteWaiting)
|
|
|
|
rxKick();
|
|
|
|
|
|
|
|
txKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txDmaWriteCopy()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(txDmaState == dmaWriting);
|
|
|
|
|
2004-07-30 17:17:20 +02:00
|
|
|
physmem->dma_write(txDmaAddr, (uint8_t *)txDmaData, txDmaLen);
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaState = dmaIdle;
|
|
|
|
|
|
|
|
DPRINTF(EthernetDMA, "tx dma write paddr=%#x len=%d\n",
|
|
|
|
txDmaAddr, txDmaLen);
|
|
|
|
DDUMP(EthernetDMA, txDmaData, txDmaLen);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
bool
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::doTxDmaWrite()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(txDmaState == dmaIdle || txDmaState == dmaWriteWaiting);
|
|
|
|
txDmaState = dmaWriting;
|
|
|
|
|
|
|
|
if (dmaInterface && !txDmaFree) {
|
|
|
|
if (dmaInterface->busy())
|
|
|
|
txDmaState = dmaWriteWaiting;
|
|
|
|
else
|
|
|
|
dmaInterface->doDMA(WriteInvalidate, txDmaAddr, txDmaLen, curTick,
|
2004-07-06 23:55:16 +02:00
|
|
|
&txDmaWriteEvent, true);
|
2004-04-22 00:23:41 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dmaWriteDelay == 0 && dmaWriteFactor == 0.0) {
|
|
|
|
txDmaWriteCopy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tick factor = ((txDmaLen + ULL(63)) >> ULL(6)) * dmaWriteFactor;
|
|
|
|
Tick start = curTick + dmaWriteDelay + factor;
|
|
|
|
txDmaWriteEvent.schedule(start);
|
|
|
|
return true;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txDmaWriteDone()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-04-22 00:23:41 +02:00
|
|
|
assert(txDmaState == dmaWriting);
|
|
|
|
txDmaWriteCopy();
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
// If the receive state machine has a pending DMA, let it go first
|
|
|
|
if (rxDmaState == dmaReadWaiting || rxDmaState == dmaWriteWaiting)
|
|
|
|
rxKick();
|
|
|
|
|
|
|
|
txKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::txKick()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2005-10-12 19:39:40 +02:00
|
|
|
bool is64bit = (bool)(regs.config & CFGR_M64ADDR);
|
|
|
|
|
|
|
|
DPRINTF(EthernetSM, "transmit kick txState=%s %d-bit\n",
|
|
|
|
NsTxStateStrings[txState], is64bit ? 64 : 32);
|
|
|
|
|
|
|
|
Addr link, bufptr;
|
|
|
|
uint32_t &cmdsts = is64bit ? txDesc64.cmdsts : txDesc32.cmdsts;
|
|
|
|
uint32_t &extsts = is64bit ? txDesc64.extsts : txDesc32.extsts;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-06-27 23:02:40 +02:00
|
|
|
next:
|
|
|
|
if (clock) {
|
|
|
|
if (txKickTick > curTick) {
|
|
|
|
DPRINTF(EthernetSM, "transmit kick exiting, can't run till %d\n",
|
|
|
|
txKickTick);
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go to the next state machine clock tick.
|
|
|
|
txKickTick = curTick + cycles(1);
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(txDmaState) {
|
|
|
|
case dmaReadWaiting:
|
|
|
|
if (doTxDmaRead())
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
case dmaWriteWaiting:
|
|
|
|
if (doTxDmaWrite())
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
link = is64bit ? (Addr)txDesc64.link : (Addr)txDesc32.link;
|
|
|
|
bufptr = is64bit ? (Addr)txDesc64.bufptr : (Addr)txDesc32.bufptr;
|
2004-04-22 00:23:41 +02:00
|
|
|
switch (txState) {
|
|
|
|
case txIdle:
|
2004-07-30 17:29:45 +02:00
|
|
|
if (!txEnable) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "Transmit disabled. Nothing to do.\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (CTDD) {
|
|
|
|
txState = txDescRefr;
|
|
|
|
|
2004-05-26 19:06:32 +02:00
|
|
|
txDmaAddr = regs.txdp & 0x3fffffff;
|
2005-10-12 19:39:40 +02:00
|
|
|
txDmaData =
|
|
|
|
is64bit ? (void *)&txDesc64.link : (void *)&txDesc32.link;
|
|
|
|
txDmaLen = is64bit ? sizeof(txDesc64.link) : sizeof(txDesc32.link);
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaFree = dmaDescFree;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaReads++;
|
|
|
|
descDmaRdBytes += txDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doTxDmaRead())
|
|
|
|
goto exit;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
} else {
|
|
|
|
txState = txDescRead;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
txDmaAddr = regs.txdp & 0x3fffffff;
|
2005-10-12 19:39:40 +02:00
|
|
|
txDmaData = is64bit ? (void *)&txDesc64 : (void *)&txDesc32;
|
|
|
|
txDmaLen = is64bit ? sizeof(txDesc64) : sizeof(txDesc32);
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaFree = dmaDescFree;
|
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaReads++;
|
|
|
|
descDmaRdBytes += txDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (doTxDmaRead())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case txDescRefr:
|
|
|
|
if (txDmaState != dmaIdle)
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
txState = txAdvance;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case txDescRead:
|
|
|
|
if (txDmaState != dmaIdle)
|
|
|
|
goto exit;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
DPRINTF(EthernetDesc, "txDesc: addr=%08x read descriptor\n",
|
2005-06-27 23:02:40 +02:00
|
|
|
regs.txdp & 0x3fffffff);
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetDesc,
|
2005-10-12 19:39:40 +02:00
|
|
|
"txDesc: link=%#x bufptr=%#x cmdsts=%#08x extsts=%#08x\n",
|
|
|
|
link, bufptr, cmdsts, extsts);
|
2004-05-26 19:06:32 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (cmdsts & CMDSTS_OWN) {
|
2004-03-12 17:04:58 +01:00
|
|
|
txState = txFifoBlock;
|
2005-10-12 19:39:40 +02:00
|
|
|
txFragPtr = bufptr;
|
|
|
|
txDescCnt = cmdsts & CMDSTS_LEN_MASK;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else {
|
2004-07-30 17:29:45 +02:00
|
|
|
devIntrPost(ISR_TXIDLE);
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case txFifoBlock:
|
|
|
|
if (!txPacket) {
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "****starting the tx of a new packet****\n");
|
2004-11-18 22:23:31 +01:00
|
|
|
txPacket = new PacketData(16384);
|
2004-04-22 00:23:41 +02:00
|
|
|
txPacketBufPtr = txPacket->data;
|
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
if (txDescCnt == 0) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "the txDescCnt == 0, done with descriptor\n");
|
2005-10-12 19:39:40 +02:00
|
|
|
if (cmdsts & CMDSTS_MORE) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "there are more descriptors to come\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txDescWrite;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts &= ~CMDSTS_OWN;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
txDmaAddr = regs.txdp & 0x3fffffff;
|
|
|
|
txDmaData = &cmdsts;
|
|
|
|
if (is64bit) {
|
|
|
|
txDmaAddr += offsetof(ns_desc64, cmdsts);
|
|
|
|
txDmaLen = sizeof(txDesc64.cmdsts);
|
|
|
|
} else {
|
|
|
|
txDmaAddr += offsetof(ns_desc32, cmdsts);
|
|
|
|
txDmaLen = sizeof(txDesc32.cmdsts);
|
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaFree = dmaDescFree;
|
|
|
|
|
|
|
|
if (doTxDmaWrite())
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
} else { /* this packet is totally done */
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "This packet is done, let's wrap it up\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
/* deal with the the packet that just finished */
|
|
|
|
if ((regs.vtcr & VTCR_PPCHK) && extstsEnable) {
|
2004-10-23 22:18:44 +02:00
|
|
|
IpPtr ip(txPacket);
|
2005-10-12 19:39:40 +02:00
|
|
|
if (extsts & EXTSTS_UDPPKT) {
|
2004-10-23 22:18:44 +02:00
|
|
|
UdpPtr udp(ip);
|
2004-09-20 16:43:53 +02:00
|
|
|
udp->sum(0);
|
2004-10-23 22:18:44 +02:00
|
|
|
udp->sum(cksum(udp));
|
2004-09-20 16:43:53 +02:00
|
|
|
txUdpChecksums++;
|
2005-10-12 19:39:40 +02:00
|
|
|
} else if (extsts & EXTSTS_TCPPKT) {
|
2004-10-23 22:18:44 +02:00
|
|
|
TcpPtr tcp(ip);
|
2004-09-20 16:43:53 +02:00
|
|
|
tcp->sum(0);
|
2004-10-23 22:18:44 +02:00
|
|
|
tcp->sum(cksum(tcp));
|
2004-09-20 16:43:53 +02:00
|
|
|
txTcpChecksums++;
|
2004-06-30 06:50:56 +02:00
|
|
|
}
|
2005-10-12 19:39:40 +02:00
|
|
|
if (extsts & EXTSTS_IPPKT) {
|
2004-09-20 16:43:53 +02:00
|
|
|
ip->sum(0);
|
2004-10-23 22:18:44 +02:00
|
|
|
ip->sum(cksum(ip));
|
2004-09-20 16:43:53 +02:00
|
|
|
txIpChecksums++;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
txPacket->length = txPacketBufPtr - txPacket->data;
|
2004-07-27 05:10:20 +02:00
|
|
|
// this is just because the receive can't handle a
|
|
|
|
// packet bigger want to make sure
|
2005-10-12 19:39:40 +02:00
|
|
|
if (txPacket->length > 1514)
|
|
|
|
panic("transmit packet too large, %s > 1514\n",
|
|
|
|
txPacket->length);
|
|
|
|
|
2004-11-17 05:59:51 +01:00
|
|
|
#ifndef NDEBUG
|
|
|
|
bool success =
|
|
|
|
#endif
|
|
|
|
txFifo.push(txPacket);
|
|
|
|
assert(success);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* this following section is not tqo spec, but
|
|
|
|
* functionally shouldn't be any different. normally,
|
|
|
|
* the chip will wait til the transmit has occurred
|
|
|
|
* before writing back the descriptor because it has
|
|
|
|
* to wait to see that it was successfully transmitted
|
|
|
|
* to decide whether to set CMDSTS_OK or not.
|
|
|
|
* however, in the simulator since it is always
|
|
|
|
* successfully transmitted, and writing it exactly to
|
|
|
|
* spec would complicate the code, we just do it here
|
|
|
|
*/
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts &= ~CMDSTS_OWN;
|
|
|
|
cmdsts |= CMDSTS_OK;
|
2004-04-22 00:23:41 +02:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetDesc,
|
2004-07-30 17:33:45 +02:00
|
|
|
"txDesc writeback: cmdsts=%08x extsts=%08x\n",
|
2005-10-12 19:39:40 +02:00
|
|
|
cmdsts, extsts);
|
2004-05-26 19:06:32 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaFree = dmaDescFree;
|
2005-10-12 19:39:40 +02:00
|
|
|
txDmaAddr = regs.txdp & 0x3fffffff;
|
|
|
|
txDmaData = &cmdsts;
|
|
|
|
if (is64bit) {
|
|
|
|
txDmaAddr += offsetof(ns_desc64, cmdsts);
|
|
|
|
txDmaLen =
|
|
|
|
sizeof(txDesc64.cmdsts) + sizeof(txDesc64.extsts);
|
|
|
|
} else {
|
|
|
|
txDmaAddr += offsetof(ns_desc32, cmdsts);
|
|
|
|
txDmaLen =
|
|
|
|
sizeof(txDesc32.cmdsts) + sizeof(txDesc32.extsts);
|
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2004-07-04 22:47:07 +02:00
|
|
|
descDmaWrites++;
|
|
|
|
descDmaWrBytes += txDmaLen;
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
transmit();
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
txPacket = 0;
|
|
|
|
|
2004-07-30 17:29:45 +02:00
|
|
|
if (!txEnable) {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "halting TX state machine\n");
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
} else
|
|
|
|
txState = txAdvance;
|
2004-07-09 17:50:27 +02:00
|
|
|
|
|
|
|
if (doTxDmaWrite())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
} else {
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
DPRINTF(EthernetSM, "this descriptor isn't done yet\n");
|
2004-11-13 22:52:08 +01:00
|
|
|
if (!txFifo.full()) {
|
2004-07-12 22:09:52 +02:00
|
|
|
txState = txFragRead;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-27 05:10:20 +02:00
|
|
|
/*
|
|
|
|
* The number of bytes transferred is either whatever
|
|
|
|
* is left in the descriptor (txDescCnt), or if there
|
|
|
|
* is not enough room in the fifo, just whatever room
|
|
|
|
* is left in the fifo
|
|
|
|
*/
|
2004-11-13 22:52:08 +01:00
|
|
|
txXferLen = min<uint32_t>(txDescCnt, txFifo.avail());
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-07-12 22:09:52 +02:00
|
|
|
txDmaAddr = txFragPtr & 0x3fffffff;
|
|
|
|
txDmaData = txPacketBufPtr;
|
|
|
|
txDmaLen = txXferLen;
|
|
|
|
txDmaFree = dmaDataFree;
|
|
|
|
|
|
|
|
if (doTxDmaRead())
|
|
|
|
goto exit;
|
|
|
|
} else {
|
|
|
|
txState = txFifoBlock;
|
|
|
|
transmit();
|
|
|
|
|
2004-07-14 15:02:15 +02:00
|
|
|
goto exit;
|
2004-07-12 22:09:52 +02:00
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case txFragRead:
|
|
|
|
if (txDmaState != dmaIdle)
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
txPacketBufPtr += txXferLen;
|
|
|
|
txFragPtr += txXferLen;
|
|
|
|
txDescCnt -= txXferLen;
|
2004-11-17 05:59:51 +01:00
|
|
|
txFifo.reserve(txXferLen);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txFifoBlock;
|
|
|
|
break;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
case txDescWrite:
|
|
|
|
if (txDmaState != dmaIdle)
|
|
|
|
goto exit;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
if (cmdsts & CMDSTS_INTR)
|
2004-04-22 00:23:41 +02:00
|
|
|
devIntrPost(ISR_TXDESC);
|
|
|
|
|
2005-06-27 23:02:40 +02:00
|
|
|
if (!txEnable) {
|
|
|
|
DPRINTF(EthernetSM, "halting TX state machine\n");
|
|
|
|
txState = txIdle;
|
|
|
|
goto exit;
|
|
|
|
} else
|
|
|
|
txState = txAdvance;
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case txAdvance:
|
2005-10-12 19:39:40 +02:00
|
|
|
if (link == 0) {
|
2004-07-30 17:29:45 +02:00
|
|
|
devIntrPost(ISR_TXIDLE);
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txIdle;
|
2004-07-30 17:29:45 +02:00
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
} else {
|
2005-09-29 23:09:53 +02:00
|
|
|
if (txDmaState != dmaIdle)
|
|
|
|
goto exit;
|
2004-04-22 00:23:41 +02:00
|
|
|
txState = txDescRead;
|
2005-10-12 19:39:40 +02:00
|
|
|
regs.txdp = link;
|
2004-04-22 00:23:41 +02:00
|
|
|
CTDD = false;
|
|
|
|
|
2005-10-12 19:39:40 +02:00
|
|
|
txDmaAddr = link & 0x3fffffff;
|
|
|
|
txDmaData = is64bit ? (void *)&txDesc64 : (void *)&txDesc32;
|
|
|
|
txDmaLen = is64bit ? sizeof(txDesc64) : sizeof(txDesc32);
|
2004-04-22 00:23:41 +02:00
|
|
|
txDmaFree = dmaDescFree;
|
|
|
|
|
|
|
|
if (doTxDmaRead())
|
|
|
|
goto exit;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
2004-04-22 00:23:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("invalid state");
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "entering next txState=%s\n",
|
2004-04-22 00:23:41 +02:00
|
|
|
NsTxStateStrings[txState]);
|
|
|
|
goto next;
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/**
|
|
|
|
* @todo do we want to schedule a future kick?
|
|
|
|
*/
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(EthernetSM, "tx state machine exited txState=%s\n",
|
2004-04-22 00:23:41 +02:00
|
|
|
NsTxStateStrings[txState]);
|
2005-06-27 23:02:40 +02:00
|
|
|
|
|
|
|
if (clock && !txKickEvent.scheduled())
|
|
|
|
txKickEvent.schedule(txKickTick);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
/**
|
|
|
|
* Advance the EEPROM state machine
|
|
|
|
* Called on rising edge of EEPROM clock bit in MEAR
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
NSGigE::eepromKick()
|
|
|
|
{
|
|
|
|
switch (eepromState) {
|
|
|
|
|
|
|
|
case eepromStart:
|
|
|
|
|
|
|
|
// Wait for start bit
|
|
|
|
if (regs.mear & MEAR_EEDI) {
|
|
|
|
// Set up to get 2 opcode bits
|
|
|
|
eepromState = eepromGetOpcode;
|
|
|
|
eepromBitsToRx = 2;
|
|
|
|
eepromOpcode = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eepromGetOpcode:
|
|
|
|
eepromOpcode <<= 1;
|
|
|
|
eepromOpcode += (regs.mear & MEAR_EEDI) ? 1 : 0;
|
|
|
|
--eepromBitsToRx;
|
|
|
|
|
|
|
|
// Done getting opcode
|
|
|
|
if (eepromBitsToRx == 0) {
|
|
|
|
if (eepromOpcode != EEPROM_READ)
|
|
|
|
panic("only EEPROM reads are implemented!");
|
|
|
|
|
|
|
|
// Set up to get address
|
|
|
|
eepromState = eepromGetAddress;
|
|
|
|
eepromBitsToRx = 6;
|
|
|
|
eepromAddress = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eepromGetAddress:
|
|
|
|
eepromAddress <<= 1;
|
|
|
|
eepromAddress += (regs.mear & MEAR_EEDI) ? 1 : 0;
|
|
|
|
--eepromBitsToRx;
|
|
|
|
|
|
|
|
// Done getting address
|
|
|
|
if (eepromBitsToRx == 0) {
|
|
|
|
|
|
|
|
if (eepromAddress >= EEPROM_SIZE)
|
|
|
|
panic("EEPROM read access out of range!");
|
|
|
|
|
|
|
|
switch (eepromAddress) {
|
|
|
|
|
|
|
|
case EEPROM_PMATCH2_ADDR:
|
|
|
|
eepromData = rom.perfectMatch[5];
|
|
|
|
eepromData <<= 8;
|
|
|
|
eepromData += rom.perfectMatch[4];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EEPROM_PMATCH1_ADDR:
|
|
|
|
eepromData = rom.perfectMatch[3];
|
|
|
|
eepromData <<= 8;
|
|
|
|
eepromData += rom.perfectMatch[2];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EEPROM_PMATCH0_ADDR:
|
|
|
|
eepromData = rom.perfectMatch[1];
|
|
|
|
eepromData <<= 8;
|
|
|
|
eepromData += rom.perfectMatch[0];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("FreeBSD driver only uses EEPROM to read PMATCH!");
|
|
|
|
}
|
|
|
|
// Set up to read data
|
|
|
|
eepromState = eepromRead;
|
|
|
|
eepromBitsToRx = 16;
|
|
|
|
|
|
|
|
// Clear data in bit
|
|
|
|
regs.mear &= ~MEAR_EEDI;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eepromRead:
|
|
|
|
// Clear Data Out bit
|
|
|
|
regs.mear &= ~MEAR_EEDO;
|
|
|
|
// Set bit to value of current EEPROM bit
|
|
|
|
regs.mear |= (eepromData & 0x8000) ? MEAR_EEDO : 0x0;
|
|
|
|
|
|
|
|
eepromData <<= 1;
|
|
|
|
--eepromBitsToRx;
|
|
|
|
|
|
|
|
// All done
|
|
|
|
if (eepromBitsToRx == 0) {
|
|
|
|
eepromState = eepromStart;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("invalid EEPROM state");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::transferDone()
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-07-30 17:33:45 +02:00
|
|
|
if (txFifo.empty()) {
|
|
|
|
DPRINTF(Ethernet, "transfer complete: txFifo empty...nothing to do\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
return;
|
2004-07-30 17:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DPRINTF(Ethernet, "transfer complete: data in txFifo...schedule xmit\n");
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
if (txEvent.scheduled())
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
txEvent.reschedule(curTick + cycles(1));
|
2004-03-12 17:04:58 +01:00
|
|
|
else
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
txEvent.schedule(curTick + cycles(1));
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2004-11-13 22:33:16 +01:00
|
|
|
NSGigE::rxFilter(const PacketPtr &packet)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-10-23 22:18:44 +02:00
|
|
|
EthPtr eth = packet;
|
2004-03-12 17:04:58 +01:00
|
|
|
bool drop = true;
|
|
|
|
string type;
|
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
const EthAddr &dst = eth->dst();
|
|
|
|
if (dst.unicast()) {
|
2004-03-12 17:04:58 +01:00
|
|
|
// If we're accepting all unicast addresses
|
|
|
|
if (acceptUnicast)
|
|
|
|
drop = false;
|
|
|
|
|
|
|
|
// If we make a perfect match
|
2004-10-23 22:18:44 +02:00
|
|
|
if (acceptPerfect && dst == rom.perfectMatch)
|
2004-03-12 17:04:58 +01:00
|
|
|
drop = false;
|
|
|
|
|
2004-09-20 16:43:53 +02:00
|
|
|
if (acceptArp && eth->type() == ETH_TYPE_ARP)
|
2004-03-12 17:04:58 +01:00
|
|
|
drop = false;
|
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
} else if (dst.broadcast()) {
|
2004-03-12 17:04:58 +01:00
|
|
|
// if we're accepting broadcasts
|
|
|
|
if (acceptBroadcast)
|
|
|
|
drop = false;
|
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
} else if (dst.multicast()) {
|
2004-03-12 17:04:58 +01:00
|
|
|
// if we're accepting all multicasts
|
|
|
|
if (acceptMulticast)
|
|
|
|
drop = false;
|
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
// Multicast hashing faked - all packets accepted
|
|
|
|
if (multicastHashEnable)
|
|
|
|
drop = false;
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (drop) {
|
|
|
|
DPRINTF(Ethernet, "rxFilter drop\n");
|
|
|
|
DDUMP(EthernetData, packet->data, packet->length);
|
|
|
|
}
|
|
|
|
|
|
|
|
return drop;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2004-11-13 22:33:16 +01:00
|
|
|
NSGigE::recvPacket(PacketPtr packet)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
|
|
|
rxBytes += packet->length;
|
|
|
|
rxPackets++;
|
|
|
|
|
2004-07-30 17:33:45 +02:00
|
|
|
DPRINTF(Ethernet, "Receiving packet from wire, rxFifoAvail=%d\n",
|
2004-11-13 22:52:08 +01:00
|
|
|
rxFifo.avail());
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-07-30 17:29:45 +02:00
|
|
|
if (!rxEnable) {
|
2004-03-12 17:04:58 +01:00
|
|
|
DPRINTF(Ethernet, "receive disabled...packet dropped\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
if (!rxFilterEnable) {
|
|
|
|
DPRINTF(Ethernet,
|
|
|
|
"receive packet filtering disabled . . . packet dropped\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rxFilter(packet)) {
|
2004-03-12 17:04:58 +01:00
|
|
|
DPRINTF(Ethernet, "packet filtered...dropped\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-11-13 22:52:08 +01:00
|
|
|
if (rxFifo.avail() < packet->length) {
|
2005-03-16 19:55:58 +01:00
|
|
|
#if TRACING_ON
|
|
|
|
IpPtr ip(packet);
|
|
|
|
TcpPtr tcp(ip);
|
|
|
|
if (ip) {
|
|
|
|
DPRINTF(Ethernet,
|
|
|
|
"packet won't fit in receive buffer...pkt ID %d dropped\n",
|
|
|
|
ip->id());
|
|
|
|
if (tcp) {
|
|
|
|
DPRINTF(Ethernet, "Seq=%d\n", tcp->seq());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2004-11-18 21:46:01 +01:00
|
|
|
droppedPackets++;
|
2004-03-12 17:04:58 +01:00
|
|
|
devIntrPost(ISR_RXORN);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-11-13 22:52:08 +01:00
|
|
|
rxFifo.push(packet);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
rxKick();
|
2004-03-12 17:04:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=====================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::serialize(ostream &os)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-06-04 21:12:27 +02:00
|
|
|
// Serialize the PciDev base class
|
|
|
|
PciDev::serialize(os);
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
|
|
|
* Finalize any DMA events now.
|
|
|
|
*/
|
|
|
|
if (rxDmaReadEvent.scheduled())
|
|
|
|
rxDmaReadCopy();
|
|
|
|
if (rxDmaWriteEvent.scheduled())
|
|
|
|
rxDmaWriteCopy();
|
|
|
|
if (txDmaReadEvent.scheduled())
|
|
|
|
txDmaReadCopy();
|
|
|
|
if (txDmaWriteEvent.scheduled())
|
|
|
|
txDmaWriteCopy();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Serialize the device registers
|
|
|
|
*/
|
|
|
|
SERIALIZE_SCALAR(regs.command);
|
|
|
|
SERIALIZE_SCALAR(regs.config);
|
|
|
|
SERIALIZE_SCALAR(regs.mear);
|
|
|
|
SERIALIZE_SCALAR(regs.ptscr);
|
|
|
|
SERIALIZE_SCALAR(regs.isr);
|
|
|
|
SERIALIZE_SCALAR(regs.imr);
|
|
|
|
SERIALIZE_SCALAR(regs.ier);
|
|
|
|
SERIALIZE_SCALAR(regs.ihr);
|
|
|
|
SERIALIZE_SCALAR(regs.txdp);
|
|
|
|
SERIALIZE_SCALAR(regs.txdp_hi);
|
|
|
|
SERIALIZE_SCALAR(regs.txcfg);
|
|
|
|
SERIALIZE_SCALAR(regs.gpior);
|
|
|
|
SERIALIZE_SCALAR(regs.rxdp);
|
|
|
|
SERIALIZE_SCALAR(regs.rxdp_hi);
|
|
|
|
SERIALIZE_SCALAR(regs.rxcfg);
|
|
|
|
SERIALIZE_SCALAR(regs.pqcr);
|
|
|
|
SERIALIZE_SCALAR(regs.wcsr);
|
|
|
|
SERIALIZE_SCALAR(regs.pcr);
|
|
|
|
SERIALIZE_SCALAR(regs.rfcr);
|
|
|
|
SERIALIZE_SCALAR(regs.rfdr);
|
2005-08-13 00:30:35 +02:00
|
|
|
SERIALIZE_SCALAR(regs.brar);
|
|
|
|
SERIALIZE_SCALAR(regs.brdr);
|
2004-04-22 00:23:41 +02:00
|
|
|
SERIALIZE_SCALAR(regs.srr);
|
|
|
|
SERIALIZE_SCALAR(regs.mibc);
|
|
|
|
SERIALIZE_SCALAR(regs.vrcr);
|
|
|
|
SERIALIZE_SCALAR(regs.vtcr);
|
|
|
|
SERIALIZE_SCALAR(regs.vdr);
|
|
|
|
SERIALIZE_SCALAR(regs.ccsr);
|
|
|
|
SERIALIZE_SCALAR(regs.tbicr);
|
|
|
|
SERIALIZE_SCALAR(regs.tbisr);
|
|
|
|
SERIALIZE_SCALAR(regs.tanar);
|
|
|
|
SERIALIZE_SCALAR(regs.tanlpar);
|
|
|
|
SERIALIZE_SCALAR(regs.taner);
|
|
|
|
SERIALIZE_SCALAR(regs.tesr);
|
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
SERIALIZE_ARRAY(rom.perfectMatch, ETH_ADDR_LEN);
|
2005-08-13 00:30:35 +02:00
|
|
|
SERIALIZE_ARRAY(rom.filterHash, FHASH_SIZE);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
SERIALIZE_SCALAR(ioEnable);
|
2004-06-12 20:24:20 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
2004-06-11 21:26:21 +02:00
|
|
|
* Serialize the data Fifos
|
2004-04-22 00:23:41 +02:00
|
|
|
*/
|
2004-11-13 22:52:08 +01:00
|
|
|
rxFifo.serialize("rxFifo", os);
|
|
|
|
txFifo.serialize("txFifo", os);
|
2004-06-11 21:26:21 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Serialize the various helper variables
|
|
|
|
*/
|
2004-04-22 00:23:41 +02:00
|
|
|
bool txPacketExists = txPacket;
|
2004-03-12 17:04:58 +01:00
|
|
|
SERIALIZE_SCALAR(txPacketExists);
|
2004-06-11 21:26:21 +02:00
|
|
|
if (txPacketExists) {
|
2005-01-19 22:26:19 +01:00
|
|
|
txPacket->length = txPacketBufPtr - txPacket->data;
|
2004-11-13 22:46:56 +01:00
|
|
|
txPacket->serialize("txPacket", os);
|
2004-06-11 21:26:21 +02:00
|
|
|
uint32_t txPktBufPtr = (uint32_t) (txPacketBufPtr - txPacket->data);
|
|
|
|
SERIALIZE_SCALAR(txPktBufPtr);
|
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
bool rxPacketExists = rxPacket;
|
2004-03-12 17:04:58 +01:00
|
|
|
SERIALIZE_SCALAR(rxPacketExists);
|
2004-06-11 21:26:21 +02:00
|
|
|
if (rxPacketExists) {
|
2004-11-13 22:46:56 +01:00
|
|
|
rxPacket->serialize("rxPacket", os);
|
2004-06-11 21:26:21 +02:00
|
|
|
uint32_t rxPktBufPtr = (uint32_t) (rxPacketBufPtr - rxPacket->data);
|
|
|
|
SERIALIZE_SCALAR(rxPktBufPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
SERIALIZE_SCALAR(txXferLen);
|
|
|
|
SERIALIZE_SCALAR(rxXferLen);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
2005-10-12 19:39:40 +02:00
|
|
|
* Serialize Cached Descriptors
|
2004-04-22 00:23:41 +02:00
|
|
|
*/
|
2005-10-12 19:39:40 +02:00
|
|
|
SERIALIZE_SCALAR(rxDesc64.link);
|
|
|
|
SERIALIZE_SCALAR(rxDesc64.bufptr);
|
|
|
|
SERIALIZE_SCALAR(rxDesc64.cmdsts);
|
|
|
|
SERIALIZE_SCALAR(rxDesc64.extsts);
|
|
|
|
SERIALIZE_SCALAR(txDesc64.link);
|
|
|
|
SERIALIZE_SCALAR(txDesc64.bufptr);
|
|
|
|
SERIALIZE_SCALAR(txDesc64.cmdsts);
|
|
|
|
SERIALIZE_SCALAR(txDesc64.extsts);
|
|
|
|
SERIALIZE_SCALAR(rxDesc32.link);
|
|
|
|
SERIALIZE_SCALAR(rxDesc32.bufptr);
|
|
|
|
SERIALIZE_SCALAR(rxDesc32.cmdsts);
|
|
|
|
SERIALIZE_SCALAR(rxDesc32.extsts);
|
|
|
|
SERIALIZE_SCALAR(txDesc32.link);
|
|
|
|
SERIALIZE_SCALAR(txDesc32.bufptr);
|
|
|
|
SERIALIZE_SCALAR(txDesc32.cmdsts);
|
|
|
|
SERIALIZE_SCALAR(txDesc32.extsts);
|
2005-06-27 23:02:40 +02:00
|
|
|
SERIALIZE_SCALAR(extstsEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Serialize tx state machine
|
|
|
|
*/
|
|
|
|
int txState = this->txState;
|
|
|
|
SERIALIZE_SCALAR(txState);
|
2004-07-30 17:29:45 +02:00
|
|
|
SERIALIZE_SCALAR(txEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
SERIALIZE_SCALAR(CTDD);
|
|
|
|
SERIALIZE_SCALAR(txFragPtr);
|
|
|
|
SERIALIZE_SCALAR(txDescCnt);
|
|
|
|
int txDmaState = this->txDmaState;
|
|
|
|
SERIALIZE_SCALAR(txDmaState);
|
2005-06-27 23:02:40 +02:00
|
|
|
SERIALIZE_SCALAR(txKickTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Serialize rx state machine
|
|
|
|
*/
|
|
|
|
int rxState = this->rxState;
|
|
|
|
SERIALIZE_SCALAR(rxState);
|
2004-07-30 17:29:45 +02:00
|
|
|
SERIALIZE_SCALAR(rxEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
SERIALIZE_SCALAR(CRDD);
|
|
|
|
SERIALIZE_SCALAR(rxPktBytes);
|
2004-11-18 03:03:51 +01:00
|
|
|
SERIALIZE_SCALAR(rxFragPtr);
|
2004-04-22 00:23:41 +02:00
|
|
|
SERIALIZE_SCALAR(rxDescCnt);
|
|
|
|
int rxDmaState = this->rxDmaState;
|
|
|
|
SERIALIZE_SCALAR(rxDmaState);
|
2005-06-27 23:02:40 +02:00
|
|
|
SERIALIZE_SCALAR(rxKickTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
/*
|
|
|
|
* Serialize EEPROM state machine
|
|
|
|
*/
|
|
|
|
int eepromState = this->eepromState;
|
|
|
|
SERIALIZE_SCALAR(eepromState);
|
|
|
|
SERIALIZE_SCALAR(eepromClk);
|
|
|
|
SERIALIZE_SCALAR(eepromBitsToRx);
|
|
|
|
SERIALIZE_SCALAR(eepromOpcode);
|
|
|
|
SERIALIZE_SCALAR(eepromAddress);
|
|
|
|
SERIALIZE_SCALAR(eepromData);
|
|
|
|
|
2004-06-11 21:26:21 +02:00
|
|
|
/*
|
2004-04-22 00:23:41 +02:00
|
|
|
* If there's a pending transmit, store the time so we can
|
|
|
|
* reschedule it later
|
|
|
|
*/
|
|
|
|
Tick transmitTick = txEvent.scheduled() ? txEvent.when() - curTick : 0;
|
|
|
|
SERIALIZE_SCALAR(transmitTick);
|
|
|
|
|
2004-06-11 21:26:21 +02:00
|
|
|
/*
|
|
|
|
* receive address filter settings
|
|
|
|
*/
|
|
|
|
SERIALIZE_SCALAR(rxFilterEnable);
|
|
|
|
SERIALIZE_SCALAR(acceptBroadcast);
|
|
|
|
SERIALIZE_SCALAR(acceptMulticast);
|
|
|
|
SERIALIZE_SCALAR(acceptUnicast);
|
|
|
|
SERIALIZE_SCALAR(acceptPerfect);
|
|
|
|
SERIALIZE_SCALAR(acceptArp);
|
2005-08-13 00:30:35 +02:00
|
|
|
SERIALIZE_SCALAR(multicastHashEnable);
|
2004-06-11 21:26:21 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
|
|
|
* Keep track of pending interrupt status.
|
|
|
|
*/
|
|
|
|
SERIALIZE_SCALAR(intrTick);
|
|
|
|
SERIALIZE_SCALAR(cpuPendingIntr);
|
|
|
|
Tick intrEventTick = 0;
|
|
|
|
if (intrEvent)
|
|
|
|
intrEventTick = intrEvent->when();
|
|
|
|
SERIALIZE_SCALAR(intrEventTick);
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::unserialize(Checkpoint *cp, const std::string §ion)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-06-04 21:12:27 +02:00
|
|
|
// Unserialize the PciDev base class
|
|
|
|
PciDev::unserialize(cp, section);
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
UNSERIALIZE_SCALAR(regs.command);
|
|
|
|
UNSERIALIZE_SCALAR(regs.config);
|
|
|
|
UNSERIALIZE_SCALAR(regs.mear);
|
|
|
|
UNSERIALIZE_SCALAR(regs.ptscr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.isr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.imr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.ier);
|
|
|
|
UNSERIALIZE_SCALAR(regs.ihr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.txdp);
|
|
|
|
UNSERIALIZE_SCALAR(regs.txdp_hi);
|
|
|
|
UNSERIALIZE_SCALAR(regs.txcfg);
|
|
|
|
UNSERIALIZE_SCALAR(regs.gpior);
|
|
|
|
UNSERIALIZE_SCALAR(regs.rxdp);
|
|
|
|
UNSERIALIZE_SCALAR(regs.rxdp_hi);
|
|
|
|
UNSERIALIZE_SCALAR(regs.rxcfg);
|
|
|
|
UNSERIALIZE_SCALAR(regs.pqcr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.wcsr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.pcr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.rfcr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.rfdr);
|
2005-08-13 00:30:35 +02:00
|
|
|
UNSERIALIZE_SCALAR(regs.brar);
|
|
|
|
UNSERIALIZE_SCALAR(regs.brdr);
|
2004-04-22 00:23:41 +02:00
|
|
|
UNSERIALIZE_SCALAR(regs.srr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.mibc);
|
|
|
|
UNSERIALIZE_SCALAR(regs.vrcr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.vtcr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.vdr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.ccsr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.tbicr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.tbisr);
|
|
|
|
UNSERIALIZE_SCALAR(regs.tanar);
|
|
|
|
UNSERIALIZE_SCALAR(regs.tanlpar);
|
|
|
|
UNSERIALIZE_SCALAR(regs.taner);
|
|
|
|
UNSERIALIZE_SCALAR(regs.tesr);
|
|
|
|
|
2004-10-23 22:18:44 +02:00
|
|
|
UNSERIALIZE_ARRAY(rom.perfectMatch, ETH_ADDR_LEN);
|
2005-08-13 00:30:35 +02:00
|
|
|
UNSERIALIZE_ARRAY(rom.filterHash, FHASH_SIZE);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
UNSERIALIZE_SCALAR(ioEnable);
|
2004-06-12 20:24:20 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
2004-06-11 21:26:21 +02:00
|
|
|
* unserialize the data fifos
|
2004-04-22 00:23:41 +02:00
|
|
|
*/
|
2004-11-13 22:52:08 +01:00
|
|
|
rxFifo.unserialize("rxFifo", cp, section);
|
|
|
|
txFifo.unserialize("txFifo", cp, section);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-06-11 21:26:21 +02:00
|
|
|
/*
|
|
|
|
* unserialize the various helper variables
|
|
|
|
*/
|
2004-03-12 17:04:58 +01:00
|
|
|
bool txPacketExists;
|
|
|
|
UNSERIALIZE_SCALAR(txPacketExists);
|
2004-06-11 21:26:21 +02:00
|
|
|
if (txPacketExists) {
|
2004-11-18 22:23:31 +01:00
|
|
|
txPacket = new PacketData(16384);
|
2004-11-13 22:46:56 +01:00
|
|
|
txPacket->unserialize("txPacket", cp, section);
|
2004-06-11 21:26:21 +02:00
|
|
|
uint32_t txPktBufPtr;
|
|
|
|
UNSERIALIZE_SCALAR(txPktBufPtr);
|
|
|
|
txPacketBufPtr = (uint8_t *) txPacket->data + txPktBufPtr;
|
|
|
|
} else
|
|
|
|
txPacket = 0;
|
|
|
|
|
2004-03-12 17:04:58 +01:00
|
|
|
bool rxPacketExists;
|
|
|
|
UNSERIALIZE_SCALAR(rxPacketExists);
|
2004-06-11 21:26:21 +02:00
|
|
|
rxPacket = 0;
|
|
|
|
if (rxPacketExists) {
|
2004-11-18 22:23:31 +01:00
|
|
|
rxPacket = new PacketData(16384);
|
2004-11-13 22:46:56 +01:00
|
|
|
rxPacket->unserialize("rxPacket", cp, section);
|
2004-06-11 21:26:21 +02:00
|
|
|
uint32_t rxPktBufPtr;
|
|
|
|
UNSERIALIZE_SCALAR(rxPktBufPtr);
|
|
|
|
rxPacketBufPtr = (uint8_t *) rxPacket->data + rxPktBufPtr;
|
|
|
|
} else
|
|
|
|
rxPacket = 0;
|
|
|
|
|
|
|
|
UNSERIALIZE_SCALAR(txXferLen);
|
|
|
|
UNSERIALIZE_SCALAR(rxXferLen);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
2005-10-12 19:39:40 +02:00
|
|
|
* Unserialize Cached Descriptors
|
2004-04-22 00:23:41 +02:00
|
|
|
*/
|
2005-10-12 19:39:40 +02:00
|
|
|
UNSERIALIZE_SCALAR(rxDesc64.link);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc64.bufptr);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc64.cmdsts);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc64.extsts);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc64.link);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc64.bufptr);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc64.cmdsts);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc64.extsts);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc32.link);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc32.bufptr);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc32.cmdsts);
|
|
|
|
UNSERIALIZE_SCALAR(rxDesc32.extsts);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc32.link);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc32.bufptr);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc32.cmdsts);
|
|
|
|
UNSERIALIZE_SCALAR(txDesc32.extsts);
|
2005-06-27 23:02:40 +02:00
|
|
|
UNSERIALIZE_SCALAR(extstsEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* unserialize tx state machine
|
|
|
|
*/
|
|
|
|
int txState;
|
|
|
|
UNSERIALIZE_SCALAR(txState);
|
|
|
|
this->txState = (TxState) txState;
|
2004-07-30 17:29:45 +02:00
|
|
|
UNSERIALIZE_SCALAR(txEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
UNSERIALIZE_SCALAR(CTDD);
|
|
|
|
UNSERIALIZE_SCALAR(txFragPtr);
|
|
|
|
UNSERIALIZE_SCALAR(txDescCnt);
|
|
|
|
int txDmaState;
|
|
|
|
UNSERIALIZE_SCALAR(txDmaState);
|
|
|
|
this->txDmaState = (DmaState) txDmaState;
|
2005-06-27 23:02:40 +02:00
|
|
|
UNSERIALIZE_SCALAR(txKickTick);
|
|
|
|
if (txKickTick)
|
|
|
|
txKickEvent.schedule(txKickTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* unserialize rx state machine
|
|
|
|
*/
|
|
|
|
int rxState;
|
|
|
|
UNSERIALIZE_SCALAR(rxState);
|
|
|
|
this->rxState = (RxState) rxState;
|
2004-07-30 17:29:45 +02:00
|
|
|
UNSERIALIZE_SCALAR(rxEnable);
|
2004-04-22 00:23:41 +02:00
|
|
|
UNSERIALIZE_SCALAR(CRDD);
|
|
|
|
UNSERIALIZE_SCALAR(rxPktBytes);
|
2004-11-18 03:03:51 +01:00
|
|
|
UNSERIALIZE_SCALAR(rxFragPtr);
|
2004-04-22 00:23:41 +02:00
|
|
|
UNSERIALIZE_SCALAR(rxDescCnt);
|
|
|
|
int rxDmaState;
|
|
|
|
UNSERIALIZE_SCALAR(rxDmaState);
|
|
|
|
this->rxDmaState = (DmaState) rxDmaState;
|
2005-06-27 23:02:40 +02:00
|
|
|
UNSERIALIZE_SCALAR(rxKickTick);
|
|
|
|
if (rxKickTick)
|
|
|
|
rxKickEvent.schedule(rxKickTick);
|
2004-04-22 00:23:41 +02:00
|
|
|
|
2005-08-13 00:30:35 +02:00
|
|
|
/*
|
|
|
|
* Unserialize EEPROM state machine
|
|
|
|
*/
|
|
|
|
int eepromState;
|
|
|
|
UNSERIALIZE_SCALAR(eepromState);
|
|
|
|
this->eepromState = (EEPROMState) eepromState;
|
|
|
|
UNSERIALIZE_SCALAR(eepromClk);
|
|
|
|
UNSERIALIZE_SCALAR(eepromBitsToRx);
|
|
|
|
UNSERIALIZE_SCALAR(eepromOpcode);
|
|
|
|
UNSERIALIZE_SCALAR(eepromAddress);
|
|
|
|
UNSERIALIZE_SCALAR(eepromData);
|
|
|
|
|
|
|
|
/*
|
2004-06-11 21:26:21 +02:00
|
|
|
* If there's a pending transmit, reschedule it now
|
2004-04-22 00:23:41 +02:00
|
|
|
*/
|
|
|
|
Tick transmitTick;
|
|
|
|
UNSERIALIZE_SCALAR(transmitTick);
|
|
|
|
if (transmitTick)
|
|
|
|
txEvent.schedule(curTick + transmitTick);
|
|
|
|
|
2004-06-11 21:26:21 +02:00
|
|
|
/*
|
|
|
|
* unserialize receive address filter settings
|
|
|
|
*/
|
|
|
|
UNSERIALIZE_SCALAR(rxFilterEnable);
|
|
|
|
UNSERIALIZE_SCALAR(acceptBroadcast);
|
|
|
|
UNSERIALIZE_SCALAR(acceptMulticast);
|
|
|
|
UNSERIALIZE_SCALAR(acceptUnicast);
|
|
|
|
UNSERIALIZE_SCALAR(acceptPerfect);
|
|
|
|
UNSERIALIZE_SCALAR(acceptArp);
|
2005-08-13 00:30:35 +02:00
|
|
|
UNSERIALIZE_SCALAR(multicastHashEnable);
|
2004-06-11 21:26:21 +02:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
/*
|
|
|
|
* Keep track of pending interrupt status.
|
|
|
|
*/
|
|
|
|
UNSERIALIZE_SCALAR(intrTick);
|
|
|
|
UNSERIALIZE_SCALAR(cpuPendingIntr);
|
|
|
|
Tick intrEventTick;
|
|
|
|
UNSERIALIZE_SCALAR(intrEventTick);
|
|
|
|
if (intrEventTick) {
|
|
|
|
intrEvent = new IntrEvent(this, true);
|
|
|
|
intrEvent->schedule(intrEventTick);
|
|
|
|
}
|
|
|
|
|
2004-06-11 21:26:21 +02:00
|
|
|
/*
|
|
|
|
* re-add addrRanges to bus bridges
|
|
|
|
*/
|
|
|
|
if (pioInterface) {
|
2004-10-22 07:34:40 +02:00
|
|
|
pioInterface->addAddrRange(RangeSize(BARAddrs[0], BARSize[0]));
|
|
|
|
pioInterface->addAddrRange(RangeSize(BARAddrs[1], BARSize[1]));
|
2004-04-22 00:23:41 +02:00
|
|
|
}
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
Tick
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigE::cacheAccess(MemReqPtr &req)
|
2004-04-22 00:23:41 +02:00
|
|
|
{
|
|
|
|
DPRINTF(EthernetPIO, "timing access to paddr=%#x (daddr=%#x)\n",
|
2006-02-21 05:41:50 +01:00
|
|
|
req->paddr, req->paddr & 0xfff);
|
2005-11-22 05:43:15 +01:00
|
|
|
|
2004-04-22 00:23:41 +02:00
|
|
|
return curTick + pioLatency;
|
|
|
|
}
|
l
base/traceflags.py:
added some more traceflags for ethernet to break it up better
dev/etherpkt.hh:
since we are not network host order, must reverse bytes for these typechecks.
also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one.
dev/ns_gige.cc:
1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably
2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway.
get rid of teh associated variables.
3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail.
4) change io_enable to ioEnable, just to be picky.
5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories
6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt().
7) clear some bools in regsReset() so they don't holdover wrong state
8) fix pseudo header generation for Tcp checksumming to account for network order
dev/ns_gige.hh:
change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant
--HG--
extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
2004-06-21 23:25:18 +02:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
BEGIN_DECLARE_SIM_OBJECT_PARAMS(NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
SimObjectParam<EtherInt *> peer;
|
2004-05-25 21:59:54 +02:00
|
|
|
SimObjectParam<NSGigE *> device;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
END_DECLARE_SIM_OBJECT_PARAMS(NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
BEGIN_INIT_SIM_OBJECT_PARAMS(NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
INIT_PARAM_DFLT(peer, "peer interface", NULL),
|
|
|
|
INIT_PARAM(device, "Ethernet device of this interface")
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
END_INIT_SIM_OBJECT_PARAMS(NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
CREATE_SIM_OBJECT(NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-05-25 21:59:54 +02:00
|
|
|
NSGigEInt *dev_int = new NSGigEInt(getInstanceName(), device);
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
EtherInt *p = (EtherInt *)peer;
|
|
|
|
if (p) {
|
|
|
|
dev_int->setPeer(p);
|
|
|
|
p->setPeer(dev_int);
|
|
|
|
}
|
|
|
|
|
|
|
|
return dev_int;
|
|
|
|
}
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
REGISTER_SIM_OBJECT("NSGigEInt", NSGigEInt)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
BEGIN_DECLARE_SIM_OBJECT_PARAMS(NSGigE)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-06-02 03:44:00 +02:00
|
|
|
Param<Tick> clock;
|
2005-10-19 04:05:05 +02:00
|
|
|
|
|
|
|
Param<Addr> addr;
|
2004-03-12 17:04:58 +01:00
|
|
|
SimObjectParam<MemoryController *> mmu;
|
|
|
|
SimObjectParam<PhysicalMemory *> physmem;
|
2005-10-19 04:05:05 +02:00
|
|
|
SimObjectParam<PciConfigAll *> configspace;
|
|
|
|
SimObjectParam<PciConfigData *> configdata;
|
|
|
|
SimObjectParam<Platform *> platform;
|
|
|
|
Param<uint32_t> pci_bus;
|
|
|
|
Param<uint32_t> pci_dev;
|
|
|
|
Param<uint32_t> pci_func;
|
|
|
|
|
|
|
|
SimObjectParam<HierParams *> hier;
|
2005-11-20 22:57:53 +01:00
|
|
|
SimObjectParam<Bus*> pio_bus;
|
|
|
|
SimObjectParam<Bus*> dma_bus;
|
2004-04-22 00:23:41 +02:00
|
|
|
SimObjectParam<Bus*> payload_bus;
|
|
|
|
Param<bool> dma_desc_free;
|
|
|
|
Param<bool> dma_data_free;
|
|
|
|
Param<Tick> dma_read_delay;
|
|
|
|
Param<Tick> dma_write_delay;
|
|
|
|
Param<Tick> dma_read_factor;
|
|
|
|
Param<Tick> dma_write_factor;
|
2005-10-19 04:05:05 +02:00
|
|
|
Param<bool> dma_no_allocate;
|
|
|
|
Param<Tick> pio_latency;
|
|
|
|
Param<Tick> intr_delay;
|
|
|
|
|
|
|
|
Param<Tick> rx_delay;
|
|
|
|
Param<Tick> tx_delay;
|
2004-07-12 22:09:52 +02:00
|
|
|
Param<uint32_t> rx_fifo_size;
|
2005-10-19 04:05:05 +02:00
|
|
|
Param<uint32_t> tx_fifo_size;
|
|
|
|
|
|
|
|
Param<bool> rx_filter;
|
|
|
|
Param<string> hardware_address;
|
2005-11-25 19:33:36 +01:00
|
|
|
Param<bool> rx_thread;
|
|
|
|
Param<bool> tx_thread;
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
END_DECLARE_SIM_OBJECT_PARAMS(NSGigE)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
BEGIN_INIT_SIM_OBJECT_PARAMS(NSGigE)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2005-06-02 03:44:00 +02:00
|
|
|
INIT_PARAM(clock, "State machine processor frequency"),
|
2005-10-19 04:05:05 +02:00
|
|
|
|
|
|
|
INIT_PARAM(addr, "Device Address"),
|
2004-03-12 17:04:58 +01:00
|
|
|
INIT_PARAM(mmu, "Memory Controller"),
|
|
|
|
INIT_PARAM(physmem, "Physical Memory"),
|
|
|
|
INIT_PARAM(configspace, "PCI Configspace"),
|
|
|
|
INIT_PARAM(configdata, "PCI Config data"),
|
2004-11-13 21:45:22 +01:00
|
|
|
INIT_PARAM(platform, "Platform"),
|
2004-03-12 17:04:58 +01:00
|
|
|
INIT_PARAM(pci_bus, "PCI bus"),
|
|
|
|
INIT_PARAM(pci_dev, "PCI device number"),
|
2004-07-12 22:09:52 +02:00
|
|
|
INIT_PARAM(pci_func, "PCI function code"),
|
2005-10-19 04:05:05 +02:00
|
|
|
|
|
|
|
INIT_PARAM(hier, "Hierarchy global variables"),
|
2005-11-20 22:57:53 +01:00
|
|
|
INIT_PARAM(pio_bus, ""),
|
|
|
|
INIT_PARAM(dma_bus, ""),
|
2005-10-19 04:05:05 +02:00
|
|
|
INIT_PARAM(payload_bus, "The IO Bus to attach to for payload"),
|
|
|
|
INIT_PARAM(dma_desc_free, "DMA of Descriptors is free"),
|
|
|
|
INIT_PARAM(dma_data_free, "DMA of Data is free"),
|
|
|
|
INIT_PARAM(dma_read_delay, "fixed delay for dma reads"),
|
|
|
|
INIT_PARAM(dma_write_delay, "fixed delay for dma writes"),
|
|
|
|
INIT_PARAM(dma_read_factor, "multiplier for dma reads"),
|
|
|
|
INIT_PARAM(dma_write_factor, "multiplier for dma writes"),
|
|
|
|
INIT_PARAM(dma_no_allocate, "Should DMA reads allocate cache lines"),
|
|
|
|
INIT_PARAM(pio_latency, "Programmed IO latency in bus cycles"),
|
|
|
|
INIT_PARAM(intr_delay, "Interrupt Delay in microseconds"),
|
|
|
|
|
|
|
|
INIT_PARAM(rx_delay, "Receive Delay"),
|
|
|
|
INIT_PARAM(tx_delay, "Transmit Delay"),
|
|
|
|
INIT_PARAM(rx_fifo_size, "max size in bytes of rxFifo"),
|
|
|
|
INIT_PARAM(tx_fifo_size, "max size in bytes of txFifo"),
|
|
|
|
|
|
|
|
INIT_PARAM(rx_filter, "Enable Receive Filter"),
|
|
|
|
INIT_PARAM(hardware_address, "Ethernet Hardware Address"),
|
2005-11-25 19:33:36 +01:00
|
|
|
INIT_PARAM(rx_thread, ""),
|
|
|
|
INIT_PARAM(tx_thread, "")
|
2004-03-12 17:04:58 +01:00
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
END_INIT_SIM_OBJECT_PARAMS(NSGigE)
|
2004-03-12 17:04:58 +01:00
|
|
|
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
CREATE_SIM_OBJECT(NSGigE)
|
2004-03-12 17:04:58 +01:00
|
|
|
{
|
2004-11-13 21:45:22 +01:00
|
|
|
NSGigE::Params *params = new NSGigE::Params;
|
|
|
|
|
|
|
|
params->name = getInstanceName();
|
2005-10-19 04:05:05 +02:00
|
|
|
|
|
|
|
params->clock = clock;
|
|
|
|
|
2004-11-13 21:45:22 +01:00
|
|
|
params->mmu = mmu;
|
2005-10-19 04:05:05 +02:00
|
|
|
params->pmem = physmem;
|
2004-11-13 21:45:22 +01:00
|
|
|
params->configSpace = configspace;
|
|
|
|
params->configData = configdata;
|
|
|
|
params->plat = platform;
|
|
|
|
params->busNum = pci_bus;
|
|
|
|
params->deviceNum = pci_dev;
|
|
|
|
params->functionNum = pci_func;
|
|
|
|
|
|
|
|
params->hier = hier;
|
2005-11-20 22:57:53 +01:00
|
|
|
params->pio_bus = pio_bus;
|
|
|
|
params->header_bus = dma_bus;
|
2004-11-13 21:45:22 +01:00
|
|
|
params->payload_bus = payload_bus;
|
|
|
|
params->dma_desc_free = dma_desc_free;
|
|
|
|
params->dma_data_free = dma_data_free;
|
|
|
|
params->dma_read_delay = dma_read_delay;
|
|
|
|
params->dma_write_delay = dma_write_delay;
|
|
|
|
params->dma_read_factor = dma_read_factor;
|
|
|
|
params->dma_write_factor = dma_write_factor;
|
2005-10-19 04:05:05 +02:00
|
|
|
params->dma_no_allocate = dma_no_allocate;
|
|
|
|
params->pio_latency = pio_latency;
|
|
|
|
params->intr_delay = intr_delay;
|
|
|
|
|
|
|
|
params->rx_delay = rx_delay;
|
|
|
|
params->tx_delay = tx_delay;
|
|
|
|
params->rx_fifo_size = rx_fifo_size;
|
|
|
|
params->tx_fifo_size = tx_fifo_size;
|
|
|
|
|
2004-11-13 21:45:22 +01:00
|
|
|
params->rx_filter = rx_filter;
|
|
|
|
params->eaddr = hardware_address;
|
2005-11-25 19:33:36 +01:00
|
|
|
params->rx_thread = rx_thread;
|
|
|
|
params->tx_thread = tx_thread;
|
2005-10-19 04:05:05 +02:00
|
|
|
|
2004-11-13 21:45:22 +01:00
|
|
|
return new NSGigE(params);
|
2004-03-12 17:04:58 +01:00
|
|
|
}
|
|
|
|
|
2004-05-25 21:59:54 +02:00
|
|
|
REGISTER_SIM_OBJECT("NSGigE", NSGigE)
|