Fix compilation after rename and switch to cpp.
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
* Copyright 2006, Jérôme Duval. All rights reserved.
|
* Copyright 2006, Jérôme Duval. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef __ACPI_PRIV_H__
|
#ifndef _ACPI_PRIVATE_H
|
||||||
#define __ACPI_PRIV_H__
|
#define _ACPI_PRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
@@ -227,4 +227,4 @@ status_t get_table(const char* signature, uint32 instance, void** tableHeader);
|
|||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
||||||
#endif /* __ACPI_PRIV_H__ */
|
#endif /* _ACPI_PRIVATE_H */
|
||||||
|
|||||||
@@ -20,11 +20,13 @@
|
|||||||
|
|
||||||
#include <safemode.h>
|
#include <safemode.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
#include "accommon.h"
|
#include "accommon.h"
|
||||||
#include "acdisasm.h"
|
#include "acdisasm.h"
|
||||||
#include "acnamesp.h"
|
#include "acnamesp.h"
|
||||||
#include "acpi_priv.h"
|
}
|
||||||
|
#include "ACPIPrivate.h"
|
||||||
|
|
||||||
//#define TRACE_ACPI_BUS
|
//#define TRACE_ACPI_BUS
|
||||||
#ifdef TRACE_ACPI_BUS
|
#ifdef TRACE_ACPI_BUS
|
||||||
@@ -384,7 +386,7 @@ status_t
|
|||||||
install_fixed_event_handler(uint32 event, interrupt_handler* handler,
|
install_fixed_event_handler(uint32 event, interrupt_handler* handler,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
return AcpiInstallFixedEventHandler(event, (void*)handler, data) == AE_OK
|
return AcpiInstallFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler, data) == AE_OK
|
||||||
? B_OK : B_ERROR;
|
? B_OK : B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,7 +394,7 @@ install_fixed_event_handler(uint32 event, interrupt_handler* handler,
|
|||||||
status_t
|
status_t
|
||||||
remove_fixed_event_handler(uint32 event, interrupt_handler* handler)
|
remove_fixed_event_handler(uint32 event, interrupt_handler* handler)
|
||||||
{
|
{
|
||||||
return AcpiRemoveFixedEventHandler(event, (void*)handler) == AE_OK
|
return AcpiRemoveFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler) == AE_OK
|
||||||
? B_OK : B_ERROR;
|
? B_OK : B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +443,7 @@ get_device(const char* hid, uint32 index, char* result, size_t resultLength)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
||||||
TRACE("get_device %s, index %ld\n", hid, index);
|
TRACE("get_device %s, index %ld\n", hid, index);
|
||||||
status = AcpiGetDevices((ACPI_STRING)hid, (void*)&get_device_by_hid_callback,
|
status = AcpiGetDevices((ACPI_STRING)hid, (ACPI_WALK_CALLBACK)&get_device_by_hid_callback,
|
||||||
counter, (void**)&buffer);
|
counter, (void**)&buffer);
|
||||||
if (status != AE_OK || buffer == NULL)
|
if (status != AE_OK || buffer == NULL)
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
@@ -523,7 +525,7 @@ get_object(const char* path, acpi_object_type** _returnValue)
|
|||||||
|
|
||||||
status = AcpiEvaluateObject(handle, NULL, NULL, &buffer);
|
status = AcpiEvaluateObject(handle, NULL, NULL, &buffer);
|
||||||
|
|
||||||
*_returnValue = buffer.Pointer;
|
*_returnValue = (acpi_object_type*)buffer.Pointer;
|
||||||
return status == AE_OK ? B_OK : B_ERROR;
|
return status == AE_OK ? B_OK : B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +547,7 @@ get_object_typed(const char* path, acpi_object_type** _returnValue,
|
|||||||
|
|
||||||
status = AcpiEvaluateObjectTyped(handle, NULL, NULL, &buffer, objectType);
|
status = AcpiEvaluateObjectTyped(handle, NULL, NULL, &buffer, objectType);
|
||||||
|
|
||||||
*_returnValue = buffer.Pointer;
|
*_returnValue = (acpi_object_type*)buffer.Pointer;
|
||||||
return status == AE_OK ? B_OK : B_ERROR;
|
return status == AE_OK ? B_OK : B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,7 +644,7 @@ prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
// Note: The supplied code must already be locked into memory.
|
// Note: The supplied code must already be locked into memory.
|
||||||
status = get_memory_map(wakeFunc, size, &wakeVector, 1);
|
status = get_memory_map((const void*)wakeFunc, size, &wakeVector, 1);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "acpi_priv.h"
|
#include "ACPIPrivate.h"
|
||||||
|
extern "C" {
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
@@ -43,17 +45,17 @@ acpi_remove_address_space_handler(acpi_device device, uint32 spaceId,
|
|||||||
{
|
{
|
||||||
return remove_address_space_handler(device->handle, spaceId, handler);
|
return remove_address_space_handler(device->handle, spaceId, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint32
|
|
||||||
|
static uint32
|
||||||
acpi_get_object_type(acpi_device device)
|
acpi_get_object_type(acpi_device device)
|
||||||
{
|
{
|
||||||
return device->type;
|
return device->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_value)
|
acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_value)
|
||||||
{
|
{
|
||||||
if (path) {
|
if (path) {
|
||||||
char objname[255];
|
char objname[255];
|
||||||
@@ -64,9 +66,9 @@ acpi_get_object(acpi_device device, const char *path, acpi_object_type **return_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
acpi_evaluate_method(acpi_device device, const char *method,
|
acpi_evaluate_method(acpi_device device, const char *method,
|
||||||
acpi_objects *args, acpi_data *returnValue)
|
acpi_objects *args, acpi_data *returnValue)
|
||||||
{
|
{
|
||||||
return evaluate_method(device->handle, method, args, returnValue);
|
return evaluate_method(device->handle, method, args, returnValue);
|
||||||
}
|
}
|
||||||
@@ -77,19 +79,17 @@ acpi_device_init_driver(device_node *node, void **cookie)
|
|||||||
{
|
{
|
||||||
ACPI_HANDLE handle;
|
ACPI_HANDLE handle;
|
||||||
const char *path;
|
const char *path;
|
||||||
acpi_device_cookie *device;
|
|
||||||
status_t status = B_OK;
|
|
||||||
uint32 type;
|
uint32 type;
|
||||||
|
|
||||||
if (gDeviceManager->get_attr_uint32(node, ACPI_DEVICE_TYPE_ITEM, &type, false) != B_OK)
|
if (gDeviceManager->get_attr_uint32(node, ACPI_DEVICE_TYPE_ITEM, &type, false) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if (gDeviceManager->get_attr_string(node, ACPI_DEVICE_PATH_ITEM, &path, false) != B_OK)
|
if (gDeviceManager->get_attr_string(node, ACPI_DEVICE_PATH_ITEM, &path, false) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
device = malloc(sizeof(*device));
|
acpi_device_cookie *device = (acpi_device_cookie*)malloc(sizeof(*device));
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
memset(device, 0, sizeof(*device));
|
memset(device, 0, sizeof(*device));
|
||||||
|
|
||||||
if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK) {
|
if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK) {
|
||||||
@@ -102,20 +102,17 @@ acpi_device_init_driver(device_node *node, void **cookie)
|
|||||||
device->type = type;
|
device->type = type;
|
||||||
device->node = node;
|
device->node = node;
|
||||||
|
|
||||||
snprintf(device->name, sizeof(device->name), "acpi_device %s",
|
snprintf(device->name, sizeof(device->name), "acpi_device %s", path);
|
||||||
path);
|
|
||||||
|
|
||||||
*cookie = device;
|
*cookie = device;
|
||||||
|
return B_OK;
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_device_uninit_driver(void *cookie)
|
acpi_device_uninit_driver(void *cookie)
|
||||||
{
|
{
|
||||||
acpi_device_cookie *device = cookie;
|
acpi_device_cookie *device = (acpi_device_cookie*)cookie;
|
||||||
|
|
||||||
free(device->path);
|
free(device->path);
|
||||||
free(device);
|
free(device);
|
||||||
}
|
}
|
||||||
@@ -133,7 +130,7 @@ acpi_device_std_ops(int32 op, ...)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
acpi_device_module_info gACPIDeviceModule = {
|
acpi_device_module_info gACPIDeviceModule = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "acpi_embedded_controller.h"
|
#include "EmbeddedController.h"
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -555,7 +555,7 @@ EcGpeQueryHandler(void* context)
|
|||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE("evaluation of query method %s failed\n", qxx);
|
TRACE("evaluation of query method %s failed\n", qxx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reenable runtime GPE if its execution was deferred.
|
// Reenable runtime GPE if its execution was deferred.
|
||||||
if (sci_enqueued) {
|
if (sci_enqueued) {
|
||||||
status = sc->ec_acpi_module->finish_gpe(sc->ec_gpehandle, sc->ec_gpebit);
|
status = sc->ec_acpi_module->finish_gpe(sc->ec_gpehandle, sc->ec_gpebit);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ extern "C" {
|
|||||||
# include "accommon.h"
|
# include "accommon.h"
|
||||||
# include "acnamesp.h"
|
# include "acnamesp.h"
|
||||||
# include "actypes.h"
|
# include "actypes.h"
|
||||||
# include "acpi_priv.h"
|
# include "ACPIPrivate.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "acpi_priv.h"
|
#include "ACPIPrivate.h"
|
||||||
|
|
||||||
#include <dpc.h>
|
#include <dpc.h>
|
||||||
#include <PCI.h>
|
#include <PCI.h>
|
||||||
@@ -126,7 +126,7 @@ acpi_enumerate_child_devices(device_node* node, const char* root)
|
|||||||
static status_t
|
static status_t
|
||||||
acpi_module_register_child_devices(void* cookie)
|
acpi_module_register_child_devices(void* cookie)
|
||||||
{
|
{
|
||||||
device_node* node = cookie;
|
device_node* node = (device_node*)cookie;
|
||||||
|
|
||||||
status_t status = gDeviceManager->publish_device(node, "acpi/namespace",
|
status_t status = gDeviceManager->publish_device(node, "acpi/namespace",
|
||||||
ACPI_NS_DUMP_DEVICE_MODULE_NAME);
|
ACPI_NS_DUMP_DEVICE_MODULE_NAME);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* ++++++++++
|
/* ++++++++++
|
||||||
ACPI namespace dump.
|
ACPI namespace dump.
|
||||||
Nothing special here, just tree enumeration and type identification.
|
Nothing special here, just tree enumeration and type identification.
|
||||||
+++++ */
|
+++++ */
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "acpi_priv.h"
|
#include "ACPIPrivate.h"
|
||||||
|
|
||||||
#include <util/kernel_cpp.h>
|
#include <util/kernel_cpp.h>
|
||||||
#include <util/ring_buffer.h>
|
#include <util/ring_buffer.h>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
class RingBuffer {
|
class RingBuffer {
|
||||||
public:
|
public:
|
||||||
RingBuffer(size_t size = 1024);
|
RingBuffer(size_t size = 1024);
|
||||||
~RingBuffer();
|
~RingBuffer();
|
||||||
size_t Read(void *buffer, ssize_t length);
|
size_t Read(void *buffer, ssize_t length);
|
||||||
size_t Write(const void *buffer, ssize_t length);
|
size_t Write(const void *buffer, ssize_t length);
|
||||||
size_t WritableAmount() const;
|
size_t WritableAmount() const;
|
||||||
@@ -60,18 +60,18 @@ make_space(acpi_ns_device_info *device, size_t space)
|
|||||||
}
|
}
|
||||||
snooze(10000);
|
snooze(10000);
|
||||||
|
|
||||||
if (!device->buffer->Lock())
|
if (!device->buffer->Lock())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} while (device->buffer->WritableAmount() < space);
|
} while (device->buffer->WritableAmount() < space);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting)
|
dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting)
|
||||||
{
|
{
|
||||||
char result[255];
|
char result[255];
|
||||||
char output[320];
|
char output[320];
|
||||||
@@ -79,13 +79,13 @@ dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting)
|
|||||||
char hid[16] = "";
|
char hid[16] = "";
|
||||||
int i;
|
int i;
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
for (i = 0; i < indenting; i++)
|
for (i = 0; i < indenting; i++)
|
||||||
strlcat(tabs, "| ", sizeof(tabs));
|
strlcat(tabs, "| ", sizeof(tabs));
|
||||||
|
|
||||||
strlcat(tabs, "|--- ", sizeof(tabs));
|
strlcat(tabs, "|--- ", sizeof(tabs));
|
||||||
|
|
||||||
int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be.
|
int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be.
|
||||||
|
|
||||||
void *counter = NULL;
|
void *counter = NULL;
|
||||||
while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) {
|
while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) {
|
||||||
uint32 type = device->acpi->get_object_type(result);
|
uint32 type = device->acpi->get_object_type(result);
|
||||||
@@ -142,13 +142,13 @@ dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting)
|
|||||||
written = 0;
|
written = 0;
|
||||||
RingBuffer &ringBuffer = *device->buffer;
|
RingBuffer &ringBuffer = *device->buffer;
|
||||||
size_t toWrite = strlen(output);
|
size_t toWrite = strlen(output);
|
||||||
|
|
||||||
if (toWrite <= 0)
|
if (toWrite <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
strlcat(output, "\n", sizeof(output));
|
strlcat(output, "\n", sizeof(output));
|
||||||
toWrite++;
|
toWrite++;
|
||||||
if (!ringBuffer.Lock())
|
if (!ringBuffer.Lock())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (ringBuffer.WritableAmount() < toWrite &&
|
if (ringBuffer.WritableAmount() < toWrite &&
|
||||||
|
|||||||
Reference in New Issue
Block a user