acpinex_event.c (a3114836) acpinex_event.c (26f3cdf0)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 * Copyright (c) 2010, Intel Corporation.
24 * All rights reserved.
25 */
26
27#include <sys/types.h>
28#include <sys/atomic.h>
29#include <sys/bitmap.h>
30#include <sys/cmn_err.h>

--- 451 unchanged lines hidden (view full) ---

482 * Acpinex driver handles ACPI system events for its children,
483 * device specific events will be handled by device drivers.
484 * Return DDI_SUCCESS on success, and DDI_FAILURE on failure.
485 */
486static int
487acpinex_event_install_handler(ACPI_HANDLE hdl, void *arg,
488 ACPI_DEVICE_INFO *infop, acpidev_data_handle_t dhdl)
489{
24 * Copyright (c) 2010, Intel Corporation.
25 * All rights reserved.
26 */
27
28#include <sys/types.h>
29#include <sys/atomic.h>
30#include <sys/bitmap.h>
31#include <sys/cmn_err.h>

--- 451 unchanged lines hidden (view full) ---

483 * Acpinex driver handles ACPI system events for its children,
484 * device specific events will be handled by device drivers.
485 * Return DDI_SUCCESS on success, and DDI_FAILURE on failure.
486 */
487static int
488acpinex_event_install_handler(ACPI_HANDLE hdl, void *arg,
489 ACPI_DEVICE_INFO *infop, acpidev_data_handle_t dhdl)
490{
491 ACPI_STATUS status;
490 int rc = DDI_SUCCESS;
491
492 ASSERT(hdl != NULL);
493 ASSERT(dhdl != NULL);
494 ASSERT(infop != NULL);
495
496 /*
497 * Check whether the event handler has already been installed on the
498 * device object. With the introduction of ACPI Alias objects, which are
499 * similar to symlinks in file systems, there may be multiple name
500 * objects in the ACPI namespace pointing to the same underlying device
501 * object. Those Alias objects need to be filtered out, otherwise
502 * it will attempt to install the event handler multiple times on the
503 * same device object which will fail.
504 */
505 if (acpidev_data_get_flag(dhdl, ACPIDEV_DATA_HANDLER_READY)) {
506 return (DDI_SUCCESS);
507 }
492 int rc = DDI_SUCCESS;
493
494 ASSERT(hdl != NULL);
495 ASSERT(dhdl != NULL);
496 ASSERT(infop != NULL);
497
498 /*
499 * Check whether the event handler has already been installed on the
500 * device object. With the introduction of ACPI Alias objects, which are
501 * similar to symlinks in file systems, there may be multiple name
502 * objects in the ACPI namespace pointing to the same underlying device
503 * object. Those Alias objects need to be filtered out, otherwise
504 * it will attempt to install the event handler multiple times on the
505 * same device object which will fail.
506 */
507 if (acpidev_data_get_flag(dhdl, ACPIDEV_DATA_HANDLER_READY)) {
508 return (DDI_SUCCESS);
509 }
508 if (ACPI_SUCCESS(AcpiInstallNotifyHandler(hdl, ACPI_SYSTEM_NOTIFY,
509 acpinex_event_system_handler, arg))) {
510 status = AcpiInstallNotifyHandler(hdl, ACPI_SYSTEM_NOTIFY,
511 acpinex_event_system_handler, arg);
512 if (status == AE_OK || status == AE_ALREADY_EXISTS) {
510 acpidev_data_set_flag(dhdl, ACPIDEV_DATA_HANDLER_READY);
511 } else {
512 char *objname;
513
514 objname = acpidev_get_object_name(hdl);
515 cmn_err(CE_WARN,
516 "!acpinex: failed to install system event handler for %s.",
517 objname);

--- 195 unchanged lines hidden ---
513 acpidev_data_set_flag(dhdl, ACPIDEV_DATA_HANDLER_READY);
514 } else {
515 char *objname;
516
517 objname = acpidev_get_object_name(hdl);
518 cmn_err(CE_WARN,
519 "!acpinex: failed to install system event handler for %s.",
520 objname);

--- 195 unchanged lines hidden ---