Exemplo n.º 1
0
from cli import *
from string import *
import nic_common
import sim_commands


nic_common.new_nic_commands("ppc440gp-emac")


#
# ------------------------ info -----------------------
#

sim_commands.new_info_command("ppc440gp-emac", nic_common.get_nic_info)

#
# ------------------------ status -----------------------
#

def get_emac_status(obj):
    status = []
    for x in obj.attributes:
        name = x[0]
        if name[0:6] == "EMACx_":
            value = SIM_get_attribute(obj, name)
            name = name[0:5] + "_" + name[6:]
            description = x[2]
            status.append((name, "0x%08x" % value))
    return nic_common.get_nic_status(obj) + [("Registers", status)]

sim_commands.new_status_command("ppc440gp-emac", get_emac_status)
Exemplo n.º 2
0
def get_info(obj):
    return ([] + sim_commands.get_pci_info(obj) + nic_common.get_nic_info(obj))


#
# --------------------- status ---------------------
#


def get_status(obj):
    csrs = obj.csrs
    return ([(None, [
        ("Bus mode (CSR0)", "0x%0.8x" % csrs[0]),
        ("Transmit poll demand (CSR1)", "0x%0.8x" % csrs[1]),
        ("Receive poll demand (CSR2)", "0x%0.8x" % csrs[2]),
        ("Receive list base address (CSR3)", "0x%0.8x" % csrs[3]),
        ("Transmit list base address (CSR4)", "0x%0.8x" % csrs[4]),
        ("Status (CSR5)", "0x%0.8x" % csrs[5]),
        ("Operation mode (CSR6)", "0x%0.8x" % csrs[6]),
        ("Interrupt enable (CSR7)", "0x%0.8x" % csrs[7]),
        ("Missed frames and overflow counter (CSR8)", "0x%0.8x" % csrs[8]),
        ("Boot ROM serial, ROM MII, (CSR9)", "0x%0.8x" % csrs[9])
    ])] + sim_commands.get_pci_status(obj) + nic_common.get_nic_status(obj))


nic_common.new_nic_commands(device_name)

sim_commands.new_info_command(device_name, get_info)
sim_commands.new_status_command(device_name, get_status)
sim_commands.new_pci_header_command(device_name, None)
Exemplo n.º 3
0
                csr0, 5), checkbit(csr0, 6), checkbit(csr0, 7))
    csr0b = "IDON=%d TINT=%d RINT=%d MERR=%d MISS=%d CERR=%d BABL=%d ERR=%d" % (
        checkbit(csr0, 8), checkbit(csr0, 9), checkbit(csr0, 10),
        checkbit(csr0, 11), checkbit(csr0, 12), checkbit(
            csr0, 13), checkbit(csr0, 14), checkbit(csr0, 15))
    #    log = obj.log_addr
    #    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (
    #        log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    #    if obj.connected == 1:
    #        connected = "yes"
    #    else:
    #        connected = "no"
    return ([
        (None, [("CSR0", csr0a),
                (None, csr0b), ("CSR1", "0x%x" % obj.csr_csr1),
                ("CSR2", "0x%x" % obj.csr_csr2),
                ("CSR3", "BCON=%d ACON=%d BSWP=%d" %
                 ((checkbit(obj.csr_csr3, 0), checkbit(
                     obj.csr_csr3, 1), checkbit(obj.csr_csr3, 2)))),
                ("CSR15", "0x%x" % obj.csr_csr15), ("RAP", obj.ioreg_rap)]),
        #              (None,
        #               [("Packets sent", obj.pkt_snt),
        #                ("Packets received", obj.pkt_rec)])
    ] + nic_common.get_nic_status(obj))


nic_common.new_nic_commands('AM79C960-dml')

sim_commands.new_info_command('AM79C960-dml', get_info)
sim_commands.new_status_command('AM79C960-dml', get_status)
Exemplo n.º 4
0
            nic_common.get_nic_info(obj))


