Ejemplo n.º 1
0
new_command("increment", increment_value_cmd, [],
            alias = "",
            type  = "empty-device commands",
            short = "increment value",
	    namespace = "empty-device",
            doc = """
Increments the value by adding 1 to it.
""")

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

def get_info(obj):
    # USER-TODO: Return something useful here
    return []

sim_commands.new_info_command('empty-device', get_info)

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

def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals",
             [("Attribute 'value'", SIM_get_attribute(obj, "value"))])]

sim_commands.new_status_command('empty-device', get_status)
Ejemplo n.º 2
0
            short="increment value",
            namespace="emerald",
            doc="""
Increments the value by adding 1 to it.
""")

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


def get_info(obj):
    # USER-TODO: Return something useful here
    return []


sim_commands.new_info_command('emerald', get_info)

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


def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals", [("Attribute 'value'",
                            SIM_get_attribute(obj, "value"))])]


sim_commands.new_status_command('emerald', get_status)
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
              ("Physical Memory", obj.physical_memory),
            ])
           ]

def get_mips_status(obj):
    address_bits = obj.address_width[1]
    return [(None, [
              ("Cycles", obj.cycles),
              ("Program counter", "0x%0*x"%(address_bits/4,
                                            SIM_get_program_counter(obj))),
              ("Context", obj.current_context),
              ("Interrupts", obj.status & 1 and "Enabled" or "Disabled"),
            ])
           ]

sim_commands.new_status_command('mips', get_mips_status)
sim_commands.new_info_command('mips', get_mips_info)

def get_diff_regs(cpu):
    diff_regs = SIM_get_all_registers(cpu)
    diff_regs = [ SIM_get_register_name(cpu, i) for i in diff_regs ]
    diff_regs.remove('pc')
    diff_regs.remove('count')
    return diff_regs

funcs = { 'print_disassemble_line':
          local_print_disassemble_line,
          'pregs':
          local_pregs,
          'get_pending_exception_string':
          local_pending_exception,
Ejemplo n.º 5
0
#
# ------------------------ 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)

def dma_status_cmd(obj):
    print
    registers = [["Register", "Value", "Description"]]
    for x in obj.attributes:
        name = x[0]
        if name[0:5] == "DMA0-":
            value = SIM_get_attribute(obj, name)
            name = name[0:4] + "_" + name[5:]
            description = x[2]
            registers += [[name, "0x%08x" % value, description]]
    print_columns([Just_Left, Just_Left, Just_Left], registers)

new_command("status", dma_status_cmd,
            [],
Ejemplo n.º 6
0
##  Copyright 2005-2007 Virtutech AB

from cli import *
import sim_commands
import string

def info(obj):
    return []

def status(obj):
    return [ (None,
              [ ("Attribute a", "%d" % obj.a)])]

    
sim_commands.new_info_command("sample_device_dml", info)
sim_commands.new_status_command("sample_device_dml", status)
Ejemplo n.º 7
0
def brec_get_info(obj):
    return [(None,
             [("Address type", VT_addr_type_to_str(obj.address_type)),
              ("CPU type", obj.cpu_type)])]

def brec_get_status(obj):
    plist = []
    for cpu in obj.processors:
        plist.append(cpu.name)
    return [(None,
             [("Number of arcs", obj.num_arcs),
              ("Attached processors", ", ".join(plist))])]

sim_commands.new_info_command("branch_recorder", brec_get_info,
                              "profiling commands")
sim_commands.new_status_command("branch_recorder", brec_get_status,
                                "profiling commands")

def start_instruction_profiling_cmd(cpu):
    if not supports_branch_profiling(cpu):
        return

    bname = "%s_branch_recorder" % cpu.name
    try:
        SIM_get_object(bname)
        print "Error! An object called %s already exists." % bname
        return
    except:
        pass
    try:
        brec = SIM_new_object("branch_recorder", bname)
        SIM_set_attribute(brec, "address_type", Addr_Type_Physical)
Ejemplo n.º 8
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)
Ejemplo n.º 9
0
def ide_get_info(obj):
    return [(None, [("IRQ device", obj.irq_dev), ("IRQ number", obj.irq_level),
                    ("Interrupt delay", obj.interrupt_delay),
                    ("Model DMA delay", obj.model_dma_delay),
                    ("Master", obj.master), ("Slave", obj.slave),
                    ("Bus master DMA", obj.bus_master_dma)])]


def ide_get_status(obj):
    return [(None, [("Selected drive", obj.selected_drive),
                    ("LBA mode", obj.lba_mode),
                    ("Interrupt request status", obj.interrupt_pin),
                    ("DMA ready", obj.dma_ready)])]


sim_commands.new_info_command("ide", ide_get_info)
sim_commands.new_status_command("ide", ide_get_status)

try:
    from pc_disk_commands import *
    create_pc_partition_table_commands("ide-disk")
except:
    pass

try:
    from sun_vtoc_commands import *
    create_sun_vtoc_commands("ide-disk")
except:
    pass
Ejemplo n.º 10
0
import sim_commands

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

low_high = ("low", "high")


def get_info(obj):
    tgts = obj.targets

    return [("Connected devices", [(("%2d" % tgts[i][0]), tgts[i][1])
                                   for i in range(len(tgts))])]


def get_status(obj):
    phase = obj.phase
    phase_name = obj.scsi_phases[phase]
    atn = int(obj.atn)
    init = obj.initiator
    tgt = obj.target

    return [(None, [("Current Phase", phase_name), ("ATN", low_high[atn]),
                    ("Current/last Initiator", "%d" % init),
                    ("Current/last Target", "%d" % tgt)])]


sim_commands.new_info_command("scsi-bus", get_info)
sim_commands.new_status_command("scsi-bus", get_status)
Ejemplo n.º 11
0
        src = frame[6:12]
        frames.append((str(seq),
                       "%s -> %s; size: %d bytes time: %d"
                       % (fmt_mac(src), fmt_mac(dst), len(frame), timestamp)))

    return [(None,
             [("Frames transmitted", obj.nframes),
              ("Bytes transmitted", obj.nbytes)]),
            ("MAC addresses",
             [("<%d:%d> %s" % (lid, iff(gid is None, -1, gid), name),
               iff(promisc, "PROMISCUOUS ", "") + fmt_macs(macs))
              for gid, lid, name, _, (macs, promisc) in obj.devices]),
            ("Frames in transfer", frames)]

sim_commands.new_info_command("ethernet-link", get_info)
sim_commands.new_status_command("ethernet-link", get_status)

#
# real-network commands
#

new_command("connect-real-network-host", real_network_host_cmd,
            [arg(str_t, "interface", "?", "", expander = net_adapter_expander),
             arg(flag_t, "-persistent")],
            type = ["Real Network", "Networking"],
            namespace = "ethernet-link",
            short = "connect to the real network",
            see_also = ['connect-real-network-host',
                        '<ethernet-link>.connect-real-network-bridge',
                        '<ethernet-link>.connect-real-network-router'],
            doc_with = 'connect-real-network-host', filename="/mp/simics-3.0/src/devices/ethernet-link/commands.py", linenumber="117")
Ejemplo n.º 12
0
              [ ("IRQ device", obj.irq_dev),
                ("IRQ number", obj.irq_level),
                ("Interrupt delay", obj.interrupt_delay),
                ("Model DMA delay", obj.model_dma_delay),
                ("Master", obj.master),
                ("Slave", obj.slave),
                ("Bus master DMA", obj.bus_master_dma) ] ) ]

