-1

I was creating some drivers and I found my self stuck in the IRQ Pins, my kernel uses IOAPIC and I don't know how this interrupt mechanism (IRQ Pins) works and how to get them and use them.

Can anyone give a detailled answer on how to use them to make interrupts work.

git_lk1
  • 76
  • 1
  • 8
  • I think more detail about the question is needed. If you don't have the detail, it's probably something a tutorial would cover. – user253751 Jul 15 '22 at 11:43
  • The question is simple, how to get IRQ Pins. What do u need as detail ? I already knew that I need to parse DSDT And I started doing that, but I asked to see if there is an easier way to do it. I think the DSDT is not that hard to read, I'll continue as I can support alot of other things aswell – git_lk1 Jul 25 '22 at 19:43

1 Answers1

1

A PCI device can potentially use up to 4 interrupt pins INTA#, INTB#, INTC# and INTD#. These signals will be wired to the interrupt controller. They are level-sensitive and may be shared by other PCI devices. If it has a single PCI function it will typically use INTA# if it uses one at all. If it has multiple PCI functions, the different PCI functions (up to 8) may use different interrupt pins or share the same one.

The read-only "Interrupt Pin" register at offset 3Dh in the PCI function's Type 00h configuration header says which interrupt pin the PCI function is using: 0 = none, 1 = INTA#, 2 = INTB#, 3 = INTC#, 4 = INTD#.

The read-write "Interrupt Line" register at offset 3Ch in the Type 00h configuration defines which IRQ number has been assigned to the PCI function by the system firmware (BIOS) or operating system. This IRQ number may be shared by other devices in the system.

Drivers don't usually care much about the "Interrupt Pin" register. They are more interested in the "Interrupt Line" register value set up by the firmware or operating system. Operating systems usually provide this information in a more friendly way than the driver having to retrieve the information directly from the PCI configuration memory.

Ian Abbott
  • 15,083
  • 19
  • 33
  • Yes but I use IOAPIC So I can't use Interrupt line cause it's only for LEGACY PIC. – git_lk1 Jul 15 '22 at 12:27
  • @git_lk1 How primitive is this operating system? Doesn't it handle the IOAPIC for you? – Ian Abbott Jul 15 '22 at 12:31
  • 1
    No, this is **my** Operating System Made from scratch, it handles simple IOAPIC Interrupts such as RTC & SMI – git_lk1 Jul 15 '22 at 13:03
  • I want to get the relative IRQ Number from the interrupt pins. – git_lk1 Jul 15 '22 at 13:05
  • There isn't an easy answer. There should be PCI (interrupt) routing table information in the ACPI DSDT table. See https://uefi.org/specs/ACPI/6.4/06_Device_Configuration/Device_Configuration.html#prt-pci-routing-table – Ian Abbott Jul 21 '22 at 15:41