2 * Linux PCI Utilities -- Common Functions
4 * Copyright (c) 1997--1999 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
17 void __attribute__((noreturn))
23 fputs("lspci: ", stderr);
24 vfprintf(stderr, msg, args);
30 xmalloc(unsigned int howmuch)
32 void *p = malloc(howmuch);
34 die("Unable to allocate %d bytes of memory", howmuch);
39 parse_generic_option(int i, struct pci_access *pacc, char *optarg)
43 #ifdef HAVE_PM_LINUX_PROC
45 pacc->method_params[PCI_ACCESS_PROC_BUS_PCI] = optarg;
46 pacc->method = PCI_ACCESS_PROC_BUS_PCI;
49 #ifdef HAVE_PM_INTEL_CONF
51 if (!strcmp(optarg, "1"))
52 pacc->method = PCI_ACCESS_I386_TYPE1;
53 else if (!strcmp(optarg, "2"))
54 pacc->method = PCI_ACCESS_I386_TYPE2;
56 die("Unknown hardware configuration type %s", optarg);
59 #ifdef HAVE_PM_SYSCALLS
61 pacc->method = PCI_ACCESS_SYSCALLS;
66 pacc->method_params[PCI_ACCESS_DUMP] = optarg;
67 pacc->method = PCI_ACCESS_DUMP;