ReactOS  0.4.14-dev-1332-g6db3d88
acpi_bus.h File Reference
#include <acpi.h>
#include "list.h"
Include dependency graph for acpi_bus.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  acpi_handle_list
 
struct  acpi_bus_ops
 
struct  acpi_device_ops
 
struct  acpi_driver
 
struct  acpi_device_status
 
struct  acpi_device_flags
 
struct  acpi_device_pnp
 
struct  acpi_device_power_flags
 
struct  acpi_device_power_state
 
struct  acpi_device_power
 
struct  acpi_device_perf_flags
 
struct  acpi_device_perf_state
 
struct  acpi_device_perf
 
struct  acpi_device_wakeup_flags
 
struct  acpi_device_wakeup_state
 
struct  acpi_device_wakeup
 
struct  acpi_device
 
struct  acpi_bus_event
 
struct  acpi_pci_root
 

Macros

#define ACPI_MAX_HANDLES   10
 
#define ACPI_DRIVER_ALL_NOTIFY_EVENTS   0x1 /* system AND device events */
 
#define acpi_device_bid(d)   ((d)->pnp.bus_id)
 
#define acpi_device_adr(d)   ((d)->pnp.bus_address)
 
#define acpi_device_hid(d)   ((d)->pnp.hardware_id)
 
#define acpi_device_uid(d)   ((d)->pnp.unique_id)
 
#define acpi_device_name(d)   ((d)->pnp.device_name)
 
#define acpi_device_class(d)   ((d)->pnp.device_class)
 
#define acpi_driver_data(d)   ((d)->driver_data)
 
#define to_acpi_device(d)   container_of(d, struct acpi_device, dev)
 
#define to_acpi_driver(d)   container_of(d, struct acpi_driver, drv)
 

Typedefs

typedef int(* acpi_op_add) (struct acpi_device *device)
 
typedef int(* acpi_op_remove) (struct acpi_device *device, int type)
 
typedef int(* acpi_op_start) (struct acpi_device *device)
 
typedef int(* acpi_op_suspend) (struct acpi_device *device, int state)
 
typedef int(* acpi_op_resume) (struct acpi_device *device, int state)
 
typedef int(* acpi_op_scan) (struct acpi_device *device)
 
typedef int(* acpi_op_bind) (struct acpi_device *device)
 
typedef int(* acpi_op_unbind) (struct acpi_device *device)
 
typedef void(* acpi_op_notify) (struct acpi_device *device, UINT32 event)
 
typedef char acpi_bus_id[8]
 
typedef unsigned long acpi_bus_address
 
typedef characpi_hardware_id
 
typedef char acpi_unique_id[9]
 
typedef char acpi_device_name[40]
 
typedef char acpi_device_class[20]
 

Enumerations

enum  acpi_bus_removal_type { ACPI_BUS_REMOVAL_NORMAL = 0, ACPI_BUS_REMOVAL_EJECT, ACPI_BUS_REMOVAL_SUPRISE, ACPI_BUS_REMOVAL_TYPE_COUNT }
 
enum  acpi_bus_device_type {
  ACPI_BUS_TYPE_DEVICE = 0, ACPI_BUS_TYPE_POWER, ACPI_BUS_TYPE_PROCESSOR, ACPI_BUS_TYPE_THERMAL,
  ACPI_BUS_TYPE_SYSTEM, ACPI_BUS_TYPE_POWER_BUTTON, ACPI_BUS_TYPE_SLEEP_BUTTON, ACPI_BUS_TYPE_POWER_BUTTONF,
  ACPI_BUS_TYPE_SLEEP_BUTTONF, ACPI_BUS_DEVICE_TYPE_COUNT
}
 
enum  acpi_irq_model_id { ACPI_IRQ_MODEL_PIC = 0, ACPI_IRQ_MODEL_IOAPIC, ACPI_IRQ_MODEL_IOSAPIC, ACPI_IRQ_MODEL_COUNT }
 

Functions

ACPI_STATUS acpi_extract_package (ACPI_OBJECT *package, ACPI_BUFFER *format, ACPI_BUFFER *buffer)
 
ACPI_STATUS acpi_evaluate_integer (ACPI_HANDLE handle, ACPI_STRING pathname, struct acpi_object_list *arguments, unsigned long long *data)
 
ACPI_STATUS acpi_evaluate_reference (ACPI_HANDLE handle, ACPI_STRING pathname, struct acpi_object_list *arguments, struct acpi_handle_list *list)
 
NTSTATUS acpi_create_volatile_registry_tables (void)
 
int acpi_bus_get_private_data (ACPI_HANDLE, void **)
 
void acpi_bus_data_handler (ACPI_HANDLE handle, void *context)
 
ACPI_STATUS acpi_bus_get_status_handle (ACPI_HANDLE handle, unsigned long long *sta)
 
int acpi_bus_get_status (struct acpi_device *device)
 
int acpi_bus_get_power (ACPI_HANDLE handle, int *state)
 
int acpi_bus_set_power (ACPI_HANDLE handle, int state)
 
BOOLEAN acpi_bus_power_manageable (ACPI_HANDLE handle)
 
BOOLEAN acpi_bus_can_wakeup (ACPI_HANDLE handle)
 
int acpi_bus_generate_proc_event (struct acpi_device *device, UINT8 type, int data)
 
int acpi_bus_generate_event (struct acpi_device *device, UINT8 type, int data)
 
int acpi_bus_receive_event (struct acpi_bus_event *event)
 
int acpi_bus_register_driver (struct acpi_driver *driver)
 
void acpi_bus_unregister_driver (struct acpi_driver *driver)
 
int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, ACPI_HANDLE handle, int type)
 
int acpi_bus_trim (struct acpi_device *start, int rmdevice)
 
int acpi_bus_start (struct acpi_device *device)
 
ACPI_STATUS acpi_bus_get_ejd (ACPI_HANDLE handle, ACPI_HANDLE *ejd)
 
int acpi_match_device_ids (struct acpi_device *device, const struct acpi_pnp_device_id *ids)
 
int acpi_bus_get_device (ACPI_HANDLE handle, struct acpi_device **device)
 
int acpi_init (void)
 
ACPI_STATUS acpi_suspend (UINT32 state)
 

Variables

struct bus_type acpi_bus_type
 
enum acpi_irq_model_id acpi_irq_model
 

Macro Definition Documentation

◆ acpi_device_adr

#define acpi_device_adr (   d)    ((d)->pnp.bus_address)

Definition at line 187 of file acpi_bus.h.

◆ acpi_device_bid

#define acpi_device_bid (   d)    ((d)->pnp.bus_id)

Definition at line 186 of file acpi_bus.h.

◆ acpi_device_class

#define acpi_device_class (   d)    ((d)->pnp.device_class)

Definition at line 191 of file acpi_bus.h.

◆ acpi_device_hid

#define acpi_device_hid (   d)    ((d)->pnp.hardware_id)

Definition at line 188 of file acpi_bus.h.

◆ acpi_device_name

#define acpi_device_name (   d)    ((d)->pnp.device_name)

Definition at line 190 of file acpi_bus.h.

◆ acpi_device_uid

#define acpi_device_uid (   d)    ((d)->pnp.unique_id)

Definition at line 189 of file acpi_bus.h.

◆ ACPI_DRIVER_ALL_NOTIFY_EVENTS

#define ACPI_DRIVER_ALL_NOTIFY_EVENTS   0x1 /* system AND device events */

Definition at line 119 of file acpi_bus.h.

◆ acpi_driver_data

#define acpi_driver_data (   d)    ((d)->driver_data)

Definition at line 289 of file acpi_bus.h.

◆ ACPI_MAX_HANDLES

#define ACPI_MAX_HANDLES   10

Definition at line 35 of file acpi_bus.h.

◆ to_acpi_device

#define to_acpi_device (   d)    container_of(d, struct acpi_device, dev)

Definition at line 291 of file acpi_bus.h.

◆ to_acpi_driver

#define to_acpi_driver (   d)    container_of(d, struct acpi_driver, drv)

Definition at line 292 of file acpi_bus.h.

Typedef Documentation

◆ acpi_bus_address

Definition at line 170 of file acpi_bus.h.

◆ acpi_bus_id

