History log of /haiku-fatelf/src/system/kernel/arch/x86/irq_routing_table.cpp
Revision Date Author Comments
# fa6327c9 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 8a5fb91c 17-Nov-2011 Michael Lotz <mmlr@mlotz.ch>

Stricter tests for PCI bridges at interrupt routing.

Validate the candidate child device a bit more by checking the device ID
and the base and subclass of the device. We don't even know if the child
is still on the PCI bus and some firmware may mark disabled devices by
simply invalidating one of these values. Possibly fixes #8111.

Added TODO concerning that we might not want to fail at all since we
ensure that we matched all devices after routing preparation at which
state we would notice any missing child devices anyway.


# 2a770280 02-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Relax ensure_all_functions_matched() to assume no interrupt use when a device
has no routing information but wasn't configured by the BIOS either. The
function will now only panic if a device that was previously configured would
not be so anymore after enabling the IO-APIC. Fixes #7971.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42795 a95241bf-73f2-0310-859d-f6bbb57e9c96


# caa82f70 26-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Don't try to check devices that are obviously not on PCI anymore.
* Fix a warning about pci_address::segment potentially being used uninitialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41760 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ce44569 25-May-2011 Michael Lotz <mmlr@mlotz.ch>

* After reading the routing table(s), do another run through the PCI devices and
check if all of them are assigned with a routing entry. If not, as happens for
PCI add-on cards that ACPI isn't aware of for example, infer the routing by
calculating it from the PCI default routing and going up through the parents
until a matching routing entry is found. Fixes #7520.
* This will also panic (for now) in case there remain unroutable devices and
eventually will prevent the IO-APIC to be used in these cases.
* Enabled some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41758 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb80e931 24-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Turn around finding the routing table on a PCI bridge and checking for it to
actually be a bridge. We always want to check if the device at hand is a PCI
bridge, because in that case we need to recurse further down. We recurse now
even if there is no routing table found for the current bridge, since that
doesn't mean that another bridge, further below, can't have a routing table
again. Possibly fixes #7520.
* Fix the matching function to just check for function 0 to be present instead
of classifying it. Previously if there happened to be a cardbus bridge on
function 0 of a multi function device, the rest of the functions of the device
would've been ignored because we returned early due to the unsupported bridge.
* Only hand down the current bus number when recursing as that makes it clearer
what's going on instead of handing in a partially filled out pci_address
structure and then filling in other parts inside the function.
* Commented out getting the segment number as we don't support it at all.
* Extended debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41726 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb4e75d3 21-May-2011 Michael Lotz <mmlr@mlotz.ch>

* When configuring a link device failed, fall back and keep the currently
active config and update the info for the remaining shared link device
entries. Seen on KVM for the (PCI) ACPI interrupt, but happens where there is
no _SRS method for a device (as this one is optional). I find that a bit
strange however as in such a case no _PRS (possible resources) should be
present either, especially not one advertising a config different from the
current one.
* Print the routing table later, after enabling irq routing, so that possible
changes due to such a fallback are included.
* Fix a typo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41652 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eda74390 11-May-2011 Michael Lotz <mmlr@mlotz.ch>

