示例#1
0
def of_printer(dict, dep, filename):
    v0 = strings("name", dict, '""')
    v1 = strings("type", dict, '""')
    v2 = strings("compat", dict, '""')
    if v0 == '""' and v1 == '""' and v2 == '""':
        return
    lkddb.lkddb_add("of '%s %s %s' %s # %s" % (v0, v1, v2, dep, filename))
示例#2
0
def virtio_printer(dict, dep, filename):
    v0 = value("device", dict)
    v1 = value("vendor", dict)
    if v0 == 0 and v1 == 0:
        return
    v0 = str_value(v0, -1, 8)
    v1 = str_value(v1, 0xffffffff, 8)
    lkddb.lkddb_add("virtio '%s %s' %s # %s" % (v0, v1, dep, filename))
示例#3
0
def ap_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    if match & AP_DEVICE_ID_MATCH_DEVICE_TYPE:
        v0 = str_value(value("dev_type", dict), -1, 2)
    else:
        v0 = ".."
    lkddb.lkddb_add("ap '%s' %s # %s" % (v0, dep, filename))
示例#4
0
def parisc_printer(dict, dep, filename):
    v3 = value("sversion", dict)
    if v3 == 0:
        return
    v3 = str_value(v3, 0xffffffff, 8)
    v0 = str_value(value("hw_type", dict), 0xff, 2)
    v1 = str_value(value("hversion_rev", dict), 0xff, 2)
    v2 = str_value(value("hversion", dict), 0xffff, 4)
    lkddb.lkddb_add("parisc '%s %s %s %s' %s # %s" %
                    (v0, v1, v2, v3, dep, filename))
示例#5
0
def sdio_printer(dict, dep, filename):
    v0 = value("class", dict)
    v1 = value("vendor", dict)
    v2 = value("device", dict)
    if v0 == 0 and v1 == 0 and v2 == 0:
        return
    v0 = str_value(v0, -1, 2)
    v1 = str_value(v1, -1, 4)
    v2 = str_value(v2, -1, 4)
    lkddb.lkddb_add("sdio '%s %s %s' %s # %s" % (v0, v1, v2, dep, filename))
示例#6
0
def sbb_printer(dict, dep, filename):
    v0 = value("vendor", dict)
    v1 = value("coreid", dict)
    v2 = value("revision", dict)
    if v0 == 0 and v1 == 0 and v2 == 0:
        return
    v0 = str_value(v0, 0xffff, 4)
    v1 = str_value(v1, 0xffff, 4)
    v2 = str_value(v2, 0xff, 2)
    lkddb.lkddb_add("sbb '%s %s %s' %s # %s" % (v0, v1, v2, dep, filename))
示例#7
0
def serio_printer(dict, dep, filename):
    v0 = value("type", dict)
    v1 = value("proto", dict)
    if v0 == 0 and v1 == 0:
        return
    v0 = str_value(v0, 0xff, 2)
    v1 = str_value(v1, 0xff, 2)
    v2 = str_value(value("id", dict), 0xff, 2)
    v3 = str_value(value("extra", dict), 0xff, 2)
    lkddb.lkddb_add("serio '%s %s %s %s' %s # %s" %
                    (v0, v1, v2, v3, dep, filename))
示例#8
0
def platform_printer(dict, dep, filename):
    if not dict.has_key("driver"):
        return
    block = dict["driver"]
    line = lkddb.split_structs(block)[0]
    driver_dict = lkddb.parse_struct(None,
                                     device_driver_fields,
                                     line,
                                     None,
                                     filename,
                                     ret=True)
    v0 = strings("name", driver_dict, '""')
    lkddb.lkddb_add("platform %s %s # %s" % (v0, dep, filename))