typedef char acpi_bus_id[8]

Definition at line 169 of file acpi_bus.h.

◆ acpi_device_class

typedef char acpi_device_class[20]

Definition at line 174 of file acpi_bus.h.

◆ acpi_device_name

typedef char acpi_device_name[40]

Definition at line 173 of file acpi_bus.h.

◆ acpi_hardware_id

Definition at line 171 of file acpi_bus.h.

◆ acpi_op_add

typedef int(* acpi_op_add) (struct acpi_device *device)

Definition at line 92 of file acpi_bus.h.

◆ acpi_op_bind

typedef int(* acpi_op_bind) (struct acpi_device *device)

Definition at line 98 of file acpi_bus.h.

◆ acpi_op_notify

typedef void(* acpi_op_notify) (struct acpi_device *device, UINT32 event)

Definition at line 100 of file acpi_bus.h.

◆ acpi_op_remove

typedef int(* acpi_op_remove) (struct acpi_device *device, int type)

Definition at line 93 of file acpi_bus.h.

◆ acpi_op_resume

typedef int(* acpi_op_resume) (struct acpi_device *device, int state)

Definition at line 96 of file acpi_bus.h.

◆ acpi_op_scan

typedef int(* acpi_op_scan) (struct acpi_device *device)

Definition at line 97 of file acpi_bus.h.

◆ acpi_op_start

typedef int(* acpi_op_start) (struct acpi_device *device)

Definition at line 94 of file acpi_bus.h.

◆ acpi_op_suspend

typedef int(* acpi_op_suspend) (struct acpi_device *device, int state)

Definition at line 95 of file acpi_bus.h.

◆ acpi_op_unbind

typedef int(* acpi_op_unbind) (struct acpi_device *device)

Definition at line 99 of file acpi_bus.h.

◆ acpi_unique_id

typedef char acpi_unique_id[9]

Definition at line 172 of file acpi_bus.h.

Enumeration Type Documentation

◆ acpi_bus_device_type

Enumerator
ACPI_BUS_TYPE_DEVICE 
ACPI_BUS_TYPE_POWER 
ACPI_BUS_TYPE_PROCESSOR 
ACPI_BUS_TYPE_THERMAL 
ACPI_BUS_TYPE_SYSTEM 
ACPI_BUS_TYPE_POWER_BUTTON 
ACPI_BUS_TYPE_SLEEP_BUTTON 
ACPI_BUS_TYPE_POWER_BUTTONF 
ACPI_BUS_TYPE_SLEEP_BUTTONF 
ACPI_BUS_DEVICE_TYPE_COUNT 

Definition at line 70 of file acpi_bus.h.

◆ acpi_bus_removal_type

Enumerator
ACPI_BUS_REMOVAL_NORMAL 
ACPI_BUS_REMOVAL_EJECT 
ACPI_BUS_REMOVAL_SUPRISE 
ACPI_BUS_REMOVAL_TYPE_COUNT 

Definition at line 63 of file acpi_bus.h.

◆ acpi_irq_model_id

Enumerator
ACPI_IRQ_MODEL_PIC 
ACPI_IRQ_MODEL_IOAPIC 
ACPI_IRQ_MODEL_IOSAPIC 
ACPI_IRQ_MODEL_COUNT 

Definition at line 384 of file acpi_bus.h.

Function Documentation

◆ acpi_bus_add()

int acpi_bus_add ( struct acpi_device **  child,
struct acpi_device parent,
ACPI_HANDLE  handle,
int  type 
)

Definition at line 1130 of file bus.c.