def ide_get_status(obj):
    return [ (None,
              [ ("Selected drive", obj.selected_drive),
                ("LBA mode", obj.lba_mode),
                ("Interrupt request status", obj.interrupt_pin),
                ("DMA ready", obj.dma_ready) ] ) ]
                 
sim_commands.new_info_command("ide", ide_get_info)
sim_commands.new_status_command("ide", ide_get_status)


try:
	from pc_disk_commands import *
	create_pc_partition_table_commands("ide-disk")
except:
	pass

try:
    from sun_vtoc_commands import *
    create_sun_vtoc_commands("ide-disk")
except:
    pass
Ejemplo n.º 13
0
def get_info(obj):
    return [(None, [
        ("PHY object", obj.phy),
    ])] + sim_commands.get_pci_info(obj)


def get_status(obj):
    csr0 = obj.csr_csr0
    csr0a = "INIT=%d STRT=%d STOP=%d TDMD=%d TXON=%d RXON=%d INEA=%d INTR=%d" % (
        checkbit(csr0, 0), checkbit(csr0, 1), checkbit(
            csr0, 2), checkbit(csr0, 3), 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))
    return ([
        (None, [("CSR0", csr0a), ("", 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)]),
    ] + sim_commands.get_pci_status(obj))


sim_commands.new_pci_header_command('AM79C973', None)
sim_commands.new_info_command('AM79C973', get_info)
sim_commands.new_status_command('AM79C973', get_status)
Ejemplo n.º 14
0
sim_commands.new_info_command("sbbc-pci", get_info)


def get_status(obj):
    return ([
        ("Registers", [("Interrupt Enable", "0x%x" % obj.interrupt_enable),
                       ("Interrupt Status", "0x%x" % obj.interrupt_status),
                       ("EPLD Interrupt", "0x%x" % obj.epld_interrupt),
                       ("Irq Generation 0", "0x%x" % obj.irq_generation_0),
                       ("Irq Generation 1", "0x%x" % obj.irq_generation_1)]),
        (None, [("Access info", iff(obj.access_info, "enabled", "disabled"))])
    ] + sim_commands.get_pci_status(obj))


sim_commands.new_status_command("sbbc-pci", get_status)

sim_commands.new_pci_header_command("sbbc-pci", None)

#
# ----------------- access-debug -----------------
#