def get_status(obj):
    return ([ ("Status and control registers",
               [("ISQ",      "0x%x" % (obj.ctrl_regs[0])),
                ("RxCFG",    "0x%x" % (obj.ctrl_regs[3])),
                ("RxEvent",  "0x%x" % (obj.ctrl_regs[4])),
                ("RxCTL",    "0x%x" % (obj.ctrl_regs[5])),
                ("TxCFG",    "0x%x" % (obj.ctrl_regs[7])),
                ("TxEvent",  "0x%x" % (obj.ctrl_regs[8])),
                ("TxCMD",    "0x%x" % (obj.ctrl_regs[9])),
                ("BufCFG",   "0x%x" % (obj.ctrl_regs[0xb])),
                ("BufEvent", "0x%x" % (obj.ctrl_regs[0xc])),
                ("RxMISS",   "0x%x" % (obj.ctrl_regs[0x10])),
                ("TxCOL",    "0x%x" % (obj.ctrl_regs[0x12])),
                ("LineCTL",  "0x%x" % (obj.ctrl_regs[0x13])),
                ("LineST",   "0x%x" % (obj.ctrl_regs[0x14])),
                ("SelfCTL",  "0x%x" % (obj.ctrl_regs[0x15])),
                ("SelfST",   "0x%x" % (obj.ctrl_regs[0x16])),
                ("BusCTL",   "0x%x" % (obj.ctrl_regs[0x17])),
                ("BusST",    "0x%x" % (obj.ctrl_regs[0x18])),
                ("TestCTL",  "0x%x" % (obj.ctrl_regs[0x19])),
                ("AUI_TDR",  "0x%x" % (obj.ctrl_regs[0x1c]))])] +
            nic_common.get_nic_status(obj))

nic_common.new_nic_commands("CS8900A")

sim_commands.new_info_command("CS8900A", get_info)
sim_commands.new_status_command("CS8900A", get_status)
Exemplo n.º 5
0
                    ("Rx ring size", rx_sizes[obj.rx_ring_size_idx]),
                    ("Tx base addr", "0x%08x" % obj.tx_desc_base),
                    ("Tx ring size", obj.tx_ring_size),
                ],
            )
        ]
        + nic_common.get_nic_info(obj)
        + pci_info
    )


def get_status(obj):
    if string.find(obj.classname, "sbus") < 0:
        pci_status = sim_commands.get_pci_status(obj)
    else:
        pci_status = []
    return (
        [(None, [("Packets sent", obj.pkt_snt), ("Packets received", obj.pkt_rec)])]
        + nic_common.get_nic_status(obj)
        + pci_status
    )


nic_common.new_nic_commands(device_name)

sim_commands.new_info_command(device_name, get_info)
sim_commands.new_status_command(device_name, get_status)

if string.find(device_name, "sbus") < 0:
    sim_commands.new_pci_header_command(device_name, None)
Exemplo n.º 6
0
    log = obj.log_addr
    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    if obj.connected == 1:
        connected = "yes"
    else:
        connected = "no"

    return [
        (
            None,
            [
                ("CSR", csr0a),
                (None, csr0b),
                ("CSR1", "0x%x" % obj.csr1),
                ("CSR2", "0x%x" % obj.csr2),
                (
                    "CSR3",
                    "BCON=%d ACON=%d BSWP=%d" % ((checkbit(obj.csr3, 0), checkbit(obj.csr3, 1), checkbit(obj.csr3, 2))),
                ),
                ("RAP", obj.rap),
            ],
        ),
        (None, [("Packets sent", obj.pkt_snt), ("Packets received", obj.pkt_rec)]),
    ] + nic_common.get_nic_status(obj)


nic_common.new_nic_commands("AM79C960")

sim_commands.new_info_command("AM79C960", get_info)
sim_commands.new_status_command("AM79C960", get_status)
Exemplo n.º 7
0
        checkbit(csr0, 4), checkbit(csr0, 5), checkbit(csr0, 6), checkbit(csr0, 7))
    csr0b = "IDON=%d TINT=%d RINT=%d MERR=%d MISS=%d CERR=%d BABL=%d ERR=%d" % (
        checkbit(csr0, 8), checkbit(csr0, 9), checkbit(csr0, 10), checkbit(csr0, 11),
        checkbit(csr0, 12), checkbit(csr0, 13), checkbit(csr0, 14), checkbit(csr0, 15))
    #    log = obj.log_addr
    #    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (
    #        log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    #    if obj.connected == 1:
    #        connected = "yes"
    #    else:
    #        connected = "no"
    return ([ (None,
               [ ("CSR0", csr0a),
                 (None,  csr0b),
                 ("CSR1", "0x%x" % obj.csr_csr1),
                 ("CSR2", "0x%x" % obj.csr_csr2),
                 ("CSR3", "BCON=%d ACON=%d BSWP=%d" % (
        (checkbit(obj.csr_csr3, 0), checkbit(obj.csr_csr3, 1), checkbit(obj.csr_csr3, 2)))),
                 ("CSR15", "0x%x" % obj.csr_csr15),
                 ("RAP", obj.ioreg_rap) ]),
              #              (None,
              #               [("Packets sent", obj.pkt_snt),
              #                ("Packets received", obj.pkt_rec)])
              ] + nic_common.get_nic_status(obj))