Provide an interrupt availability check callback instead of a maximum IRQ
number. This accounts for possible gaps in the IO-APIC GSI mappings. Since most
of the time there will be only a single IO-APIC the extra overhead is relatively
small.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41431 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c7e314bb 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Use const references instead of pointers for the print functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9173e384 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Choose the desired configuration of the link devices at preparation time
already. This allows to detect invalid settings before starting to enable
IRQ routing and therefore allows to gracefully fall back to PIC mode on error.
* Actually read the number of IO-APIC entries before using that number in
routing preparation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad175725 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Check hardwired and chosen IRQs against the maximum we can address. Try to fail
gracefully in such cases (resulting in the IO-APIC not being used).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41415 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c4a8701 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Remove comment that does no longer apply.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41413 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5c4213a 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually increase the usage counter by the amount of devices behind the link
device as it may have multiple devices routed to it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41402 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 80c4e0ce 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Balance the IRQs amongst the possible ones. A simple usage counter, filled by
hardwired GSIs and updated on configuring the link devices, is used for that.
This doesn't guarantee optimal results as some link devices may not be
configurable to some IRQs and we might fill up their slots this way. Most of
the time this should be good enough though.
* Take the BIOS assigned IRQ white list into account when assigning IRQs in the
ISA range and avoid assigning to non white listed IRQs. Quite probably it'd be
ok to use all of the IRQs present in the possible IRQ list, but let's play it
safe...
* Also white listed are the IRQs that were set on the link device before
reconfiguration.
* Some cleanup, use references instead of pointers where applicable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41401 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 35ce8223 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Seperated out reading and enabling IRQ routing. Reading will only read the
configuration that doesn't require any link device changes and will only
prepare for updating the pci_info. Enabling then does the link device setup
and updates the pci_info with the new IRQ values.
* Configuring link devices now takes into account that multiple devices may
share a single link device, meaning that the sharing PCI devices can't be
configured independently.

We still only blindly configure the first possible IRQ on the link devices, but
now we actually have all the information to change that. Working on that next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41400 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbfddcd6 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Separate out matching PCI devices and updating their info. They will be called
independently. Matching will happen first to enumerate and match all devices.
Updating will happen after configuring all link devices, so once we know the
final GSI of all entries. The info about matching functions is kept in a
bitmask in the table entry.
* Move routing table entry handling out of the loop into it's own function to
faciliate early returns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f65eaf15 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Read and keep around the originally assigned interrupt_line of the PCI devices.
Those can be used to white list PCI IRQs in ISA space (<= 15) as those are
basically guaranteed not to overlap with ISA devices. Those white listed entries
can then be used if we only have a 16 pin IO-APIC or if there are only legacy
IRQ resources available for configuration (i.e. ones with bitmasks of 16 bits,
limiting their range to IRQs 0-15).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41397 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de7dbd8a 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Tiny cleanup, that one went past the 80 chars.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41396 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a07f84d9 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Do the PCI device matching using direct PCI config space matches instead of
using the already parsed pci_info data from the PCI module. This removes the
need to iterate over all of the pci_infos for each routing table entries which
makes this an order of magnitude less expensive. Heavily inspired by the
corresponding FreeBSD code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41395 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2507ed4 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually use the ACPICA headers to get at the correct types instead of
duplicating the structs on our side. IRQ assignment didn't work with extended
IRQ resources because the alignment of the structs were different in our local
duplicates...
Brings in the ACPICA naming sheme and isn't really clean either. So all of the
reconfiguration should probably just be moved into the ACPI bus_manager.
On the plus side we can now use the proper descriptive macros instead of the
hardcoded numbers which fixes a few of the TODOs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3e3ae8e 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Implement a very naive configure_link_device() function that just blindly sets
the first possible configuration. This will probably result in a "everything
mapped to a single IRQ" situation, but should get systems that make use of link
devices in APIC mode at least running.
To make more sensible decisions the interface has to be changed next as it
currently doesn't allow to get anything but the very first possible config.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2a127b71 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

Reimplement the IRQ setting function. Based on the template we get from current
resources we input the desired configuration and then set them. Note that the
set_current_resources() ("_SRS") method is pretty picky (on the low-level ACPI
side) and needs the configuration in exactly the form get_current_resources()
("_CRS") returns, so that's why we need to utilize that buffer as a template.
Looking at FreeBSD there seem to be systems that don't actually provide a
"_CRS", where we will need to fall back to using the get_possible_resources()
("_PRS") data to construct a valid template...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b50b288 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Implement the PCI address retrieval on the kernel side and remove the need
for the introduced get_pci_info() method in ACPI as it doesn't work reliably.
The new version should be more robust and efficient as it only resolves the
root bridge values once.
* Don't try to read and use the secondary bus register for the root bridge as
it isn't actually a normal bridge. We get the root bridge bus by using the
Base Bus Number (_BBN) method.
* Rewrite the logic to recurse down to all busses.
* Minor debug output changes to make the info more readable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90fd2a07 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