def access_info_cmd(obj):
    try:
        cur = obj.access_info
        obj.access_info = 1 - cur
        print "%sabling access info" % iff(cur == 0, "En", "Dis")
    except Exception, msg:
        print msg
Ejemplo n.º 15
0
                ("Physical Memory", obj.physical_memory),
            ])]


def get_mips_status(obj):
    address_bits = obj.address_width[1]
    return [(None, [
        ("Cycles", obj.cycles),
        ("Program counter",
         "0x%0*x" % (address_bits / 4, SIM_get_program_counter(obj))),
        ("Context", obj.current_context),
        ("Interrupts", obj.status & 1 and "Enabled" or "Disabled"),
    ])]


sim_commands.new_status_command('mips', get_mips_status)
sim_commands.new_info_command('mips', get_mips_info)


def get_diff_regs(cpu):
    diff_regs = SIM_get_all_registers(cpu)
    diff_regs = [SIM_get_register_name(cpu, i) for i in diff_regs]
    diff_regs.remove('pc')
    diff_regs.remove('count')
    return diff_regs


funcs = {
    'print_disassemble_line': local_print_disassemble_line,
    'pregs': local_pregs,
    'get_pending_exception_string': local_pending_exception,
Ejemplo n.º 16
0
              ("Extended Memory", "%d" % ((seq_regs[0x04] & 0x02) >> 1))]),
            ("Attribute",
             [("Video", dis_en_str[video_en]),
              ("Palette Size", "%d" % ((attr_regs[0x10] & 0x80) >> 7)),
              ("Palette", string.join([ str(attr_regs[i])
                                        for i in range(16) ], ' ')),
              ("Pixel Clock", "%d" % ((attr_regs[0x10] & 0x40) >> 6)),
              ("Enable Blink", "%d" % ((attr_regs[0x10] & 0x08) >> 3)),
              ("Enable Line Gfx", "%d" % ((attr_regs[0x10] & 0x04) >> 2)),
              ("Graphics Mode", "%d" % (attr_regs[0x10] & 0x01)),
              ("Color Plane 0-4", string.join([ str((attr_regs[0x12] >> i) & 0x01)
                                                for i in range(4) ], ' '))]),
            ("Graphics",
             [("Set/Reset", "0x%x" % gfx_regs[0x00]),
              ("Enable Set/Reset", "0x%x" % gfx_regs[0x01]),
              ("Chain Odd/Even", "%d" % ((gfx_regs[0x06] & 0x02) >> 1)),
              ("Memory Map", "%d" % ((gfx_regs[0x06] & 0x0c) >> 2)),
              ("Rotate", "%d" % (gfx_regs[0x03] & 0x07)),
              ("Function", func_names[int((gfx_regs[0x03] & 0x18) >> 3)]),
              ("Odd/Even", "%d" % ((gfx_regs[0x05] & 0x10) >> 4)),
              ("Write Mode", "%d" % (gfx_regs[0x05] & 0x03)),
              ("Read Mode", "%d" % ((gfx_regs[0x05] & 0x08) >> 3)),
              ("Read Map", "%d" % gfx_regs[0x04]),
              ("Shift Reg", "%d" % ((gfx_regs[0x05] & 0x60) >> 5)),
              ("Bit Mask 0 - 7", string.join([ str((gfx_regs[0x08] >> i) & 0x01)
                                               for i in range(8) ], ' ')),
              ("Mode (Gfx/Alpha)",
               alpha_gfx_str[int(gfx_regs[0x06] & 0x01)])])]

sim_commands.new_status_command(vga_name, vga_get_status)
Ejemplo n.º 17
0
new_command("process_info", process_info_cmd,
            args = [],
            alias = "",
            type  = "common commands",
            short = "process info",
	    namespace = "common",
            doc = """
Shows information about the os processes (requires os visibility in kernel).
""")

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

def get_info(obj):
    # USER-TODO: Return something useful here
    return []

sim_commands.new_info_command('common', get_info)

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

def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals",
             [("Attribute 'value'", SIM_get_attribute(obj, "disk_delay"))])]

sim_commands.new_status_command('common', get_status)
Ejemplo n.º 18
0
import sim_commands

def get_info(obj):
    try:
        devices = obj.i2c_devices
    except:
        devices = "None"
    else:
        devices.sort()
        devices = ", ".join(map(lambda x: ("%s (0x%x)" % (x[0], x[1])), devices))
    return [(None,
             [ ('I2C devices', devices) ]
             )]

def get_status(obj):
    slave = obj.current_slave
    if not slave:
        slave = '<none>'
    state = [ 'idle', 'master transmit', 'master receive',
              'slave transmit', 'slave receive' ][obj.current_state]
    return [(None,
             [ ('Current slave', slave),
               ('Current state', state)
               ]
             ) ]