示例#9
0
def input_printer(dict, dep, filename):
    match = value("flags", dict)
    if not match:
        return
    v0 = "...."
    v1 = "...."
    v2 = "...."
    v3 = "...."
    if match & INPUT_DEVICE_ID_MATCH_BUS:
        v0 = str_value(value("bustype", dict), -1, 4)
    if match & INPUT_DEVICE_ID_MATCH_VENDOR:
        v1 = str_value(value("vendor", dict), -1, 4)
    if match & INPUT_DEVICE_ID_MATCH_PRODUCT:
        v2 = str_value(value("product", dict), -1, 4)
    if match & INPUT_DEVICE_ID_MATCH_VERSION:
        v3 = str_value(value("version", dict), -1, 4)

    b1 = 0xff
    b2 = 0xffff
    b3 = 0xff
    b4 = 0xff
    b5 = 0xff
    b6 = 0xff
    b7 = 0xff
    b8 = 0xff
    b9 = 0xff
    if match & INPUT_DEVICE_ID_MATCH_EVBIT:
        b1 = value("evbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_KEYBIT:
        b2 = value("keybit", dict)
    if match & INPUT_DEVICE_ID_MATCH_RELBIT:
        b3 = value("relbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_ABSBIT:
        b4 = value("absbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_MSCIT:
        b5 = value("mscbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_LEDBIT:
        b6 = value("ledbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_SNDBIT:
        b7 = value("sndbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_FFBIT:
        b8 = value("ffbit", dict)
    if match & INPUT_DEVICE_ID_MATCH_SWBIT:
        b9 = value("swbit", dict)
    lkddb.lkddb_add(
        "input '%s %s %s %s' %s %s %s %s %s %s %s %s %s %s # %s" %
        (v0, v1, v2, v3, b1, b2, b3, b4, b5, b6, b7, b8, b9, dep, filename))
示例#10
0
def parse_kconfig(kerneldir, filename):
    f = open(os.path.join(kerneldir, filename))
    src = f.read()
    f.close()
    for conf, descr in tristate_re.findall(src):
        conf = "CONFIG_" + conf
        if modules.has_key(conf):
            for name in modules[conf].split():
                if not name.endswith(".o"):
                    if name[-1] == "/":
                        lkddb.log("Kconfig: name %s does'n ends with '.o (%s from %s)" % (
                            name, conf, filename))
                    continue
                lkddb.lkddb_add('module %s "%s" %s # %s' % (
                    name[:-2], descr, conf, filename))
        else:
            lkddb.log("kconfig: could not find the module obj of %s from %s" % (conf, filename))
示例#11
0
def ccw_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    v0 = "...."
    v1 = ".."
    v2 = "...."
    v3 = ".."
    if match & CCW_DEVICE_ID_MATCH_CU_TYPE:
        v0 = str_value(value("cu_type", dict), -1, 4)
    if match & CCW_DEVICE_ID_MATCH_CU_MODEL:
        v1 = str_value(value("cu_model", dict), -1, 2)
    if match & CCW_DEVICE_ID_MATCH_DEVICE_TYPE:
        v2 = str_value(value("dev_type", dict), -1, 4)
    if match & CCW_DEVICE_ID_MATCH_DEVICE_MODEL:
        v3 = str_value(value("dev_model", dict), -1, 2)
    lkddb.lkddb_add("ccw '%s %s %s %s' %s # %s" %
                    (v0, v1, v2, v3, dep, filename))
示例#12
0
def ieee1394_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    v0 = "......"
    v1 = "......"
    v2 = "......"
    v3 = "......"
    if match & IEEE1394_MATCH_VENDOR_ID:
        v0 = str_value(value("vendor_id", dict), -1, 6)
    if match & IEEE1394_MATCH_MODEL_ID:
        v1 = str_value(value("model_id", dict), -1, 6)
    if match & IEEE1394_MATCH_SPECIFIER_ID:
        v2 = str_value(value("specifier_id", dict), -1, 6)
    if match & IEEE1394_MATCH_VERSION:
        v3 = str_value(value("version", dict), -1, 6)
    lkddb.lkddb_add("ieee1394 '%s %s %s %s' %s # %s" %
                    (v0, v1, v2, v3, dep, filename))
示例#13
0
def pcmcia_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    v0 = "...."
    v1 = "...."
    v2 = ".."
    v3 = ".."
    v4 = ".."
    if match & PCMCIA_DEV_ID_MATCH_MANF_ID:
        v0 = str_value(value("manf_id", dict), -1, 4)
    if match & PCMCIA_DEV_ID_MATCH_CARD_ID:
        v1 = str_value(value("card_id", dict), -1, 4)
    if match & PCMCIA_DEV_ID_MATCH_FUNC_ID:
        v2 = str_value(value("func_id", dict), -1, 2)
    if match & PCMCIA_DEV_ID_MATCH_FUNCTION:
        v3 = str_value(value("function", dict), -1, 2)
    if match & PCMCIA_DEV_ID_MATCH_DEVICE_NO:
        v4 = str_value(value("device_no", dict), -1, 2)
    s1 = '""'
    s2 = '""'
    s3 = '""'
    s4 = '""'
    if match & (PCMCIA_DEV_ID_MATCH_PROD_ID1 | PCMCIA_DEV_ID_MATCH_PROD_ID2
                | PCMCIA_DEV_ID_MATCH_PROD_ID3 | PCMCIA_DEV_ID_MATCH_PROD_ID4):
        prods = lkddb.nullstring_re.sub('""', dict["prod_id"])
        line = lkddb.split_structs(prods)[0]
        dict_prod = lkddb.parse_struct(None,
                                       lkddb.unwind_array,
                                       line,
                                       None,
                                       filename,
                                       ret=True)
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID1:
            s1 = strings("n1", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID2:
            s2 = strings("n2", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID3:
            s3 = strings("n3", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID4:
            s4 = strings("n4", dict_prod, '""')
    lkddb.lkddb_add("pcmcia '%s %s %s %s %s' %s %s %s %s %s # %s" %
                    (v0, v1, v2, v3, v4, s1, s2, s3, s4, dep, filename))
示例#14
0
def pci_printer(dict, dep, filename):
    v0 = value("vendor", dict)
    v1 = value("device", dict)
    cl = value("class", dict)
    if v0 == 0 and v1 == 0 and cl == 0:
        return
    v2 = value("subvendor", dict)
    v3 = value("subdevice", dict)
    cm = value("class_mask", dict)

    v0 = str_value(v0, -1, 4)
    v1 = str_value(v1, -1, 4)
    v2 = str_value(v2, -1, 4)
    v3 = str_value(v3, -1, 4)
    cl = str_value(cl, -1, 6).replace("......",
                                      "ffffff")  ### really needed ?????????
    cm = str_value(cm, -1, 6).replace("......", "ffffff")
    v4 = mask(cl, cm, 6)
    lkddb.lkddb_add("pci '%s %s %s %s %s' %s # %s" %
                    (v0, v1, v2, v3, v4, dep, filename))
示例#15
0
def pnp_card_printer(dict, dep, filename):
    v0 = strings("id", dict, '""')
    if v0 == '""':
        return
    s = [
        '""',
    ] * 8
    prods = lkddb.nullstring_re.sub('""', dict["devs"])
    line = lkddb.split_structs(prods)[0]
    dict_prod = lkddb.parse_struct(None,
                                   lkddb.unwind_array,
                                   line,
                                   None,
                                   filename,
                                   ret=True)
    for i in range(8):
        s[i] = strings("n%u" % (i + 1), dict_prod, '""')
    lkddb.lkddb_add(
        "pnp_card %s %s %s %s %s %s %s %s %s %s # %s" %
        (v0, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], dep, filename))
示例#16
0
def usb_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    v0 = "...."
    v1 = "...."
    v2 = 0
    v3 = 65535
    v4 = ".."
    v5 = ".."
    v6 = ".."
    v7 = ".."
    v8 = ".."
    v9 = ".."
    if match & USB_DEVICE_ID_MATCH_VENDOR:
        v0 = str_value(value("idVendor", dict), -1, 4)
    if match & USB_DEVICE_ID_MATCH_PRODUCT:
        v1 = str_value(value("idProduct", dict), -1, 4)
    if match & USB_DEVICE_ID_MATCH_DEV_LO:
        v2 = str_value(value("bcdDevice_lo", dict), -1, 4)
    if match & USB_DEVICE_ID_MATCH_DEV_HI:
        v3 = str_value(value("bcdDevice_hi", dict), -1, 4)
    if match & USB_DEVICE_ID_MATCH_DEV_CLASS:
        v4 = str_value(value("bDeviceClass", dict), -1, 2)
    if match & USB_DEVICE_ID_MATCH_DEV_SUBCLASS:
        v5 = str_value(value("bDeviceSubClass", dict), -1, 2)
    if match & USB_DEVICE_ID_MATCH_DEV_PROTOCOL:
        v6 = str_value(value("bDeviceProtocol", dict), -1, 2)
    if match & USB_DEVICE_ID_MATCH_INT_CLASS:
        v7 = str_value(value("bInterfaceClass", dict), -1, 2)
    if match & USB_DEVICE_ID_MATCH_INT_SUBCLASS:
        v8 = str_value(value("bInterfaceSubClass", dict), -1, 2)
    if match & USB_DEVICE_ID_MATCH_INT_PROTOCOL:
        v9 = str_value(value("bInterfaceProtocol", dict), -1, 2)
    lkddb.lkddb_add("usb '%s %s %s%s%s %s%s%s ....' %s %s %s # %s" %
                    (v0, v1, v4, v5, v6, v7, v8, v9, v2, v3, dep, filename))
示例#17
0
def eisa_printer(dict, dep, filename):
    v0 = strings("sig", dict, '""')
    if v0 == '""':
        return
    lkddb.lkddb_add("eisa %s %s # %s" % (v0, dep, filename))
示例#18
0
print "doing the directory %s and the sub-dirs: %s" % (
	kerneldir, ", ".join(dirs) )


header = "### Linux Kernel Driver DataBase. See http://cateee.net/lkddb/"


skeleton_files = frozenset(("drivers/video/skeletonfb.c", "drivers/net/isa-skeleton.c",
        "drivers/net/pci-skeleton.c", "drivers/pci/hotplug/pcihp_skeleton.c",
        "drivers/usb/usb-skeleton.c",
   # these are #included in other files:
        "drivers/usb/host/ohci-pci.c"
)
)

lkddb.lkddb_add(kernel_info(kerneldir))


for root_full, d_, files in os.walk(os.path.join(kerneldir, "include")):
    if root_full.endswith("/asm")  or  root_full.endswith("/asm-um"):
	continue
    dir = root_full[kerdir_len:]
    if dir.startswith("include/config")  or  dir.startswith("include/asm/"):
	continue
    if dir.startswith("include/asm-")  and  dir != "include/asm-generic":
	p = dir.split("/")
	if len(p) == 2:
	    dir_i = "include/asm"
	elif p[2].startswith("arch-"):
	    dir_i = "include/asm/arch" + "/".join(p[3:])
	else:
示例#19
0
def fs_printer(dict, dep, filename):
    v0 = strings("name", dict, '""')
    lkddb.lkddb_add("fs %s %s # %s" % (v0, dep, filename))
示例#20
0
def i2c_snd_printer(dict, dep, filename):
    if not dict.has_key("name"):
        return
    v0 = strings("name", dict, '""')
    lkddb.lkddb_add("i2c %s %s # %s" % (v0, dep, filename))
示例#21
0
def pnp_printer(dict, dep, filename):
    v0 = strings("id", dict, '""')
    if v0 == '""':
        return
    lkddb.lkddb_add("pnp %s %s # %s" % (v0, dep, filename))
示例#22
0
def vio_printer(dict, dep, filename):
    v0 = strings("name", dict, '""')
    v1 = strings("compat", dict, '""')
    if v0 == '""' and v1 == '""':
        return
    lkddb.lkddb_add("vio %s %s %s # %s" % (v0, v1, dep, filename))