2

If we add a device that does not support PNP (Plug-an Play), the manufacturer will hopefully provide explicit directions on how to assign IRQ values for it.

However, if we don't know what IRQ value to specify, what command line should be used to check if a IRQ value is free or not?

lsdev displays info about devices:

$lsdev 
Device            DMA   IRQ  I/O Ports
------------------------------------------------
0000:00:02.0                   7000-703f
0000:00:1f.2                   7060-707f   7080-7087   7088-708f   7090-7093   7094-7097
0000:00:1f.3                   efa0-efbf
0000:01:00.0                     6000-607f
0000:04:00.0                     4000-40ff
0000:05:00.0                     3000-30ff
acpi                      9 
ACPI                           1800-1803   1804-1805   1808-180b   1810-1815   1820-182f   1850-1850
ahci                     43      7060-707f     7080-7087     7088-708f     7090-7093     7094-7097
cascade             4       

What about this cmd lsdev, is it enough for this task? For example, if we want to know if 1233 is free, we would run this command:

lsdev | awk '{print $3}'|grep 1233  

NOTE: $3 above is used because IRQ value printed in the 3rd column of lsdev output.

Then if no output, it means that it is free for us to use?

1

Looking at the man page for lsdev there is this comment:

This program only shows the kernel's idea of what hardware is present, not what's actually physically available.

The output of lsdev is actually just the contents of the /proc/interrupts file:

excerpt from man proc

   /proc/interrupts
        This  is  used to record the number of interrupts per CPU per IO 
        device.  Since Linux 2.6.24, for the i386 and x86_64 architectures,
        at least, this also includes interrupts internal to the system (that 
        is, not associated with a device as such), such  as  NMI  (non‐
        maskable  interrupt), LOC (local timer interrupt), and for SMP 
        systems, TLB (TLB flush interrupt), RES (rescheduling interrupt), 
        CAL (remote function call interrupt), and possibly others.  Very 
        easy to read formatting, done in ASCII.

So I'd likely go off of the contents of /proc/interrupts instead:

$ cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
  0:        157          0          0          0   IO-APIC-edge      timer
  1:     114046      13823      22163      22418   IO-APIC-edge      i8042
  8:          0          0          0          1   IO-APIC-edge      rtc0
  9:     863103     151734     155913     156348   IO-APIC-fasteoi   acpi
 12:    2401994     396391     512623     477252   IO-APIC-edge      i8042
 16:        555        593        598        626   IO-APIC-fasteoi   mmc0
 19:        127         31         83         71   IO-APIC-fasteoi   ehci_hcd:usb2, firewire_ohci, ips
 23:         32          8         21         16   IO-APIC-fasteoi   ehci_hcd:usb1, i801_smbus
 40:       5467       4735    1518263    1230227   PCI-MSI-edge      ahci
 41:    1206772    1363618    2193180    1477903   PCI-MSI-edge      i915
 42:        267    5142231        817        590   PCI-MSI-edge      iwlwifi
 43:          5          8          6          4   PCI-MSI-edge      mei_me
 44:          0          2          2      23405   PCI-MSI-edge      em1
 45:         19         66         39         23   PCI-MSI-edge      snd_hda_intel
NMI:      12126      25353      28874      26600   Non-maskable interrupts
LOC:   29927091   27300830   30247245   26674337   Local timer interrupts
SPU:          0          0          0          0   Spurious interrupts
PMI:      12126      25353      28874      26600   Performance monitoring interrupts
IWI:     634179     806528     600811     632305   IRQ work interrupts
RTR:          5          1          1          0   APIC ICR read retries
RES:    4083290    3763061    3806592    3539082   Rescheduling interrupts
CAL:      16375        624      25561        737   Function call interrupts
TLB:     806653     778539     828520     806776   TLB shootdowns
TRM:          0          0          0          0   Thermal event interrupts
THR:          0          0          0          0   Threshold APIC interrupts
MCE:          0          0          0          0   Machine check exceptions
MCP:        416        416        416        416   Machine check polls
ERR:          0
MIS:          0

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.