1135 {
1136  int result = 0;
1138  struct acpi_device *device = NULL;
1139  char bus_id[5] = {'?',0};
1142  char *hid = NULL;
1143  char *uid = NULL;
1144  ACPI_PNP_DEVICE_ID_LIST *cid_list = NULL;
1145  int i = 0;
1146  acpi_unique_id static_uid_buffer;
1147 
1148  if (!child)
1150 
1151  device = ExAllocatePoolWithTag(NonPagedPool,sizeof(struct acpi_device), 'DpcA');
1152  if (!device) {
1153  DPRINT1("Memory allocation error\n");
1154  return_VALUE(-12);
1155  }
1156  memset(device, 0, sizeof(struct acpi_device));
1157 
1158  device->handle = handle;
1159  device->parent = parent;
1160 
1161  /*
1162  * Bus ID
1163  * ------
1164  * The device's Bus ID is simply the object name.
1165  * TBD: Shouldn't this value be unique (within the ACPI namespace)?
1166  */
1167  switch (type) {
1168  case ACPI_BUS_TYPE_SYSTEM:
1169  snprintf(device->pnp.bus_id, sizeof(device->pnp.bus_id), "%s", "ACPI");
1170  break;
1173  snprintf(device->pnp.bus_id, sizeof(device->pnp.bus_id), "%s", "PWRF");
1174  break;
1177  snprintf(device->pnp.bus_id, sizeof(device->pnp.bus_id), "%s", "SLPF");
1178  break;
1179  default:
1180  buffer.Length = sizeof(bus_id);
1181  buffer.Pointer = bus_id;
1183 
1184 
1185  /* Clean up trailing underscores (if any) */
1186  for (i = 3; i > 1; i--) {
1187  if (bus_id[i] == '_')
1188  bus_id[i] = '\0';
1189  else
1190  break;
1191  }
1192  snprintf(device->pnp.bus_id, sizeof(device->pnp.bus_id), "%s", bus_id);
1193  buffer.Pointer = NULL;
1194 
1195  break;
1196  }
1197 
1198  /*
1199  * Flags
1200  * -----
1201  * Get prior to calling acpi_bus_get_status() so we know whether
1202  * or not _STA is present. Note that we only look for object
1203  * handles -- cannot evaluate objects until we know the device is
1204  * present and properly initialized.
1205  */
1207  if (result)
1208  goto end;
1209 
1210  /*
1211  * Status
1212  * ------
1213  * See if the device is present. We always assume that non-Device()
1214  * objects (e.g. thermal zones, power resources, processors, etc.) are
1215  * present, functioning, etc. (at least when parent object is present).
1216  * Note that _STA has a different meaning for some objects (e.g.
1217  * power resources) so we need to be careful how we use it.
1218  */
1219  switch (type) {
1220  case ACPI_BUS_TYPE_DEVICE:
1222  if (result)
1223  goto end;
1224  break;
1225  default:
1226  STRUCT_TO_INT(device->status) = 0x0F;
1227  break;
1228  }
1229  if (!device->status.present) {
1230  result = -2;
1231  goto end;
1232  }
1233 
1234  /*
1235  * Initialize Device
1236  * -----------------
1237  * TBD: Synch with Core's enumeration/initialization process.
1238  */
1239 
1240  /*
1241  * Hardware ID, Unique ID, & Bus Address
1242  * -------------------------------------
1243  */
1244  switch (type) {
1245  case ACPI_BUS_TYPE_DEVICE:
1247  if (ACPI_FAILURE(status)) {
1248  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1249  "Error reading device info\n"));
1250  result = AE_NOT_FOUND;
1251  info = NULL;
1252  goto end;
1253  }
1254  if (info->Valid & ACPI_VALID_HID)
1255  hid = info->HardwareId.String;
1256  if (info->Valid & ACPI_VALID_UID)
1257  uid = info->UniqueId.String;
1258  if (info->Valid & ACPI_VALID_CID) {
1259  cid_list = &info->CompatibleIdList;
1260  device->pnp.cid_list = ExAllocatePoolWithTag(NonPagedPool,cid_list->ListSize, 'DpcA');
1261  if (device->pnp.cid_list) {
1262  char *p = (char *)&device->pnp.cid_list->Ids[cid_list->Count];
1263  device->pnp.cid_list->Count = cid_list->Count;
1264  device->pnp.cid_list->ListSize = cid_list->ListSize;
1265  for (i = 0; i < cid_list->Count; i++) {
1266  device->pnp.cid_list->Ids[i].Length = cid_list->Ids[i].Length;
1267  device->pnp.cid_list->Ids[i].String = p;
1268  ASSERT(p + cid_list->Ids[i].Length <= (char *)device->pnp.cid_list + cid_list->ListSize);
1269  memcpy(device->pnp.cid_list->Ids[i].String,
1270  cid_list->Ids[i].String, cid_list->Ids[i].Length);
1271  p += cid_list->Ids[i].Length;
1272  }
1273  }
1274  else
1275  DPRINT("Memory allocation error\n");
1276  }
1277  if (info->Valid & ACPI_VALID_ADR) {
1278  device->pnp.bus_address = info->Address;
1279  device->flags.bus_address = 1;
1280  }
1281  break;
1282  case ACPI_BUS_TYPE_POWER:
1283  hid = ACPI_POWER_HID;
1284  uid = static_uid_buffer;
1285  snprintf(uid, sizeof(static_uid_buffer), "%d", (PowerDeviceCount++));
1286  break;
1288  hid = ACPI_PROCESSOR_HID;
1289  uid = static_uid_buffer;
1290  snprintf(uid, sizeof(static_uid_buffer), "_%d", (ProcessorCount++));
1291  break;
1292  case ACPI_BUS_TYPE_SYSTEM:
1293  hid = ACPI_SYSTEM_HID;
1294  break;
1295  case ACPI_BUS_TYPE_THERMAL:
1296  hid = ACPI_THERMAL_HID;
1297  uid = static_uid_buffer;
1298  snprintf(uid, sizeof(static_uid_buffer), "%d", (ThermalZoneCount++));
1299  break;
1301  hid = ACPI_BUTTON_HID_POWER;
1302  uid = static_uid_buffer;
1303  snprintf(uid, sizeof(static_uid_buffer), "%d", (PowerButtonCount++));
1304  break;
1306  hid = ACPI_BUTTON_HID_POWERF;
1307  uid = static_uid_buffer;
1308  snprintf(uid, sizeof(static_uid_buffer), "%d", (FixedPowerButtonCount++));
1309  break;
1311  hid = ACPI_BUTTON_HID_SLEEP;
1312  uid = static_uid_buffer;
1313  snprintf(uid, sizeof(static_uid_buffer), "%d", (SleepButtonCount++));
1314  break;
1316  hid = ACPI_BUTTON_HID_SLEEPF;
1317  uid = static_uid_buffer;
1318  snprintf(uid, sizeof(static_uid_buffer), "%d", (FixedSleepButtonCount++));
1319  break;
1320  }
1321 
1322  /*
1323  * \_SB
1324  * ----
1325  * Fix for the system root bus device -- the only root-level device.
1326  */
1328  hid = ACPI_BUS_HID;
1329  snprintf(device->pnp.device_name, sizeof(device->pnp.device_name), "%s", ACPI_BUS_DEVICE_NAME);
1330  snprintf(device->pnp.device_class, sizeof(device->pnp.device_class), "%s", ACPI_BUS_CLASS);
1331  }
1332 
1333  if (hid) {
1334  device->pnp.hardware_id = ExAllocatePoolWithTag(NonPagedPool, strlen(hid) + 1, 'DpcA');
1335  if (device->pnp.hardware_id) {
1336  snprintf(device->pnp.hardware_id, strlen(hid) + 1, "%s", hid);
1337  device->flags.hardware_id = 1;
1338  }
1339  }
1340  if (uid) {
1341  snprintf(device->pnp.unique_id, sizeof(device->pnp.unique_id), "%s", uid);
1342  device->flags.unique_id = 1;
1343  }
1344 
1345  /*
1346  * If we called get_object_info, we now are finished with the buffer,
1347  * so we can free it.
1348  */
1349  //if (buffer.Pointer)
1350  //AcpiOsFree(buffer.Pointer);
1351 
1352  /*
1353  * Power Management
1354  * ----------------
1355  */
1356  if (device->flags.power_manageable) {
1358  if (result)
1359  goto end;
1360  }
1361 
1362  /*
1363  * Performance Management
1364  * ----------------------
1365  */
1366  if (device->flags.performance_manageable) {
1368  if (result)
1369  goto end;
1370  }
1371 
1372  /*
1373  * Context
1374  * -------
1375  * Attach this 'struct acpi_device' to the ACPI object. This makes
1376  * resolutions from handle->device very efficient. Note that we need
1377  * to be careful with fixed-feature devices as they all attach to the
1378  * root object.
1379  */
1380  switch (type) {
1385  break;
1386  default:
1387  status = AcpiAttachData(device->handle,
1389  break;
1390  }
1391  if (ACPI_FAILURE(status)) {
1392  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1393  "Error attaching device data\n"));
1394  result = AE_NOT_FOUND;
1395  goto end;
1396  }
1397 
1398  /*
1399  * Linkage
1400  * -------
1401  * Link this device to its parent and siblings.
1402  */
1403  INIT_LIST_HEAD(&device->children);
1404  if (!device->parent)
1405  INIT_LIST_HEAD(&device->node);
1406  else
1407  list_add_tail(&device->node, &device->parent->children);
1408 
1409  /*
1410  * Global Device Hierarchy:
1411  * ------------------------
1412  * Register this device with the global device hierarchy.
1413  */
1415 
1416  /*
1417  * Bind _ADR-Based Devices
1418  * -----------------------
1419  * If there's a a bus address (_ADR) then we utilize the parent's
1420  * 'bind' function (if exists) to bind the ACPI- and natively-
1421  * enumerated device representations.
1422  */
1423  if (device->flags.bus_address) {
1424  if (device->parent && device->parent->ops.bind)
1425  device->parent->ops.bind(device);
1426  }
1427 
1428  /*
1429  * Locate & Attach Driver
1430  * ----------------------
1431  * If there's a hardware id (_HID) or compatible ids (_CID) we check
1432  * to see if there's a driver installed for this kind of device. Note
1433  * that drivers can install before or after a device is enumerated.
1434  *
1435  * TBD: Assumes LDM provides driver hot-plug capability.
1436  */
1437  if (device->flags.hardware_id || device->flags.compatible_ids)
1439 
1440 end:
1441  if (info != NULL)
1442  ACPI_FREE(info);
1443  if (result) {
1444  if (device->pnp.cid_list) {
1445  ExFreePoolWithTag(device->pnp.cid_list, 'DpcA');
1446  }
1447  if (device->pnp.hardware_id) {
1448  ExFreePoolWithTag(device->pnp.hardware_id, 'DpcA');
1449  }
1450  ExFreePoolWithTag(device, 'DpcA');
1452  }
1453  *child = device;
1454 
1455  return_VALUE(0);
1456 }
static int acpi_bus_get_flags(struct acpi_device *device)
Definition: bus.c:1080
int ProcessorCount
Definition: bus.c:58
#define ACPI_VALID_HID
Definition: actypes.h:1306
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_BUTTON_HID_POWERF
Definition: acpi_drivers.h:91
int acpi_bus_get_status(struct acpi_device *device)
Definition: bus.c:147
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
int PowerButtonCount
Definition: bus.c:58
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ACPI_PNP_DEVICE_ID Ids[1]
Definition: actypes.h:1273
#define INIT_LIST_HEAD(ptr)
Definition: list.h:24
#define snprintf
Definition: wintirpc.h:48
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define ACPI_BUS_HID
Definition: acpi_drivers.h:38
static int acpi_bus_find_driver(struct acpi_device *device)
Definition: bus.c:990
GLuint GLuint end
Definition: gl.h:1545
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_SINGLE_NAME
Definition: actypes.h:1053
#define ACPI_BUS_CLASS
Definition: acpi_drivers.h:37
static HWND child
Definition: cursoricon.c:298
int FixedPowerButtonCount
Definition: bus.c:58
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ACPI_PROCESSOR_HID
Definition: acpi_drivers.h:221
#define ACPI_BUTTON_HID_SLEEPF
Definition: acpi_drivers.h:99
Definition: devices.h:37
#define ACPI_THERMAL_HID
Definition: acpi_drivers.h:266
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_VALID_CID
Definition: actypes.h:1308
static int acpi_bus_get_power_flags(struct acpi_device *device)
Definition: bus.c:370
void DPRINT(...)
Definition: polytest.cpp:61
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
char acpi_unique_id[9]
Definition: acpi_bus.h:172
ACPI_STATUS AcpiGetName(ACPI_HANDLE Handle, UINT32 NameType, ACPI_BUFFER *Buffer)
Definition: nsxfname.c:173
r parent
Definition: btrfs.c:2869
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define for
Definition: utility.h:88
#define AE_NOT_FOUND
Definition: acexcep.h:113
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
void acpi_bus_data_handler(ACPI_HANDLE handle, void *context)
Definition: bus.c:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ACPI_VALID_ADR
Definition: actypes.h:1305
#define ACPI_BUS_DEVICE_NAME
Definition: acpi_drivers.h:40
int ThermalZoneCount
Definition: bus.c:59
static int acpi_device_register(struct acpi_device *device, struct acpi_device *parent)
Definition: bus.c:62
ACPI_STATUS AcpiGetObjectInfo(ACPI_HANDLE Handle, ACPI_DEVICE_INFO **ReturnBuffer)
Definition: nsxfname.c:287
static int acpi_bus_get_perf_flags(struct acpi_device *device)
Definition: bus.c:440
#define ACPI_SYSTEM_HID
Definition: acpi_drivers.h:244
#define DPRINT1
Definition: precomp.h:8
#define ACPI_BUTTON_HID_SLEEP
Definition: acpi_drivers.h:98
#define ACPI_POWER_HID
Definition: acpi_drivers.h:198
#define ACPI_BUTTON_HID_POWER
Definition: acpi_drivers.h:90
#define ACPI_VALID_UID
Definition: actypes.h:1307
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiAttachData(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void *Data)
Definition: nsxfeval.c:952
int FixedSleepButtonCount
Definition: bus.c:59
int PowerDeviceCount
Definition: bus.c:58
#define STRUCT_TO_INT(s)
Definition: bus.c:41
Definition: ps.c:97
int SleepButtonCount
Definition: bus.c:59