Added root name for PCI express, a note about why it works even without it and
a TODO to eventually do it correctly anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41368 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c804ef2 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Added functionality to resolve the addresses provided in the IRQ routing table
to PCI devices partly using the new ACPI interface and by using bridge config
information from PCI.
* Added lookup of matching device/pin combinations and update of the relevant
interrupt line variable via the new PCI module function. This means that the
Global System Interrupt (GSI) that is used after switching to the IO-APIC is
now stored in the PCI config space and drivers enumerating these devices will
now attach their interrupt handlers to the right IRQs.
* Resolve all relevant interrupt information directly into the irq_routing_entry
so that can be used as the single source for config information. This includes
resolving the current setting of any PCI link devices into the irq field that
represents a GSI now.
* Use that info to configure interrupts in arch_int.cpp and remove the logic
there.
* Some cleanup and added debug output.

This implements the final missing part for using IO-APICs and full APIC mode for
interrupt routing. Note that there is no quirk handling of any form, so this
may very well not work on some configurations. Note also that I have tested this
only on one machine so far. Once proper testing is done the default of disabling
the IO-APIC can be removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 218aaf53 05-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Prettify the printed routing table.
* Remove wrong extra line when printing an irq_descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0b7f988 05-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Change some of the structure fields to more sensible types.
* The irq values we get from ACPICA are already converted, remove the wrong
extra conversion from bitfield to irq number.
* Add and handle extended irq structures.
* Disable the legacy PIC when done configuring the IOAPIC. Since during that
configuration the ACPI module is initialized, the ACPI SCI is still enabled
in the PIC instead of the IOAPIC. We'll have to delay that routing in the
ACPI module for it to work.
* Correctly handle the fixed IRQ case for the PCI interrupt routing (hopefully).
* Actually allow for enumeration of possible IRQ settings. Not yet used though.

All of this brings us a bit closer, though it still won't work for PCI
interrupts. ISA interrupts work fine through the IOAPIC as far as my hardware
goes, but PCI interrupts are connected to dedicated IOAPIC pins and I still
haven't figured out how to determine their exact routing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41328 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e52f69e 03-May-2011 Michael Lotz <mmlr@mlotz.ch>

Cleanup and a minor debug output change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fae7797 19-Mar-2011 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Just some cleanup. We won't need pci module for setup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41025 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59ada82f 20-Aug-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

First version of reading IRQ's that returns proper results.
There are TODO's in here, because the ACPI module needs restructuring and which I will take care of.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6df7fdcf 03-Jul-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Fix reading of the irq routing table.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad0b2833 11-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Fix spelling, pointed out by Stefano and Axel.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36139 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb58e3f7 06-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Rescue acpi irq stuff from my defect laptop. Code is disabled and should't to any harm.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36059 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa6327c9f48f89f3be1f229d5aca749241b55bf0 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 8a5fb91c07d432b9af95e88cecbf7cd868b79d57 17-Nov-2011 Michael Lotz <mmlr@mlotz.ch>

Stricter tests for PCI bridges at interrupt routing.

Validate the candidate child device a bit more by checking the device ID
and the base and subclass of the device. We don't even know if the child
is still on the PCI bus and some firmware may mark disabled devices by
simply invalidating one of these values. Possibly fixes #8111.

Added TODO concerning that we might not want to fail at all since we
ensure that we matched all devices after routing preparation at which
state we would notice any missing child devices anyway.


# 2a77028057a41cf2a62855c9459cd67f4a603220 02-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Relax ensure_all_functions_matched() to assume no interrupt use when a device
has no routing information but wasn't configured by the BIOS either. The
function will now only panic if a device that was previously configured would
not be so anymore after enabling the IO-APIC. Fixes #7971.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42795 a95241bf-73f2-0310-859d-f6bbb57e9c96


