Here's a good article about how
PCI Interrupts for x86 Machines under FreeBSD are implemented. While the article is targeted at FreeBSD, it also looks into the various interrupt routing mechanisms on x86 which apply to all systems software such as firmware and operating systems.