From owner-freebsd-hackers Thu Jul 22 13:25:47 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from verdi.nethelp.no (verdi.nethelp.no [158.36.41.162]) by hub.freebsd.org (Postfix) with SMTP id 35F71155E8 for ; Thu, 22 Jul 1999 13:25:41 -0700 (PDT) (envelope-from sthaug@nethelp.no) Received: (qmail 57421 invoked by uid 1001); 22 Jul 1999 20:24:57 +0000 (GMT) To: freebsd-hackers@freebsd.org, freebsd-smp@freebsd.org Subject: rndcontrol and SMP From: sthaug@nethelp.no X-Mailer: Mew version 1.05+ on Emacs 19.34.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Date: Thu, 22 Jul 1999 22:24:57 +0200 Message-ID: <57419.932675097@verdi.nethelp.no> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG rndcontrol doesn't work very well for SMP systems. I have a system here with IRQs 16 and 18 for Ethernet and SCSI: fxp0: rev 0x05 int a irq 18 on pci0.10.0 ahc0: rev 0x00 int a irq 16 on pci0.12.0 and I'd like to use these with rndcontrol. However, the ioctl chokes on IRQ >= 16. From i386/i386/mem.c: /* * XXX the data is 16-bit due to a historical botch, so we use * magic 16's instead of ICU_LEN and can't support 24 interrupts * under SMP. */ intr = *(int16_t *)data; if (cmd != MEM_RETURNIRQ && (intr < 0 || intr >= 16)) return (EINVAL); What is needed to make this support a more sensible number of IRQs? Also, rndcontrol naturally returns an error message, which could have been better: rndcontrol: rndcontrol: Invalid argument rndcontrol uses warn() with argv[0] as the argument - but warn() is documented to always print the program name. So it gets doubled. Below is a patch against 3.2-STABLE to make it slightly more intelligent, so we get an error message like this instead: rndcontrol: setting irq 16: Invalid argument Steinar Haug, Nethelp consulting, sthaug@nethelp.no ---------------------------------------------------------------------- *** rndcontrol.c.orig Mon Oct 13 13:08:47 1997 --- rndcontrol.c Thu Jul 22 22:06:52 1999 *************** *** 76,82 **** printf("%s: setting irq %d\n", argv[0], irq); result = ioctl(fd, MEM_SETIRQ, (char *)&irq); if (result == -1) { ! warn("%s", argv[0]); return (1); } break; --- 76,82 ---- printf("%s: setting irq %d\n", argv[0], irq); result = ioctl(fd, MEM_SETIRQ, (char *)&irq); if (result == -1) { ! warn("setting irq %d", irq); return (1); } break; *************** *** 86,92 **** printf("%s: clearing irq %d\n", argv[0], irq); result = ioctl(fd, MEM_CLEARIRQ, (char *)&irq); if (result == -1) { ! warn("%s", argv[0]); return (1); } break; --- 86,92 ---- printf("%s: clearing irq %d\n", argv[0], irq); result = ioctl(fd, MEM_CLEARIRQ, (char *)&irq); if (result == -1) { ! warn("clearing irq %d", irq); return (1); } break; *************** *** 98,104 **** if (verbose) { result = ioctl(fd, MEM_RETURNIRQ, (char *)&irq); if (result == -1) { ! warn("%s", argv[0]); return (1); } printf("%s: interrupts in use:", argv[0]); --- 98,104 ---- if (verbose) { result = ioctl(fd, MEM_RETURNIRQ, (char *)&irq); if (result == -1) { ! warn(""); return (1); } printf("%s: interrupts in use:", argv[0]); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message