Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 1999 22:24:57 +0200
From:      sthaug@nethelp.no
To:        freebsd-hackers@freebsd.org, freebsd-smp@freebsd.org
Subject:   rndcontrol and SMP
Message-ID:  <57419.932675097@verdi.nethelp.no>

next in thread | raw e-mail | index | archive | help
rndcontrol doesn't work very well for SMP systems. I have a system here
with IRQs 16 and 18 for Ethernet and SCSI:

fxp0: <Intel EtherExpress Pro 10/100B Ethernet> rev 0x05 int a irq 18 on pci0.10.0
ahc0: <Adaptec 2940 Ultra2 SCSI adapter> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57419.932675097>