sim_commands.new_info_command("i2c-bus", get_info)
sim_commands.new_status_command("i2c-bus", get_status)
Ejemplo n.º 19
0
          ("Last SENSE key", "%d" % sense),
          ("Target to reselect", resel_tgt)]

    if obj.classname == "scsi-disk":
        st += [("Sectors read",
                "%d  ( = %d bytes)" % (obj.sectors_read, obj.sectors_read * 512)),
               ("Sectors written",
                "%d  ( = %d bytes)" % (obj.sectors_written, obj.sectors_written * 512))]
    else:
        st += [("Sectors read",
                "%d  ( = %d bytes)" % (obj.sectors_read, obj.sectors_read * 2048)),
               ("Sectors written",
                "%d  ( = %d bytes)" % (obj.sectors_written, obj.sectors_written * 2048))]
    return [(None, st)]

# will only be called for scsi-disk itself
sim_commands.new_info_command("scsi-disk", get_info)
sim_commands.new_status_command("scsi-disk", get_status)

try:
    from sun_vtoc_commands import *
    create_sun_vtoc_commands("scsi-disk")
except:
    pass

try:
    from pc_disk_commands import *
    create_pc_partition_table_commands("scsi-disk")
except:
    pass
        return "%.3g %s%s" % (val, pre[0], unit)
    else: # abs(val) < 1.0:
        pre = prefixes_down
        while val < 1.0 and len(pre) > 1:
            val = val * 1000.0
            pre = pre[1:]
        return "%.3g %s%s" % (val, pre[0], unit)


def get_info(obj):
    devices = obj.devices
    doc = ([(None,
             [("Timing granularity", fmt_prefixed_unit(obj.frequency, "Hz")),
              ("Latency", fmt_prefixed_unit(obj.latency * 1.0 / obj.frequency, "s")),
              ("Maximum throughput", iff(obj.throttle,
                                         "%s bps" % obj.throttle,
                                         "unlimited"))]),
            ("Devices",
             [("Local devices",  ["<%d:%d> %s" % (lid, iff(gid is None, -1, gid), name)
                                  for gid, lid, name, dev, _ in devices if dev]),
              ("Remote devices", ["<%d:%d> %s" % (lid, iff(gid is None, -1, gid), name)
                                  for gid, lid, name, dev, _ in devices if not dev])])])
    return doc

def get_status(obj):
    return []

sim_commands.new_info_command("serial-link", get_info)
sim_commands.new_status_command("serial-link", get_status)

Ejemplo n.º 21
0
SIM_register_typed_attribute(
    class_name, 'start_time',
    get_start_time, None,
    set_start_time, None,
    Sim_Attr_Optional,
    'i', None,
    'The time, as seconds in standard Unix format, when the simulation was '
    'started.')

io_if = io_memory_interface_t()
io_if.operation = rtc_operation
SIM_register_interface(class_name, 'io_memory', io_if)

from cli import *
import sim_commands

# info command prints static information
def get_info(obj):
    return []

# status command prints dynamic information
def get_status(obj):
    inst = device_instances[obj]
    return [('Registers',
             [('Seconds', str(long(inst.current_time())))]),
            ('Other', [('Time', time.ctime(inst.current_time()))])]

sim_commands.new_info_command(class_name, get_info)
sim_commands.new_status_command(class_name, get_status)
Ejemplo n.º 22
0
        doc += [("Simulated Network", link_info)]
    return doc

for cls in rn_classes:
    sim_commands.new_info_command(cls, get_info)

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

def get_status(rn):
    return [(None,
             [("Connected", iff(rn.connected, "Yes", "No"))])]

for cls in rn_classes:
    sim_commands.new_status_command(cls, get_status)

#
# -------------- disconnect --------------
#

def disconnect_rn_cmd(rn):
    # see also disconnect in ethernet-link (namespace and global)
    del_rn_default_route(rn)
    print "Disconnecting link %s from the real network." % rn.link.name
    SIM_delete_object(rn)

new_command("disconnect-real-network", disconnect_rn_cmd,
            type = "real-network commands",
            namespace = "real_network",
            short = "disconnect from the real network",
Ejemplo n.º 23
0
# cpc700-uic


def uic_get_info(obj):
    return [(None, [("interrupt device", obj.irq_dev)])]


def uic_get_status(obj):
    return [(None, [("UICSR (status)", number_str(obj.uicsr, 16)),
                    ("UICER (enable)", number_str(obj.uicer, 16)),
                    ("UICCR (critical)", number_str(obj.uiccr, 16)),
                    ("UICVCR (vector)", number_str(obj.uicvcr, 16))])]


sim_commands.new_info_command("cpc700-uic", uic_get_info)
sim_commands.new_status_command("cpc700-uic", uic_get_status)

# cpc700-mc

sim_commands.new_info_command("cpc700-mc", get_empty)
sim_commands.new_status_command("cpc700-mc", get_empty)

# cpc700-gpt

sim_commands.new_info_command("cpc700-gpt", get_empty)
sim_commands.new_status_command("cpc700-gpt", get_empty)

# cpc700-pi

sim_commands.new_info_command("cpc700-pi", get_empty)
sim_commands.new_status_command("cpc700-pi", get_empty)
#


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)


