1 /******************************************************************************
2 *
3 * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
4 * Address Spaces.
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45 #define __EVXFREGN_C__
46
47 #include "acpi.h"
48 #include "accommon.h"
49 #include "acnamesp.h"
50 #include "acevents.h"
51
52 #define _COMPONENT ACPI_EVENTS
53 ACPI_MODULE_NAME ("evxfregn")
54
55
56 /*******************************************************************************
57 *
58 * FUNCTION: AcpiInstallAddressSpaceHandler
59 *
60 * PARAMETERS: Device - Handle for the device
61 * SpaceId - The address space ID
62 * Handler - Address of the handler
63 * Setup - Address of the setup function
64 * Context - Value passed to the handler on each access
65 *
132 *
133 * For all other SpaceIDs, we can safely execute the _REG methods immediately.
134 * This means that for IDs like EmbeddedController, this function should be called
135 * only after AcpiEnableSubsystem has been called.
136 */
137 switch (SpaceId)
138 {
139 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
140 case ACPI_ADR_SPACE_SYSTEM_IO:
141 case ACPI_ADR_SPACE_PCI_CONFIG:
142 case ACPI_ADR_SPACE_DATA_TABLE:
143
144 if (!AcpiGbl_RegMethodsExecuted)
145 {
146 /* We will defer execution of the _REG methods for this space */
147 goto UnlockAndExit;
148 }
149 break;
150
151 default:
152 break;
153 }
154
155 /* Run all _REG methods for this address space */
156
157 Status = AcpiEvExecuteRegMethods (Node, SpaceId);
158
159
160 UnlockAndExit:
161 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
162 return_ACPI_STATUS (Status);
163 }
164
165 ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
166
167
168 /*******************************************************************************
169 *
170 * FUNCTION: AcpiRemoveAddressSpaceHandler
171 *
293 /* Walk the linked list of handlers */
294
295 LastObjPtr = &HandlerObj->AddressSpace.Next;
296 HandlerObj = HandlerObj->AddressSpace.Next;
297 }
298
299 /* The handler does not exist */
300
301 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
302 "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
303 Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc));
304
305 Status = AE_NOT_EXIST;
306
307 UnlockAndExit:
308 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
309 return_ACPI_STATUS (Status);
310 }
311
312 ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
313
|
1 /******************************************************************************
2 *
3 * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
4 * Address Spaces.
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45 #define __EVXFREGN_C__
46 #define EXPORT_ACPI_INTERFACES
47
48 #include "acpi.h"
49 #include "accommon.h"
50 #include "acnamesp.h"
51 #include "acevents.h"
52
53 #define _COMPONENT ACPI_EVENTS
54 ACPI_MODULE_NAME ("evxfregn")
55
56
57 /*******************************************************************************
58 *
59 * FUNCTION: AcpiInstallAddressSpaceHandler
60 *
61 * PARAMETERS: Device - Handle for the device
62 * SpaceId - The address space ID
63 * Handler - Address of the handler
64 * Setup - Address of the setup function
65 * Context - Value passed to the handler on each access
66 *
133 *
134 * For all other SpaceIDs, we can safely execute the _REG methods immediately.
135 * This means that for IDs like EmbeddedController, this function should be called
136 * only after AcpiEnableSubsystem has been called.
137 */
138 switch (SpaceId)
139 {
140 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
141 case ACPI_ADR_SPACE_SYSTEM_IO:
142 case ACPI_ADR_SPACE_PCI_CONFIG:
143 case ACPI_ADR_SPACE_DATA_TABLE:
144
145 if (!AcpiGbl_RegMethodsExecuted)
146 {
147 /* We will defer execution of the _REG methods for this space */
148 goto UnlockAndExit;
149 }
150 break;
151
152 default:
153
154 break;
155 }
156
157 /* Run all _REG methods for this address space */
158
159 Status = AcpiEvExecuteRegMethods (Node, SpaceId);
160
161
162 UnlockAndExit:
163 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
164 return_ACPI_STATUS (Status);
165 }
166
167 ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
168
169
170 /*******************************************************************************
171 *
172 * FUNCTION: AcpiRemoveAddressSpaceHandler
173 *
295 /* Walk the linked list of handlers */
296
297 LastObjPtr = &HandlerObj->AddressSpace.Next;
298 HandlerObj = HandlerObj->AddressSpace.Next;
299 }
300
301 /* The handler does not exist */
302
303 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
304 "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
305 Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc));
306
307 Status = AE_NOT_EXIST;
308
309 UnlockAndExit:
310 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
311 return_ACPI_STATUS (Status);
312 }
313
314 ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
|