tools: PCI: Add 'e' to clear IRQ

Add a new command line option 'e' to invoke "PCITEST_CLEAR_IRQ"
ioctl. This can be used to clear the irqs set using the 'i' option.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
This commit is contained in:
Kishon Vijay Abraham I 2020-03-17 15:31:56 +05:30 committed by Lorenzo Pieralisi
parent 475007f9ce
commit 74d60b28d5
1 changed files with 15 additions and 1 deletions

View File

@ -30,6 +30,7 @@ struct pci_test {
int irqtype; int irqtype;
bool set_irqtype; bool set_irqtype;
bool get_irqtype; bool get_irqtype;
bool clear_irq;
bool read; bool read;
bool write; bool write;
bool copy; bool copy;
@ -76,6 +77,15 @@ static int run_test(struct pci_test *test)
fprintf(stdout, "%s\n", irq[ret]); fprintf(stdout, "%s\n", irq[ret]);
} }
if (test->clear_irq) {
ret = ioctl(fd, PCITEST_CLEAR_IRQ);
fprintf(stdout, "CLEAR IRQ:\t\t");
if (ret < 0)
fprintf(stdout, "FAILED\n");
else
fprintf(stdout, "%s\n", result[ret]);
}
if (test->legacyirq) { if (test->legacyirq) {
ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0); ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0);
fprintf(stdout, "LEGACY IRQ:\t"); fprintf(stdout, "LEGACY IRQ:\t");
@ -164,7 +174,7 @@ int main(int argc, char **argv)
/* set default endpoint device */ /* set default endpoint device */
test->device = "/dev/pci-endpoint-test.0"; test->device = "/dev/pci-endpoint-test.0";
while ((c = getopt(argc, argv, "D:b:m:x:i:dIlhrwcs:")) != EOF) while ((c = getopt(argc, argv, "D:b:m:x:i:deIlhrwcs:")) != EOF)
switch (c) { switch (c) {
case 'D': case 'D':
test->device = optarg; test->device = optarg;
@ -205,6 +215,9 @@ int main(int argc, char **argv)
case 'c': case 'c':
test->copy = true; test->copy = true;
continue; continue;
case 'e':
test->clear_irq = true;
continue;
case 's': case 's':
test->size = strtoul(optarg, NULL, 0); test->size = strtoul(optarg, NULL, 0);
continue; continue;
@ -222,6 +235,7 @@ usage:
"\t-m <msi num> MSI test (msi number between 1..32)\n" "\t-m <msi num> MSI test (msi number between 1..32)\n"
"\t-x <msix num> \tMSI-X test (msix number between 1..2048)\n" "\t-x <msix num> \tMSI-X test (msix number between 1..2048)\n"
"\t-i <irq type> \tSet IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n" "\t-i <irq type> \tSet IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n"
"\t-e Clear IRQ\n"
"\t-I Get current IRQ type configured\n" "\t-I Get current IRQ type configured\n"
"\t-d Use DMA\n" "\t-d Use DMA\n"
"\t-l Legacy IRQ test\n" "\t-l Legacy IRQ test\n"