def dma_status_cmd(obj):
    print
    registers = [["Register", "Value", "Description"]]
    for x in obj.attributes:
        name = x[0]
        if name[0:5] == "DMA0-":
            value = SIM_get_attribute(obj, name)
            name = name[0:4] + "_" + name[5:]
            description = x[2]
            registers += [[name, "0x%08x" % value, description]]
    print_columns([Just_Left, Just_Left, Just_Left], registers)

Ejemplo n.º 25
0
# cpc700-uic

def uic_get_info(obj):
    return [ (None,
              [("interrupt device", obj.irq_dev)])]

def uic_get_status(obj):
    return [ (None,
              [("UICSR (status)",    number_str(obj.uicsr,16)),
               ("UICER (enable)",    number_str(obj.uicer,16)),
               ("UICCR (critical)",  number_str(obj.uiccr,16)),
               ("UICVCR (vector)",   number_str(obj.uicvcr,16))])]

sim_commands.new_info_command("cpc700-uic", uic_get_info)
sim_commands.new_status_command("cpc700-uic", uic_get_status)

# cpc700-mc

sim_commands.new_info_command("cpc700-mc", get_empty)
sim_commands.new_status_command("cpc700-mc", get_empty)

# cpc700-gpt

sim_commands.new_info_command("cpc700-gpt", get_empty)
sim_commands.new_status_command("cpc700-gpt", get_empty)

# cpc700-pi

sim_commands.new_info_command("cpc700-pi", get_empty)
sim_commands.new_status_command("cpc700-pi", get_empty)
Ejemplo n.º 26
0
import sim_commands

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

low_high = ("low", "high")

def get_info(obj):
    tgts = obj.targets

    return [("Connected devices",
             [(("%2d" % tgts[i][0]), tgts[i][1])
              for i in range(len(tgts))])]
    
def get_status(obj):
    phase = obj.phase
    phase_name = obj.scsi_phases[phase]
    atn = int(obj.atn)
    init = obj.initiator
    tgt = obj.target

    return [(None,
             [("Current Phase", phase_name),
              ("ATN", low_high[atn]),
              ("Current/last Initiator", "%d" % init),
              ("Current/last Target", "%d" % tgt)])]
    
sim_commands.new_info_command("scsi-bus", get_info)
sim_commands.new_status_command("scsi-bus", get_status)
Ejemplo n.º 27
0
#

def get_sample_info(obj):
    return []

sim_commands.new_info_command('sample-device', get_sample_info)

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

def get_sample_status(obj):
    return [(None,
             [("Attribute 'value'", obj.value)])]

sim_commands.new_status_command('sample-device', get_sample_status)

#
# ------------------------ add-log -----------------------
#

def add_log_cmd(obj, str):
    try:
        obj.add_log = str
    except Exception, msg:
        print "Error adding log string: %s" % msg


new_command("add-log", add_log_cmd,
            [arg(str_t, "log-string", "?", "default text")],
            alias = "",
Ejemplo n.º 28
0
def get_sample_info(obj):
    return []


sim_commands.new_info_command('sample-device', get_sample_info)

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


def get_sample_status(obj):
    return [(None, [("Attribute 'value'", obj.value)])]


sim_commands.new_status_command('sample-device', get_sample_status)

#
# ------------------------ add-log -----------------------
#


def add_log_cmd(obj, str):
    try:
        obj.add_log = str
    except Exception, msg:
        print "Error adding log string: %s" % msg


new_command("add-log",
            add_log_cmd, [arg(str_t, "log-string", "?", "default text")],
Ejemplo n.º 29
0
            + nic_common.get_nic_info(obj))


def get_status(obj):
    left = obj.count
    if left is None:
        left = "unlimited"
    return ([(None, [("Enabled", iff(obj.enabled, "yes", "no")),
                     ("Packets left to send", left),
                     ("Packets sent", obj.total_tx_packets),
                     ("Packets received", obj.total_rx_packets)])] +
            nic_common.get_nic_status(obj))


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


def start(obj, count):
    if count:
        obj.count = count
    if not obj.enabled:
        print "Starting", obj.name
        obj.enabled = 1


new_command("start",
            start, [arg(int_t, "count", "?")],
            type="etg commands",
            short="Start generating traffic",
            namespace="etg",
Ejemplo n.º 30
0
    else:
        return 0

def get_info(obj):
    return [ (None, [
        ("PHY object", obj.phy),
        ] ) ] + sim_commands.get_pci_info(obj)

def get_status(obj):
    csr0 = obj.csr_csr0
    csr0a = "INIT=%d STRT=%d STOP=%d TDMD=%d TXON=%d RXON=%d INEA=%d INTR=%d" % (
        checkbit(csr0, 0), checkbit(csr0, 1), checkbit(csr0, 2), checkbit(csr0, 3),
        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))
    return ([ (None,
               [ ("CSR0", csr0a),
                 ("",  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) ]),
              ] + sim_commands.get_pci_status(obj))

sim_commands.new_pci_header_command('AM79C973', None)
sim_commands.new_info_command('AM79C973', get_info)
sim_commands.new_status_command('AM79C973', get_status)
Ejemplo n.º 31
0
##  Copyright 2005-2007 Virtutech AB

from cli import *
import sim_commands
import string


def info(obj):
    return []


def status(obj):
    return [(None, [("Attribute a", "%d" % obj.a)])]


sim_commands.new_info_command("sample_device_dml", info)
sim_commands.new_status_command("sample_device_dml", status)

sim_commands.new_info_command('v9-sol9-idle-opt', get_info)


def get_status(obj):
    return [(None, [("Enabled", iff(obj.enabled, "yes", "no")),
                    ("Auto-detect", iff(obj.auto_detect, "yes", "no")),
                    ("Multi-pro", iff(obj.multi_pro, "yes", "no")),
                    ("Memory space", obj.memory_space),
                    ("Address", "0x%x" % obj.address),
                    ("Idle speed", obj.idle_speed),
                    ("Busy speed", obj.busy_speed)])]


sim_commands.new_status_command('v9-sol9-idle-opt', get_status)


def v9_sol9_idle_opt_cmd(memory_space, multi_pro):
    i = 0
    done = 0
    while not done:
        try:
            obj_name = "idle-opt-%d" % i
            SIM_get_object(obj_name) != None
            i = i + 1
        except:
            done = 1
            obj = SIM_create_object(
                "v9-sol9-idle-opt", obj_name,
                [["memory_space", memory_space], ["multi_pro", multi_pro]])
Ejemplo n.º 33
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)
Ejemplo n.º 34
0
               ("Size", "%d bytes" % obj.packet_size)])] +
            nic_common.get_nic_info(obj))

