Changeset 16637
- Timestamp:
- 03/08/06 01:51:46 (3 years ago)
- Location:
- haiku/trunk
- Files:
-
- 4 modified
-
headers/os/drivers/ACPI.h (modified) (1 diff)
-
src/add-ons/kernel/bus_managers/acpi/acpi_busman.c (modified) (3 diffs)
-
src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c (modified) (6 diffs)
-
src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/headers/os/drivers/ACPI.h
r11891 r16637 35 35 status_t (*get_device_hid) (const char *path, char *hid); 36 36 uint32 (*get_object_type) (const char *path); 37 status_t (*get_object) (const char *path, acpi_object_type **return_value); 38 status_t (*get_object_typed) (const char *path, acpi_object_type **return_value, uint32 object_type); 37 39 38 40 /* Control method execution and data acquisition */ -
haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c
r12440 r16637 24 24 25 25 status_t get_device_hid (const char *path, char *hid); 26 status_t get_object(const char *path, acpi_object_type **return_value); 27 status_t get_object_typed(const char *path, acpi_object_type **return_value, uint32 object_type); 26 28 uint32 get_object_type (const char *path); 27 29 … … 51 53 get_device, 52 54 get_device_hid, 55 get_object, 56 get_object_typed, 53 57 get_object_type, 54 58 evaluate_object, … … 252 256 } 253 257 258 status_t get_object (const char *path, acpi_object_type **return_value) { 259 ACPI_HANDLE handle; 260 ACPI_BUFFER buffer; 261 ACPI_STATUS status; 262 263 status = AcpiGetHandle(NULL, path, &handle); 264 if (status != AE_OK) { 265 return B_ENTRY_NOT_FOUND; 266 } 267 buffer.Pointer = NULL; 268 buffer.Length = ACPI_ALLOCATE_BUFFER; 269 270 status = AcpiEvaluateObject(handle, NULL, NULL, &buffer); 271 272 *return_value = buffer.Pointer; 273 return (status == AE_OK) ? B_OK : B_ERROR; 274 } 275 276 status_t get_object_typed (const char *path, acpi_object_type **return_value, uint32 object_type) { 277 ACPI_HANDLE handle; 278 ACPI_BUFFER buffer; 279 ACPI_STATUS status; 280 281 status = AcpiGetHandle(NULL, path, &handle); 282 if (status != AE_OK) { 283 return B_ENTRY_NOT_FOUND; 284 } 285 buffer.Pointer = NULL; 286 buffer.Length = ACPI_ALLOCATE_BUFFER; 287 288 status = AcpiEvaluateObjectTyped(handle, NULL, NULL, &buffer, object_type); 289 290 *return_value = buffer.Pointer; 291 return (status == AE_OK) ? B_OK : B_ERROR; 292 } 293 254 294 status_t evaluate_object (const char *object, acpi_object_type *return_value, size_t buf_len) { 255 295 ACPI_BUFFER buffer; -
haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.c
r16562 r16637 37 37 td->open = 0; 38 38 td->num = device_count; 39 39 40 dprintf("acpi_thermal: Adding thermal device from: %s\n", result); 40 41 td->path = malloc(sizeof(char) * strlen(result) + 1); … … 140 141 acpi_thermal_read (void* cookie, off_t position, void *buf, size_t* num_bytes) 141 142 { 143 int i; 142 144 acpi_thermal_type therm_info; 143 145 if (*num_bytes < 1) … … 150 152 *num_bytes = strlen((char *)buf); 151 153 152 sprintf((char *)buf + *num_bytes, " Critical Temperature: %lu.%lu K\n", (therm_info.critical_temp / 10), (therm_info.critical_temp % 10)); 154 sprintf((char *)buf + *num_bytes, " Critical Temperature: %lu.%lu K\n", 155 (therm_info.critical_temp / 10), (therm_info.critical_temp % 10)); 153 156 *num_bytes = strlen((char *)buf); 154 157 155 sprintf((char *)buf + *num_bytes, " Current Temperature: %lu.%lu K\n", (therm_info.current_temp / 10), (therm_info.current_temp % 10)); 158 sprintf((char *)buf + *num_bytes, " Current Temperature: %lu.%lu K\n", 159 (therm_info.current_temp / 10), (therm_info.current_temp % 10)); 156 160 *num_bytes = strlen((char *)buf); 157 161 158 162 if (therm_info.hot_temp > 0) { 159 sprintf((char *)buf, "Hot Temperature: %lu.%lu K\n", (therm_info.hot_temp / 10), (therm_info.hot_temp % 10)); 163 sprintf((char *)buf + *num_bytes, " Hot Temperature: %lu.%lu K\n", 164 (therm_info.hot_temp / 10), (therm_info.hot_temp % 10)); 160 165 *num_bytes = strlen((char *)buf); 166 } 167 168 if (therm_info.passive_package) { 169 /* Incomplete. 170 Needs to obtain acpi global lock. 171 acpi_object_type needs Reference entry (with Handle that can be resolved) 172 what you see here is _highly_ unreliable. 173 */ 174 /* if (therm_info.passive_package->data.package.count > 0) { 175 sprintf((char *)buf + *num_bytes, " Passive Devices\n"); 176 *num_bytes = strlen((char *)buf); 177 for (i = 0; i < therm_info.passive_package->data.package.count; i++) { 178 sprintf((char *)buf + *num_bytes, " Processor: %lu\n", therm_info.passive_package->data.package.objects[i].data.processor.cpu_id); 179 *num_bytes = strlen((char *)buf); 180 } 181 } 182 */ 183 free(therm_info.passive_package); 161 184 } 162 185 } else { … … 179 202 180 203 thermal_dev *td = (thermal_dev *)cookie; 204 char objname[255]; 181 205 acpi_thermal_type *att = NULL; 182 206 207 size_t bufsize = sizeof(acpi_object_type); 183 208 acpi_object_type buf; 184 size_t bufsize = sizeof(buf); 185 209 186 210 switch (op) { 187 211 case drvOpGetThermalType: { … … 189 213 att = (acpi_thermal_type *)arg; 190 214 215 // Read basic temperature thresholds. 191 216 att->devnum = td->num; 192 217 err = acpi->evaluate_method(td->path, "_CRT", &buf, bufsize, NULL, 0); … … 202 227 dprintf("acpi_thermal: GotBasicTemperatures()\n"); 203 228 204 // TODO: Fill this out 205 att->passive_count = 0; 229 // Read Passive Cooling devices 206 230 att->passive_package = NULL; 231 sprintf(objname, "%s._PSL", td->path); 232 err = acpi->get_object(objname, &(att->passive_package)); 207 233 208 234 att->active_count = 0; -
haiku/trunk/src/add-ons/kernel/drivers/power/acpi_thermal/acpi_thermal.h
r16562 r16637 27 27 uint32 hot_temp; 28 28 29 /* List of acpi_objects_types assigned to the passive device list */ 30 uint32 passive_count; 29 /* acpi_objects_type evaluated from _PSL 30 if != NULL, client must free() 31 */ 31 32 acpi_object_type *passive_package; 32 33