Referenced by acpi_bus_init(), acpi_bus_scan(), and acpi_bus_scan_fixed().

◆ acpi_bus_can_wakeup()

BOOLEAN acpi_bus_can_wakeup ( ACPI_HANDLE  handle)

Definition at line 360 of file bus.c.

361 {
362  struct acpi_device *device;
363  int result;
364 
366  return result ? 0 : device->wakeup.flags.valid;
367 }
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
Definition: devices.h:37
GLuint64EXT * result
Definition: glext.h:11304

◆ acpi_bus_data_handler()

void acpi_bus_data_handler ( ACPI_HANDLE  handle,
void context 
)

Definition at line 95 of file bus.c.

98 {
99  DPRINT1("acpi_bus_data_handler not implemented\n");
100 
101  /* TBD */
102 
103  return;
104 }
#define DPRINT1
Definition: precomp.h:8

Referenced by acpi_bus_add(), and acpi_bus_get_device().

◆ acpi_bus_generate_event()

int acpi_bus_generate_event ( struct acpi_device device,
UINT8  type,
int  data 
)

Definition at line 485 of file bus.c.

489 {
490  ULONG_PTR TypeData = 0;
491 
492  DPRINT("acpi_bus_generate_event\n");
493 
494  if (!device)
496 
497  /* drop event on the floor if no one's listening */
498  if (!event_is_open)
499  return_VALUE(0);
500 
501  /* Data shouldn't even get near 24 bits */
502  ASSERT(!(data & 0xFF000000));
503 
504  TypeData = data;
505  TypeData |= type << 24;
506 
507  KeInsertQueueDpc(&event_dpc, device, (PVOID)TypeData);
508 
509  return_VALUE(0);
510 }
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
uint32_t ULONG_PTR
Definition: typedefs.h:64
Definition: devices.h:37
void DPRINT(...)
Definition: polytest.cpp:61
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
int event_is_open
Definition: bus.c:46
KDPC event_dpc
Definition: bus.c:56

Referenced by acpi_button_notify().

◆ acpi_bus_generate_proc_event()

int acpi_bus_generate_proc_event ( struct acpi_device device,
UINT8  type,
int  data 
)

◆ acpi_bus_get_device()

int acpi_bus_get_device ( ACPI_HANDLE  handle,
struct acpi_device **  device 
)

Definition at line 108 of file bus.c.

111 {
113 
114  if (!device)
116 
117  /* TBD: Support fixed-feature devices */
118 
120  if (ACPI_FAILURE(status) || !*device) {
121  DPRINT( "Error getting context for object [%p]\n",
122  handle);
124  }
125 
126  return 0;
127 }
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
Definition: devices.h:37
void DPRINT(...)
Definition: polytest.cpp:61
ACPI_STATUS AcpiGetData(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void **Data)
Definition: nsxfeval.c:1065
#define AE_NOT_FOUND
Definition: acexcep.h:113
void acpi_bus_data_handler(ACPI_HANDLE handle, void *context)
Definition: bus.c:95
#define AE_OK
Definition: acexcep.h:97
Definition: ps.c:97

Referenced by acpi_bus_can_wakeup(), acpi_bus_check_device(), acpi_bus_get_power(), acpi_bus_notify(), acpi_bus_power_manageable(), acpi_bus_set_power(), acpi_power_get_context(), Bus_PDO_PnP(), Bus_PDO_QueryDeviceCaps(), Bus_PDO_QueryDeviceId(), Bus_PDO_QueryResources(), and Bus_PlugInDevice().

◆ acpi_bus_get_ejd()

ACPI_STATUS acpi_bus_get_ejd ( ACPI_HANDLE  handle,
ACPI_HANDLE ejd 
)

◆ acpi_bus_get_power()

int acpi_bus_get_power ( ACPI_HANDLE  handle,
int state 
)

Definition at line 198 of file bus.c.

201 {
202  int result = 0;
203  ACPI_STATUS status = 0;
204  struct acpi_device *device = NULL;
205  unsigned long long psc = 0;
206 
208  if (result)
210 
212 
213  if (!device->flags.power_manageable) {
214  /* TBD: Non-recursive algorithm for walking up hierarchy */
215  if (device->parent)
216  *state = device->parent->power.state;
217  else
218  *state = ACPI_STATE_D0;
219  }
220  else {
221  /*
222  * Get the device's power state either directly (via _PSC) or
223  * indirectly (via power resources).
224  */
225  if (device->power.flags.explicit_get) {
226  status = acpi_evaluate_integer(device->handle, "_PSC",
227  NULL, &psc);
228  if (ACPI_FAILURE(status))
230  device->power.state = (int) psc;
231  }
232  else if (device->power.flags.power_resources) {
234  if (result)
236  }
237 
238  *state = device->power.state;
239  }
240 
241  DPRINT("Device [%s] power state is D%d\n",
242  device->pnp.bus_id, device->power.state);
243 
244  return_VALUE(0);
245 }
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
#define return_VALUE(s)
Definition: acoutput.h:499
ACPI_STATUS acpi_evaluate_integer(ACPI_HANDLE handle, ACPI_STRING pathname, ACPI_OBJECT_LIST *arguments, unsigned long long *data)
Definition: utils.c:242
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_NOT_FOUND
Definition: acexcep.h:113
static int state
Definition: maze.c:121
static SCRIPT_CACHE * psc
Definition: usp10.c:64
int acpi_power_get_inferred_state(struct acpi_device *device)
Definition: power.c:444
#define ACPI_STATE_D0
Definition: actypes.h:625
GLuint64EXT * result
Definition: glext.h:11304
#define ACPI_STATE_UNKNOWN
Definition: actypes.h:614
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
Definition: ps.c:97

Referenced by acpi_bus_set_power(), and Bus_InitializePdo().

◆ acpi_bus_get_private_data()

int acpi_bus_get_private_data ( ACPI_HANDLE  ,
void **   
)

Definition at line 178 of file bus.c.