def get_status(obj):
    left = obj.count
    if left is None:
        left = "unlimited"
    return ([ (None,
               [ ("Enabled", iff(obj.enabled, "yes", "no")),
                 ("Packets left to send", left),
                 ("Packets sent", obj.total_tx_packets),
                 ("Packets received", obj.total_rx_packets)])] +
            nic_common.get_nic_status(obj))

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

def start(obj, count):
    if count:
        obj.count = count
    if not obj.enabled:
        print "Starting", obj.name
        obj.enabled = 1

new_command("start", start,
            [arg(int_t, "count", "?")],
            type = "etg commands",
            short = "Start generating traffic",
            namespace = "etg",
            doc = """
Start the traffic generator.
Ejemplo n.º 35
0
##  Copyright 2004-2007 Virtutech AB

from cli import *
import sim_commands

def get_sbd_info(obj):
    return []

sim_commands.new_info_command('simple-byte-dump', get_sbd_info)

def get_sbd_status(obj):
    return [(None,
             [("Output file: ", obj.filename)])]

sim_commands.new_status_command('simple-byte-dump', get_sbd_status)

def set_output_file_cmd(obj, filename):
    try:
        obj.filename = filename
    except Exception, msg:
        print "Could not set output filename: %s" % msg

new_command("set-output-file", set_output_file_cmd,
            [arg(str_t, "filename")],
            alias = "",
            type  = "simple-byte-dump commands",
            short = "sets file to output to",
	    namespace = "simple-byte-dump",
            doc = """
Sets the name of the file to which bytes will be written.
            # interruptible ports
            if interruptible_port :
                # interrupt control bits
                bit_state += ", ie=%d, ies=%d, ifg=%d" % (checkbit(pxie,bit),
                                                          checkbit(pxies,bit),
                                                          checkbit(pxifg,bit))
            # complete the bit state list
            bit_state_list += [(bit_name, bit_state)]
        # generate status item for this port
        report_list += [("Port %d" % (port), bit_state_list)]
    # return the completed list
    # print report_list
    return report_list

sim_commands.new_info_command('telos-io-ports', get_info_io_ports)
sim_commands.new_status_command('telos-io-ports', get_status_io_ports)


#----------------------------------------------------------------------
#  Info & Status for environment
#----------------------------------------------------------------------
def get_info_environment(obj):
    return [ (None,
              [])
             ]

def get_status_environment(obj):
    return [ ("Parameter values",
              [("Location.X", "%d" % obj.location_x),
               ("Location.Y", "%d" % obj.location_y),
               ("Location.Z", "%d" % obj.location_z),
Ejemplo n.º 37
0
new_command("dump_lock", dump_lock_cmd,
            args = [arg(int_t, "addr")],
            alias = "",
            type  = "sync_char commands",
            short = "dump lock",
	    namespace = "sync_char",
            doc = """
Increments the value by adding 1 to it.
""")

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

def get_info(obj):
    # USER-TODO: Return something useful here
    return []

sim_commands.new_info_command('sync_char', get_info)

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

def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals",
             [("Attribute 'value'", SIM_get_attribute(obj, "disk_delay"))])]

sim_commands.new_status_command('sync_char', get_status)
Ejemplo n.º 38
0
import sim_commands


def get_info(obj):
    try:
        devices = obj.i2c_devices
    except:
        devices = "None"
    else:
        devices.sort()
        devices = ", ".join(
            map(lambda x: ("%s (0x%x)" % (x[0], x[1])), devices))
    return [(None, [('I2C devices', devices)])]


def get_status(obj):
    slave = obj.current_slave
    if not slave:
        slave = '<none>'
    state = [
        'idle', 'master transmit', 'master receive', 'slave transmit',
        'slave receive'
    ][obj.current_state]
    return [(None, [('Current slave', slave), ('Current state', state)])]


sim_commands.new_info_command("i2c-bus", get_info)
sim_commands.new_status_command("i2c-bus", get_status)
Ejemplo n.º 39
0
            + sim_commands.get_pci_info(obj))

sim_commands.new_info_command("sbbc-pci", get_info)

def get_status(obj):
    return ([("Registers",
              [("Interrupt Enable", "0x%x" % obj.interrupt_enable),
               ("Interrupt Status", "0x%x" % obj.interrupt_status),
               ("EPLD Interrupt", "0x%x" % obj.epld_interrupt),
               ("Irq Generation 0", "0x%x" % obj.irq_generation_0),
               ("Irq Generation 1", "0x%x" % obj.irq_generation_1)]),
             (None,
              [("Access info", iff(obj.access_info, "enabled", "disabled"))])]
            + sim_commands.get_pci_status(obj))

sim_commands.new_status_command("sbbc-pci", get_status)

sim_commands.new_pci_header_command("sbbc-pci", None)

#
# ----------------- access-debug -----------------
#

def access_info_cmd(obj):
    try:
        cur = obj.access_info
        obj.access_info = 1 - cur
        print "%sabling access info" % iff(cur == 0, "En", "Dis")
    except Exception, msg:
        print msg
    
Ejemplo n.º 40
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)
Ejemplo n.º 41
0
        obj.host_root = root
    else:
        print obj.host_root

