Commit Graph

4468 Commits

Author SHA1 Message Date
Rene Gollent
e7d7b1e232 Add debug option to disable the on-screen debug output's paging by default, for
cases such as USB keyboards where the keyboard no longer functions once the 
kernel is entered and the USB stack initializes.

Implements #7561.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41736 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-25 02:56:46 +00:00
Michael Lotz
cb80e931f6 * 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
2011-05-25 00:11:33 +00:00
Rene Gollent
e26b9867f0 Build fix, removed one line too many.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-24 12:34:05 +00:00
Rene Gollent
5e3eb88b1c Cleanup: no need for parsing since the kernel settings will handle semicolon separated options directly. Thanks Axel!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41707 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-24 12:10:57 +00:00
Rene Gollent
8837310ce7 * Slightly alter the semantics of the input gathering function to take the
menu item it's associated with rather than an input string. This allows it
  to calculate the position to start the input at, as well as the correct
  line to place it on. The previous solution always put the input at the
  center line, which happened to be the right place by happy coincidence
  unless one also had the menu items for viewing/saving the debug syslog
  present.
* Implement input buffer scrolling, and consequently lift the previous size
  limit on user input (it is now only limited by the size of the passed in
  buffer).
* Implement parsing of the input buffer to allow it to handle comma-separated
  options. Thus, one can now input things like "disable_smp true, serial_debug_output false"
  and it will be handled properly.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41706 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-24 03:21:51 +00:00