nic_common.new_nic_commands('AM79C960-dml')

sim_commands.new_info_command('AM79C960-dml', get_info)
sim_commands.new_status_command('AM79C960-dml', get_status)
from cli import *
from string import *
import nic_common
import sim_commands

nic_common.new_nic_commands("ppc440gp-emac")

#
# ------------------------ info -----------------------
#

sim_commands.new_info_command("ppc440gp-emac", nic_common.get_nic_info)

#
# ------------------------ status -----------------------
#


def get_emac_status(obj):
    status = []
    for x in obj.attributes:
        name = x[0]
        if name[0:6] == "EMACx_":
            value = SIM_get_attribute(obj, name)
            name = name[0:5] + "_" + name[6:]
            description = x[2]
            status.append((name, "0x%08x" % value))
    return nic_common.get_nic_status(obj) + [("Registers", status)]


sim_commands.new_status_command("ppc440gp-emac", get_emac_status)
Exemplo n.º 9
0
from cli import *
from string import *
import nic_common

module_name = get_last_loaded_module()

if module_name == "440gx-devices":
    soc_name = "ppc440gx"
elif module_name == "440gp-devices":
    soc_name = "ppc440gp"
else:
    print "unknown module name: " + module_name

nic_common.new_nic_commands(soc_name + "-emac")

#
# ------------------------ info -----------------------
#

def emac_info_cmd(obj):
    print 
    print "%s is a %s" % (obj.name, obj.classname)
    print
    print "the ethernet address is " + obj.mac_address
    print "min-latency is %s ns" % obj.min_latency    

new_command("info", emac_info_cmd,
            [],
            alias = "",
            type  = "ppc440gp-emac commands",
            short = "print static information about device",
Exemplo n.º 10
0

def get_status(obj):
    return ([("Status and control registers", [
        ("ISQ", "0x%x" % (obj.ctrl_regs[0])),
        ("RxCFG", "0x%x" % (obj.ctrl_regs[3])),
        ("RxEvent", "0x%x" % (obj.ctrl_regs[4])),
        ("RxCTL", "0x%x" % (obj.ctrl_regs[5])),
        ("TxCFG", "0x%x" % (obj.ctrl_regs[7])),
        ("TxEvent", "0x%x" % (obj.ctrl_regs[8])),
        ("TxCMD", "0x%x" % (obj.ctrl_regs[9])),
        ("BufCFG", "0x%x" % (obj.ctrl_regs[0xb])),
        ("BufEvent", "0x%x" % (obj.ctrl_regs[0xc])),
        ("RxMISS", "0x%x" % (obj.ctrl_regs[0x10])),
        ("TxCOL", "0x%x" % (obj.ctrl_regs[0x12])),
        ("LineCTL", "0x%x" % (obj.ctrl_regs[0x13])),
        ("LineST", "0x%x" % (obj.ctrl_regs[0x14])),
        ("SelfCTL", "0x%x" % (obj.ctrl_regs[0x15])),
        ("SelfST", "0x%x" % (obj.ctrl_regs[0x16])),
        ("BusCTL", "0x%x" % (obj.ctrl_regs[0x17])),
        ("BusST", "0x%x" % (obj.ctrl_regs[0x18])),
        ("TestCTL", "0x%x" % (obj.ctrl_regs[0x19])),
        ("AUI_TDR", "0x%x" % (obj.ctrl_regs[0x1c]))
    ])] + nic_common.get_nic_status(obj))


nic_common.new_nic_commands("CS8900A")

sim_commands.new_info_command("CS8900A", get_info)
sim_commands.new_status_command("CS8900A", get_status)