new_command("root", root_cmd,
            [arg(filename_t(dirs=1, exist=1), "dir", "?", "")],
            namespace = "hostfs",
            type = "hostfs commands",
            short = "set or show the hostfs root directory",
            doc = """
Set the host directory that is visible to the simulated machine to
<arg>dir</arg>. If no directory is specified, the current root directory
is shown. Changes may not take effect until next the file system is
mounted.""", filename="/mp/simics-3.0/src/devices/hostfs/commands.py", linenumber="10")

def get_info(obj):
    return [(None,
             [("Host Root", obj.host_root)])]

sim_commands.new_info_command('hostfs', get_info)

def get_status(obj):
    if obj.version == (1L << 64) - 1:
        mount_stat = "no"
    else:
        mount_stat = "yes"
    return [(None,
             [("Mounted", mount_stat)])]

sim_commands.new_status_command('hostfs', get_status)
Ejemplo n.º 42
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)
Ejemplo n.º 43
0
##  Copyright 2003-2007 Virtutech AB

from cli import *
import sim_commands

device_name = get_last_loaded_module()

def get_info(obj):
    return [ (None,
              [ ("SCSI bus", obj.scsi_bus) ] ) ] + sim_commands.get_pci_info(obj)

def get_status(obj):
    return [] + sim_commands.get_pci_status(obj)

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)
Ejemplo n.º 44
0
from cli import *
import sim_commands


def get_sbd_info(obj):
    return []


sim_commands.new_info_command('simple-byte-dump', get_sbd_info)


def get_sbd_status(obj):
    return [(None, [("Output file: ", obj.filename)])]


sim_commands.new_status_command('simple-byte-dump', get_sbd_status)


def set_output_file_cmd(obj, filename):
    try:
        obj.filename = filename
    except Exception, msg:
        print "Could not set output filename: %s" % msg


new_command("set-output-file",
            set_output_file_cmd, [arg(str_t, "filename")],
            alias="",
            type="simple-byte-dump commands",
            short="sets file to output to",
            namespace="simple-byte-dump",
Ejemplo n.º 45
0
new_command("root",
            root_cmd, [arg(filename_t(dirs=1, exist=1), "dir", "?", "")],
            namespace="hostfs",
            type="hostfs commands",
            short="set or show the hostfs root directory",
            doc="""
Set the host directory that is visible to the simulated machine to
<arg>dir</arg>. If no directory is specified, the current root directory
is shown. Changes may not take effect until next the file system is
mounted.""",
            filename="/mp/simics-3.0/src/devices/hostfs/commands.py",
            linenumber="10")


def get_info(obj):
    return [(None, [("Host Root", obj.host_root)])]


sim_commands.new_info_command('hostfs', get_info)


def get_status(obj):
    if obj.version == (1L << 64) - 1:
        mount_stat = "no"
    else:
        mount_stat = "yes"
    return [(None, [("Mounted", mount_stat)])]


sim_commands.new_status_command('hostfs', get_status)
              for stid, ctid, method, ip, filename, blocks in obj.tftp_sessions])]

