Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ intr(D2) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       intr(D2)                                                    intr(D2)


       NAME
             intr - process a device interrupt

       SYNOPSIS
             void prefixintr(int ivec);

          Arguments
             ivec      Number used by the operating system to associate a
                       driver's interrupt handler with an interrupting
                       device.  The makeup and interpretation of ivec is
                       specific to each system implementation.  On some
                       systems, this number may be the logical device
                       number, or a combination of logical device and
                       logical controller numbers, used to map the correct
                       interrupt routine with a subdevice.  On others, this
                       number could be the interrupt vector number.

       DESCRIPTION
             The intr routine is the interrupt handler for both block and
             character hardware drivers, as well as for non-driver hardware
             modules.

          Return Values
             None

       USAGE
             This entry point is only required for those modules that
             interface to hardware that interrupts the host computer.  It
             is not used with software drivers.

             The interrupt handler is responsible for determining the
             reason for an interrupt, servicing the interrupt, and waking
             up any base-level driver processes sleeping on any events
             associated with the interrupt.

             For example, when a disk drive has transferred information to
             the host to satisfy a read request, the disk drive's
             controller generates an interrupt.  The CPU acknowledges the
             interrupt and calls the interrupt handler associated with that
             controller and disk drive.  The interrupt routine services the
             interrupt and then wakes up the driver base-level process
             waiting for data.  The base-level portion of the driver then
             conveys the data to the user.





                           Copyright 1994 Novell, Inc.               Page 1













      intr(D2)                                                    intr(D2)


            In general, most interrupt routines do the following tasks:

                  keep a record of interrupt occurrences

                  return immediately if no devices controlled by a driver
                  caused the interrupt (only for systems supporting shared
                  interrupts)

                  interpret the interrupt routine argument ivec

                  reject requests for devices that are not served by the
                  device's controller

                  process interrupts that happen without cause (called
                  spurious interrupts)

                  handle all possible device errors

                  wake processes that are sleeping on any events
                  associated with the interrupt

            There are also many tasks the intr routine must perform that
            are driver-type and device specific.  For example, the
            following types of drivers require different functions from
            their intr routines:

                  A block driver dequeues requests and wakes up processes
                  sleeping on an I/O request.

                  A terminal driver receives and sends characters.

                  A printer driver ensures that characters are sent.

            In addition, the functions of an intr routine are device
            dependent.  You should know the exact chip set that produces
            the interrupt for your device.  You need to know the exact bit
            patterns of the device's control and status register and how
            data is transmitted into and out of your computer.  These
            specifics differ for every device you access.

            The intr routine for an intelligent controller that does not
            use individual interrupt vectors for each subdevice must
            access the completion queue to determine which subdevice
            generated the interrupt.  It must also update the status
            information, set/clear flags, set/clear error indicators, and
            so forth to complete the handling of a job.  The code should


                          Copyright 1994 Novell, Inc.               Page 2













       intr(D2)                                                    intr(D2)


             also be able to handle a spurious completion interrupt
             identified by an empty completion queue.  When the routine
             finishes, it should advance the unload pointer to the next
             entry in the completion queue.

             If the driver called biowait(D3) or sleep(D3) [or, for
             multithreaded drivers, called SV_WAIT(D3) or SV_WAIT_SIG(D3)]
             to await the completion of an operation, the intr routine must
             call biodone(D3) or wakeup(D3) [or, for multithreaded drivers,
             call SV_SIGNAL(D3) or SV_BROADCAST(D3)] to signal the process
             to resume.

             The interrupt routine runs at the processor level associated
             with the interrupt level for the given device.  Lower priority
             interrupts are deferred while the interrupt routine is active.
             Certain processor levels can block different interrupts.  See
             spl(D3) for more information.

             uiomove(D3), ureadc(D3), and uwritec(D3) cannot be used in an
             interrupt routine when the uio_segflg member of the uio(D4)
             structure is set to UIO_USERSPACE (indicating a transfer
             between user and kernel space).

          Synchronization Constraints
             The intr routine must never:

                   use functions that sleep

                   drop the interrupt priority level below the level at
                   which the interrupt routine was entered

                   call any function or routine that requires user context
                   (that is, if it accesses or alters information
                   associated with the running process)

       REFERENCES
             biodone(D3), biowait(D3), spl(D3), SV_BROADCAST(D3),
             SV_SIGNAL(D3), SV_WAIT(D3), SV_WAIT_SIG(D3), wakeup(D3)

       NOTICES
          Portability
             AT-compatible architectures

          Applicability
             ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp



                           Copyright 1994 Novell, Inc.               Page 3








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026