179 {
181 
182  if (!*data)
183  return -1;
184 
186  if (ACPI_FAILURE(status) || !*data) {
187  DPRINT("No context for object [%p]\n", handle);
188  return -1;
189  }
190 
191  return 0;
192 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
void DPRINT(...)
Definition: polytest.cpp:61
ACPI_STATUS AcpiGetData(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void **Data)
Definition: nsxfeval.c:1065
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void acpi_bus_private_data_handler(ACPI_HANDLE handle, void *context)
Definition: bus.c:172
#define AE_OK
Definition: acexcep.h:97
Definition: ps.c:97

◆ acpi_bus_get_status()

int acpi_bus_get_status ( struct acpi_device device)

Definition at line 147 of file bus.c.

149 {
151  unsigned long long sta;
152 
153  status = acpi_bus_get_status_handle(device->handle, &sta);
154  if (ACPI_FAILURE(status))
155  return -1;
156 
157  STRUCT_TO_INT(device->status) = (int) sta;
158 
159  if (device->status.functional && !device->status.present) {
160  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
161  "functional but not present;\n",
162  device->pnp.bus_id,
163  (UINT32) STRUCT_TO_INT(device->status)));
164  }
165 
166  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
167  device->pnp.bus_id,
168  (UINT32) STRUCT_TO_INT(device->status)));
169  return 0;
170 }
ACPI_STATUS acpi_bus_get_status_handle(ACPI_HANDLE handle, unsigned long long *sta)
Definition: bus.c:129
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
Definition: devices.h:37
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_INFO
Definition: acoutput.h:153
static SERVICE_STATUS status
Definition: service.c:31
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define STRUCT_TO_INT(s)
Definition: bus.c:41
Definition: ps.c:97

Referenced by acpi_bus_add(), and acpi_bus_check_device().

◆ acpi_bus_get_status_handle()

ACPI_STATUS acpi_bus_get_status_handle ( ACPI_HANDLE  handle,
unsigned long long sta 
)

Definition at line 129 of file bus.c.

131 {
133 
134  status = acpi_evaluate_integer(handle, "_STA", NULL, sta);
135  if (ACPI_SUCCESS(status))
136  return AE_OK;
137 
138  if (status == AE_NOT_FOUND) {
141  return AE_OK;
142  }
143  return status;
144 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS acpi_evaluate_integer(ACPI_HANDLE handle, ACPI_STRING pathname, ACPI_OBJECT_LIST *arguments, unsigned long long *data)
Definition: utils.c:242
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_STA_DEVICE_PRESENT
Definition: actypes.h:1315
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_STA_DEVICE_UI
Definition: actypes.h:1317
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define ACPI_STA_DEVICE_FUNCTIONING
Definition: actypes.h:1318
static SERVICE_STATUS status
Definition: service.c:31
#define AE_OK
Definition: acexcep.h:97
#define ACPI_STA_DEVICE_ENABLED
Definition: actypes.h:1316
Definition: ps.c:97

Referenced by acpi_bus_get_status().

◆ acpi_bus_power_manageable()

BOOLEAN acpi_bus_power_manageable ( ACPI_HANDLE  handle)

Definition at line 351 of file bus.c.

352 {
353  struct acpi_device *device;
354  int result;
355 
357  return result ? 0 : device->flags.power_manageable;
358 }
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
Definition: devices.h:37
GLuint64EXT * result
Definition: glext.h:11304

Referenced by Bus_PDO_PnP(), and Bus_PDO_Power().

◆ acpi_bus_receive_event()

int acpi_bus_receive_event ( struct acpi_bus_event event)

Definition at line 513 of file bus.c.

515 {
516 // unsigned long flags = 0;
517  struct acpi_bus_event *entry = NULL;
518  KIRQL OldIrql;
519 
520  //DECLARE_WAITQUEUE(wait, current);
521 
522  DPRINT("acpi_bus_receive_event\n");
523 
524  if (!event)
525  return AE_BAD_PARAMETER;
526 
527  event_is_open++;
529  Executive,
530  KernelMode,
531  FALSE,
532  NULL);
533  event_is_open--;
535 
536  if (list_empty(&acpi_bus_event_list))
538 
539 // spin_lock_irqsave(&acpi_bus_event_lock, flags);
541  entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
542  if (entry)
543  list_del(&entry->node);
545 // spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
546 
547  if (!entry)
549 
550  memcpy(event, entry, sizeof(struct acpi_bus_event));
551 
552  ExFreePoolWithTag(entry, 'epcA');
553  return_VALUE(0);
554 }
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static void list_del(struct list_head *entry)
Definition: list.h:89
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define list_entry(ptr, type, member)
Definition: list.h:185
UCHAR KIRQL
Definition: env_spec_w32.h:591
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define AE_NOT_FOUND
Definition: acexcep.h:113
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _cl_event * event
Definition: glext.h:7739
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
KSPIN_LOCK acpi_bus_event_lock
Definition: bus.c:52
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
int event_is_open
Definition: bus.c:46
KEVENT AcpiEventQueue
Definition: bus.c:55
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
Definition: dlist.c:348

Referenced by ButtonWaitThread().

◆ acpi_bus_register_driver()

int acpi_bus_register_driver ( struct acpi_driver driver)

acpi_bus_register_driver

Registers a driver with the ACPI bus. Searches the namespace for all devices that match the driver's criteria and binds.

Definition at line 1029 of file bus.c.

1031 {
1032  if (!driver)
1034 
1035  //if (acpi_disabled)
1036  // return_VALUE(AE_NOT_FOUND);
1037 
1039  list_add_tail(&driver->node, &acpi_bus_drivers);
1041 
1043  WALK_DOWN, driver);
1044 
1045  return_VALUE(driver->references);
1046 }
struct acpi_device * acpi_root
Definition: bus.c:51
static int acpi_bus_attach(struct acpi_device *device, int level, void *data)
Definition: bus.c:906
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static int acpi_bus_walk(struct acpi_device *start, acpi_bus_walk_callback callback, int direction, void *data)
Definition: bus.c:575
#define WALK_DOWN
Definition: bus.c:39
#define down(mutex)
Definition: glue.h:29
#define up(mutex)
Definition: glue.h:30
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
static FAST_MUTEX acpi_bus_drivers_lock
Definition: bus.c:810
struct @1625::@1626 driver

Referenced by acpi_button_init(), acpi_power_init(), and acpi_system_init().

◆ acpi_bus_set_power()

int acpi_bus_set_power ( ACPI_HANDLE  handle,
int  state 
)

Definition at line 249 of file bus.c.

252 {
253  int result = 0;
255  struct acpi_device *device = NULL;
256  char object_name[5] = {'_','P','S','0'+state,'\0'};
257 
258 
260  if (result)
262 
263  if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
265 
266  /* Make sure this is a valid target state */
267 
268  if (!device->flags.power_manageable) {
269  DPRINT1( "Device is not power manageable\n");
271  }
272  /*
273  * Get device's current power state
274  */
275  //if (!acpi_power_nocheck) {
276  /*
277  * Maybe the incorrect power state is returned on the bogus
278  * bios, which is different with the real power state.
279  * For example: the bios returns D0 state and the real power
280  * state is D3. OS expects to set the device to D0 state. In
281  * such case if OS uses the power state returned by the BIOS,
282  * the device can't be transisted to the correct power state.
283  * So if the acpi_power_nocheck is set, it is unnecessary to
284  * get the power state by calling acpi_bus_get_power.
285  */
286  acpi_bus_get_power(device->handle, &device->power.state);
287  //}
288 
289  if ((state == device->power.state) && !device->flags.force_power_state) {
290  DPRINT1("Device is already at D%d\n", state);
291  return 0;
292  }
293  if (!device->power.states[state].flags.valid) {
294  DPRINT1( "Device does not support D%d\n", state);
295  return AE_NOT_FOUND;
296  }
297  if (device->parent && (state < device->parent->power.state)) {
298  DPRINT1( "Cannot set device to a higher-powered state than parent\n");
299  return AE_NOT_FOUND;
300  }
301 
302  /*
303  * Transition Power
304  * ----------------
305  * On transitions to a high-powered state we first apply power (via
306  * power resources) then evalute _PSx. Conversely for transitions to
307  * a lower-powered state.
308  */
309  if (state < device->power.state) {
310  if (device->power.flags.power_resources) {
312  if (result)
313  goto end;
314  }
315  if (device->power.states[state].flags.explicit_set) {
316  status = AcpiEvaluateObject(device->handle,
317  object_name, NULL, NULL);
318  if (ACPI_FAILURE(status)) {
320  goto end;
321  }
322  }
323  }
324  else {
325  if (device->power.states[state].flags.explicit_set) {
326  status = AcpiEvaluateObject(device->handle,
327  object_name, NULL, NULL);
328  if (ACPI_FAILURE(status)) {
330  goto end;
331  }
332  }
333  if (device->power.flags.power_resources) {
335  if (result)
336  goto end;
337  }
338  }
339 
340 end:
341  if (result)
342  DPRINT( "Error transitioning device [%s] to D%d\n",
343  device->pnp.bus_id, state);
344  else
345  DPRINT("Device [%s] transitioned to D%d\n",
346  device->pnp.bus_id, state);
347 
348  return result;
349 }
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
#define return_VALUE(s)
Definition: acoutput.h:499
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
GLuint GLuint end
Definition: gl.h:1545
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
r parent
Definition: btrfs.c:2869
int acpi_bus_get_power(ACPI_HANDLE handle, int *state)
Definition: bus.c:198
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define ACPI_STATE_D3
Definition: actypes.h:628
static int state
Definition: maze.c:121
int acpi_power_transition(struct acpi_device *device, int state)
Definition: power.c:484
float power
Definition: d3drm.c:3372
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
Definition: nsxfeval.c:217
#define DPRINT1
Definition: precomp.h:8
#define ACPI_STATE_D0
Definition: actypes.h:625
GLuint64EXT * result
Definition: glext.h:11304
#define AE_OK
Definition: acexcep.h:97
Definition: ps.c:97