def get_status(obj):
    snds = get_sn_devs(obj)
    doc = []
    svc_list = map(lambda x: [x[0], iff(x[1], 'en', 'dis') + 'abled'],
                   obj.services.items())
    doc += [("Service Status", svc_list)]
    for snd in snds:
        if snd.link:
            doc += [("ARP table network %s" % snd.link.name,
                     snd.arp_table)]
    return doc + get_tftp_status(obj)

sim_commands.new_info_command("service-node", get_info)
sim_commands.new_status_command("service-node", get_status)

def get_host_name(node, ip):
    hosts = node.hosts
    for h in hosts:
        if h[1] == ip:
            if len(h[3]) > 0:
                return h[2] + "." + h[3]
            else:
                return h[2]
    else:
        return ""

def arp_cmd(obj, del_flag, del_ip):
    snds = get_sn_devs(obj)
    if del_flag:
Ejemplo n.º 47
0
        return tracker.iface.tracker.describe_trackee(tracker, tid)

    return [(None, [("Tracker", get_name(obj.object_data.tracker))]),
            ("Contexts for specific trackees",
             [(describe_tid(tid), get_name(ctx))
              for (tid, ctx) in obj.object_data.contexts.iteritems()]),
            ("Contexts for specific binaries",
             [(bin, get_name(ctx))
              for (bin, (ctx,
                         count)) in obj.object_data.exec_watch.iteritems()]),
            ("Default contexts",
             [(cpu.name, get_name(ctx))
              for (cpu, ctx) in obj.object_data.default_context.iteritems()])]


sim_commands.new_status_command(class_name, get_status)


def get_context(name):
    try:
        ctx = SIM_get_object(name)
    except:
        ctx = SIM_create_object("context", name, [])
    if ctx.classname == "context":
        return ctx
    else:
        raise SimExc_General("'%s' is not a context" % name)


def cmd_track_pid():
    def cmd(obj, pid, ctx, remove):
Ejemplo n.º 48
0
##  the Agreement.
##  
##  This Source Code and any derivatives thereof are provided on an "as
##  is" basis.  Virtutech makes no warranties with respect to the Source
##  Code or any derivatives thereof and disclaims all implied warranties,
##  including, without limitation, warranties of merchantability and
##  fitness for a particular purpose and non-infringement.

from cli import *
import sim_commands

try:
    # commands from scsi-disk
    from mod_scsi_disk_commands import *
    sim_commands.new_info_command("scsi-cdrom", get_info)
    sim_commands.new_status_command("scsi-cdrom", get_status)
except:
    print "Cannot include scsi-disk commands"

#
# -------------------- insert --------------------
#

def insert_cmd(obj, medium):
    try:
        obj.cd_media = medium
        print "Inserting medium '%s' in CD-ROM drive" % medium.name
    except Exception, msg:
        print "Error inserting medium: %s" % msg

new_command("insert", insert_cmd,
Ejemplo n.º 49
0
sim_commands.new_info_command("recorder", get_info)


def get_status(obj):
    if obj.recording:
        rec = "yes (file: %s)" % obj.out_file
    else:
        rec = "no"
    if obj.playback:
        play = "yes (file: %s)" % obj.in_file
    else:
        play = "no"
    return [(None, [("Recording", rec), ("Playing back", play)])]


sim_commands.new_status_command("recorder", get_status)

#
# -------------------- playback-start --------------------
#


def playback_start_cmd(obj, filename):
    try:
        SIM_set_attribute(obj, "in_file", filename)
        SIM_set_attribute(obj, "playback", 1)
        print "Playback from input file %s" % filename
    except Exception, msg:
        print "Error starting playback: %s" % msg

    if obj.classname == "scsi-disk":
        st += [
            ("Sectors read",
             "%d  ( = %d bytes)" % (obj.sectors_read, obj.sectors_read * 512)),
            ("Sectors written", "%d  ( = %d bytes)" %
             (obj.sectors_written, obj.sectors_written * 512))
        ]
    else:
        st += [("Sectors read", "%d  ( = %d bytes)" %
                (obj.sectors_read, obj.sectors_read * 2048)),
               ("Sectors written", "%d  ( = %d bytes)" %
                (obj.sectors_written, obj.sectors_written * 2048))]
    return [(None, st)]


# will only be called for scsi-disk itself
sim_commands.new_info_command("scsi-disk", get_info)
sim_commands.new_status_command("scsi-disk", get_status)

try:
    from sun_vtoc_commands import *
    create_sun_vtoc_commands("scsi-disk")
except:
    pass

try:
    from pc_disk_commands import *
    create_pc_partition_table_commands("scsi-disk")
except:
    pass