X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=setpci.c;h=497538a5b9d73658f23255001378e812137e613f;hb=239ff18adf556b63a16be968725ba9fd0e6d5227;hp=a3bfb63d545a1d441acdfaecf96c8fd409ea858d;hpb=727ce158868ed101006ecc5d3dd3faede927165c;p=pciutils.git diff --git a/setpci.c b/setpci.c index a3bfb63..497538a 100644 --- a/setpci.c +++ b/setpci.c @@ -1,9 +1,9 @@ /* - * $Id: setpci.c,v 1.9 1999/01/22 21:05:02 mj Exp $ + * $Id: setpci.c,v 1.12 2002/03/30 15:39:24 mj Exp $ * * Linux PCI Utilities -- Manipulate PCI Configuration Registers * - * Copyright (c) 1998 Martin Mares + * Copyright (c) 1998 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -56,10 +56,11 @@ exec_op(struct op *op, struct pci_dev *dev) char *mm[] = { NULL, "%02x", "%04x", NULL, "%08x" }; char *m = mm[op->width]; unsigned int x; - int i; + int i, addr; if (verbose) printf("%02x:%02x.%x:%02x", dev->bus, dev->dev, dev->func, op->addr); + addr = op->addr; if (op->num_values >= 0) for(i=0; inum_values; i++) { @@ -73,15 +74,16 @@ exec_op(struct op *op, struct pci_dev *dev) switch (op->width) { case 1: - pci_write_byte(dev, op->addr, op->values[i]); + pci_write_byte(dev, addr, op->values[i]); break; case 2: - pci_write_word(dev, op->addr, op->values[i]); + pci_write_word(dev, addr, op->values[i]); break; default: - pci_write_long(dev, op->addr, op->values[i]); + pci_write_long(dev, addr, op->values[i]); break; } + addr += op->width; } else { @@ -92,13 +94,13 @@ exec_op(struct op *op, struct pci_dev *dev) switch (op->width) { case 1: - x = pci_read_byte(dev, op->addr); + x = pci_read_byte(dev, addr); break; case 2: - x = pci_read_word(dev, op->addr); + x = pci_read_word(dev, addr); break; default: - x = pci_read_long(dev, op->addr); + x = pci_read_long(dev, addr); break; } printf(m, x); @@ -325,7 +327,7 @@ next: usage(); if (c[2]) d = (c[2] == '=') ? c+3 : c+2; - else if (argc) + else if (argc > 1) { argc--; argv++;