Referenced by Bus_PDO_PnP(), and Bus_PDO_Power().

◆ acpi_bus_start()

int acpi_bus_start ( struct acpi_device device)

◆ acpi_bus_trim()

int acpi_bus_trim ( struct acpi_device start,
int  rmdevice 
)

◆ acpi_bus_unregister_driver()

void acpi_bus_unregister_driver ( struct acpi_driver driver)

acpi_bus_unregister_driver

Unregisters a driver with the ACPI bus. Searches the namespace for all devices that match the driver's criteria and unbinds.

Definition at line 1056 of file bus.c.

1058 {
1059  if (!driver)
1060  return;
1061 
1063 
1064  if (driver->references)
1065  return;
1066 
1068  list_del(&driver->node);
1070 
1071  return;
1072 }
struct acpi_device * acpi_root
Definition: bus.c:51
static void list_del(struct list_head *entry)
Definition: list.h:89
static int acpi_bus_walk(struct acpi_device *start, acpi_bus_walk_callback callback, int direction, void *data)
Definition: bus.c:575
#define down(mutex)
Definition: glue.h:29
#define up(mutex)
Definition: glue.h:30
static int acpi_bus_unattach(struct acpi_device *device, int level, void *data)
Definition: bus.c:951
static FAST_MUTEX acpi_bus_drivers_lock
Definition: bus.c:810
struct @1625::@1626 driver
#define WALK_UP
Definition: bus.c:38

Referenced by acpi_button_exit(), and acpi_system_exit().

◆ acpi_create_volatile_registry_tables()

NTSTATUS acpi_create_volatile_registry_tables ( void  )

Definition at line 522 of file utils.c.

523 {
525  UNICODE_STRING HardwareKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\ACPI");
528  ACPI_STATUS AcpiStatus;
529  ACPI_TABLE_HEADER *OutTable;
530  ACPI_PHYSICAL_ADDRESS RsdpAddress;
531  ACPI_TABLE_RSDP *Rsdp;
532  ACPI_PHYSICAL_ADDRESS Address;
533  UINT32 TableEntrySize;
534 
535  /* Create Main Hardware ACPI key*/
537  &HardwareKeyName,
539  NULL,
540  NULL);
541  Status = ZwCreateKey(&KeyHandle,
542  KEY_WRITE,
544  0,
545  NULL,
547  NULL);
548  if (!NT_SUCCESS(Status))
549  {
550  DPRINT1("ZwCreateKey() for ACPI failed (Status 0x%08lx)\n", Status);
551  return Status;
552  }
553  /* Read DSDT table */
554  AcpiStatus = AcpiGetTable(ACPI_SIG_DSDT, 0, &OutTable);
555  if (ACPI_FAILURE(AcpiStatus))
556  {
557  DPRINT1("AcpiGetTable() for DSDT failed (Status 0x%08lx)\n", AcpiStatus);
559  goto done;
560  }
561  /* Dump DSDT table */
562  Status = acpi_create_registry_table(KeyHandle, OutTable, L"DSDT");
563  if (!NT_SUCCESS(Status))
564  {
565  DPRINT1("acpi_dump_table_to_registry() for DSDT failed (Status 0x%08lx)\n", Status);
566  goto done;
567  }
568  /* Read FACS table */
569  AcpiStatus = AcpiGetTable(ACPI_SIG_FACS, 0, &OutTable);
570  if (ACPI_FAILURE(AcpiStatus))
571  {
572  DPRINT1("AcpiGetTable() for FACS failed (Status 0x%08lx)\n", AcpiStatus);
574  goto done;
575  }
576  /* Dump FACS table */
577  Status = acpi_create_registry_table(KeyHandle, OutTable, L"FACS");
578  if (!NT_SUCCESS(Status))
579  {
580  DPRINT1("acpi_dump_table_to_registry() for FACS failed (Status 0x%08lx)\n", Status);
581  goto done;
582  }
583  /* Read FACS table */
584  AcpiStatus = AcpiGetTable(ACPI_SIG_FADT, 0, &OutTable);
585  if (ACPI_FAILURE(AcpiStatus))
586  {
587  DPRINT1("AcpiGetTable() for FADT failed (Status 0x%08lx)\n", AcpiStatus);
589  goto done;
590  }
591  /* Dump FADT table */
592  Status = acpi_create_registry_table(KeyHandle, OutTable, L"FADT");
593  if (!NT_SUCCESS(Status))
594  {
595  DPRINT1("acpi_dump_table_to_registry() for FADT failed (Status 0x%08lx)\n", Status);
596  goto done;
597  }
598  /* This is a rough copy from ACPICA reading of RSDT/XSDT and added to avoid patching acpica */
599  RsdpAddress = AcpiOsGetRootPointer();
600  /* Map the entire RSDP and extract the address of the RSDT or XSDT */
601  Rsdp = AcpiOsMapMemory(RsdpAddress, sizeof(ACPI_TABLE_RSDP));
602  if (!Rsdp)
603  {
604  DPRINT1("AcpiOsMapMemory() failed\n");
606  goto done;
607  }
608  /* Use XSDT if present and not overridden. Otherwise, use RSDT */
609  if ((Rsdp->Revision > 1) &&
610  Rsdp->XsdtPhysicalAddress &&
611  !AcpiGbl_DoNotUseXsdt)
612  {
613  /*
614  * RSDP contains an XSDT (64-bit physical addresses). We must use
615  * the XSDT if the revision is > 1 and the XSDT pointer is present,
616  * as per the ACPI specification.
617  */
618  Address = (ACPI_PHYSICAL_ADDRESS)Rsdp->XsdtPhysicalAddress;
619  TableEntrySize = ACPI_XSDT_ENTRY_SIZE;
620  }
621  else
622  {
623  /* Root table is an RSDT (32-bit physical addresses) */
624  Address = (ACPI_PHYSICAL_ADDRESS)Rsdp->RsdtPhysicalAddress;
625  TableEntrySize = ACPI_RSDT_ENTRY_SIZE;
626  }
627  /*
628  * It is not possible to map more than one entry in some environments,
629  * so unmap the RSDP here before mapping other tables
630  */
631  AcpiOsUnmapMemory(Rsdp, sizeof(ACPI_TABLE_RSDP));
632  OutTable = AcpiOsMapMemory(Address, TableEntrySize);
633  if (!OutTable)
634  {
635  DPRINT1("AcpiOsMapMemory() failed\n");
637  goto done;
638  }
639  /* Dump RSDT table */
640  Status = acpi_create_registry_table(KeyHandle, OutTable, L"RSDT");
641  AcpiOsUnmapMemory(OutTable, TableEntrySize);
642  if (!NT_SUCCESS(Status))
643  {
644  DPRINT1("acpi_dump_table_to_registry() for RSDT failed (Status 0x%08lx)\n", Status);
645  }
646 
647 done:
649  return Status;
650 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
void * AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS Where, ACPI_SIZE Length)
Definition: osl.c:108
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
#define ACPI_XSDT_ENTRY_SIZE
Definition: actbl.h:209
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define ACPI_RSDT_ENTRY_SIZE
Definition: actbl.h:208
ACPI_STATUS AcpiGetTable(char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:366
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define ACPI_SIG_FACS
Definition: actbl.h:69
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
UINT64 XsdtPhysicalAddress
Definition: actbl.h:157
#define ACPI_SIG_DSDT
Definition: actbl.h:67
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS acpi_create_registry_table(HANDLE ParentKeyHandle, ACPI_TABLE_HEADER *OutTable, PCWSTR KeyName)
Definition: utils.c:374
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT8 Revision
Definition: actbl.h:154
UINT32 RsdtPhysicalAddress
Definition: actbl.h:155
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static const WCHAR L[]
Definition: oid.c:1250
#define ACPI_SIG_FADT
Definition: actbl.h:68
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define DPRINT1
Definition: precomp.h:8
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer(void)
Definition: osl.c:43
void AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Size)
Definition: osl.c:128
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by Bus_StartFdo().