# caa82f7074a0bf99658638b8ca26728c39d3a3dc 26-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Don't try to check devices that are obviously not on PCI anymore.
* Fix a warning about pci_address::segment potentially being used uninitialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41760 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ce4456927f38d2bde2c8ba56d89338ab69a660a 25-May-2011 Michael Lotz <mmlr@mlotz.ch>

* After reading the routing table(s), do another run through the PCI devices and
check if all of them are assigned with a routing entry. If not, as happens for
PCI add-on cards that ACPI isn't aware of for example, infer the routing by
calculating it from the PCI default routing and going up through the parents
until a matching routing entry is found. Fixes #7520.
* This will also panic (for now) in case there remain unroutable devices and
eventually will prevent the IO-APIC to be used in these cases.
* Enabled some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41758 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb80e931f6f8501f4fa431f5b41b2b932524000f 24-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Turn around finding the routing table on a PCI bridge and checking for it to
actually be a bridge. We always want to check if the device at hand is a PCI
bridge, because in that case we need to recurse further down. We recurse now
even if there is no routing table found for the current bridge, since that
doesn't mean that another bridge, further below, can't have a routing table
again. Possibly fixes #7520.
* Fix the matching function to just check for function 0 to be present instead
of classifying it. Previously if there happened to be a cardbus bridge on
function 0 of a multi function device, the rest of the functions of the device
would've been ignored because we returned early due to the unsupported bridge.
* Only hand down the current bus number when recursing as that makes it clearer
what's going on instead of handing in a partially filled out pci_address
structure and then filling in other parts inside the function.
* Commented out getting the segment number as we don't support it at all.
* Extended debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41726 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb4e75d3ebefcb87cee402f56144caae7d11a8f5 21-May-2011 Michael Lotz <mmlr@mlotz.ch>

* When configuring a link device failed, fall back and keep the currently
active config and update the info for the remaining shared link device
entries. Seen on KVM for the (PCI) ACPI interrupt, but happens where there is
no _SRS method for a device (as this one is optional). I find that a bit
strange however as in such a case no _PRS (possible resources) should be
present either, especially not one advertising a config different from the
current one.
* Print the routing table later, after enabling irq routing, so that possible
changes due to such a fallback are included.
* Fix a typo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41652 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eda743903ea64c85411430c0a7e660d77f51e246 11-May-2011 Michael Lotz <mmlr@mlotz.ch>

Provide an interrupt availability check callback instead of a maximum IRQ
number. This accounts for possible gaps in the IO-APIC GSI mappings. Since most
of the time there will be only a single IO-APIC the extra overhead is relatively
small.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41431 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c7e314bba7367820d2e8f28fd86f9981c0b7fcda 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Use const references instead of pointers for the print functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9173e3843e8623782de1890aea764f68426b8a63 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Choose the desired configuration of the link devices at preparation time
already. This allows to detect invalid settings before starting to enable
IRQ routing and therefore allows to gracefully fall back to PIC mode on error.
* Actually read the number of IO-APIC entries before using that number in
routing preparation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad1757252e43d6fc2e682df1d95b1d9f3a0f1fbd 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Check hardwired and chosen IRQs against the maximum we can address. Try to fail
gracefully in such cases (resulting in the IO-APIC not being used).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41415 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c4a8701d6ec347cd38c2b56237898f24f795c75 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

