Fixed a hang on boot problem with bus manager initialization. Apparently the BeOS kernel doesn't seem to like using spinlocks as the ver first thing in the boot process, so I rolled my own. Everything is now working consistently.
I also fixed my power button, so I don't need to test acpi_button by shorting motherboard contacts with a screwdriver... git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11465 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <ACPI.h>
|
#include <ACPI.h>
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
#include "acpixf.h"
|
#include "acpixf.h"
|
||||||
|
|||||||
@@ -123,6 +123,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <malloc.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
@@ -506,7 +507,7 @@ AcpiOsMapMemory (
|
|||||||
|
|
||||||
*there += page_offset;
|
*there += page_offset;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (area > 0 ? AE_OK : AE_BAD_ADDRESS);
|
return (area > 0 ? AE_OK : AE_BAD_ADDRESS);
|
||||||
}
|
}
|
||||||
@@ -689,7 +690,9 @@ AcpiOsCreateLock (
|
|||||||
ACPI_HANDLE *OutHandle)
|
ACPI_HANDLE *OutHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
*OutHandle = (ACPI_HANDLE)memalign(sizeof(spinlock),sizeof(spinlock));
|
*OutHandle = (ACPI_HANDLE)malloc(sizeof(spinlock));
|
||||||
|
*((spinlock *)(*OutHandle)) = 1;
|
||||||
|
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,7 +709,7 @@ AcpiOsAcquireLock (
|
|||||||
ACPI_HANDLE Handle,
|
ACPI_HANDLE Handle,
|
||||||
UINT32 Flags)
|
UINT32 Flags)
|
||||||
{
|
{
|
||||||
cpu_status cpu;
|
/*cpu_status cpu;
|
||||||
|
|
||||||
if (Flags == ACPI_NOT_ISR)
|
if (Flags == ACPI_NOT_ISR)
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
@@ -714,7 +717,16 @@ AcpiOsAcquireLock (
|
|||||||
acquire_spinlock ((spinlock *)(Handle));
|
acquire_spinlock ((spinlock *)(Handle));
|
||||||
|
|
||||||
if (Flags == ACPI_NOT_ISR)
|
if (Flags == ACPI_NOT_ISR)
|
||||||
restore_interrupts(cpu);
|
restore_interrupts(cpu);*/
|
||||||
|
|
||||||
|
/* Why aren't we using real spinlocks? Well, they seem to cause
|
||||||
|
kernel hangs at boot, at least on Dano. I don't really know
|
||||||
|
why, as they should be equivalent to this. Maybe in sysinit2
|
||||||
|
interrupts are already off, and the double disable interrupts
|
||||||
|
call is hanging the system? I'm not sure how to detect that
|
||||||
|
though. Anyway, this works, even if it's stupid. */
|
||||||
|
|
||||||
|
while (atomic_add(((spinlock *)(Handle)),0) <= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -723,7 +735,7 @@ AcpiOsReleaseLock (
|
|||||||
ACPI_HANDLE Handle,
|
ACPI_HANDLE Handle,
|
||||||
UINT32 Flags)
|
UINT32 Flags)
|
||||||
{
|
{
|
||||||
cpu_status cpu;
|
/*cpu_status cpu;
|
||||||
|
|
||||||
if (Flags == ACPI_NOT_ISR)
|
if (Flags == ACPI_NOT_ISR)
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
@@ -731,7 +743,9 @@ AcpiOsReleaseLock (
|
|||||||
release_spinlock ((spinlock *)(Handle));
|
release_spinlock ((spinlock *)(Handle));
|
||||||
|
|
||||||
if (Flags == ACPI_NOT_ISR)
|
if (Flags == ACPI_NOT_ISR)
|
||||||
restore_interrupts(cpu);
|
restore_interrupts(cpu);*/
|
||||||
|
|
||||||
|
atomic_add(((spinlock *)(Handle)),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -787,7 +801,7 @@ AcpiOsRemoveInterruptHandler (
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _KERNEL_MODE
|
#ifdef _KERNEL_MODE
|
||||||
|
dprintf("AcpiOsRemoveInterruptHandler()\n");
|
||||||
remove_io_interrupt_handler(InterruptNumber,(interrupt_handler)ServiceRoutine,NULL);
|
remove_io_interrupt_handler(InterruptNumber,(interrupt_handler)ServiceRoutine,NULL);
|
||||||
/* Crap. We don't get the Context argument back. */
|
/* Crap. We don't get the Context argument back. */
|
||||||
#warning Sketchy code!
|
#warning Sketchy code!
|
||||||
@@ -896,7 +910,7 @@ AcpiOsStall (
|
|||||||
|
|
||||||
if (microseconds)
|
if (microseconds)
|
||||||
{
|
{
|
||||||
snooze (microseconds);
|
spin (microseconds);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user