Commit Graph
100 Commits
Author SHA1 Message Date
Fredrik Holmqvist e6e0db9ef4 Rewrite allocated regions, remove mmu_free
mmu_free was only used for ACPI and only set a released flag
in the region. This released flag was never checked anywhere.

platform_free_region removes region from linked list now.
There are a lot of calls to it, so it should save some mem and make
memory layout cleaner.

Compiles on boots on AMD64
Compiles on ARM and loads kernel, but can't start it, since we havn't
setup the mmap with proper virtual addresses (with some other fixes to
ld-script and ELF32 loader EFI code.

Change-Id: Icfe871fa400b49f19e7ca1dbb9e1561309b21a22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3403
Reviewed-by: Rene Gollent <[email protected]>
2020-11-19 19:09:38 +00:00
Fredrik Holmqvist 7b9ad03e70 Remove mmu allocation and free
EFI should have ACPI regions mapped, and kernel does its own mapping

Change-Id: I12a1ce625740dfe9751f2907ac462ef112b22645
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3402
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Rene Gollent <[email protected]>
2020-11-19 19:09:38 +00:00
Fredrik Holmqvist d9f74c873b Graphite options only, replace dupes with floop-nest-optimize
Other loop optimization is enabled in -O3 already
2020-07-18 15:19:44 +02:00
Fredrik Holmqvist 7cea5bf07f Remove graphite building, we have gcc with these deps in build
When we moved ISL, MPFR, GMP and so on inside GCC we no longer
need to do any specific building to support graphite.
2020-07-18 15:19:17 +02:00
Fredrik Holmqvist bc8cfa3a8c EFI: Use BlockIO to find bootable disks
There is one efi_block_io_protocol per disk and one per partition.
All we need to do is find the disk ones and let Haiku find
bootable partitions.

There is a special case for a device with one fixed partition
which does not have one for disk, but it is unlikely we will
ever want to boot from such a device.

Fixes #15587.

Change-Id: I915870d6d3b19947bc58b32a969f9f89d2d2245d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2232
Reviewed-by: waddlesplash <[email protected]>
2020-02-08 17:38:38 +00:00
Fredrik Holmqvist 0d932a49ad Revert "loader: fetch all potential boot partitions for boot device."
This reverts commit e888217124.

Change-Id: I06be82ac863f615796d9edc86f5ef903b8123a9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2231
Reviewed-by: waddlesplash <[email protected]>
2020-02-08 17:38:38 +00:00
Fredrik Holmqvist 9edb207fab Fix for bug 6991, replace registrars timer tick
Registrar schedules an event every second to do
fRoster-CheckSanity(). This uses 2.5% cpu on my machine
when idle. Changing it to five seconds lowers it to 0.1%

waddlesplash then pointed me to this bug which changes it
to watch for team deletion and call fRoster->CheckSanity()

As I know little in this area, it's mostly based on what
LaunchDaemon does in MessageRecieved.

Change-Id: Ie69f9399cab41d2d492d469b5d3dc88e6080c15c
Reviewed-on: https://review.haiku-os.org/c/876
Reviewed-by: waddlesplash <[email protected]>
2019-01-24 18:57:50 +00:00
Fredrik Holmqvist abdd597add Add CACHE_LINE_SIZE for ARM in FreeBSD header
The Haiku headers are C++ and include other C++ ones
2019-01-16 22:35:35 +01:00
Fredrik Holmqvist ffbedf6088 Revert "Fix for bug 6991, replace registrars timer tick"
Unintentional commit, still not used to gerrit things

This reverts commit a02e4534f5.
2019-01-16 21:17:48 +01:00
Fredrik Holmqvist ea0dc313dc First try at libunwind arch for ARM
ICU fails on linking unwind exceptions on ARM
2019-01-16 21:14:19 +01:00
Fredrik Holmqvist a02e4534f5 Fix for bug 6991, replace registrars timer tick
Registrar schedules an event every second to do
fRoster-CheckSanity(). This uses 2.5% cpu on my machine
when idle. Changing it to five seconds lowers it to 0.1%

waddlesplash then pointed me to this bug which changes it
to watch for team deletion and call fRoster->CheckSanity()

As I know little in this area, it's mostly based on what
LaunchDaemon does in MessageRecieved.
2019-01-16 21:13:04 +01:00
Fredrik Holmqvist 08c9948c20 Upgrade ACPICA to 20181213: a lot of bug-fixes 2018-12-19 21:19:25 +01:00
Fredrik Holmqvist 3431cf5b06 PS2 Elantech mostly working still disabled
Does handle coords correctly, but two finger jumps position somewhere
We can also report actual buttons, but not sure how movementmaker handles
it.

Will do cleanup once working

To test or help out return B_OK in probe_elantech
2018-11-03 18:10:40 +01:00
Fredrik Holmqvist 9b6198ec5f Unused #define INFO, no sense in internal logic
(Just starting to cleanup my ps2_elantech code)
2018-11-03 17:56:31 +01:00
Fredrik Holmqvist aacc409159 intel_extreme: use int cast to please the grumpy oldtimer gcc2 2018-09-30 21:38:06 +02:00
Fredrik Holmqvist 39a3fe56de intel_extreme: check that vbt_header is in area 2018-09-30 12:18:00 +02:00
Fredrik Holmqvist 597837c788 Remove unused variable in intel_extreme 2018-09-30 12:17:39 +02:00
Fredrik Holmqvist 6172ccc455 Embedded Controller, sync with FreeBSD
* Tries to handle all pending events at once
 * Wait is now polling every mS while waiting
2018-09-01 19:41:25 +02:00
Fredrik Holmqvist b2e0398cd4 ps2_dev encapsulate TRACING code
Avoid doing system_time() calls in a loop.
Is this even needed anymore?
2018-08-24 13:51:48 +02:00
Fredrik Holmqvist 1368eabbff Fix gcc2 comparison, and only align if not aligned (8 - 0) 2018-08-03 15:31:03 +02:00
Fredrik Holmqvist 04cbc2588e Use fast clearing of visible screen for splash
memset uses rep stosb on x86 during boot, with memory
not set to write-combining, which makes it slow.

Instead we do aligned writes of 2 x four bytes at once.
Only clear the minimum of size and width * height * 4
UEFI framebuffer size can be huge, upto 512MB here,
and rep stosb seems to be around 25-30MB/s

This is written as generic as possible to work on
old compilers and different platforms, without
expecting boot memset to be optimized.

This makes it almost unnoticable compared to not
clearing.
2018-08-03 13:40:04 +02:00
Fredrik Holmqvist 15db6949b6 Don't clear video mem on UEFI, efi video mode refactor
Writes to videomem is slow without memory remapping
Can't do the mapping without leaving UEFI, so skipping
the clear. Afaict it should always be cleared by UEFI

This saves ~10 seconds of booting on my machine
(1920*1080*4 bytes)

EFI video mode (should have been it's own commit)
 * Only do strcmp if there are enough params
 * break when found
2018-08-01 21:12:08 +02:00
Fredrik Holmqvist e2ab1a8ef9 Unused and should be removed, fixes last commit 2018-08-01 18:32:52 +02:00
Fredrik Holmqvist 61e207f6e1 Unused
Approved by DeadYak to remove
2018-08-01 18:29:49 +02:00
Fredrik Holmqvist 9832d1f89a Use strict typing 2018-08-01 18:28:06 +02:00
Fredrik Holmqvist 004094b574 Bug found by unused-but-set-variable, entry should be updated
Verfied by DeadYak
2018-08-01 18:22:49 +02:00
Fredrik Holmqvist 86901205d0 Avoid arithmetic operations on void pointers
See what I did there?
2018-04-25 21:42:16 +02:00
Fredrik Holmqvist 6d34de21b8 Missing else in else if. 2018-04-25 21:41:33 +02:00
Fredrik Holmqvist 72c715ecbe Another while (( ..) 2018-04-25 21:41:33 +02:00
Fredrik Holmqvist a7affb9189 The ' = ' character is no more. 2018-04-25 21:41:33 +02:00
Fredrik Holmqvist b18b18ac3e Wrong order of arguments in header.
It is called from KernelInterface with Mount(&fs, server, serverName, path..
That is also what FileSystem.cpp says.
2018-04-25 21:41:33 +02:00
Fredrik Holmqvist e3becd53ee Ternary operator proper precedence.
Going through PVS Studio blogs on Haiku.
2018-04-23 23:25:16 +02:00
Fredrik Holmqvist 58c99ce4d4 malloc_referenced adds +1 to int32 pointer so use its release 2018-04-22 12:47:30 +02:00
Fredrik Holmqvist c0ceea9c79 Remove unused var and always true check. Clean redeclaration. 2018-04-22 12:09:56 +02:00
Fredrik Holmqvist aa2c061c3d cppcheck: Shifting 32-bit value by 63 bits is undefined. 2018-04-22 11:47:15 +02:00
Fredrik Holmqvist 99400bbed0 Objs in array was deleted, but not array itself. 2018-04-22 00:12:08 +02:00
Fredrik Holmqvist c7fad27a8b Free ci on error 2018-04-21 23:37:01 +02:00
Fredrik Holmqvist 29208af825 Redundant '(' 2018-04-21 23:36:04 +02:00
Fredrik Holmqvist 5676dce83c memcmp on sizeof(x)==0 bytes fix 2018-04-21 23:34:16 +02:00
Fredrik Holmqvist ff2e2f8198 Upgrade to ACPICA 20180105
Tested on x86_64 and x86_gcc2, works on my machine and most likely fixes
that was most likely due to missing lock sync in previous ACPI upgrade.

 * Redid some of kallisti5's work as it was easier to start from earlier
   version.

 * Evaluating 64 bit physical addressing on 32 bit Haiku again as this
   was likely the cause of pagefaults (#12377):
"Implemented internal support for full 64-bit addresses that appear in all
Generic Address Structure (GAS) structures. Previously, only the lower 32
bits were used. Affects the use of GAS structures in the FADT and other
tables, as well as the GAS structures passed to the AcpiRead and
AcpiWrite public external interfaces that are used by drivers. Lv Zheng."

 * Mostly bugfixes in ACPICA
2018-01-21 20:09:45 +01:00
Fredrik Holmqvist 3f04c8352e Revert "acpica: Upgrade to 20170303"
This reverts commit 0bc647d605.
2018-01-21 20:09:45 +01:00
Fredrik Holmqvist 1446507ce3 Remove the code to force ACPI to shutdown on CPU0
It was discussed and introduced based on docs that some systems
need this to shutdown properly. I can find no mention of this in
ACPICA or ACPI docs.
This needs to be re-evalutad, as all my shutdowns been successful
after disabling it and I can't locate where this info came from
or if it actually helped.

See 1316462ab0 for original commit
and bug 12306 on current shutdown issue.
2017-12-31 17:43:31 +01:00
Fredrik Holmqvist 7d93e79a04 Latest ACPI update removed some essential configuration
* The global lock, needed for hw <-> os to sync, was a no op.
  This means that OS and HW could read and write to same value
  at the same time, causing garbled data and crashes. This is easiest
  to see in battery status, where battery values and OEM name would
  become garbage. It also causes instability and failure to shutdown

* ACPI used 64 bit addressing (which it normally should) on 32 bit.
  This would cause page faults as it would jump to incorrect addresses
2017-12-30 19:26:01 +01:00
Fredrik Holmqvist 73159ec931 Make UEFI boot-platform build again
gnuefi package was replaced by gnu_efi_kernel, but build
was not updated. This is guesswork, as I couldn't track down what changed.
It finds headers, headers_arch and lib and works so should be ok.
2017-12-27 18:51:30 +01:00
Fredrik Holmqvist 3eee68eb9a Revert "Check needs extra paranthesis to aviod ambiguity."
This reverts commit 4e219110d4.
The commit also added the mask that caused ambiguity.
It shouldn't be there.
2017-07-03 07:32:41 +02:00
Fredrik Holmqvist 4e219110d4 Check needs extra paranthesis to aviod ambiguity.
Build fails with an ambiguity warning on x86_64 cross compile otherwise.
2017-07-02 22:33:17 +02:00
Fredrik Holmqvist 0cfd77ac3b Print elantech touchpad version. 2017-04-10 21:17:58 +02:00
Fredrik Holmqvist 044cab8e74 Activate Elantech toucpad probe but fail.
Now we can see who has Elantech touchpad.
Driver is currently in very bad shape on my hw:
 * mouse jumps
 * mouse clicks maps to wrong button
 * keyboard not working properly when enabled
 * power button only works in force shutdown mode
2017-04-09 15:14:02 +02:00
Fredrik Holmqvist e5c95a01ff Use 64 bit addressing for ACPI on 32 bit builds.
32 bit builds with PAE are so much fun. It's like
64 bit without all the extra registers...
2017-03-28 21:34:42 +02:00
Fredrik Holmqvist dd9702007b When logging, use correct function name. 2017-03-28 21:34:42 +02:00
Fredrik Holmqvist 4bef8ab8de Function needs more void. 2017-03-27 20:12:24 +02:00
Fredrik Holmqvist 35226072bc __FreeBSD_version__ is always 8, remove old #if
Reduce number of todos...
2017-03-27 19:04:30 +02:00
Fredrik Holmqvist f1361497b0 Revert min / max change and set timeout_t nice way
Mixing up seconds and micro-seconds made me do it.
2017-03-25 15:00:55 +01:00
Fredrik Holmqvist 3bbff30d9e DHCP initial timeout 0.25s from 4s
Connecting to wifi is very slow, there are several issues.
Easiest to find and fis is that on my wifi DHCP always took
4s, as first request fails. Still investigating why..
Reducing timeout to 0.25s makes DHCP process fast.

Moved timout handling into its own struct, and changed state
timeout from max(remaing, 60s) to min(remaining, MAX_TIMEOUT)
Not sure about that change, but why would you want a max value
that is at least 60s?
2017-03-25 13:42:08 +01:00
Fredrik Holmqvist ca92f2f454 Add back 32 bit addressing flag for 32 bit builds.
Should fix #13383.

Leaving other warning fix as they may not be needed with new ACPICA.
2017-03-19 21:14:07 +01:00
Fredrik Holmqvist 8bc91c5e0f Prettify code. 2017-03-01 22:44:04 +01:00
Fredrik Holmqvist 73c5d705cd Use static inline (gcc2 issue). Some format cleanup. 2017-03-01 20:32:37 +01:00
Fredrik Holmqvist 5e3916baee FreeBSD compability layer optimized read and writes.
FreeBSD has a simple inlined bus_space_read while Haikus had one
with call overhead.
This still needs cleanup as it is x86 specific, which it was already.
Also it redefines inX and outX defines as arch/x86/arch_cpu.h has a
C++ namespace so it can't be included from FreeBSD drivers C-files.

The results of these changes should be worth it though.
2017-03-01 18:32:18 +01:00
Fredrik Holmqvist 9b264ecce1 Second try att enabling Werror for ACPI 2017-02-21 19:28:33 +01:00
Fredrik Holmqvist f18e21a832 Cast ACPI UINT32* to uint32* to avoid warning on 32 bit builds. 2017-02-21 19:27:13 +01:00
Fredrik Holmqvist 95c239a3fb Revert "Treat warnings as error for ACPI."
Better do a recheck on 32 bit first, my old checks from a few
months ago doesn't seem valid anymore.

This reverts commit 7212666f4a.
2017-02-20 16:44:27 +01:00
Fredrik Holmqvist 584a39688c Log ACPI address and size as 64 bit
Even on 32 bit machines the default is to use 64 bit addresses
because of PAE. Haiku currently forces 32 bit addresses which
probably should be fixed.
See achaiku.h: define ACPI_32BIT_PHYSICAL_ADDRESS
2017-02-20 16:26:43 +01:00
Fredrik Holmqvist 7212666f4a Treat warnings as error for ACPI. 2017-02-20 15:25:53 +01:00
Fredrik Holmqvist fe3f23d202 Temporary fix for warning, until we have a better fix from upstrea,. 2017-02-20 15:24:56 +01:00
Fredrik Holmqvist 28de88fee1 Our stripped ACPI don't use/export utprint.c
Fixes a few warnings.
ACPICA comes with many extras, and they are easy to add
when needed.
2017-02-20 14:58:20 +01:00
Fredrik Holmqvist 6a9b063b74 Casting string constant to ACPI_STRING to fix warning 2017-02-20 14:32:55 +01:00
Fredrik Holmqvist 7c9a09d0e0 Casting string constant to ACPI_STRING to fix warning 2017-02-20 14:32:05 +01:00
Fredrik Holmqvist 06f719d1c3 Fix printf warnings for addr and size args 2017-02-20 14:26:32 +01:00
Fredrik Holmqvist 1d8306654a Rewrote device handling in EFI boot-loader
This allows me to find and boot disks and cds(*)
platform_add_boot_device tries to find the disk of the EFI partition
As on other platforms if boot disk isn't found platform_add_block_devices
will be called.
platform_add_block_devices will find all block devices that arn't partitions as
they are handled by Haiku already.
Currently first found suitable partition will be selected.

TODO:
 * pass in partition UUID's as boot-loader arg to setup boot for
any partition.
 * Better cd detection
 * Better disk_identifier

*) vfs_boot.cpp is very restrictive when it comes to booting cds.
It either do very Anyboot check where boot partition should be at offset 0,
which isn't true for EFI. In my case it's not even on that disk.
Or it only allow data session partition types.
This is currently failing as the Anyboot partition type is BFS.
2017-01-06 19:43:08 +01:00
Fredrik Holmqvist 57b59d47c5 memset was done twice 2017-01-06 19:39:58 +01:00
Fredrik Holmqvist 9e487d8d74 UEFI: serial debugging support.
Signed-off-by: Jessica Hamilton <[email protected]>
2016-12-18 14:41:54 +13:00
Fredrik Holmqvist 735f1daee9 EFI: Implement console code. 2016-09-02 19:02:32 +12:00
Fredrik Holmqvist bd0604764e Setup -fno-pic or -fpic in Architecture Rules.
EFI boot needs -fpic but all boot code was built with -fno-pic.
This is now set accordingly in HAIKU_BOOT_CCFLAGS and
HAIKU_BOOT_C++FLAGS.

Also setup compile flags for EFI platform.
2016-09-02 19:02:32 +12:00
Fredrik Holmqvist 211483cb51 EFI: Initial test EFI application
* Only set HAIKU_BOOT_PLATFORM to bios_ia32 if not defined
* Add gnuefi build feature
* Introduce BOOT_LDFLAGS, and move options for passing to linker
  into ArchitectureSetup
* x86_64 compile fixes for warnings in boot loader
* loader/elf.cpp: don't include ELF32 support when targeting EFI
* relocation_func.cpp: copy of the relocation code from gnuefi
  to make _relocate extern "C", and avoid including <efilib.h>
* boot_loader_efi.ld: copy of gnuefi's elf_x86_64_efi.lds,
  modified to include support for C++ constructors, etc. Keep in
  sync with the gnuefi package

Signed-off-by: Jessica Hamilton <[email protected]>
2016-09-02 19:02:29 +12:00
Fredrik Holmqvist 74ffd18dd5 Update ACPICA to 20160729
Changelog: https://acpica.org/sites/acpica/files/changes_34.txt

Mostly minor fixes and ACPI 6.0 work since latest update.
2016-08-07 10:07:25 +02:00
Fredrik Holmqvist e5ebfda19d Enable power button on 64 bit.
Works here. You may need to hold in for a second or two.
2016-08-07 00:46:27 +02:00
Fredrik Holmqvist 20e11028aa Don't use partition pointer as id, as it only works on 32bit platforms.
Use a counter to generate the partition id, and store the id to partition
lookup in a hashmap instead.
2016-04-14 19:18:21 +12:00
Fredrik Holmqvist b64e8511cd Update ACPICA to 20160108, removed common.
Changelog: https://acpica.org/sites/acpica/files/changes_29.txt

 * This is based on the upgrade waddlesplash aborted due to a bug
in ACPICA which has since been fixed.
 * Some ACPICA code is excluded until needed. (You may want to
   compare our acpica dir to ACPICA if you are missing functions.)
2016-01-17 21:55:44 +01:00
Fredrik Holmqvist c8bd1b0ad0 Set ACPI io and physical address to 32 bit on 32 bit arch.
This is temporary fix, our ACPI.h header needs a review, and perhaps
a better approach.
2015-09-14 22:18:02 +02:00
Fredrik Holmqvist 65ecbac0dc Switch from ACPI_SIZE to ACPI_PHYSICAL_ADDRESS.
Should fix build bustage on 32 bit builds.
2015-09-13 22:16:19 +02:00
Fredrik Holmqvist e226d1d04f Update ACPICA to 20150818.
Previous update was 20140724.
    Changes at:
    https://acpica.org/sites/acpica/files/changes_25.txt
2015-09-13 21:12:49 +02:00
Fredrik Holmqvist 0cd38980a3 Add unit tests specific for #12208. Pass depends on network.
NetworkAddressTest passes (most) tests when you have network.
When no network interface (ie -net none in QEMU) tests take forever and
more tests fail.
When network interface exists but is disabled in Haiku, tests are fast but
more tests fail.
2015-07-28 22:13:23 +02:00
Fredrik Holmqvist c0958d1b7f Include string.h for strcmp, fix not keyword var. 2015-07-23 12:55:53 +02:00
Fredrik Holmqvist 35059a549c Or is also a keyword. 2015-07-23 12:03:30 +02:00
Fredrik Holmqvist ff7da47aa9 Spelling error on notCondition. 2015-07-23 10:48:41 +02:00
Fredrik Holmqvist 8a9464f30c Don't use keywords and and not for variables. 2015-07-23 10:44:03 +02:00
Fredrik Holmqvist bd7a8d8329 Temporarily hardcode ACPI _REV to 2 until we upgrade ACPICA.
Some manufacturers (Dell, HP, ..) use this value to detect Windows and
only do proper setup in this case. Now we pretend to be Windows as well.
This may cause some things to behave different or stop working.

Please keep this in mind.

For more information see:
http://mjg59.dreamwidth.org/34542.html
https://github.com/acpica/acpica/commit/7af00219681ab35ebe57d64a9189fd04a5a026d8#diff-76c5dc94fc085f5e3e2d17e6304f3ae0L186
2015-04-24 21:51:50 +02:00
Fredrik Holmqvist 251eb00d51 Use B_PRId32. 2015-04-01 20:18:00 +02:00
Fredrik Holmqvist 1c355970ab Only add global handlers on debug.
It is only useful for ACPI devs. If the need ever arise it can
easily be reworked to be enabled / disabled at runtime.
For everyone else it was just syslog garbage.
2015-01-10 12:58:47 +01:00
Fredrik Holmqvist ae715b108d Add Todos for adapter and displays. 2014-11-08 13:04:07 +01:00
Fredrik Holmqvist b5be958727 WIP ACPI display adapters driver
Currently find display adapters and attached displays but nothing more.
I would like it to publish adapters and displays in dev tree, so that
you can open and control the adapter (get firmware, boot display) and
the adapter itself would have child devices for displays (brightness ..).

However that part could use some review, and since my time is limited it
is better to make it availble for others to work on as well.
2014-11-08 11:51:30 +01:00
Fredrik Holmqvist 3594baabf8 Add get_name and fix get_next_object.
TODO: Need to add defines or enum for nameType.
2014-09-14 00:01:10 +02:00
Fredrik Holmqvist c262488a26 Codestyle. 2014-09-10 22:31:40 +02:00
Fredrik Holmqvist 15d8a434d0 Add function to walk through children.
Without losing my sanity that is.
ACPI API refactoring will happen some day.
2014-09-10 21:39:46 +02:00
Fredrik Holmqvist 95b6779381 Format code, add display device base.
Still very much work in progress.
2014-09-07 21:20:35 +02:00
Fredrik Holmqvist 8516e6a924 Rename display_controls to display_adapter
ACPI talks about display_adapters, and we will likely have displays
as child nodes. Displays will be attached to an adapter.
2014-09-07 19:02:06 +02:00
Fredrik Holmqvist 62f4f056a7 Fix include order. 2014-09-05 22:10:30 +02:00
Fredrik Holmqvist 76a17ee226 No semicolons on defines. 2014-09-05 18:44:16 +02:00
Fredrik Holmqvist 1c7917f33e Tell ACPI if we use PIC or APIC. 2014-09-05 18:40:38 +02:00
Fredrik Holmqvist b4908ff5d8 Todo about walking namespace and init _PRW's.
This needs a deeper understanding and brighter mind than mine.
2014-09-05 17:12:27 +02:00