From 713d3793267c69fa671d83e08251cc22cb423e27 Mon Sep 17 00:00:00 2001 From: Per Olofsson Date: Sun, 23 Dec 2007 22:01:01 +0100 Subject: [PATCH 1/1] initialize upstream branch --- ChangeLog | 9 + Makefile | 32 +++ lspnp.c | 735 +++++++++++++++++++++++++++++++++++++++++++++++++ lspnp.man | 59 ++++ pnp.ids | 591 +++++++++++++++++++++++++++++++++++++++ pnp_resource.h | 148 ++++++++++ setpnp.c | 303 ++++++++++++++++++++ setpnp.man | 70 +++++ 8 files changed, 1947 insertions(+) create mode 100644 ChangeLog create mode 100644 Makefile create mode 100644 lspnp.c create mode 100644 lspnp.man create mode 100644 pnp.ids create mode 100644 pnp_resource.h create mode 100644 setpnp.c create mode 100644 setpnp.man diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..9a09e69 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,9 @@ +Thu Jul 6 17:05:23 MDT 2006 Bjorn Helgaas + + * Released 0.1. + + * Extracted lspnp and setpnp from pcmcia-cs-3.2.5. Added support for + sysfs, so it works with PNPACPI, PNPBIOS, and ISAPNP (previously it + worked only with PNPBIOS). + + * Removed pcmcia-cs Mozilla license, so this package is GPL v2 only. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..54e25f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +CFLAGS = -O2 -Wall -Wstrict-prototypes + +VERSION=0.1 +DATE="July 6, 2006" + +all: lspnp lspnp.8 setpnp setpnp.8 + +clean: + rm -f *.o *.8 lspnp setpnp + +%.8: %.man + M=`echo $(DATE)`; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pnputils-$(VERSION)/;" + +install: all + install -m 755 lspnp setpnp /sbin + install -m 644 lspnp.8 setpnp.8 /usr/share/man/man8 + install -m 644 pnp.ids /usr/share/misc + +REL=pnputils-$(VERSION) +DISTTMP=/tmp/pnputils-dist + +dist: clean + rm -rf $(DISTTMP) + mkdir $(DISTTMP) + cp -a . $(DISTTMP)/$(REL) + cd $(DISTTMP) ; tar czvvf /tmp/$(REL).tar.gz $(REL) + rm -rf $(DISTTMP) + +.PHONY: all clean install dist + +lspnp.o: lspnp.c pnp_resource.h +setpnp.o: setpnp.c pnp_resource.h diff --git a/lspnp.c b/lspnp.c new file mode 100644 index 0000000..d23c835 --- /dev/null +++ b/lspnp.c @@ -0,0 +1,735 @@ +/*====================================================================== + + A utility for dumping resource information for PnP devices + + lspnp.c 1.9 2006/07/06 15:27:55 MDT + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + + (c) Copyright 2006 Hewlett-Packard Development Company, L.P. + Bjorn Helgaas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + Usage: lspnp [-b] [-v[v]] [device #] + +======================================================================*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pnp_resource.h" + +static int verbose = 0, boot = 0; + +static struct { + __u8 base; + char * name; +} base_type[] = { + { 1, "mass storage device" }, + { 2, "network interface controller" }, + { 3, "display controller" }, + { 4, "multimedia controller" }, + { 5, "memory controller" }, + { 6, "bridge controller" }, + { 7, "communications device" }, + { 8, "system peripheral" }, + { 9, "input device" }, + { 10, "service processor" } +}; +#define NBASE (sizeof(base_type)/sizeof(base_type[0])) + +static struct { + __u8 base, sub; + char * name; +} sub_type[] = { + { 1, 0, "SCSI" }, + { 1, 1, "IDE" }, + { 1, 2, "floppy" }, + { 1, 3, "IPI" }, + { 2, 0, "ethernet" }, + { 2, 1, "token ring" }, + { 2, 2, "FDDI" }, + { 3, 0, "VGA" }, + { 3, 1, "SVGA" }, + { 3, 2, "XGA" }, + { 4, 0, "video" }, + { 4, 1, "audio" }, + { 5, 0, "RAM" }, + { 5, 1, "flash" }, + { 6, 0, "host processor" }, + { 6, 1, "ISA" }, + { 6, 2, "EISA" }, + { 6, 3, "MicroChannel" }, + { 6, 4, "PCI" }, + { 6, 5, "PCMCIA" }, + { 6, 6, "VME" }, + { 7, 0, "RS-232" }, + { 7, 1, "AT parallel port" }, + { 8, 0, "programmable interrupt controller" }, + { 8, 1, "DMA controller" }, + { 8, 2, "system timer" }, + { 8, 3, "real time clock" }, + { 8, 4, "L2 cache" }, + { 8, 5, "NVRAM" }, + { 8, 6, "power management" }, + { 8, 7, "CMOS" }, + { 8, 8, "operator panel" }, + { 9, 0, "keyboard" }, + { 9, 1, "digitizer" }, + { 9, 2, "mouse" }, + { 9, 3, "tablet" }, + { 10, 0, "general memory" } +}; +#define NSUB (sizeof(sub_type)/sizeof(sub_type[0])) + +static struct eisa_id { + char id[8]; + char * name; + struct eisa_id * next; +} *eisa_id = NULL; + +#define swap16(n) ((((n)&0x00ff)<<8) | (((n)&0xff00)>>8)) +#define swap32(n) \ + ((((n)&0xff000000)>>24) | (((n)&0x00ff0000)>>8) | \ + (((n)&0x0000ff00)<<8) | (((n)&0x000000ff)<<24)) + +#if (__BYTE_ORDER == _BIG_ENDIAN) +#define flip16(n) swap16(n) +#define flip32(n) swap32(n) +#else +#define flip16(n) (n) +#define flip32(n) (n) +#endif + +/*====================================================================*/ + +#define HEX(id,a) hex[((id)>>a) & 15] +#define CHAR(id,a) (0x40 + (((id)>>a) & 31)) + +static char *eisa_str(__u32 id) +{ + const char *hex = "0123456789abcdef"; + static char str[8]; + id = swap32(id); + str[0] = CHAR(id, 26); + str[1] = CHAR(id, 21); + str[2] = CHAR(id,16); + str[3] = HEX(id, 12); + str[4] = HEX(id, 8); + str[5] = HEX(id, 4); + str[6] = HEX(id, 0); + str[7] = '\0'; + return str; +} + +static void load_ids(void) +{ + char s[133], *t; + int n; + struct eisa_id *id; + FILE *f = fopen("/usr/share/misc/pnp.ids", "r"); + + if (f == NULL) + return; + while (fgets(s, sizeof(s), f)) { + if ((strlen(s) < 9) || + !(isupper(s[0]) && isupper(s[1]) && isupper(s[2]) && + isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && + isxdigit(s[6]))) continue; + id = malloc(sizeof(struct eisa_id)); + strncpy(id->id, s, 7); + for (n = 3; n < 7; n++) + id->id[n] = tolower(id->id[n]); + id->id[7] = '\0'; + s[strlen(s)-1] = '\0'; + for (t = s+7; isspace(*t); t++) ; + id->name = strdup(t); + id->next = eisa_id; eisa_id = id; + } + fclose(f); +} + +static void dump_flags(int flags) +{ + printf(" flags:"); + if (!flags) + printf(" none"); + if (flags & 0x0001) + printf(" [no disable]"); + if (flags & 0x0002) + printf(" [no config]"); + if (flags & 0x0004) + printf(" [output]"); + if (flags & 0x0008) + printf(" [input]"); + if (flags & 0x0010) + printf(" [bootable]"); + if (flags & 0x0020) + printf(" [dock]"); + if (flags & 0x0040) + printf(" [removable]"); + if ((flags & 0x0180) == 0x0000) + printf(" [static]"); + if ((flags & 0x0180) == 0x0080) + printf(" [dynamic]"); + if ((flags & 0x0180) == 0x0180) + printf(" [dynamic only]"); + printf("\n"); +} + +static void dump_class(int t1, int t2) +{ + int i; + for (i = 0; i < NBASE; i++) + if (t1 == base_type[i].base) break; + printf("%s: ", (i < NBASE) ? base_type[i].name : "reserved"); + for (i = 0; i < NSUB; i++) + if ((t1 == sub_type[i].base) && (t2 == sub_type[i].sub)) + break; + printf("%s", (i < NSUB) ? sub_type[i].name : "other"); +} + +/* + Small resource tags +*/ + +static void dump_version(union pnp_small_resource *r) +{ + printf("\tPnP version %d.%d, vendor version %d.%d\n", + r->version.pnp>>4, r->version.pnp & 0x0f, + r->version.vendor>>4, r->version.vendor & 0x0f); +} + +static void dump_ldid(union pnp_small_resource *r, int sz) +{ + printf("\tlogical ID %s", eisa_str(r->ldid.id)); + if (verbose > 1) { + if (r->ldid.flag0 & PNP_RES_LDID_BOOT) + printf(" [boot]"); + } + printf("\n"); +} + +static void dump_gdid(union pnp_small_resource *r) +{ + struct eisa_id *eid; + char *eis = eisa_str(r->gdid.id); + + printf("\t%s", eis); + for (eid = eisa_id; eid; eid = eid->next) + if (strcmp(eis, eid->id) == 0) break; + if (eid) + printf(" %s\n", eid->name); + else + printf("\n"); +} + +static void dump_irq(union pnp_small_resource *r, int sz) +{ + int mask = flip16(r->irq.mask); + printf("\tirq "); + if (!mask) { + printf("disabled"); + } else if (mask & (mask-1)) { + printf("mask 0x%04x", mask); + } else { + printf("%d", ffs(mask)-1); + } + if (verbose > 1) { + if (sz == 3) { + if (r->irq.info & PNP_RES_IRQ_HIGH_EDGE) + printf(" [high edge]"); + if (r->irq.info & PNP_RES_IRQ_LOW_EDGE) + printf(" [low edge]"); + if (r->irq.info & PNP_RES_IRQ_HIGH_LEVEL) + printf(" [high level]"); + if (r->irq.info & PNP_RES_IRQ_LOW_LEVEL) + printf(" [low level]"); + } else { + printf(" [high edge]"); + } + } + printf("\n"); +} + +static void dump_dma(union pnp_small_resource *r) +{ + int mask = r->dma.mask; + printf("\tdma "); + if (!mask) { + printf("disabled"); + } else if (mask & (mask-1)) { + printf("mask 0x%04x", mask); + } else { + printf("%d", ffs(mask)-1); + } + if (verbose > 1) { + switch (r->dma.info & PNP_RES_DMA_WIDTH_MASK) { + case PNP_RES_DMA_WIDTH_8: + printf(" [8 bit]"); break; + case PNP_RES_DMA_WIDTH_8_16: + printf(" [8/16 bit]"); break; + case PNP_RES_DMA_WIDTH_16: + printf(" [16 bit]"); break; + } + if (r->dma.info & PNP_RES_DMA_BUSMASTER) + printf(" [master]"); + if (r->dma.info & PNP_RES_DMA_COUNT_BYTE) + printf(" [count byte]"); + if (r->dma.info & PNP_RES_DMA_COUNT_WORD) + printf(" [count word]"); + switch (r->dma.info & PNP_RES_DMA_SPEED_MASK) { + case PNP_RES_DMA_SPEED_COMPAT: printf(" [compat]"); break; + case PNP_RES_DMA_SPEED_TYPEA: printf(" [type A]"); break; + case PNP_RES_DMA_SPEED_TYPEB: printf(" [type B]"); break; + case PNP_RES_DMA_SPEED_TYPEF: printf(" [type F]"); break; + } + } + printf("\n"); +} + +static void dump_dep_start(union pnp_small_resource *r, int sz) +{ + printf("\t[start dep fn"); + if (sz) { + printf(": priority: "); + switch (r->dep_start.priority) { + case PNP_RES_CONFIG_GOOD: + printf("good"); break; + case PNP_RES_CONFIG_ACCEPTABLE: + printf("acceptable"); break; + case PNP_RES_CONFIG_SUBOPTIMAL: + printf("suboptimal"); break; + default: + printf("reserved"); break; + } + } + printf("]\n"); +} + +static void dump_dep_end(union pnp_small_resource *r) +{ + printf("\t[end dep fn]\n"); +} + +static void dump_io(union pnp_small_resource *r) +{ + int min = flip16(r->io.min), max = flip16(r->io.max); + printf("\tio "); + if (r->io.len == 0) + printf("disabled"); + else if (min == max) + printf("0x%04x-0x%04x", min, min+r->io.len-1); + else + printf("base 0x%04x-0x%04x align 0x%02x len 0x%02x", + min, max, r->io.align, r->io.len); + if (verbose > 1) { + if (r->io.info & PNP_RES_IO_DECODE_16) + printf(" [16-bit decode]"); + } + printf("\n"); +} + +static void dump_io_fixed(union pnp_small_resource *r) +{ + int base = flip16(r->io_fixed.base); + printf("\tio "); + if (r->io_fixed.len == 0) + printf("disabled\n"); + else + printf("0x%04x-0x%04x\n", base, base+r->io_fixed.len-1); +} + +/* + Large resource tags +*/ + +static void dump_mem_info(__u8 info) +{ + switch (info & PNP_RES_MEM_WIDTH_MASK) { + case PNP_RES_MEM_WIDTH_8: + printf(" [8 bit]"); break; + case PNP_RES_MEM_WIDTH_16: + printf(" [16 bit]"); break; + case PNP_RES_MEM_WIDTH_8_16: + printf(" [8/16 bit]"); break; + case PNP_RES_MEM_WIDTH_32: + printf(" [32 bit]"); break; + } + printf((info & PNP_RES_MEM_WRITEABLE) ? " [r/w]" : " [r/o]"); + if (info & PNP_RES_MEM_CACHEABLE) + printf(" [cacheable]"); + if (info & PNP_RES_MEM_HIGH_ADDRESS) + printf(" [high]"); + if (info & PNP_RES_MEM_SHADOWABLE) + printf(" [shadow]"); + if (info & PNP_RES_MEM_EXPANSION_ROM) + printf(" [rom]"); +} + +static void dump_ansi(union pnp_large_resource *r, int sz) +{ + printf("\tidentifier '%.*s'\n", sz, r->ansi.str); +} + +static void dump_mem(union pnp_large_resource *r) +{ + int min = flip16(r->mem.min) << 8; + int max = flip16(r->mem.max) << 8; + int align = flip16(r->mem.align), len = flip16(r->mem.len); + printf("\tmem "); + if (len == 0) + printf("disabled"); + else if (min == max) + printf("0x%06x-0x%06x", min, min+len-1); + else + printf("base 0x%06x-%06x, align 0x%04x, len 0x%06x", + min, max, align ? align : 0x10000, len<<8); + if (verbose > 1) + dump_mem_info(r->mem.info); + printf("\n"); +} + +static void dump_mem32(union pnp_large_resource *r) +{ + u_int min = flip32(r->mem32.min), max = flip32(r->mem32.max); + u_int align = flip32(r->mem32.align), len = flip32(r->mem32.len); + printf("\tmem "); + if (len == 0) + printf("disabled"); + else if (min == max) + printf("0x%08x-0x%08x", min, min+len-1); + else + printf("\tmem base 0x%08x-0x%08x align 0x%06x len 0x%06x", + min, max, align, len); + if (verbose > 1) + dump_mem_info(r->mem32.info); + printf("\n"); +} + +static void dump_mem32_fixed(union pnp_large_resource *r) +{ + u_int base = flip32(r->mem32_fixed.base); + u_int len = flip32(r->mem32_fixed.len); + printf("\tmem "); + if (len == 0) + printf("disabled"); + else + printf("0x%08x-0x%08x", base, base+len-1); + if (verbose > 1) + dump_mem_info(r->mem32_fixed.info); + printf("\n"); +} + +/*====================================================================*/ + +static u_char *dump_chain(u_char *buf, int nr) +{ + union pnp_resource *p = (union pnp_resource *)buf; + int tag = 0, sz; + + while (((u_char *)p < buf+nr) && (tag != PNP_RES_SMTAG_END)) { + if (p->lg.tag & PNP_RES_LARGE_ITEM) { + union pnp_large_resource *r = &p->lg.d; + tag = p->lg.tag & ~PNP_RES_LARGE_ITEM; + sz = flip16(p->lg.sz) + 2; + switch (tag) { + case PNP_RES_LGTAG_MEM: + dump_mem(r); break; + case PNP_RES_LGTAG_ID_ANSI: + dump_ansi(r, sz-2); break; + case PNP_RES_LGTAG_ID_UNICODE: + /* dump_unicode(r); */ break; + case PNP_RES_LGTAG_MEM32: + dump_mem32(r); break; + case PNP_RES_LGTAG_MEM32_FIXED: + dump_mem32_fixed(r); break; + } + } else { + union pnp_small_resource *r = &p->sm.d; + tag = (p->sm.tag >> 3); sz = (p->sm.tag & 7); + switch (tag) { + case PNP_RES_SMTAG_VERSION: + dump_version(r); break; + case PNP_RES_SMTAG_LDID: + dump_ldid(r, sz); break; + case PNP_RES_SMTAG_CDID: + dump_gdid(r); break; + case PNP_RES_SMTAG_IRQ: + dump_irq(r, sz); break; + case PNP_RES_SMTAG_DMA: + dump_dma(r); break; + case PNP_RES_SMTAG_DEP_START: + dump_dep_start(r, sz); break; + case PNP_RES_SMTAG_DEP_END: + dump_dep_end(r); break; + case PNP_RES_SMTAG_IO: + dump_io(r); break; + case PNP_RES_SMTAG_IO_FIXED: + dump_io_fixed(r); break; + } + } + p = (union pnp_resource *) ((u_char *)p + sz + 1); + } + return (u_char *)p; +} + +static void dump_resources(char *name) +{ + char fn[40]; + u_char buf[4096], *p; + int fd, nr; + + sprintf(fn, "/proc/bus/pnp/%s%s", (boot ? "boot/" : ""), name); + fd = open(fn, O_RDONLY); + nr = read(fd, buf, sizeof(buf)); + close(fd); + if (nr > 0) { + if (verbose > 1) + printf(" allocated resources:\n"); + p = dump_chain(buf, nr); + if (verbose > 1) { + if (p+4 < buf+nr) { + printf(" possible resources:\n"); + } + p = dump_chain(p, nr); + if (p+2 < buf+nr) { + printf(" compatible devices:\n"); + p = dump_chain(p, nr); + } + } + } +} + +static int match_device(char *name, char *match) +{ + char *dev; + + if (name[0] == '.') + return 0; + + /* no filter or exact match */ + if (!match || !strcmp(name, match)) + return 1; + + /* let "01" match "xx:01" or "01" */ + dev = strrchr(name, ':'); + if (dev) + dev++; + else + dev = name; + if (!strcmp(dev, match)) + return 1; + + /* let "1" match "xx:01" or "01" */ + while (*dev == '0') + dev++; + if (*dev == '\0') /* saw "00", back up to "0" */ + dev--; + if (!strcmp(dev, match)) + return 1; + + return 0; +} + +#define SYSFS_PATH "/sys/bus/pnp/devices" + +static void sysfs_dump_resources(char *name) +{ + FILE *file; + char buf[256], *nl; + int first; + struct eisa_id *eid; + + sprintf(buf, "%s/%s/resources", SYSFS_PATH, name); + file = fopen(buf, "r"); + if (!file) + return; + first = 1; + fgets(buf, sizeof(buf), file); + printf(" %s", buf); /* "state =" */ + while (fgets(buf, sizeof(buf), file)) { + if (first && verbose > 1) { + printf(" allocated resources:\n"); + first = 0; + } + printf("\t%s", buf); + } + fclose(file); + + if (verbose < 2) + return; + + sprintf(buf, "%s/%s/options", SYSFS_PATH, name); + file = fopen(buf, "r"); + if (!file) + return; + first = 1; + while (fgets(buf, sizeof(buf), file)) { + if (first) { + printf(" possible resources:\n"); + first = 0; + } + printf("\t%s", buf); + } + fclose(file); + + sprintf(buf, "%s/%s/id", SYSFS_PATH, name); + file = fopen(buf, "r"); + if (!file) + return; + first = 1; + fgets(buf, sizeof(buf), file); /* skip first one */ + while (fgets(buf, sizeof(buf), file)) { + if (first) { + printf(" compatible devices:\n"); + first = 0; + } + nl = strchr(buf, '\n'); + if (nl) + *nl = '\0'; + for (eid = eisa_id; eid; eid = eid->next) + if (strcmp(buf, eid->id) == 0) break; + printf("\t%s %s\n", buf, eid ? eid->name : "(unknown)"); + } + fclose(file); +} + +static char *sysfs_get_string(char *name, char *object) +{ + int fd, len; + char *buf, *nl; + + buf = malloc(256); + if (!buf) + return 0; + sprintf(buf, "%s/%s/%s", SYSFS_PATH, name, object); + fd = open(buf, O_RDONLY); + if (fd < 0) + return 0; + len = read(fd, buf, 256); + close(fd); + nl = strchr(buf, '\n'); + if (nl) + *nl = '\0'; + return buf; +} + +static int sysfs_dump_basic(char *match) +{ + struct dirent **namelist; + char *name, *eis; + struct eisa_id *eid; + int i, n; + + n = scandir(SYSFS_PATH, &namelist, 0, alphasort); + if (n < 0) + return -1; + + for (i = 0; i < n; i++) { + name = namelist[i]->d_name; + if (match_device(name, match)) { + eis = sysfs_get_string(name, "id"); + for (eid = eisa_id; eid; eid = eid->next) + if (strcmp(eis, eid->id) == 0) break; + printf("%s %s %s\n", name, eis, eid ? eid->name : "(unknown)"); + if (verbose) { + sysfs_dump_resources(name); + if (!match) printf("\n"); + } + free(eis); + } + + free(namelist[i]); + } + free(namelist); + return 0; +} + +static int dump_basic(char *match) +{ + int id, t1, t2, t3, flags; + struct eisa_id *eid; + char name[4], *eis, buf[64]; + FILE *f; + + if (sysfs_dump_basic(match) == 0) + return 0; + + f = fopen("/proc/bus/pnp/devices", "r"); + if (f == NULL) { + fprintf(stderr, "lspnp: neither %s nor /proc/bus/pnp is available\n", + SYSFS_PATH); + return -1; + } + while (fgets(buf, 63, f) != NULL) { + sscanf(buf, "%2s %x %x:%x:%x %x", name, &id, &t1, &t2, &t3, &flags); + if (!match_device(name, match)) + continue; + eis = eisa_str(id); + printf("%s %7s ", name, eis); + for (eid = eisa_id; eid; eid = eid->next) + if (strcmp(eis, eid->id) == 0) break; + if (eid) + printf("%s", eid->name); + else + dump_class(t1, t2); + printf("\n"); + if (verbose > 1) + dump_flags(flags); + if (verbose) { + dump_resources(name); + if (!match) printf("\n"); + } + } + fclose(f); + return 0; +} + +/*====================================================================*/ + +void usage(char *name) +{ + fprintf(stderr, "usage: %s [-b] [-v[v]] [device #]\n", name); + exit(EXIT_FAILURE); +} + +int main(int argc, char *argv[]) +{ + int optch, errflg = 0; + + while ((optch = getopt(argc, argv, "bv")) != -1) { + switch (optch) { + case 'b': + boot++; break; + case 'v': + verbose++; break; + default: + errflg = 1; break; + } + } + if (errflg) + usage(argv[0]); + load_ids(); + if (optind < argc) { + while (optind < argc) { + if (dump_basic(argv[optind]) != 0) + return EXIT_FAILURE; + optind++; + } + return EXIT_SUCCESS; + } + return dump_basic(NULL); +} diff --git a/lspnp.man b/lspnp.man new file mode 100644 index 0000000..3078aeb --- /dev/null +++ b/lspnp.man @@ -0,0 +1,59 @@ +.\" Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net +.\" (c) Copyright 2006 Hewlett-Packard Development Company, L.P. +.\" Bjorn Helgaas +.\" +.TH lspnp 8 "@TODAY@" "@VERSION@" "Linux Plug and Play Utilities" +.SH NAME +lspnp \- list Plug and Play BIOS device nodes and resources +.SH SYNOPSIS +.B lspnp +.RB [ -b ] +.RB [ -v [ v ]] +.RI [ "device ..." ] +.SH DESCRIPTION +This utility presents a formatted interpretation of the contents of the +.I /sys/bus/pnp/devices +or +.I /proc/bus/pnp +tree. The default output is a list of Plug and Play device node +names, product identifiers, and descriptions. Verbose output +.RB ( -v ) +includes resource allocations (IO ports, memory, interrupts, and DMA +channels) for each device. Very verbose output +.RB ( -vv ) +includes lists of possible resources, various configuration flags, and +product identifiers for compatible devices. +.PP +The output can be limited to one or more specific device nodes by +specifying their node names on the command line. By +default, current (dynamic) device configuration information is +displayed; with the +.B -b +option, the boot (static) configuration is shown. +.SH OPTIONS +.TP +.B \-b +Boot mode: read device resource information that will be used at next +boot (as opposed to current resource info). This is supported only on +kernels that provide the old +.I /proc/bus/pnp +interface. +.TP +.B \-v +Selects more verbose output. Can be used more than once. +.SH FILES +.TP \w'/usr/share/pnp.ids\ \ \ \ |\|'u +/usr/share/misc/pnp.ids +A database of known Plug and Play device ID's. +.TP +/sys/bus/pnp/devices/... +The kernel interface for Plug and Play BIOS device services. +.TP +/proc/bus/pnp/... +The old kernel interface for Plug and Play BIOS device services. +.SH AUTHORS +David Hinds \- dahinds@users.sourceforge.net +.br +Bjorn Helgaas \- bjorn.helgaas@hp.com +.SH "SEE ALSO" +setpnp(8) diff --git a/pnp.ids b/pnp.ids new file mode 100644 index 0000000..b1c6e04 --- /dev/null +++ b/pnp.ids @@ -0,0 +1,591 @@ +#--Interrupt Controllers-- +PNP0000 AT programmable interrupt controller +PNP0001 EISA programmable interrupt controller +PNP0002 MCA programmable interrupt controller +PNP0003 Advanced programmable interrupt controller +PNP0004 Cyrix SLiC MP interrupt controller + +#--Timers-- +PNP0100 AT system timer +PNP0101 EISA system timer +PNP0102 MCA system timer +PNP0103 High-Precision Event Timer + +#--DMA-- +PNP0200 AT DMA controller +PNP0201 EISA DMA controller +PNP0202 MCA DMA controller + +#--Keyboards-- +PNP0300 IBM PC/XT keyboard controller (83-key) +PNP0301 IBM PC/AT keyboard controller (86-key) +PNP0302 IBM PC/XT keyboard controller (84-key) +PNP0303 IBM enhanced keyboard (101/102-key, PS/2 mouse support) +PNP0304 Olivetti keyboard (83-key) +PNP0305 Olivetti keyboard (102-key) +PNP0306 Olivetti keyboard (86-key) +PNP0307 Microsoft Windows(R) keyboard +PNP0308 General Input Device Emulation Interface (GIDEI) legacy +PNP0309 Olivetti keyboard (A101/102 key) +PNP030A AT&T 302 keyboard +PNP030B Reserved by Microsoft +PNP0320 Japanese 106-key keyboard A01 +PNP0321 Japanese 101-key keyboard +PNP0322 Japanese AX keyboard +PNP0323 Japanese 106-key keyboard 002/003 +PNP0324 Japanese 106-key keyboard 001 +PNP0325 Japanese Toshiba desktop keyboard +PNP0326 Japanese Toshiba laptop keyboard +PNP0327 Japanese Toshiba notebook keyboard +PNP0340 Korean 84-key keyboard +PNP0341 Korean 86-key keyboard +PNP0342 Korean enhanced keyboard +PNP0343 Korean enhanced keyboard 101b +PNP0343 Korean enhanced keyboard 101c +PNP0344 Korean enhanced keyboard 103 + +#--Parallel Devices-- +PNP0400 Standard LPT printer port +PNP0401 ECP printer port + +#--Serial Devices-- +PNP0500 Standard PC COM port +PNP0501 16550A-compatible serial port +PNP0502 Multiport serial device (non-intelligent 16550) +PNP0510 Generic IRDA-compatible device +PNP0511 Generic IRDA-compatible device + +#--Disk Controllers-- +PNP0600 Generic ESDI/IDE/ATA compatible hard disk controller +PNP0601 Plus Hardcard II +PNP0602 Plus Hardcard IIXL/EZ +PNP0603 Generic IDE supporting Microsoft Device Bay Specification +PNP0680 Standard bus mastering IDE hard disk controller +PNP0683 Standard bus mastering IDE controller (no serialization) +PNP0700 PC standard floppy disk controller +PNP0701 Standard floppy controller supporting MS Device Bay Spec + +#--Compatibility with early device ID list-- +PNP0802 Microsoft Sound System compatible device + +#--Display Adapters-- +PNP0900 VGA-compatible display adapter +PNP0901 Video Seven VRAM/VRAM II/1024i +PNP0902 8514/A Compatible +PNP0903 Trident VGA +PNP0904 Cirrus Logic Laptop VGA +PNP0905 Cirrus Logic VGA +PNP0906 Tseng ET4000 +PNP0907 Western Digital VGA +PNP0908 Western Digital Laptop VGA +PNP0909 S3 Inc. 911/924 +PNP090A ATI Ultra Pro/Plus (Mach 32) +PNP090B ATI Ultra (Mach 8) +PNP090C XGA Compatible +PNP090D ATI VGA Wonder +PNP090E Weitek P9000 Graphics Adapter +PNP090F Oak Technology VGA +PNP0910 Compaq QVision +PNP0911 XGA/2 +PNP0912 Tseng Labs W32/W32i/W32p +PNP0913 S3 Inc. 801/928/964 +PNP0914 Cirrus Logic 5429/5434 (memory mapped) +PNP0915 Compaq Advanced VGA (AVGA) +PNP0916 ATI Ultra Pro Turbo (Mach64) +PNP0917 Reserved by Microsoft +PNP0918 Matrox MGA +PNP0919 Compaq QVision 2000 +PNP091A Tseng W128 +PNP0930 Chips & Technologies Super VGA +PNP0931 Chips & Technologies Accelerator +PNP0940 NCR 77c22e Super VGA +PNP0941 NCR 77c32blt +PNP09FF Plug and Play Monitors (VESA DDC) + +#--Peripheral Buses-- +PNP0A00 ISA bus +PNP0A01 EISA bus +PNP0A02 MCA bus +PNP0A03 PCI bus +PNP0A04 VESA/VL bus +PNP0A05 Generic ACPI bus +PNP0A06 Generic ACPI extended-IO bus (EIO bus) + +#-- Real Time Clock, BIOS, System board devices-- +PNP0800 AT speaker +PNP0B00 AT real-time clock +PNP0C00 Plug and Play BIOS +PNP0C01 System board +PNP0C02 Motherboard resources +PNP0C03 Plug and Play BIOS event notification interrupt +PNP0C04 Math coprocessor +PNP0C05 APM BIOS (version independent) +PNP0C06 Reserved for early Plug and Play BIOS +PNP0C07 Reserved for early Plug and Play BIOS +PNP0C08 ACPI system board hardware +PNP0C09 ACPI embedded controller +PNP0C0A ACPI control method battery +PNP0C0B ACPI fan +PNP0C0C ACPI power button device +PNP0C0D ACPI lid device +PNP0C0E ACPI sleep button device +PNP0C0F PCI interrupt link device +PNP0C10 ACPI system indicator device +PNP0C11 ACPI thermal zone +PNP0C12 Device bay controller +PNP0C13 Plug and Play BIOS (used when ACPI mode cannot be used) +PNP0C14 Microsoft Windows Management Instrumentation device +PNP0C80 Memory Module + +#--PCMCIA Controller Chipsets-- +PNP0E00 Intel 82365-Compatible PCMCIA Controller +PNP0E01 Cirrus Logic CL-PD6720 PCMCIA Controller +PNP0E02 VLSI VL82C146 PCMCIA Controller +PNP0E03 Intel 82365-compatible CardBus controller + +#--Mice-- +PNP0F00 Microsoft Bus Mouse +PNP0F01 Microsoft Serial Mouse +PNP0F02 Microsoft InPort Mouse +PNP0F03 Microsoft PS/2-style Mouse +PNP0F04 Mouse Systems Mouse +PNP0F05 Mouse Systems 3-Button Mouse (COM2) +PNP0F06 Genius Mouse (COM1) +PNP0F07 Genius Mouse (COM2) +PNP0F08 Logitech Serial Mouse +PNP0F09 Microsoft BallPoint Serial Mouse +PNP0F0A Microsoft Plug and Play Mouse +PNP0F0B Microsoft Plug and Play BallPoint Mouse +PNP0F0C Microsoft-compatible Serial Mouse +PNP0F0D Microsoft-compatible InPort-compatible Mouse +PNP0F0E Microsoft-compatible PS/2-style Mouse +PNP0F0F Microsoft-compatible Serial BallPoint-compatible Mouse +PNP0F10 Texas Instruments QuickPort Mouse +PNP0F11 Microsoft-compatible bus mouse +PNP0F12 Logitech PS/2-style Mouse +PNP0F13 PS/2 port for PS/2-style mice +PNP0F14 Microsoft Kids Mouse +PNP0F15 Logitech bus mouse +PNP0F16 Logitech SWIFT device +PNP0F17 Logitech-compatible serial mouse +PNP0F18 Logitech-compatible bus mouse +PNP0F19 Logitech-compatible PS/2-style mouse +PNP0F1A Logitech-compatible SWIFT device +PNP0F1B HP Omnibook Mouse +PNP0F1C Compaq LTE Trackball PS/2-style Mouse +PNP0F1D Compaq LTE Trackball Serial Mouse +PNP0F1E Microsoft Kids Trackball Mouse +PNP0F1F Reserved by Microsoft Input Device Group +PNP0F20 Reserved by Microsoft Input Device Group +PNP0F21 Reserved by Microsoft Input Device Group +PNP0F22 Reserved by Microsoft Input Device Group +PNP0F23 Reserved by Microsoft Input Device Group +PNP0FFF Reserved by Microsoft Systems + +#--Network Adapters-- +PNP8001 Novell/Anthem NE3200 +PNP8004 Compaq NE3200 +PNP8006 Intel EtherExpress/32 +PNP8008 HP EtherTwist EISA LAN Adapter/32 (HP27248A) +PNP8065 Ungermann-Bass NIUps or NIUps/EOTP +PNP8072 DEC (DE211) EtherWorks MC/TP +PNP8073 DEC (DE212) EtherWorks MC/TP_BNC +PNP8078 DCA 10 Mb MCA +PNP8074 HP MC LAN Adapter/16 TP (PC27246) +PNP80c9 IBM Token Ring +PNP80ca IBM Token Ring II +PNP80cb IBM Token Ring II/Short +PNP80cc IBM Token Ring 4/16Mbs +PNP80d3 Novell/Anthem NE1000 +PNP80d4 Novell/Anthem NE2000 +PNP80d5 NE1000 Compatible +PNP80d6 NE2000 Compatible +PNP80d7 Novell/Anthem NE1500T +PNP80d8 Novell/Anthem NE2100 +PNP80dd SMC ARCNETPC +PNP80de SMC ARCNET PC100, PC200 +PNP80df SMC ARCNET PC110, PC210, PC250 +PNP80e0 SMC ARCNET PC130/E +PNP80e1 SMC ARCNET PC120, PC220, PC260 +PNP80e2 SMC ARCNET PC270/E +PNP80e5 SMC ARCNET PC600W, PC650W +PNP80e7 DEC DEPCA +PNP80e8 DEC (DE100) EtherWorks LC +PNP80e9 DEC (DE200) EtherWorks Turbo +PNP80ea DEC (DE101) EtherWorks LC/TP +PNP80eb DEC (DE201) EtherWorks Turbo/TP +PNP80ec DEC (DE202) EtherWorks Turbo/TP_BNC +PNP80ed DEC (DE102) EtherWorks LC/TP_BNC +PNP80ee DEC EE101 (Built-In) +PNP80ef DECpc 433 WS (Built-In) +PNP80f1 3Com EtherLink Plus +PNP80f3 3Com EtherLink II or IITP (8 or 16-bit) +PNP80f4 3Com TokenLink +PNP80f6 3Com EtherLink 16 +PNP80f7 3Com EtherLink III +PNP80f8 3Com Generic Etherlink Plug and Play Device +PNP80fb Thomas Conrad TC6045 +PNP80fc Thomas Conrad TC6042 +PNP80fd Thomas Conrad TC6142 +PNP80fe Thomas Conrad TC6145 +PNP80ff Thomas Conrad TC6242 +PNP8100 Thomas Conrad TC6245 +PNP8105 DCA 10 MB +PNP8106 DCA 10 MB Fiber Optic +PNP8107 DCA 10 MB Twisted Pair +PNP8113 Racal NI6510 +PNP811C Ungermann-Bass NIUpc +PNP8120 Ungermann-Bass NIUpc/EOTP +PNP8123 SMC StarCard PLUS (WD/8003S) +PNP8124 SMC StarCard PLUS With On Board Hub (WD/8003SH) +PNP8125 SMC EtherCard PLUS (WD/8003E) +PNP8126 SMC EtherCard PLUS With Boot ROM Socket (WD/8003EBT) +PNP8127 SMC EtherCard PLUS With Boot ROM Socket (WD/8003EB) +PNP8128 SMC EtherCard PLUS TP (WD/8003WT) +PNP812a SMC EtherCard PLUS 16 With Boot ROM Socket (WD/8013EBT) +PNP812d Intel EtherExpress 16 or 16TP +PNP812f Intel TokenExpress 16/4 +PNP8130 Intel TokenExpress MCA 16/4 +PNP8132 Intel EtherExpress 16 (MCA) +PNP8137 Artisoft AE-1 +PNP8138 Artisoft AE-2 or AE-3 +PNP8141 Amplicard AC 210/XT +PNP8142 Amplicard AC 210/AT +PNP814b Everex SpeedLink /PC16 (EV2027) +PNP8155 HP PC LAN Adapter/8 TP (HP27245) +PNP8156 HP PC LAN Adapter/16 TP (HP27247A) +PNP8157 HP PC LAN Adapter/8 TL (HP27250) +PNP8158 HP PC LAN Adapter/16 TP Plus (HP27247B) +PNP8159 HP PC LAN Adapter/16 TL Plus (HP27252) +PNP815f National Semiconductor Ethernode *16AT +PNP8160 National Semiconductor AT/LANTIC EtherNODE 16-AT3 +PNP816a NCR Token-Ring 4 Mbs ISA +PNP816d NCR Token-Ring 16/4 Mbs ISA +PNP8191 Olicom 16/4 Token-Ring Adapter +PNP81c3 SMC EtherCard PLUS Elite (WD/8003EP) +PNP81c4 SMC EtherCard PLUS 10T (WD/8003W) +PNP81c5 SMC EtherCard PLUS Elite 16 (WD/8013EP) +PNP81c6 SMC EtherCard PLUS Elite 16T (WD/8013W) +PNP81c7 SMC EtherCard PLUS Elite 16 Combo (WD/8013EW or 8013EWC) +PNP81c8 SMC EtherElite Ultra 16 +PNP81e4 Pure Data PDI9025-32 (Token Ring) +PNP81e6 Pure Data PDI508+ (ArcNet) +PNP81e7 Pure Data PDI516+ (ArcNet) +PNP81eb Proteon Token Ring (P1390) +PNP81ec Proteon Token Ring (P1392) +PNP81ed Proteon ISA Token Ring (1340) +PNP81ee Proteon ISA Token Ring (1342) +PNP81ef Proteon ISA Token Ring (1346) +PNP81f0 Proteon ISA Token Ring (1347) +PNP81ff Cabletron E2000 Series DNI +PNP8200 Cabletron E2100 Series DNI +PNP8209 Zenith Data Systems Z-Note +PNP820a Zenith Data Systems NE2000-Compatible +PNP8213 Xircom Pocket Ethernet II +PNP8214 Xircom Pocket Ethernet I +PNP821d RadiSys EXM-10 +PNP8227 SMC 3000 Series +PNP8228 SMC 91C2 controller +PNP8231 Advanced Micro Devices AM2100/AM1500T +PNP8263 Tulip NCC-16 +PNP8277 Exos 105 +PNP828A Intel '595 based Ethernet +PNP828B TI2000-style Token Ring +PNP828C AMD PCNet Family cards +PNP828D AMD PCNet32 (VL version) +PNP8294 IrDA Infrared NDIS driver (Microsoft-supplied) +PNP82bd IBM PCMCIA-NIC +PNP82C2 Xircom CE10 +PNP82C3 Xircom CEM2 +PNP8321 DEC Ethernet (All Types) +PNP8323 SMC EtherCard (All Types except 8013/A) +PNP8324 ARCNET Compatible +PNP8326 Thomas Conrad (All Arcnet Types) +PNP8327 IBM Token Ring (All Types) +PNP8385 Remote Network Access Driver +PNP8387 RNA Point-to-point Protocol Driver +PNP8388 Reserved for Microsoft Networking components +PNP8389 Peer IrLAN infrared driver (Microsoft-supplied) +PNP8390 Generic network adapter + +#--SCSI, Proprietary CD Adapters-- +PNPA002 Future Domain 16-700 compatible controller +PNPA003 Panasonic proprietary CD-ROM adapter (SBPro/SB16) +PNPA01B Trantor 128 SCSI Controller +PNPA01D Trantor T160 SCSI Controller +PNPA01E Trantor T338 Parallel SCSI controller +PNPA01F Trantor T348 Parallel SCSI controller +PNPA020 Trantor Media Vision SCSI controller +PNPA022 Always IN-2000 SCSI controller +PNPA02B Sony proprietary CD-ROM controller +PNPA02D Trantor T13b 8-bit SCSI controller +PNPA02F Trantor T358 Parallel SCSI controller +PNPA030 Mitsumi LU-005 Single Speed CD-ROM controller + drive +PNPA031 Mitsumi FX-001 Single Speed CD-ROM controller + drive +PNPA032 Mitsumi FX-001 Double Speed CD-ROM controller + drive + +#--Sound/Video-capture, multimedia-- +PNPB000 Sound Blaster 1.5 sound device +PNPB001 Sound Blaster 2.0 sound device +PNPB002 Sound Blaster Pro sound device +PNPB003 Sound Blaster 16 sound device +PNPB004 Thunderboard-compatible sound device +PNPB005 Adlib-compatible FM synthesizer device +PNPB006 MPU401 compatible +PNPB007 Microsoft Windows Sound System-compatible sound device +PNPB008 Compaq Business Audio +PNPB009 Plug and Play Microsoft Windows Sound System Device +PNPB00A MediaVision Pro Audio Spectrum +PNPB00B MediaVision Pro Audio 3D +PNPB00C MusicQuest MQX-32M +PNPB00D MediaVision Pro Audio Spectrum Basic +PNPB00E MediaVision Pro Audio Spectrum +PNPB00F MediaVision Jazz-16 chipset (OEM Versions) +PNPB010 Auravision VxP500 chipset - Orchid Videola +PNPB018 MediaVision Pro Audio Spectrum 8-bit +PNPB019 MediaVision Pro Audio Spectrum Basic +PNPB020 Yamaha OPL3-compatible FM synthesizer device +PNPB02F Joystick/Game port + +#--Modems-- +PNPC000 Compaq 14400 Modem (TBD) +PNPC001 Compaq 2400/9600 Modem (TBD) + +#--Vendor specific-- + +ABC1234 Intel Virtual Audio Device + +ACC1660 Accton EN1660 PnP LAN Card + +ACU0101 NCR SDMS (TM) Miniport Driver + +ADP1502 Adaptec AVA-1502 SCSI Host Adapter +ADP1505 Adaptec AVA-1505 SCSI Host Adapter +ADP1510 Adaptec AHA-1510 SCSI Host Adapter +ADP1515 Adaptec AVA-1515 SCSI Host Adapter +ADP1520 Adaptec AHA-152X/AHA-1510 SCSI Host Adapter +ADP1522 Adaptec AHA-152X Plug and Play SCSI Host Adapter +ADP1532 Adaptec AHA-152X Plug and Play SCSI Host Adapter +ADP1540 Adaptec AHA-154X/AHA-164X/AHA-1535 SCSI Host Adapter +ADP1542 Adaptec AHA-154X/AHA-1535 Plug and Play SCSI Host Adapter +ADP154F Adaptec SCSI Adapter Floppy Controller +ADP1740 Adaptec AHA-174X EISA Host Adapter +ADP2015 Adaptec AHA-152X/AHA-1510 SCSI Host Adapter +ADP2215 Adaptec AHA-152X Plug and Play SCSI Host Adapter +ADP2840 Adaptec AHA-284X VESA SCSI Host Adapter +ADP3015 Adaptec AHA-153X/AIC-6370 Plug and Play SCSI Host Adapter +ADP3215 Adaptec AHA-153X/AIC-6370 Plug and Play SCSI Host Adapter +ADP4215 Adaptec AHA-154X/AHA-1535 Plug and Play SCSI Host Adapter +ADP6360 Adaptec AHA-150X/1510/152X/AIC-6X60 SCSI Host Adapter +ADP7770 Adaptec AIC-777X EISA SCSI Host Adapter +ADP7771 Adaptec AIC-777X EISA SCSI Host Adapter + +ADV55AA AMD PCNET Family Ethernet Adapter/ISA+ +ADV55AA Mitron LX-2100+ Ethernet Adapter + +ATI4402 ATI Graphics Ultra Pro EISA (mach32) + +ATK1500 Allied Telesyn AT-1510 Plug and Play Ethernet Adapter + +AZT1605 Aztech Sound Galaxy Nova 16 +AZT2316 Aztech Sound Galaxy Washington 16 + +BRI0200 Boca Complete Office Communicator (Voice) +BRI1001 Boca Research BOCALANcard + +BUS0042 BusLogic MultiMaster SCSI Host Adapters +BUS4201 BusLogic 32-Bit Bus Master EISA-to-SCSI Host Adapter w/Floppy + +CPQ3001 Compaq EISA Advanced VGA (AVGA) +CPQ3011 Compaq QVision 1024/E +CPQ3111 Compaq QVision 1024/E +CPQ3112 Compaq QVision 1280/E +CPQ3122 Compaq QVision 1280/I +CPQ4300 Compaq Advanced ESDI Controller +CPQ4410 Compaq Integrated 32-Bit Fast-SCSI-2 Controller +CPQ4411 Compaq EISA 32-Bit Fast-SCSI-2 Controller +CPQ6001 Compaq 32-Bit DualSpeed Token Ring Controller +CPQ6002 Compaq NetFlex-2 TR Controller +CPQ6100 Compaq NetFlex ENET/TR Controller +CPQ6101 Compaq NetFlex-2 ENET/TR Controller +CPQ9A83 Compaq Deskpro XL Processor Board +CPQA050 Compaq SCSI Controller +CPQA060 Compaq Elite Ethernet Controller +CPQA090 Compaq SmartStation +CPQA0A0 Compaq MiniStation/EN +CPQA0B0 Compaq MiniStation/TR +CPQA0D2 Compaq Modem Audio +CPQA0D4 Compaq Modem Audio +CPQA0D5 ESS ES688 AudioDrive +CPQA0D6 Compaq Presario Bezel Volume Control +CPQA0D7 Compaq Enhanced Keyboard +CPQA0D8 Compaq PS/2 Port Mouse +CPQA0D9 Communications Port +CPQA0DA Compaq IDE Controller +CPQA0DB Compaq Floppy Disk Controller +CPQA0DE Compaq PCMCIA Controller +CPQA0DF Compaq Notebook Display (WD) +CPQA0E0 ECP Printer Port +CPQA0E1 Compaq TV Tuner +CPQA0E2 Compaq TV Tuner +CPQA0E3 Compaq Contura Integrated Ethernet Controller +CPQA0E4 Compaq Modem Audio +CPQA0EF Compaq Deskpro Thermal Sensor +CPQAE08 Compaq Deskpro Thermal Sensor +CPQAE26 ESS ES1688 AudioDrive +CPQFA1B Compaq Deskpro 486/50 system memory board +CPQFD17 Compaq SCSI Tape Adapter + +CSC0000 Crystal PnP audio system CODEC +CSC0001 Crystal PnP audio system joystick +CSC0002 Crystal PnP audio system control registers +CSC0003 Crystal PnP audio system MPU-401 compatible +CSC0004 Crystal PnP IDE controller +CSC0010 Crystal PnP audio system control registers +CSC0011 Crystal PnP audio system CODEC/joystick + +CSI2201 Cabletron E2200 Series DNI / Primary +CSI2202 Cabletron E2200 Series DNI / Secondary +CSI2203 Cabletron E2200 Series DNI + +CTL0001 Creative Labs Sound Blaster 16 or AWE-32 Plug and Play +CTL0021 Creative Advanced Wave Effects Synthesis for AWE 32 +CTL0031 Creative Labs Sound Blaster 16 or AWE-32 Plug and Play +CTL2001 MKEPanasonic CD-ROM Drive +CTL2011 Creative Labs IDE controller +CTL3011 Creative Labs Modem Blaster 28.8 DSVD PnP Voice +CTL7001 Gameport Joystick +CTL8001 Creative Advanced Wave Effects Synthesis for AWE 32 + +DBK0000 Databook ISA PCMCIA Controller +DBK0000 MobileMax Deskrunner ISA PCMCIA Controller +DBK0204 Databook Plug and Play PCMCIA Controller based on DB86084 +DBK0214 Databook Plug and Play PCMCIA Controller based on DB86184 +DBK0402 Databook Plug and Play PCMCIA Controller based on DB86084 +DBK1402 Databook Plug and Play PCMCIA Controller based on DB86184 + +ESS0100 ESS ES688 PnP AudioDrive +ESS0102 ESS ES1688 PnP AudioDrive +ESS1481 ESS ES1488 AudioDrive +ESS1681 ESS ES1688 AudioDrive +ESS4881 ESS ES488 AudioDrive +ESS6880 ESS ES688 AudioDrive and Game Controller +ESS6881 ESS ES688 AudioDrive + +FAR0002 Farallon EtherWave Plug and Play PC-ISA Card + +FDC0000 Future Domain MCS-600/700 SCSI Host Adapter +FDC0000 Future Domain TMC-1650/1660/1670/1680 SCSI Host Adapter +FDC0000 Future Domain TMC-1790/1795 SCSI Host Adapter +FDC0950 Future Domain TMC-850/M/MER/MEX SCSI Host Adapter +FDC0950 Future Domain TMC-860/860M/885/885M SCSI Host Adapter +FDC1600 Future Domain PNP-1630/1640 Plug and Play SCSI controller +FDC1695 Future Domain TMC-1695 Plug and Play SCSI Host Adapter +FDC9516 Future Domain TMC-1695 Plug and Play SCSI Host Adapter + +HPQ0001 HP PCI Express Root Complex +HPQ0002 HP PCI Express Local Bus Adapter + +HWP0001 HP System Bus Adapter/IO Controller +HWP0002 HP PCI/PCI-X Local Bus Adapter +HWP0003 HP AGP Local Bus Adapter +HWP0004 HP IO Controller +HWP0005 HP System Bus Adapter +HWP0006 HP Cell Controller +HWP0007 HP AGP 3.0 Local Bus Adapter +HWP1940 HP J2577A 10/100VG EISA LAN Adapter +HWP1950 HP J2573A 10/100VG ISA LAN Adapter +HWP1C10 HP COM and LPT Ports Combo Card +HWP5004 HP Global Shared Memory + +IBM0001 IBM Auto 16/4 ISA Token-Ring Adapter +IBM0002 IBM Thinkpad pnfrared port +IBM0020 InfraRed connector on the King ISA PnP PCMCIA Controller +IBM0034 IBM Thinkpad infrared port +IBM0070 IBM Thinkpad infrared port +IBM0071 IBM Thinkpad infrared port +IBM36E0 IBM Mwave DSP +IBM36F1 IBM Mwave Midi Synthesizer +IBM36F2 IBM Mwave SoundBlaster Compatibility +IBM3730 IBM 3780i PnP Communications Adapter +IBM3731 IBM 3780i PnP Communications Extender +IBM3760 IBM Thinkpad Mwave DSP +IBM3780 PS/2 TrackPoint + +IFX0101 Infineon Trusted Platform Module +IFX0102 Infineon Trusted Platform Module + +INT0902 Intel TokenExpress EISA 16/4 +INT1030 Intel EtherExpress PRO/10 (PnP Enabled) +INT1060 Intel EtherExpress PRO/100 (EISA) +INT1201 Intel TokenExpress 32bit EISA 16/4 + +IPI0001 IPMI System Interface + +ISAB701 All Iomega 8-bit PC2x SCSI Host Adapters except PC2F +ISAB702 Iomega PC2F 8-bit SCSI Host Adapters + +MDG0002 Madge Smart 16/4 EISA Ringnode +MDG0101 Madge Smart 16/4 ISA Client PnP Ringnode + +MDY1900 Microdyne NE2500 Ethernet Adapter +MDY1901 Microdyne NE2500T Ethernet Adapter + +NEC8201 NEC EISA SCSI Host Adapter + +NVL0701 Intel EtherExpress 32 +NVL0701 Novell/Anthem NE3200 or compatible +NVL0702 Novell/Anthem NE3200T + +OLC0902 Olicom EISA 16/4 Token-Ring Adapter +OLC1201 Olicom 32bit Token-Ring Server Adapter +OLC9430 Olicom Plug and Play Token-Ring ISA 16/4 (OC-3118) + +PRO6000 Proteon ProNET-4/16 EISA Token Ring (P1990) Rev A1-A7 +PRO6001 Proteon ProNET-4/16 EISA Token Ring (P1990) Rev A8 & above +PRO6002 Proteon ProNET-4/16 EISA Token Ring (P1990) Plus + +RII0101 Racal ES3210 EISA + +RTL8019 Realtek RTL8019 PnP LAN adapter or compatible + +SCM0469 SCM SwapBox Family Plug and Play PCMCIA controller + +SKD8000 SysKonnect SK-NET Flash Ethernet Adapter + +SMC8010 SMC EtherCard Elite Ultra 32 +SMC8416 SMC EtherEZ (8416) +SMC9000 SMC 9000 Ethernet Adapter +SMCF010 SMC Fast Infrared Port + +SUP1380 SupraExpress 288i PnP Voice + +SVE0001 SVEC FD0421 EtherPlug-ISA + +SYN0002 Synaptics PS/2 Port Pointing Device +SYN0100 Synaptics PS/2 Port Pointing Device +SYN010D Synaptics PS/2 Port TouchPad + +TCI00D0 Tulip NCC-16 ISA+ + +TCM5092 3Com EtherLink III EISA (3C579-TP) +TCM5093 3Com EtherLink III EISA (3C579) +TCM619B 3Com TokenLink III ISA in EISA mode (3C619B) + +TCO4145 Thomas-Conrad Token Ring TC4145 + +TOS7400 Toshiba AcuPoint + +USC0140 UltraStor 14F/14FB/34F/34FA/34FB Driver +USC0141 UltraStor 14F/14FB/34F/34FA/34FB Driver +USC0142 UltraStor 14F/14FB/34F/34FA/34FB Driver +USC0143 UltraStor 14F/14FB/34F/34FA/34FB Driver +USC0240 UltraStor 24F/24FA Driver +USC1240 UltraStor 124F Driver + +VDM0469 Vadem PCIC compatible Plug and Play PCMCIA controller + +WDC2001 Future Domain TMC-7000EX EISA SCSI Host Adapter + +ZDS2000 ZDS SCSI/IDE/Floppy EISA Controller Board +ZDS2010 Zeos EISA IDE Controller diff --git a/pnp_resource.h b/pnp_resource.h new file mode 100644 index 0000000..aac1058 --- /dev/null +++ b/pnp_resource.h @@ -0,0 +1,148 @@ +#ifndef LINUX_PNP_RESOURCE +#define LINUX_PNP_RESOURCE + +/* ISA Plug and Play Resource Definitions */ + +#define PNP_RES_LARGE_ITEM 0x80 + +/* Small resource items */ +#define PNP_RES_SMTAG_VERSION 0x01 +#define PNP_RES_SMTAG_LDID 0x02 +#define PNP_RES_SMTAG_CDID 0x03 +#define PNP_RES_SMTAG_IRQ 0x04 +#define PNP_RES_SMTAG_DMA 0x05 +#define PNP_RES_SMTAG_DEP_START 0x06 +#define PNP_RES_SMTAG_DEP_END 0x07 +#define PNP_RES_SMTAG_IO 0x08 +#define PNP_RES_SMTAG_IO_FIXED 0x09 +#define PNP_RES_SMTAG_VENDOR 0x0e +#define PNP_RES_SMTAG_END 0x0f + +/* Large resource items */ +#define PNP_RES_LGTAG_MEM 0x01 +#define PNP_RES_LGTAG_ID_ANSI 0x02 +#define PNP_RES_LGTAG_ID_UNICODE 0x03 +#define PNP_RES_LGTAG_VENDOR 0x04 +#define PNP_RES_LGTAG_MEM32 0x05 +#define PNP_RES_LGTAG_MEM32_FIXED 0x06 + +/* Logical device ID flags */ +#define PNP_RES_LDID_BOOT 0x01 + +/* IRQ information */ +#define PNP_RES_IRQ_HIGH_EDGE 0x01 +#define PNP_RES_IRQ_LOW_EDGE 0x02 +#define PNP_RES_IRQ_HIGH_LEVEL 0x04 +#define PNP_RES_IRQ_LOW_LEVEL 0x08 + +/* DMA information */ +#define PNP_RES_DMA_WIDTH_MASK 0x03 +#define PNP_RES_DMA_WIDTH_8 0x00 +#define PNP_RES_DMA_WIDTH_8_16 0x01 +#define PNP_RES_DMA_WIDTH_16 0x02 +#define PNP_RES_DMA_BUSMASTER 0x04 +#define PNP_RES_DMA_COUNT_BYTE 0x08 +#define PNP_RES_DMA_COUNT_WORD 0x10 +#define PNP_RES_DMA_SPEED_MASK 0x60 +#define PNP_RES_DMA_SPEED_COMPAT 0x00 +#define PNP_RES_DMA_SPEED_TYPEA 0x20 +#define PNP_RES_DMA_SPEED_TYPEB 0x40 +#define PNP_RES_DMA_SPEED_TYPEF 0x60 + +/* Resource group priority */ +#define PNP_RES_CONFIG_GOOD 0x00 +#define PNP_RES_CONFIG_ACCEPTABLE 0x01 +#define PNP_RES_CONFIG_SUBOPTIMAL 0x02 + +/* IO information */ +#define PNP_RES_IO_DECODE_16 0x01 + +/* Memory information */ +#define PNP_RES_MEM_WRITEABLE 0x01 +#define PNP_RES_MEM_CACHEABLE 0x02 +#define PNP_RES_MEM_HIGH_ADDRESS 0x04 +#define PNP_RES_MEM_WIDTH_MASK 0x18 +#define PNP_RES_MEM_WIDTH_8 0x00 +#define PNP_RES_MEM_WIDTH_16 0x08 +#define PNP_RES_MEM_WIDTH_8_16 0x10 +#define PNP_RES_MEM_WIDTH_32 0x18 +#define PNP_RES_MEM_SHADOWABLE 0x20 +#define PNP_RES_MEM_EXPANSION_ROM 0x40 + +/* + note: multi-byte data types in these structures are little endian, + and have to be byte swapped before use on big endian platforms. +*/ + +#pragma pack(1) +union pnp_small_resource { + struct { + __u8 pnp, vendor; + } version; + struct { + __u32 id; + __u8 flag0, flag1; + } ldid; + struct { + __u32 id; + } gdid; + struct { + __u16 mask; + __u8 info; + } irq; + struct { + __u8 mask, info; + } dma; + struct { + __u8 priority; + } dep_start; + struct { + __u8 info; + __u16 min, max; + __u8 align, len; + } io; + struct { + __u16 base; + __u8 len; + } io_fixed; + struct { + __u8 checksum; + } end; +}; + +union pnp_large_resource { + struct { + __u8 info; + __u16 min, max, align, len; + } mem; + struct { + __u8 str[0]; + } ansi; + struct { + __u16 country; + __u8 str[0]; + } unicode; + struct { + __u8 info; + __u32 min, max, align, len; + } mem32; + struct { + __u8 info; + __u32 base, len; + } mem32_fixed; +}; + +union pnp_resource { + struct { + __u8 tag; + union pnp_small_resource d; + } sm; + struct { + __u8 tag; + __u16 sz; + union pnp_large_resource d; + } lg; +}; +#pragma pack() + +#endif /* LINUX_PNP_RESOURCE */ diff --git a/setpnp.c b/setpnp.c new file mode 100644 index 0000000..6a992c4 --- /dev/null +++ b/setpnp.c @@ -0,0 +1,303 @@ +/*====================================================================== + + A utility for reconfiguring PnP BIOS devices + + setpnp.c 1.11 2006/07/06 15:27:55 MDT + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + + (c) Copyright 2006 Hewlett-Packard Development Company, L.P. + Bjorn Helgaas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + Usage: + + setpnp [-b] [device #] [resource list] + setpnp [-b] [device #] {on|off} + + The device number is a two-digit hex string. The resource list + consists of a series of resource names and values. Four resource + names are available: "io", "mem", "irq", and "dma". Values can + either be single numbers or dash-delimited ranges. More than one + value can be listed in a single argument, separated by commas. + + For example: + + setpnp 0d irq 3 io 0x02f8-0x02ff + +======================================================================*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pnp_resource.h" + +static int verbose = 0, boot = 0; + +#define swap16(n) ((((n)&0x00ff)<<8) | (((n)&0xff00)>>8)) +#define swap32(n) \ + ((((n)&0xff000000)>>24) | (((n)&0x00ff0000)>>8) | \ + (((n)&0x0000ff00)<<8) | (((n)&0x000000ff)<<24)) + +#if (__BYTE_ORDER == _BIG_ENDIAN) +#define flip16(n) swap16(n) +#define flip32(n) swap32(n) +#else +#define flip16(n) (n) +#define flip32(n) (n) +#endif + +#define NRSRC 4 +#define NBASE 8 +#define R_IO 0 +#define R_MEM 1 +#define R_IRQ 2 +#define R_DMA 3 + +struct rsrc_list { + int nr[NRSRC]; + u_long base[NRSRC][NBASE]; + u_long len[NRSRC][NBASE]; +}; + +static const char *rsrc_type[] = { "io", "mem", "irq", "dma" }; + +/*====================================================================*/ + +static u_char *update_chain(u_char *buf, int nr, struct rsrc_list *res) +{ + union pnp_resource *p = (union pnp_resource *)buf; + int tag = 0, sz, nu[4]; + u_long base, len; + + nu[0] = nu[1] = nu[2] = nu[3] = 0; + while (((u_char *)p < buf+nr) && (tag != PNP_RES_SMTAG_END)) { + if (p->lg.tag & PNP_RES_LARGE_ITEM) { + union pnp_large_resource *r = &p->lg.d; + tag = p->lg.tag & ~PNP_RES_LARGE_ITEM; + sz = flip16(p->lg.sz) + 2; + switch (tag) { + case PNP_RES_LGTAG_MEM: + if (res->nr[R_MEM] > nu[R_MEM]) { + base = res->base[R_MEM][nu[R_MEM]++]; + len = res->len[R_MEM][nu[R_MEM]++]; + r->mem.min = r->mem.max = flip16(base >> 8); + r->mem.len = flip16(len); + } + break; + case PNP_RES_LGTAG_MEM32: + if (res->nr[R_MEM] > nu[R_MEM]) { + base = res->base[R_MEM][nu[R_MEM]++]; + len = res->len[R_MEM][nu[R_MEM]++]; + r->mem32.min = r->mem32.max = flip32(base); + r->mem32.len = flip32(len); + } + break; + case PNP_RES_LGTAG_MEM32_FIXED: + if (res->nr[R_MEM] > nu[R_MEM]) { + base = res->base[R_MEM][nu[R_MEM]]; + len = res->len[R_MEM][nu[R_MEM]++]; + r->mem32_fixed.base = flip32(base); + r->mem32_fixed.len = flip32(len); + } + break; + } + } else { + union pnp_small_resource *r = &p->sm.d; + tag = (p->sm.tag >> 3); sz = (p->sm.tag & 7); + switch (tag) { + case PNP_RES_SMTAG_IRQ: + if (res->nr[R_IRQ] > nu[R_IRQ]) { + base = res->base[R_IRQ][nu[R_IRQ]]; + len = res->len[R_IRQ][nu[R_IRQ]++]; + r->irq.mask = len ? flip16(1<nr[R_DMA] > nu[R_DMA]) { + base = res->base[R_DMA][nu[R_DMA]]; + len = res->len[R_DMA][nu[R_DMA]++]; + r->dma.mask = len ? flip16(1<nr[R_IO] > nu[R_IO]) { + base = res->base[R_IO][nu[R_IO]]; + len = res->len[R_IO][nu[R_IO]++]; + r->io.min = r->io.max = flip16(base); + r->io.len = len; + } + break; + case PNP_RES_SMTAG_IO_FIXED: + if (res->nr[R_IO] > nu[R_IO]) { + base = res->base[R_IO][nu[R_IO]++]; + len = res->len[R_IO][nu[R_IO]++]; + r->io_fixed.base = flip16(base); + r->io_fixed.len = len; + } + break; + } + } + p = (union pnp_resource *) ((u_char *)p + sz + 1); + } + return (u_char *)p; +} + +static int update_resources(int num, struct rsrc_list *res) +{ + char fn[40]; + u_char buf[4096]; + int fd, nr, nw; + + if (access("/proc/bus/pnp", F_OK) != 0) { + fprintf(stderr, "lspnp: /proc/bus/pnp not available\n"); + return EXIT_FAILURE; + } + + sprintf(fn, "/proc/bus/pnp/%s%02x", (boot ? "boot/" : ""), num); + fd = open(fn, O_RDWR); + nr = read(fd, buf, sizeof(buf)); + if (nr <= 0) { + perror("read failed"); + return EXIT_FAILURE; + } + + update_chain(buf, nr, res); + nw = write(fd, buf, nr); + close(fd); + if (nr != nw) { + perror("write failed"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +static int reset_resources(int num) +{ + char fn[40]; + u_char buf[4096]; + int fd, nr, nw; + + if (access("/proc/bus/pnp", F_OK) != 0) { + fprintf(stderr, "lspnp: /proc/bus/pnp not available\n"); + return EXIT_FAILURE; + } + sprintf(fn, "/proc/bus/pnp/boot/%02x", num); + fd = open(fn, O_RDONLY); + nr = read(fd, buf, sizeof(buf)); + close(fd); + if (nr <= 0) { + perror("read failed"); + return EXIT_FAILURE; + } + sprintf(fn, "/proc/bus/pnp/%02x", num); + fd = open(fn, O_WRONLY); + nw = write(fd, buf, nr); + close(fd); + if (nr != nw) { + perror("write failed"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +/*====================================================================*/ + +static int parse_resources(char *argv[], int argc, + struct rsrc_list *res) +{ + int i, j; + u_long base, len; + char *s, *t; + + for (i = 0; i < argc; i += 2) { + for (j = 0; j < NRSRC; j++) + if (strcmp(rsrc_type[j], argv[i]) == 0) break; + if (j == NRSRC) { + fprintf(stderr, "bad resource type: '%s'\n", argv[i]); + return EXIT_FAILURE; + } + s = strtok(argv[i+1], ", \t"); + while (s) { + if (strcmp(s, "off") == 0) { + base = len = 0; + t = s + strlen(s); + } else { + base = strtoul(s, &t, 0); + len = ((*t == '-') ? strtoul(t+1, &t, 0)-base+1 : 1); + } + if ((*s == '\0') || (*t != '\0')) { + fprintf(stderr, "bad resource argument: '%s'\n", t); + return EXIT_FAILURE; + } + res->base[j][res->nr[j]] = base; + res->len[j][res->nr[j]++] = len; + s = strtok(NULL, ", \t"); + } + } + return EXIT_SUCCESS; +} + +/*====================================================================*/ + +void usage(char *name) +{ + fprintf(stderr, "usage: %s [-b] [device #] [resources ...]\n" + " or %s [-b] [device #] {on|off}\n", name, name); + exit(EXIT_FAILURE); +} + +int main(int argc, char *argv[]) +{ + int i, optch, errflg = 0; + static struct rsrc_list res; + char *s; + + while ((optch = getopt(argc, argv, "bv")) != -1) { + switch (optch) { + case 'b': + boot++; break; + case 'v': + verbose++; break; + default: + errflg = 1; break; + } + } + if (errflg || (optind == argc)) + usage(argv[0]); + + i = strtoul(argv[optind], &s, 16); + if ((argv[optind] == '\0') || (*s != '\0')) + usage(argv[0]); + optind++; + + /* Special commands */ + if (argc == optind+1) { + if (strcmp(argv[optind], "off") == 0) { + res.nr[0] = res.nr[1] = res.nr[2] = res.nr[3] = 7; + optind++; + } else if (strcmp(argv[optind], "on") == 0) { + return reset_resources(i); + } else { + usage(argv[0]); + } + } else if (argc == optind) + usage(argv[0]); + + if ((argc - optind) % 2) + usage(argv[0]); + if (parse_resources(argv+optind, argc-optind, &res) == 0) + return update_resources(i, &res); + return EXIT_FAILURE; +} diff --git a/setpnp.man b/setpnp.man new file mode 100644 index 0000000..5a5f740 --- /dev/null +++ b/setpnp.man @@ -0,0 +1,70 @@ +.\" Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net +.\" (c) Copyright 2006 Hewlett-Packard Development Company, L.P. +.\" Bjorn Helgaas +.\" +.TH setpnp 8 "@TODAY@" "@VERSION@" "Linux Plug and Play Utilities" +.SH NAME +setpnp \- modify Plug and Play BIOS device resources +.SH SYNOPSIS +.B setpnp +.RB [ -b ] +.I device resource... +.br +.B setpnp +.RB [ -b ] +.I device {on|off} +.SH DESCRIPTION +This utility updates the system resource information for Plug and Play +BIOS device nodes. A device is specified by its two-digit hex node +number. In its first form, a list of resources are given on the +command line. Alternatively, a device can either be simply switched +``on'' (reset to its boot configuration) or ``off'' (all resources +disabled). +.PP +There are four types of resources: ``io'', ``mem'', ``irq'', and +``dma''. A resource list consists of one or more space-separated +pairs of a resource type with one or more values. Multiple values for +one resource type can be separated by commas. Values can also either +be unitary or dash-separated ranges. For example: +.sp +.RS +.nf +setpnp 0d io 0x2f8-0x2ff irq 3 +setpnp 12 io 0x350-0x35f,0x2f8-0x2ff irq 3 irq 10 +setpnp 0b irq off +.RE +.fi +.sp +The order of items of different types is not important, but if more +than one item of the same type is present, their relative order is +significant. The Plug and Play BIOS will reject invalid configuration +attempts; however, +.B setpnp +will not attempt to determine why a configuration was rejected. +.PP +By default, current (dynamic) device configuration information is +modified. With the +.B -b +option, a device's boot (static) configuration can be updated. Some +devices may only be reconfigured for the following boot. Be especially +careful when modifying your system's boot configuration. Improper use +of this command may disable vital system devices and render your +system unbootable. +.SH OPTIONS +.TP +.B \-b +Boot mode: update the device resource information that will be used at +next boot (as opposed to current resource info). +.SH FILES +.TP +/sys/bus/pnp/devices/... +The kernel interface for Plug and Play BIOS device services. +.TP +/proc/bus/pnp/... +The old kernel interface for Plug and Play BIOS device services. +.SH AUTHORS +David Hinds \- dahinds@users.sourceforge.net +.br +Bjorn Helgaas \- bjorn.helgaas@hp.com +.SH "SEE ALSO" +lspnp(8) -- 2.32.0.93.g670b81a890