Michael Lotz
2c0d5258df Of course the PIC mask register is a _mask_ and the enabled interrupts are the
ones that aren't masked. This reversed the enabled interrupts and therefore
disabled the already installed ACPI SCI handler and wrongly enabled the other
interrupt pins instead on PIC to IO-APIC handover. Probably fixes #7525.
+r1alpha3


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 18:01:59 +00:00
Michael Lotz
f599932f82 * Simplify APIC writes.
* Add explicit volatile keyword.
* Minor variable name cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41684 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 15:02:05 +00:00
Michael Lotz
2ae3d5121c Switch to using the PIT in mode 0 (interrupt on 0) instead of mode 2 (rate
generator). There are chipsets (namely ATI/AMD SBx00) where mode 2 doesn't seem
to work (the counter isn't reloaded after the countdown has completed). Mode 0
has the same resolution as mode 2 and, as interrupts are disabled at this point
in booting, is otherwise equivalent as well. I've tested this on 5 machines
available to me and it doesn't seem to have any negative effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 14:51:42 +00:00
Michael Lotz
7adc7269d8 * Re-program the timer for each loop instead of waiting for it to wrap around.
With that we will usually start right away without having to wait for the
  timer to be in the desired state, which removes roughly 116ms of spinning
  around for a normal calibration run.
* Read back the value once after programming. The delay this introduces
  accounts for the fact that the counter will only start counting down on the
  next clock cycle.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41680 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 13:25:44 +00:00
Michael Lotz
2d62c17d26 * Add a limit to how often we retry the calibration. It's there as an upper
bound to prevent spinning forever if we have a very unstable TSC that we
  simply can't calibrate. Shouldn't really happen though.
* Set the gate low for channel 2 on exit if we used it as the counter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41678 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 12:36:43 +00:00
Michael Lotz
34d3f13c64 * Put the calibration loop into a static inline function and replace the three
copies of it with a call to that.
* Make the variable names more readable and spacing cleanup.

No functional change intended.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41670 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 11:15:51 +00:00
Michael Lotz
d620303480 * Use macros to make the PIT programming more readable. Yes, I know that the PIT
timer code has such definitions too, but they're not quite as verbose. Will
  eventually make the latter use these too.
* Prepare for possibly using other PIT channels for the calibration. Right now
  everything's the same still.
* Add disabled print of the resulting factors.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-23 10:33:10 +00:00
Michael Lotz
cb4e75d3eb * 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
2011-05-22 12:06:17 +00:00
François Revol
76b93c655d Fix the Amiga bootloader build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41600 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-19 23:08:03 +00:00
Rene Gollent
93e483aeab Another build fix...need coffee.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41580 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-19 12:08:13 +00:00
Rene Gollent
b4aa5d34cf Build fixes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-19 03:33:56 +00:00
Rene Gollent
d2b49a0031 * Implement support for user input of additional safe mode options that
aren't otherwise exposed via the safe mode menus. The option can be 
found under the debug options menu, where additional settings can be 
added one at a time with the same syntax used in kernel settings files 
(i.e. disable_acpi on). 

Scrolling of the input buffer is not yet supported (will implement that 
soon), so currently the input is clamped to the size of one line. This 
shouldn't be a problem for our current set of options though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41577 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-19 01:38:02 +00:00
Rene Gollent
13fd92e6a0 Update boot loader copyright year. Resolves #7515.
+alpha3



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-18 23:10:23 +00:00
Ingo Weinhold
222b8cf7b7 cache_io(): Since satisfy_cache_io() (respectively the function it calls)
unlocks the cache, we have to look up the page again, since someone else could
have removed it in the meantime. Possibly fixes #7514.

+r1alpha3


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41564 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-18 10:13:44 +00:00
Michael Lotz
aa373c439f We have to decouple the enumeration and marking of the NMIs from the actual NMI
pin configuration as the configuration only happens after preparing the
configuration where we already need the NMI mask.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41536 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 14:59:25 +00:00
Michael Lotz
74e9ede3b2 Simplify and clean up. Removed most of the shifts and made direct masks out of
the macros. This makes things more readable and also fixes the few remaining
80 char limit violations. No functional change intended.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41533 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 14:32:01 +00:00
Michael Lotz
bc409b4915 Fix minor debug output oversight in the last commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 14:11:24 +00:00
Michael Lotz
9ae3fdcb02 * Move redirection entry configuration into a separate function and allow to
specify the delivery mode.
* Use that function from ioapic_configure_io_interrupt() and use it when
  configuring NMI sources to actually set the entries to NMI.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 14:06:27 +00:00
Michael Lotz
86d59c04c6 Support NMI sources. Any non maskable interrupt (NMI) will be marked as
unavailable for routing so that we don't end up configuring anything on them.
I haven't seen these in actual use though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41530 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 13:36:31 +00:00
Michael Lotz
22d72c8ee1 Guard against IO-APICs with too many entries. We only support 64 entries because
we use a 64 bit level triggered mask. In practice these don't exist as far as I
know. If we encounter them at a later stage we need to revisit the mask.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41529 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 13:25:45 +00:00
Michael Lotz
fb5a1727f4 * Implement interrupt source overrides. We install a relay interrupt handler
at the override entry to trigger the overriden vector so that we don't need
  to configure any additional redirections.
* Also configures the polarity and trigger modes found in the override entry.
* When disabling the legacy PIC, retrieve the enabled interrupts and re-enable
  then in the IO-APIC. This will for example make the ACPI SCI work that is
  installed prior to switching interrupt models. Through the transparent support
  for interrupt source overrides it'll also automatically relay from the old to
  the new vector.

This should make ACPI interrupts work and should support relocating the ISA PIT
from irq 0 to a different global system interrupt (usually 2) so that it can
still work when IO-APICs are in use.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 12:57:40 +00:00
Michael Lotz
9c1714ec1a Enable IO-APICs by default. It's been tested on a broad spectrum of hardware and
all reports so far have been positive. We fall back to legacy mode in the cases
where we can't figure out the correct routing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-16 08:42:30 +00:00
Oliver Tappe
6a5ce30120 Move functions declared in private/system/system_info.h out of the public namespace.
* prepend private functions get_system_info_etc(), start_watching_system() and 
  stop_watching_system() with '__'
* adjust callers accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41517 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-15 17:02:36 +00:00
Oliver Tappe
22a7fe9695 Cleanup system-revision stuff.
* move system_revision.h to headers/private/libroot
* unify libroot's get_system_revision() (the one I introduced recently) with kernel's
  get_haiku_revision(), the function is now called get_haiku_revision() in the kernel
  and __get_haiku_revision() in libroot
* system_revision.c is now being built as part of libroot and as part of the kernel
* adjusted all callers of get_system_revision() accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41516 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-15 16:33:30 +00:00
Michael Lotz
e64bb27712 Fix another oversight of r41500. The size check was using sizeof(char *) instead
of bufferSize, corrupting entries when multiple items within the same menu were
checked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41505 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-14 23:22:35 +00:00
Michael Lotz
192bc027ea Disabling the local APIC also means disabling SMP, as the APIC is the base for
all inter-CPU messaging. The previously described timekeeping is just an extra
function of local APICs. Before, if you'd select "disable local APIC" it would
still blindly write to invalid memory (targetting the non-mapped local APIC) and
then just hang waiting for the other CPUs (that were obviously not responding
to the init sequence that wasn't programmed).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41504 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-14 23:09:18 +00:00
Michael Lotz
ba0c232abb Fix typo that caused the (first) IO-APIC address not to be set anymore when
configuring SMP via MP tables. We don't support that method anyhow, but it
should still report correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-14 22:37:26 +00:00
Rene Gollent
469cccb22c Fix small error in previous commit that resulted in the fix not working as intended.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41501 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-14 21:12:07 +00:00
Rene Gollent
e21407d07b When applying settings from the boot menus, aggregate them and then add them
to the kernel args in a single go. Otherwise we wind up with more link list
entries than expected, which in turn resulted in settings not quite being
parsed properly upon entering the kernel, which meant that if options were
chosen in both the debug and safe mode menus, only the debug ones were
applied. This might also have resulted in the kernel settings not being
loaded correctly in such an instance.

Should fix various issues people have had with safe mode settings not being
applied properly.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-14 20:37:37 +00:00
Oliver Tappe
a961bbc69d * move sHaikuRevision from uname.c into new system_revision.c
* add private function get_system_revision() for accessing the
  revision string
* adjust uname to use get_system_revision

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41479 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-13 20:38:14 +00:00
Michael Lotz
8908aef9c2 * Don't map the IO-APIC within the bootloader. We don't need it to set up SMP
at all and, since there can be multiple IO-APICs, we need to do the
  enumeration again in the kernel anyway. Also only set ioapic_phys the first
  time we encounter an IO-APIC object as it looks cleaner when we arrive at the
  first IO-APIC default address.
* Therefore we don't have to worry about already mapped IO-APICs when
  enumerating them in the kernel.
* Also remove the mapping function that is now not used anymore.
* We still use the ioapic_phys field of the kernel args to determine whether
  there is an IO-APIC at all to avoid needlessly doing the enumeration again.

This fixes multi IO-APIC configurations, because before we would indeed map
the last IO-APIC listed in the MADT, but then in the kernel assumed we mapped
the first one. We'd end up with mapping the last listed IO-APIC twice and the
first IO-APIC never, always programming the last one when we actually targetted
the first one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41476 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-13 16:31:31 +00:00
Michael Lotz
0798779a2f Resolve TODO: Take the writing order into account. Ensure the mask bit is
written first/last depending on the operation to avoid modifying entries that
are still unmasked or unmasking entries that aren't set up yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41457 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-12 00:11:34 +00:00
Michael Lotz
f91cbdde46 Better watch those 1s. These are actually signed 32 bit values, so they will
have unexpected side effects once we shift them more than 30 bits.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41452 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 23:38:06 +00:00
Michael Lotz
ca00b28e8b Fix another case where the local interrupt vector would be added instead of the
global system one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41451 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 23:17:12 +00:00
Michael Lotz
0414a20330 Print some more MADT entries when debug output is enabled. Right now they are
informational only, but most of these entries actually need to be handled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 23:14:02 +00:00
Michael Lotz
6347525607 * Always retrieve the APIC ID from the descriptors.
* Actually program the IO-APIC ID when configuring the IO-APIC.
* Moved some debug output around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41447 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 19:55:56 +00:00
Ingo Weinhold
5e36c12a42 mmu_allocate_physical(): The wrong base argument was passed to
get_free_physical_address_range(). Fixes the debug syslog feature.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41446 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 19:10:26 +00:00
Michael Lotz
a56cbb2afb * When initializing MSI support, don't assume a single 24 entry IO-APIC. Instead
mark the ISA interrupts as unusable and then use ioapic_is_interrupt_available
  to determine if that vector is possibly taken by an IO-APIC. If IO-APICs are
  not used, this will simply always return false, leaving all vectors free for
  MSI use.
* The msi_init() now has to be done after a potential IO-APIC init, so it is now
  done after ioapic_init() instead of inside apic_init().
* Add apic_disable_local_ints() to clear the local ints on the local APIC once
  we are in APIC mode (i.e. the IO-APIC is set up and we don't need the external
  routing anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41445 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 18:05:05 +00:00
Michael Lotz
0f91697fd7 Fix previous commit and add printing APIC id fields.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41437 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 11:24:15 +00:00
Michael Lotz
cdb247a328 Extended and fix some of the debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 11:16:10 +00:00
Michael Lotz
7a8ce431b5 Obviously we want to use the GSI as interrupt vector as well...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41435 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 09:49:51 +00:00
Michael Lotz
e9d5569740 Only make GSI 0 into an ExtInt and GSIs 1-15 ISA interrupts. When having
multiple IO-APICs every IO-APIC was initialized to the standard mapping before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41434 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 09:13:21 +00:00
Michael Lotz
ca67ddb353 When enumerating IO-APICs failed, try to still get the routing done with how far
we got. If the routing is possible with the limited IO-APICs everythings good,
if not we will simply fail at the routing preparation stage where we can still
fall back gracefully. This makes things a bit more error resilient.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41432 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 09:01:50 +00:00
Michael Lotz
eda743903e 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
2011-05-11 08:47:56 +00:00
Michael Lotz
d11e32a807 Enumerate IO-APICs using the ACPI Multiple APIC Descriptor Table (MADT). We do
the same for the first IO-APIC in the bootloader (also using the MADT), but
here we can use the ACPI module. The enumerated IO-APICs are added to the list
and should be usable from there on. For lack of hardware I wasn't able to really
test that though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-11 08:27:03 +00:00