Commit Graph

4414 Commits

Author SHA1 Message Date
Michael Lotz
c7e314bba7 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
2011-05-10 10:07:46 +00:00
Michael Lotz
9173e3843e * 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
2011-05-10 09:59:50 +00:00
Michael Lotz
ad1757252e 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
2011-05-10 09:29:57 +00:00
Michael Lotz
414f205aee Remove the IRQ to IO-APIC pin mapping array. It isn't used as we don't redirect
vectors at all. It'd also not work for multi IO-APIC setups which we don't
support yet (but are relatively rare anyway).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41414 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-10 08:50:57 +00:00
Michael Lotz
3c4a8701d6 Remove comment that does no longer apply.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41413 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-10 07:31:55 +00:00
Michael Lotz
c5c4213aee 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
2011-05-09 16:49:17 +00:00
Michael Lotz
80c4e0ced0 * 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
2011-05-09 16:46:18 +00:00
Michael Lotz
35ce82238f * 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
2011-05-09 15:38:18 +00:00
Michael Lotz
cbfddcd6e8 * 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
2011-05-09 13:26:41 +00:00
Michael Lotz
f65eaf15ad 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
2011-05-09 12:19:41 +00:00
Michael Lotz
de7dbd8a33 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
2011-05-09 11:59:31 +00:00
Michael Lotz
a07f84d9cb 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
2011-05-09 11:53:52 +00:00
Philippe Houdoin
48315186a8 Remove reference to SVN, now that revision is a VCS-agnostic string...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41394 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-09 11:49:03 +00:00
Michael Lotz
c2507ed4ae 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
2011-05-09 01:56:20 +00:00
Oliver Tappe
6250297a08 Switch haiku-revision from uint32 to string, as that's going to be required soon, no matter if we switch to Git or Mercurial
* increase _SYS_NAMELEN defined in sys/utsname.h to 128 to allow long(ish) revisions
* sHaikuRevision is now a static character array (in both libroot and kernel)
* adjust build tool set_haiku_revision to write the revision as string


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41389 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-08 20:02:42 +00:00
Michael Lotz
d3e3ae8edc 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
2011-05-08 13:15:26 +00:00
Michael Lotz
2a127b718c 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
2011-05-08 12:56:49 +00:00
Michael Lotz
348eade4a8 Print the routing table unconditionally for now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41373 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-08 01:17:02 +00:00
Michael Lotz
9b50b2889a * 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
2011-05-08 01:07:39 +00:00
Michael Lotz
56b5ad0781 Added a temporary opt-in option "enable_ioapic" to the boot menu. This way the
IO-APIC can be easily enabled to test it on various configurations. Note that
the previous default opt-out didn't work because the safemode options would not
be touched at all when not actually entering the boot menu.
Once IO-APIC is more broadly tested this can be removed again and the opt-out
option reenabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-07 21:41:09 +00:00
Michael Lotz
90fd2a0795 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
2011-05-07 17:36:10 +00:00
Michael Lotz
8c804ef2d6 * 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
2011-05-07 17:32:12 +00:00
François Revol
6d4e8bc473 More Milan specific stuff...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41355 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-06 21:35:17 +00:00
François Revol
6091174371 Add some calls for Milan debugging.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41351 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-06 20:11:05 +00:00
Michael Lotz
218aaf536f * 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
2011-05-06 02:01:09 +00:00
Michael Lotz
1882d05b95 We need to specify the intended interrupt model with ACPI so that we get the
correct PCI IRQ routing table for that mode. With this, we finally get the right
PIRQ <-> Global System Interrupt mapping and can therefore program the right
IO APIC entries. The only missing part now is to fix up the pci_info of the
devices with the then active GSI.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-06 01:55:58 +00:00
Michael Lotz
c846e2aab0 Remove wrong comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41329 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-05 20:06:23 +00:00
Michael Lotz
c0b7f988f4 * 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
2011-05-05 19:59:04 +00:00
Michael Lotz
8e52f69ef2 Cleanup and a minor debug output change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41313 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-03 22:49:27 +00:00
Clemens Zeidler
08444962ae Interpret a year like 10 as 2010 and not as 1910 if the now time is near 2010. Add test case for that.
Should fix #7257.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41146 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-31 04:55:08 +00:00
Axel Dörfler
5b82a6b615 * Obviously forgot to compile after a last minute change, sorry!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-26 22:07:27 +00:00
Axel Dörfler
ea8749b6b5 * legacy_driver::devices_used was not taken into account when deciding to
unload a driver. This was causing bug #4608 depending on the order of events;
  now you should have less worries removing your USB device before having it
  unmounted.