◆ acpi_evaluate_integer()

ACPI_STATUS acpi_evaluate_integer ( ACPI_HANDLE  handle,
ACPI_STRING  pathname,
struct acpi_object_list arguments,
unsigned long long data 
)

Definition at line 242 of file utils.c.

247 {
250  ACPI_BUFFER buffer = {sizeof(ACPI_OBJECT), &element};
251 
252  ACPI_FUNCTION_TRACE("acpi_evaluate_integer");
253 
254  if (!data)
256 
258  if (ACPI_FAILURE(status)) {
261  }
262 
263  if (element.Type != ACPI_TYPE_INTEGER) {
266  }
267 
268  *data = element.Integer.Value;
269 
270  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data));
271 
273 }
union acpi_object ACPI_OBJECT
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
char pathname[512]
Definition: util.h:13
GLuint buffer
Definition: glext.h:5915
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static void acpi_util_eval_error(ACPI_HANDLE h, ACPI_STRING p, ACPI_STATUS s)
Definition: utils.c:40
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
Definition: nsxfeval.c:217
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97
Definition: ps.c:97

Referenced by acpi_bus_get_power(), acpi_bus_get_status_handle(), acpi_power_get_state(), and Bus_PDO_QueryResources().

◆ acpi_evaluate_reference()

ACPI_STATUS acpi_evaluate_reference ( ACPI_HANDLE  handle,
ACPI_STRING  pathname,
struct acpi_object_list arguments,
struct acpi_handle_list list 
)

Definition at line 277 of file utils.c.

282 {
284  ACPI_OBJECT *package = NULL;
287  UINT32 i = 0;
288 
289  ACPI_FUNCTION_TRACE("acpi_evaluate_reference");
290 
291  if (!list) {
293  }
294 
295  /* Evaluate object. */
296 
298  if (ACPI_FAILURE(status))
299  goto end;
300 
301  package = (ACPI_OBJECT *) buffer.Pointer;
302 
303  if ((buffer.Length == 0) || !package) {
304  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
305  "No return object (len %X ptr %p)\n",
306  buffer.Length, package));
309  goto end;
310  }
311  if (package->Type != ACPI_TYPE_PACKAGE) {
312  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
313  "Expecting a [Package], found type %X\n",
314  package->Type));
317  goto end;
318  }
319  if (!package->Package.Count) {
320  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
321  "[Package] has zero elements (%p)\n",
322  package));
325  goto end;
326  }
327 
328  if (package->Package.Count > ACPI_MAX_HANDLES) {
329  return AE_NO_MEMORY;
330  }
331  list->count = package->Package.Count;
332 
333  /* Extract package data. */
334 
335  for (i = 0; i < list->count; i++) {
336 
337  element = &(package->Package.Elements[i]);
338 
339  if (element->Type != ACPI_TYPE_LOCAL_REFERENCE) {
341  ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
342  "Expecting a [Reference] package element, found type %X\n",
343  element->type));
345  break;
346  }
347 
348  if (!element->Reference.Handle) {
349  ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid reference in"
350  " package %s\n", pathname));
352  break;
353  }
354  /* Get the ACPI_HANDLE. */
355 
356  list->handles[i] = element->Reference.Handle;
357  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]\n",
358  list->handles[i]));
359  }
360 
361 end:
362  if (ACPI_FAILURE(status)) {
363  list->count = 0;
364  //ExFreePool(list->handles);
365  }
366 
367  if (buffer.Pointer)
368  AcpiOsFree(buffer.Pointer);
369 
371 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
char pathname[512]
Definition: util.h:13
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:711
GLuint buffer
Definition: glext.h:5915
GLuint GLuint end
Definition: gl.h:1545
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
static void acpi_util_eval_error(ACPI_HANDLE h, ACPI_STRING p, ACPI_STATUS s)
Definition: utils.c:40
#define ACPI_ALLOCATE_BUFFER
Definition: actypes.h:1036
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Definition: _list.h:228
#define AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_MAX_HANDLES
Definition: acpi_bus.h:35
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
Definition: nsxfeval.c:217
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_NULL_ENTRY
Definition: acexcep.h:118
void AcpiOsFree(void *Memory)
Definition: osl.c:167
#define AE_OK
Definition: acexcep.h:97
Definition: ps.c:97

Referenced by acpi_bus_get_power_flags().

◆ acpi_extract_package()

ACPI_STATUS acpi_extract_package ( ACPI_OBJECT package,
ACPI_BUFFER format,
ACPI_BUFFER buffer 
)

Definition at line 60 of file utils.c.

64 {
65  UINT32 size_required = 0;
66  UINT32 tail_offset = 0;
67  char *format_string = NULL;
68  UINT32 format_count = 0;
69  UINT32 i = 0;
70  UINT8 *head = NULL;
71  UINT8 *tail = NULL;
72 
73  if (!package || (package->Type != ACPI_TYPE_PACKAGE) || (package->Package.Count < 1)) {
74  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'package' argument\n"));
76  }
77 
78  if (!format || !format->Pointer || (format->Length < 1)) {
79  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n"));
81  }
82 
83  if (!buffer) {
84  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n"));
86  }
87 
88  format_count = (format->Length/sizeof(char)) - 1;
89  if (format_count > package->Package.Count) {
90  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
92  }
93 
94  format_string = format->Pointer;
95 
96  /*
97  * Calculate size_required.
98  */
99  for (i=0; i<format_count; i++) {
100 
101  ACPI_OBJECT *element = &(package->Package.Elements[i]);
102 
103  if (!element) {
105  }
106 
107  switch (element->Type) {
108 
109  case ACPI_TYPE_INTEGER:
110  switch (format_string[i]) {
111  case 'N':
112  size_required += sizeof(ACPI_INTEGER);
113  tail_offset += sizeof(ACPI_INTEGER);
114  break;
115  case 'S':
116  size_required += sizeof(char*) + sizeof(ACPI_INTEGER) + sizeof(char);
117  tail_offset += sizeof(char*);
118  break;
119  default:
120  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecting [%c].\n", i, format_string[i]));
122  break;
123  }
124  break;
125 
126  case ACPI_TYPE_STRING:
127  case ACPI_TYPE_BUFFER:
128  switch (format_string[i]) {
129  case 'S':
130  size_required += sizeof(char*) + (element->String.Length * sizeof(char)) + sizeof(char);
131  tail_offset += sizeof(char*);
132  break;
133  case 'B':
134  size_required += sizeof(UINT8*) + (element->Buffer.Length * sizeof(UINT8));
135  tail_offset += sizeof(UINT8*);
136  break;
137  default:
138  ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecting [%c].\n", i, format_string[i]));
140  break;
141  }
142  break;
143 
144  case ACPI_TYPE_PACKAGE:
145  default:
146  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d\n", i));
147  /* TBD: handle nested packages... */
149  break;
150  }
151  }
152 
153  /*
154  * Validate output buffer.
155  */
156  if (buffer->Length < size_required) {
157  buffer->Length = size_required;
159  }
160  else if (buffer->Length != size_required || !buffer->Pointer) {
162  }
163 
164  head = buffer->Pointer;
165  tail = ((PUCHAR)buffer->Pointer) + tail_offset;
166 
167  /*
168  * Extract package data.
169  */
170  for (i=0; i<format_count; i++) {
171 
172  UINT8 **pointer = NULL;
173  ACPI_OBJECT *element = &(package->Package.Elements[i]);
174 
175  if (!element) {
177  }
178 
179  switch (element->Type) {
180 
181  case ACPI_TYPE_INTEGER:
182  switch (format_string[i]) {
183  case 'N':
184  *((ACPI_INTEGER*)head) = element->Integer.Value;
185  head += sizeof(ACPI_INTEGER);
186  break;
187  case 'S':
188  pointer = (UINT8**)head;
189  *pointer = tail;
190  *((ACPI_INTEGER*)tail) = element->Integer.Value;
191  head += sizeof(ACPI_INTEGER*);
192  tail += sizeof(ACPI_INTEGER);
193  /* NULL terminate string */
194  *tail = (char)0;
195  tail += sizeof(char);
196  break;
197  default:
198  /* Should never get here */
199  break;
200  }
201  break;
202 
203  case ACPI_TYPE_STRING:
204  case ACPI_TYPE_BUFFER:
205  switch (format_string[i]) {
206  case 'S':
207  pointer = (UINT8**)head;
208  *pointer = tail;
209  memcpy(tail, element->String.Pointer, element->String.Length);
210  head += sizeof(char*);
211  tail += element->String.Length * sizeof(char);
212  /* NULL terminate string */
213  *tail = (char)0;
214  tail += sizeof(char);
215  break;
216  case 'B':
217  pointer = (UINT8**)head;
218  *pointer = tail;
219  memcpy(tail, element->Buffer.Pointer, element->Buffer.Length);
220  head += sizeof(UINT8*);
221  tail += element->Buffer.Length * sizeof(UINT8);
222  break;
223  default:
224  /* Should never get here */
225  break;
226  }
227  break;
228 
229  case ACPI_TYPE_PACKAGE:
230  /* TBD: handle nested packages... */
231  default:
232  /* Should never get here */
233  break;
234  }
235  }
236 
238 }
struct outqueuenode * tail
Definition: adnsresfilter.c:66
UINT64 ACPI_INTEGER
Definition: actypes.h:514
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
struct acpi_object::@604 Package
struct outqueuenode * head
Definition: adnsresfilter.c:66
GLsizei const GLvoid * pointer
Definition: glext.h:5848
#define ACPI_TYPE_BUFFER
Definition: actypes.h:682
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
unsigned char * PUCHAR
Definition: retypes.h:3
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AE_SUPPORT
Definition: acexcep.h:123
const char * format_string(const WAVEFORMATEX *wfx)
Definition: capture.c:84
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_STRING
Definition: actypes.h:681
ACPI_OBJECT_TYPE Type
Definition: actypes.h:960
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

