[comp.os.minix] Triple Ugly

ackerman@uvm-gen.UUCP (Steve Ackerman) (01/28/89)

In article <1480@ditsyda.oz> evans@ditsyda.oz (Bruce Evans) writes:

> In article <1941@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) writes:
> > Second, I think is is cleaner to have the EOI sent in a single place for
> > all device classes, rather than having every routine have to worry about it
> 
> I don't object to a single EOI statement done in interrupt(). But what is
> done now defeats the point of this: it tests for the special cases
> 
> 	ps && task == FLOPPY
> 	pc_at && task == WINCHESTER
> 
> to decide the appropiate place to send the EOI to. Since only CLOCK, FLOPPY,
> PRINTER and WINCHESTER currently depend on the EOI done here, only two cases
> are being handled generally. All the PS cases for models >= 50 will be
> different again.

    I agree with everything, but is there a better way besides totally
  redesigning how interrupts are handled in Minix?
   
> Interrupt() must be kept short since it runs with interrupts disabled. So I
> don't want to have any port_out()s in it (a dozen or so instructions in C
> compared with 2 in assembler) or lots of cases to check. Attention to this
> detail was one of the things required to boost rs232 performance from 300
> baud to 19200 baud on a 5MHz 8088.

    Maybe the interrupt routines should do the "checks".  That way, the code
  would be very fast (assembly), and it would keep much of the dependencies
  out of the C code.

    Right now, the code is quite ugly (Triple ugly, in fact!).  Since I've
  been trying to finish the 1.1 -> 1.3 upgrade, I haven't had time to "clean"
  up the code.  Currently, the interrupt code looks something like:

     if (mca && task == FLOPPY) {       /* Need to mask of Disk Interrupt
            port_in(INT_CTLMASK, &valu); * for PS/2 Model <= 50 
            valu |= 0x40;                */
            port_out(INT_CTLMASK, valu);

    In fdc_results() after reading in all the bytes from the FDC and before
  returning, there is a brief delay loop, and then the disk interrupts are
  turned on.  This is the Double Ugly approach Dr. Tanenbuam was talking 
  about in article <1944@ast.cs.vu.nl>.  However, there is also another
  kludge that makes it Triple ugly!  For some reason, there appears to
  be an extra interrupt, which gets sent to floppy_task().  Since the
  sender is HARDWARE, floppy_task does a panic.  To get around this for
  the time being, I an if statement in floppy_task to ignore it and continue.
  Like I said: triple ugly.

    I haven't been spending much time lately on this particular problem since
  I've been working on finishing the upgrade process 1.1 -> 1.3 -> 1.4.  If
  anyone has a PS/2 and wants a copy of my KLUDGED proc.c and floppy.c in 
  order to help solve this problem, send me e-mail.

    I was able to try my changes on a Model 50, and they worked.  A friend
  of mine has a Model 60 at work, and he said he'd be willing to test Minix
  on it.  So, it appears the question is no longer "can we get Minix to
  run on a PS/2", but "what's the best way to code it".  If there are any
  suggestions about the "KLUDGE", tell me, and I'll try to implement them.
  For now, I've got library woes, and commands to compile, and cdiffs to
  patch! :-)

  Steve
--
============================================================================
Steven Ackerman                          |  EMBA-CF University of Vermont    
uunet!uvm-gen!ackerman                   |  Burlington, Vermont 05401 
Internet: ackerman@uvm-gen.uvm.edu       |  Telephone: (802) 879-0371