Remove comment that does no longer apply.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41413 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5c4213aeee7d5cb8fcfe6d6137f9d4512529c7d 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually increase the usage counter by the amount of devices behind the link
device as it may have multiple devices routed to it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41402 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 80c4e0ced06167a20dc11bfeb80f4cb671a86805 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Balance the IRQs amongst the possible ones. A simple usage counter, filled by
hardwired GSIs and updated on configuring the link devices, is used for that.
This doesn't guarantee optimal results as some link devices may not be
configurable to some IRQs and we might fill up their slots this way. Most of
the time this should be good enough though.
* Take the BIOS assigned IRQ white list into account when assigning IRQs in the
ISA range and avoid assigning to non white listed IRQs. Quite probably it'd be
ok to use all of the IRQs present in the possible IRQ list, but let's play it
safe...
* Also white listed are the IRQs that were set on the link device before
reconfiguration.
* Some cleanup, use references instead of pointers where applicable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41401 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 35ce82238fa244f331ede53401d16cc884472bab 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Seperated out reading and enabling IRQ routing. Reading will only read the
configuration that doesn't require any link device changes and will only
prepare for updating the pci_info. Enabling then does the link device setup
and updates the pci_info with the new IRQ values.
* Configuring link devices now takes into account that multiple devices may
share a single link device, meaning that the sharing PCI devices can't be
configured independently.

We still only blindly configure the first possible IRQ on the link devices, but
now we actually have all the information to change that. Working on that next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41400 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbfddcd6e8ed35e06ed5d5d1c425fda3ca4448ef 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Separate out matching PCI devices and updating their info. They will be called
independently. Matching will happen first to enumerate and match all devices.
Updating will happen after configuring all link devices, so once we know the
final GSI of all entries. The info about matching functions is kept in a
bitmask in the table entry.
* Move routing table entry handling out of the loop into it's own function to
faciliate early returns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f65eaf15adbb2dc8d233534c1f3c26e8ead228bd 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Read and keep around the originally assigned interrupt_line of the PCI devices.
Those can be used to white list PCI IRQs in ISA space (<= 15) as those are
basically guaranteed not to overlap with ISA devices. Those white listed entries
can then be used if we only have a 16 pin IO-APIC or if there are only legacy
IRQ resources available for configuration (i.e. ones with bitmasks of 16 bits,
limiting their range to IRQs 0-15).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41397 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de7dbd8a331b6620adeed2c333836a49e00f0f64 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Tiny cleanup, that one went past the 80 chars.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41396 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a07f84d9cb3a5f4deb12648f285e1b1ea4d1f88b 09-May-2011 Michael Lotz <mmlr@mlotz.ch>

Do the PCI device matching using direct PCI config space matches instead of
using the already parsed pci_info data from the PCI module. This removes the
need to iterate over all of the pci_infos for each routing table entries which
makes this an order of magnitude less expensive. Heavily inspired by the
corresponding FreeBSD code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41395 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2507ed4aecb4e84364c0934a9ca95598d484465 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually use the ACPICA headers to get at the correct types instead of
duplicating the structs on our side. IRQ assignment didn't work with extended
IRQ resources because the alignment of the structs were different in our local
duplicates...
Brings in the ACPICA naming sheme and isn't really clean either. So all of the
reconfiguration should probably just be moved into the ACPI bus_manager.
On the plus side we can now use the proper descriptive macros instead of the
hardcoded numbers which fixes a few of the TODOs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3e3ae8edca87284ea610a6a43b5fdac8ccbd579 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Implement a very naive configure_link_device() function that just blindly sets
the first possible configuration. This will probably result in a "everything
mapped to a single IRQ" situation, but should get systems that make use of link
devices in APIC mode at least running.
To make more sensible decisions the interface has to be changed next as it
currently doesn't allow to get anything but the very first possible config.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2a127b718cf16c7a121eea1d9579343ccfcabfdc 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