* Added a "legacy_device" KDL command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-26 20:26:33 +00:00
Axel Dörfler
31cf5e520a * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-26 20:23:21 +00:00
Axel Dörfler
2545ff58c1 * Applied patch by VinDuv/Jonas to use the existing check_for_key() that fixes
a problem on the Mac which obviously messed up its BIOS.
* This busy loops, but CPU utilization should be a maxed out in the boot loader
  anyway - we could add a pause, though.
* This closes bug #2654.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-26 20:01:37 +00:00
Fredrik Holmqvist
7fae779766 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
2011-03-19 11:47:18 +00:00
Ithamar R. Adema
e59aab0981 ARM: Some header cleanup in preperation of more CPU support code...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40948 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-14 13:48:21 +00:00
Ithamar R. Adema
36fa904ede Fix aligment of data segment, by moving our ARM ldscript closer to the X86 one. This restores
the state of the ARM port to booting all the way up to the idle thread again.

However, will still need to investigate why we need the PHDRS magic, likely due to improper
setup of the ARM toolchain. If anyone has ideas, please let me know!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-13 23:17:29 +00:00
Ithamar R. Adema
60644e6de6 * Add support for R_ARM_ABS32 to kernel ELF linker
* Removal of some commented out (messy) code



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-13 15:48:52 +00:00
Ithamar R. Adema
5707f2519c * Quiet down VM debug output, so we can easily find errors ;)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-13 10:42:18 +00:00
Ithamar R. Adema
8bbaee6124 * Fix ARM kernel compilation
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40926 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-13 10:28:51 +00:00
Jérôme Duval
8775d8d25d dir_remove() now handles a path which ends with "/./" and fixed #6817.
Another way would be to disallow removing such a path, as Linux does.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-05 17:17:19 +00:00
Oliver Tappe
e8226ce48d * fix support for influencing tzset() via TZ environment variable
(now at least <std> and <offset> are supported properly)
* instead of creating a TimeZone object whenever needed, we now
  create it in tzset() and keep it around
* add tests for TZ to locale_test

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40788 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-03 00:34:51 +00:00
Jérôme Duval
548836e4f8 * if ioctl hook wasn't found, now returns B_DEV_INVALID_IOCTL
* in case fd_ioctl() was about to return B_DEV_INVALID_IOCTL, translate to ENOTTY to satisfy #7279.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40787 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-02 18:58:14 +00:00
Jérôme Duval
57ceeee424 copy sig_action structure from the current thread if we're the same team. Helps with #7235
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40701 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-26 15:26:47 +00:00
Jérôme Duval
fa90700d74 reverted r40686
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40699 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-26 10:45:03 +00:00
Jérôme Duval
3116b031dc FIONBIO and FIONREAD don't apply to directories, files, attributes: returns ENOTTY in these cases. This fixes #7279.
ENOTTY could also be replaced with a B_ error code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-25 19:58:25 +00:00
Philippe Saint-Pierre
85b2f68b69 Fix build on gcc2.
(Note, I honestly have no idea what was initially wrong with the code; everything seamt right to me..)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40676 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-25 01:49:26 +00:00
Jérôme Duval
3a04b74922 Don't dereference thread after free(). Thanks to Stephan for noticing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-24 22:53:01 +00:00
Jérôme Duval
bafa759148 now correctly init the thread id in the pthread struct for main thread and threads spawned with spawn_thread(). This definitely helps for #7235.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40665 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-24 17:28:59 +00:00
Philippe Houdoin
a4c21b1c82 Check if the name is already used in add_debugger_command*() and reject
duplicate attempt(s).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-22 11:56:57 +00:00