1/******************************************************************************* 2 * 3 * Module Name: rsxface - Public interfaces to the resource manager 4 * $Revision: 1.1.1.1 $ 5 * 6 ******************************************************************************/ 7 8/* 9 * Copyright (C) 2000, 2001 R. Byron Moore 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 27#include "acpi.h" 28#include "acinterp.h" 29#include "acnamesp.h" 30#include "acresrc.h" 31 32#define _COMPONENT ACPI_RESOURCES 33 MODULE_NAME ("rsxface") 34 35 36/******************************************************************************* 37 * 38 * FUNCTION: Acpi_get_irq_routing_table 39 * 40 * PARAMETERS: Device_handle - a handle to the Bus device we are querying 41 * Ret_buffer - a pointer to a buffer to receive the 42 * current resources for the device 43 * 44 * RETURN: Status 45 * 46 * DESCRIPTION: This function is called to get the IRQ routing table for a 47 * specific bus. The caller must first acquire a handle for the 48 * desired bus. The routine table is placed in the buffer pointed 49 * to by the Ret_buffer variable parameter. 50 * 51 * If the function fails an appropriate status will be returned 52 * and the value of Ret_buffer is undefined. 53 * 54 * This function attempts to execute the _PRT method contained in 55 * the object indicated by the passed Device_handle. 56 * 57 ******************************************************************************/ 58 59acpi_status 60acpi_get_irq_routing_table ( 61 acpi_handle device_handle, 62 acpi_buffer *ret_buffer) 63{ 64 acpi_status status; 65 66 67 FUNCTION_TRACE ("Acpi_get_irq_routing_table "); 68 69 70 /* 71 * Must have a valid handle and buffer, So we have to have a handle 72 * and a return buffer structure, and if there is a non-zero buffer length 73 * we also need a valid pointer in the buffer. If it's a zero buffer length, 74 * we'll be returning the needed buffer size, so keep going. 75 */ 76 if ((!device_handle) || 77 (!ret_buffer) || 78 ((!ret_buffer->pointer) && (ret_buffer->length))) { 79 return_ACPI_STATUS (AE_BAD_PARAMETER); 80 } 81 82 status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); 83 return_ACPI_STATUS (status); 84} 85 86 87/******************************************************************************* 88 * 89 * FUNCTION: Acpi_get_current_resources 90 * 91 * PARAMETERS: Device_handle - a handle to the device object for the 92 * device we are querying 93 * Ret_buffer - a pointer to a buffer to receive the 94 * current resources for the device 95 * 96 * RETURN: Status 97 * 98 * DESCRIPTION: This function is called to get the current resources for a 99 * specific device. The caller must first acquire a handle for 100 * the desired device. The resource data is placed in the buffer 101 * pointed to by the Ret_buffer variable parameter. 102 * 103 * If the function fails an appropriate status will be returned 104 * and the value of Ret_buffer is undefined. 105 * 106 * This function attempts to execute the _CRS method contained in 107 * the object indicated by the passed Device_handle. 108 * 109 ******************************************************************************/ 110 111acpi_status 112acpi_get_current_resources ( 113 acpi_handle device_handle, 114 acpi_buffer *ret_buffer) 115{ 116 acpi_status status; 117 118 119 FUNCTION_TRACE ("Acpi_get_current_resources"); 120 121 122 /* 123 * Must have a valid handle and buffer, So we have to have a handle 124 * and a return buffer structure, and if there is a non-zero buffer length 125 * we also need a valid pointer in the buffer. If it's a zero buffer length, 126 * we'll be returning the needed buffer size, so keep going. 127 */ 128 if ((!device_handle) || 129 (!ret_buffer) || 130 ((ret_buffer->length) && (!ret_buffer->pointer))) { 131 return_ACPI_STATUS (AE_BAD_PARAMETER); 132 } 133 134 status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); 135 return_ACPI_STATUS (status); 136} 137 138 139/******************************************************************************* 140 * 141 * FUNCTION: Acpi_get_possible_resources 142 * 143 * PARAMETERS: Device_handle - a handle to the device object for the 144 * device we are querying 145 * Ret_buffer - a pointer to a buffer to receive the 146 * resources for the device 147 * 148 * RETURN: Status 149 * 150 * DESCRIPTION: This function is called to get a list of the possible resources 151 * for a specific device. The caller must first acquire a handle 152 * for the desired device. The resource data is placed in the 153 * buffer pointed to by the Ret_buffer variable. 154 * 155 * If the function fails an appropriate status will be returned 156 * and the value of Ret_buffer is undefined. 157 * 158 ******************************************************************************/ 159 160acpi_status 161acpi_get_possible_resources ( 162 acpi_handle device_handle, 163 acpi_buffer *ret_buffer) 164{ 165 acpi_status status; 166 167 168 FUNCTION_TRACE ("Acpi_get_possible_resources"); 169 170 171 /* 172 * Must have a valid handle and buffer, So we have to have a handle 173 * and a return buffer structure, and if there is a non-zero buffer length 174 * we also need a valid pointer in the buffer. If it's a zero buffer length, 175 * we'll be returning the needed buffer size, so keep going. 176 */ 177 if ((!device_handle) || 178 (!ret_buffer) || 179 ((ret_buffer->length) && (!ret_buffer->pointer))) { 180 return_ACPI_STATUS (AE_BAD_PARAMETER); 181 } 182 183 status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); 184 return_ACPI_STATUS (status); 185} 186 187 188/******************************************************************************* 189 * 190 * FUNCTION: Acpi_set_current_resources 191 * 192 * PARAMETERS: Device_handle - a handle to the device object for the 193 * device we are changing the resources of 194 * In_buffer - a pointer to a buffer containing the 195 * resources to be set for the device 196 * 197 * RETURN: Status 198 * 199 * DESCRIPTION: This function is called to set the current resources for a 200 * specific device. The caller must first acquire a handle for 201 * the desired device. The resource data is passed to the routine 202 * the buffer pointed to by the In_buffer variable. 203 * 204 ******************************************************************************/ 205 206acpi_status 207acpi_set_current_resources ( 208 acpi_handle device_handle, 209 acpi_buffer *in_buffer) 210{ 211 acpi_status status; 212 213 214 FUNCTION_TRACE ("Acpi_set_current_resources"); 215 216 217 /* 218 * Must have a valid handle and buffer 219 */ 220 if ((!device_handle) || 221 (!in_buffer) || 222 (!in_buffer->pointer) || 223 (!in_buffer->length)) { 224 return_ACPI_STATUS (AE_BAD_PARAMETER); 225 } 226 227 status = acpi_rs_set_srs_method_data (device_handle, in_buffer); 228 return_ACPI_STATUS (status); 229} 230