Reimplement the IRQ setting function. Based on the template we get from current
resources we input the desired configuration and then set them. Note that the
set_current_resources() ("_SRS") method is pretty picky (on the low-level ACPI
side) and needs the configuration in exactly the form get_current_resources()
("_CRS") returns, so that's why we need to utilize that buffer as a template.
Looking at FreeBSD there seem to be systems that don't actually provide a
"_CRS", where we will need to fall back to using the get_possible_resources()
("_PRS") data to construct a valid template...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b50b2889a9260e1a1b59af7b48423205a4e1630 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Implement the PCI address retrieval on the kernel side and remove the need
for the introduced get_pci_info() method in ACPI as it doesn't work reliably.
The new version should be more robust and efficient as it only resolves the
root bridge values once.
* Don't try to read and use the secondary bus register for the root bridge as
it isn't actually a normal bridge. We get the root bridge bus by using the
Base Bus Number (_BBN) method.
* Rewrite the logic to recurse down to all busses.
* Minor debug output changes to make the info more readable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 90fd2a0795a3f5cff2b3954e01de70d53fbd362b 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

Added root name for PCI express, a note about why it works even without it and
a TODO to eventually do it correctly anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41368 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c804ef2d6816a50d59579314451a2f827bb8b95 07-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Added functionality to resolve the addresses provided in the IRQ routing table
to PCI devices partly using the new ACPI interface and by using bridge config
information from PCI.
* Added lookup of matching device/pin combinations and update of the relevant
interrupt line variable via the new PCI module function. This means that the
Global System Interrupt (GSI) that is used after switching to the IO-APIC is
now stored in the PCI config space and drivers enumerating these devices will
now attach their interrupt handlers to the right IRQs.
* Resolve all relevant interrupt information directly into the irq_routing_entry
so that can be used as the single source for config information. This includes
resolving the current setting of any PCI link devices into the irq field that
represents a GSI now.
* Use that info to configure interrupts in arch_int.cpp and remove the logic
there.
* Some cleanup and added debug output.

This implements the final missing part for using IO-APICs and full APIC mode for
interrupt routing. Note that there is no quirk handling of any form, so this
may very well not work on some configurations. Note also that I have tested this
only on one machine so far. Once proper testing is done the default of disabling
the IO-APIC can be removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 218aaf536fdb933fe9a8a468f16e6df4342917ca 05-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Prettify the printed routing table.
* Remove wrong extra line when printing an irq_descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0b7f988f45f57636059c2648849259acd6b7d32 05-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Change some of the structure fields to more sensible types.
* The irq values we get from ACPICA are already converted, remove the wrong
extra conversion from bitfield to irq number.
* Add and handle extended irq structures.
* Disable the legacy PIC when done configuring the IOAPIC. Since during that
configuration the ACPI module is initialized, the ACPI SCI is still enabled
in the PIC instead of the IOAPIC. We'll have to delay that routing in the
ACPI module for it to work.
* Correctly handle the fixed IRQ case for the PCI interrupt routing (hopefully).
* Actually allow for enumeration of possible IRQ settings. Not yet used though.

All of this brings us a bit closer, though it still won't work for PCI
interrupts. ISA interrupts work fine through the IOAPIC as far as my hardware
goes, but PCI interrupts are connected to dedicated IOAPIC pins and I still
haven't figured out how to determine their exact routing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41328 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e52f69ef2d51b7b10865c8bd75b13cb477a1101 03-May-2011 Michael Lotz <mmlr@mlotz.ch>

Cleanup and a minor debug output change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fae77976618b676ff17571fff9759402d61d961 19-Mar-2011 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Just some cleanup. We won't need pci module for setup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41025 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59ada82f2649c24116012f181a7e5da14c9e17ab 20-Aug-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

First version of reading IRQ's that returns proper results.
There are TODO's in here, because the ACPI module needs restructuring and which I will take care of.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6df7fdcf0347bd55f399e00ed228f8dda63de850 03-Jul-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Fix reading of the irq routing table.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad0b28334d09ee5ae254a5c2c1837c85187c00a3 11-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Fix spelling, pointed out by Stefano and Axel.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36139 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cb58e3f7843976f2f0da38e67b6ad0849837a3dd 06-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Rescue acpi irq stuff from my defect laptop. Code is disabled and should't to any harm.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36059 a95241bf-73f2-0310-859d-f6bbb57e9c96