◆ acpi_init()

int acpi_init ( void  )

Definition at line 1754 of file bus.c.

1755 {
1756  int result = 0;
1757 
1758  DPRINT("acpi_init\n");
1759 
1760  DPRINT("Subsystem revision %08x\n",ACPI_CA_VERSION);
1761 
1765 
1766  result = acpi_bus_init();
1767 
1768  //if (!result) {
1769  //pci_mmcfg_late_init();
1770  //if (!(pm_flags & PM_APM))
1771  // pm_flags |= PM_ACPI;
1772  //else {
1773  //DPRINT1("APM is already active, exiting\n");
1774  //disable_acpi();
1775  //result = -ENODEV;
1776  //}
1777  //} else
1778  // disable_acpi();
1779 
1780  /*
1781  * If the laptop falls into the DMI check table, the power state check
1782  * will be disabled in the course of device power transistion.
1783  */
1784  //dmi_check_system(power_nocheck_dmi_table);
1785 
1786  /*
1787  * Install drivers required for proper enumeration of the
1788  * ACPI namespace.
1789  */
1790  acpi_system_init(); /* ACPI System */
1791  acpi_power_init(); /* ACPI Bus Power Management */
1792  acpi_button_init();
1793  //acpi_ec_init(); /* ACPI Embedded Controller */
1794 #ifdef CONFIG_ACPI_PCI
1795  if (!acpi_pci_disabled) {
1796  acpi_pci_link_init(); /* ACPI PCI Interrupt Link */
1797  acpi_pci_root_init(); /* ACPI PCI Root Bridge */
1798  }
1799 #endif
1800 
1801  //acpi_scan_init();
1802  //acpi_ec_init();
1803  //acpi_power_init();
1804  //acpi_system_init();
1805  //acpi_debug_init();
1806  //acpi_sleep_proc_init();
1807  //acpi_wakeup_device_init();
1808 
1809  return result;
1810 }
int acpi_system_init(void)
Definition: system.c:399
int acpi_bus_init(void)
Definition: bus.c:1640
#define ACPI_CA_VERSION
Definition: acpixf.h:49
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
void DPRINT(...)
Definition: polytest.cpp:61
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
KSPIN_LOCK acpi_bus_event_lock
Definition: bus.c:52
KEVENT AcpiEventQueue
Definition: bus.c:55
static FAST_MUTEX acpi_bus_drivers_lock
Definition: bus.c:810
GLuint64EXT * result
Definition: glext.h:11304
int acpi_power_init(void)
Definition: power.c:660
int acpi_button_init(void)
Definition: button.c:298

Referenced by Bus_StartFdo().

◆ acpi_match_device_ids()

int acpi_match_device_ids ( struct acpi_device device,
const struct acpi_pnp_device_id ids 
)

◆ acpi_suspend()

ACPI_STATUS acpi_suspend ( UINT32  state)

acpi_suspend - OS-agnostic system suspend/resume support (S? states) @state: state we're entering

Definition at line 347 of file system.c.

349 {
351 
352  /* only support S1 and S5 on kernel 2.4 */
353  //if (state != ACPI_STATE_S1 && state != ACPI_STATE_S4
354  // && state != ACPI_STATE_S5)
355  // return AE_ERROR;
356 
357 
358  //if (ACPI_STATE_S4 == state) {
359  // /* For s4bios, we need a wakeup address. */
360  // if (1 == AcpiGbl_FACS->S4bios_f &&
361  // 0 != AcpiGbl_FADT->smi_cmd) {
362  // if (!acpi_wakeup_address)
363  // return AE_ERROR;
364  // AcpiSetFirmwareWakingVector((acpi_physical_address) acpi_wakeup_address);
365  // } else
366  // /* We don't support S4 under 2.4. Give up */
367  // return AE_ERROR;
368  //}
370 
373  return status;
374 
375  /* disable interrupts and flush caches */
376  _disable();
378 
379  /* perform OS-specific sleep actions */
381 
382  /* Even if we failed to go to sleep, all of the devices are in an suspended
383  * mode. So, we run these unconditionally to make sure we have a usable system
384  * no matter what.
385  */
388 
389  /* make sure interrupts are enabled */
390  _enable();
391 
392  /* reset firmware waking vector */
394 
395  return status;
396 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
void __cdecl _enable(void)
Definition: intrin_arm.h:373
ACPI_STATUS AcpiSetFirmwareWakingVector(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_PHYSICAL_ADDRESS PhysicalAddress64)
Definition: hwxfsleep.c:174
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_STATE_S5
Definition: actypes.h:621
ACPI_STATUS acpi_system_suspend(UINT32 state)
Definition: system.c:313
#define ACPI_FLUSH_CPU_CACHE()
Definition: accygwin.h:53
static int state
Definition: maze.c:121
void __cdecl _disable(void)
Definition: intrin_arm.h:365
ACPI_STATUS AcpiLeaveSleepState(UINT8 SleepState)
Definition: hwxfsleep.c:501
static SERVICE_STATUS status
Definition: service.c:31
ACPI_STATUS AcpiEnterSleepStatePrep(UINT8 SleepState)
Definition: hwxfsleep.c:347
ACPI_STATUS AcpiEnterSleepState(UINT8 SleepState)
Definition: hwxfsleep.c:431
ACPI_STATUS acpi_system_restore_state(UINT32 state)
Definition: system.c:156
Definition: ps.c:97

Referenced by Bus_FDO_Power().

Variable Documentation

◆ acpi_bus_type

struct bus_type acpi_bus_type

◆ acpi_irq_model

enum acpi_irq_model_id acpi_irq_model