summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi_acad.c11
-rw-r--r--sys/dev/acpica/acpi_button.c12
-rw-r--r--sys/dev/acpica/acpi_cmbat.c41
-rw-r--r--sys/dev/acpica/acpi_cpu.c3
-rw-r--r--sys/dev/acpica/acpi_ec.c44
-rw-r--r--sys/dev/acpica/acpi_lid.c4
-rw-r--r--sys/dev/acpica/acpi_thermal.c39
-rw-r--r--sys/dev/acpica/acpivar.h5
8 files changed, 91 insertions, 68 deletions
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c
index 5b4f751..107b9a8 100644
--- a/sys/dev/acpica/acpi_acad.c
+++ b/sys/dev/acpica/acpi_acad.c
@@ -80,10 +80,8 @@ acpi_acad_get_status(void *context)
sc->status = newstatus;
/* set system power profile based on AC adapter status */
powerprofile_set_state(sc->status ? POWERPROFILE_PERFORMANCE : POWERPROFILE_ECONOMY);
- }
-
- if (bootverbose) {
- device_printf(dev,"%s\n",(sc->status) ? "On Line" : "Off Line");
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "%s Line\n",(sc->status) ? "On" : "Off");
}
}
@@ -92,9 +90,8 @@ acpi_acad_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
{
device_t dev = context;
- if (bootverbose) {
- device_printf(dev, "Notify %d\n", notify);
- }
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "Notify %d\n", notify);
switch (notify) {
case ACPI_DEVICE_CHECK_PNP:
diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c
index aa2fc78..b05c7d3 100644
--- a/sys/dev/acpica/acpi_button.c
+++ b/sys/dev/acpica/acpi_button.c
@@ -133,11 +133,13 @@ acpi_button_notify_pressed_for_sleep(void *arg)
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
- device_printf(sc->button_dev, "power button pressed\n", sc->button_type);
+ ACPI_VPRINT(sc->button_dev, acpi_sc,
+ "power button pressed\n", sc->button_type);
acpi_eventhandler_power_button_for_sleep((void *)acpi_sc);
break;
case ACPI_SLEEP_BUTTON:
- device_printf(sc->button_dev, "sleep button pressed\n", sc->button_type);
+ ACPI_VPRINT(sc->button_dev, acpi_sc,
+ "sleep button pressed\n", sc->button_type);
acpi_eventhandler_sleep_button_for_sleep((void *)acpi_sc);
break;
default:
@@ -162,11 +164,13 @@ acpi_button_notify_pressed_for_wakeup(void *arg)
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
- device_printf(sc->button_dev, "wakeup by power button\n", sc->button_type);
+ ACPI_VPRINT(sc->button_dev, acpi_sc,
+ "wakeup by power button\n", sc->button_type);
acpi_eventhandler_power_button_for_wakeup((void *)acpi_sc);
break;
case ACPI_SLEEP_BUTTON:
- device_printf(sc->button_dev, "wakeup by sleep button\n", sc->button_type);
+ ACPI_VPRINT(sc->button_dev, acpi_sc,
+ "wakeup by sleep button\n", sc->button_type);
acpi_eventhandler_sleep_button_for_wakeup((void *)acpi_sc);
break;
default:
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index 63212f4..281a231 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -61,8 +61,8 @@ MODULE_NAME("BATTERY")
#define PKG_GETINT(res, tmp, idx, dest, label) do { \
tmp = &res->Package.Elements[idx]; \
if (tmp == NULL) { \
- device_printf(dev, "%s: PKG_GETINT idx = %d\n.", \
- __func__, idx); \
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), \
+ __func__ ": PKG_GETINT error, idx = %d\n.", idx); \
goto label; \
} \
if (tmp->Type != ACPI_TYPE_INTEGER) \
@@ -75,8 +75,8 @@ MODULE_NAME("BATTERY")
length = size; \
tmp = &res->Package.Elements[idx]; \
if (tmp == NULL) { \
- device_printf(dev, "%s: PKG_GETSTR idx = %d\n.", \
- __func__, idx); \
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), \
+ __func__ ": PKG_GETSTR error, idx = %d\n.", idx); \
goto label; \
} \
bzero(dest, sizeof(dest)); \
@@ -99,11 +99,6 @@ MODULE_NAME("BATTERY")
dest[sizeof(dest)-1] = '\0'; \
} while (0)
-#define CMBAT_DPRINT(dev, x...) do { \
- if (acpi_get_verbose(acpi_device_get_parent_softc(dev))) \
- device_printf(dev, x); \
-} while (0)
-
struct acpi_cmbat_softc {
device_t dev;
@@ -209,8 +204,8 @@ retry:
}
as = AcpiEvaluateObject(h, "_BST", NULL, &sc->bst_buffer);
if (as != AE_BUFFER_OVERFLOW) {
- CMBAT_DPRINT(dev, "CANNOT FOUND _BST - %s\n",
- AcpiFormatException(as));
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "couldn't find _BST - %s\n", AcpiFormatException(as));
goto end;
}
@@ -229,19 +224,21 @@ retry:
free(sc->bst_buffer.Pointer, M_ACPICMBAT);
sc->bst_buffer.Pointer = NULL;
}
- CMBAT_DPRINT(dev, "bst size changed to %d\n", sc->bst_buffer.Length);
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "bst size changed to %d\n", sc->bst_buffer.Length);
sc->bst_buffer.Length = 0;
goto retry;
} else if (as != AE_OK) {
- CMBAT_DPRINT(dev, "CANNOT FOUND _BST - %s\n",
- AcpiFormatException(as));
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "couldn't find _BST - %s\n", AcpiFormatException(as));
goto end;
}
res = (ACPI_OBJECT *)sc->bst_buffer.Pointer;
if ((res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count != 4)) {
- CMBAT_DPRINT(dev, "Battery status corrupted\n");
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "battery status corrupted\n");
goto end;
}
@@ -280,8 +277,8 @@ retry:
}
as = AcpiEvaluateObject(h, "_BIF", NULL, &sc->bif_buffer);
if (as != AE_BUFFER_OVERFLOW) {
- CMBAT_DPRINT(dev, "CANNOT FOUND _BIF - %s\n",
- AcpiFormatException(as));
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "couldn't find _BIF - %s\n", AcpiFormatException(as));
goto end;
}
@@ -300,19 +297,21 @@ retry:
free(sc->bif_buffer.Pointer, M_ACPICMBAT);
sc->bif_buffer.Pointer = NULL;
}
- CMBAT_DPRINT(dev, "bif size changed to %d\n", sc->bif_buffer.Length);
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "bif size changed to %d\n", sc->bif_buffer.Length);
sc->bif_buffer.Length = 0;
goto retry;
} else if (as != AE_OK) {
- CMBAT_DPRINT(dev, "CANNOT FOUND _BIF - %s\n",
- AcpiFormatException(as));
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "couldn't find _BIF - %s\n", AcpiFormatException(as));
goto end;
}
res = (ACPI_OBJECT *)sc->bif_buffer.Pointer;
if ((res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count != 13)) {
- CMBAT_DPRINT(dev, "Battery info corrupted\n");
+ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
+ "battery info corrupted\n");
goto end;
}
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 7860d73..887a97c 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -333,7 +333,8 @@ acpi_cpu_set_speed(u_int32_t speed)
p_cnt |= CPU_P_CNT_THT_EN;
CPU_SET_P_CNT(sc, p_cnt);
}
- device_printf(sc->cpu_dev, "set speed to %d.%d%%\n", CPU_SPEED_PRINTABLE(speed));
+ ACPI_VPRINT(sc->cpu_dev, acpi_device_get_parent_softc(sc->cpu_dev),
+ "set speed to %d.%d%%\n", CPU_SPEED_PRINTABLE(speed));
}
cpu_current_state = speed;
}
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c
index 54eb519..c681368 100644
--- a/sys/dev/acpica/acpi_ec.c
+++ b/sys/dev/acpica/acpi_ec.c
@@ -463,7 +463,8 @@ EcGpeQueryHandler(void *Context)
* If we failed to get anything from the EC, give up
*/
if (Status != AE_OK) {
- device_printf(sc->ec_dev, "GPE query failed - %s\n", AcpiFormatException(Status));
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "GPE query failed - %s\n", AcpiFormatException(Status));
break;
}
@@ -477,8 +478,9 @@ EcGpeQueryHandler(void *Context)
* Ignore spurious query requests.
*/
if (Status != AE_OK && (Data != 0 || Status != AE_NOT_FOUND)) {
- device_printf(sc->ec_dev, "evaluation of GPE query method %s failed - %s\n",
- qxx, AcpiFormatException(Status));
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "evaluation of GPE query method %s failed - %s\n",
+ qxx, AcpiFormatException(Status));
}
}
/* I know I request Level trigger cleanup */
@@ -599,7 +601,8 @@ EcWaitEventIntr(struct acpi_ec_softc *sc, EC_EVENT Event)
return_ACPI_STATUS(EcWaitEvent(sc, Event));
if (!EcIsLocked(sc))
- device_printf(sc->ec_dev, "EcWaitEventIntr called without EC lock!\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcWaitEventIntr called without EC lock!\n");
EcStatus = EC_GET_CSR(sc);
@@ -633,7 +636,8 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event)
UINT32 i = 0;
if (!EcIsLocked(sc))
- device_printf(sc->ec_dev, "EcWaitEvent called without EC lock!\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcWaitEvent called without EC lock!\n");
/*
* Stall 1us:
@@ -686,7 +690,8 @@ EcQuery(struct acpi_ec_softc *sc, UINT8 *Data)
EcUnlock(sc);
if (Status != AE_OK)
- device_printf(sc->ec_dev, "timeout waiting for EC to respond to EC_COMMAND_QUERY\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "timeout waiting for EC to respond to EC_COMMAND_QUERY\n");
return(Status);
}
@@ -740,9 +745,11 @@ EcTransaction(struct acpi_ec_softc *sc, EC_REQUEST *EcRequest)
}
if (AcpiClearEvent(sc->ec_gpebit, ACPI_EVENT_GPE) != AE_OK)
- device_printf(sc->ec_dev, "EcRequest: Unable to clear the EC GPE.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRequest: Unable to clear the EC GPE.\n");
if (AcpiEnableEvent(sc->ec_gpebit, ACPI_EVENT_GPE, 0) != AE_OK)
- device_printf(sc->ec_dev, "EcRequest: Unable to re-enable the EC GPE.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRequest: Unable to re-enable the EC GPE.\n");
return(Status);
}
@@ -754,19 +761,22 @@ EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data)
ACPI_STATUS Status;
if (!EcIsLocked(sc))
- device_printf(sc->ec_dev, "EcRead called without EC lock!\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRead called without EC lock!\n");
/*EcBurstEnable(EmbeddedController);*/
EC_SET_CSR(sc, EC_COMMAND_READ);
if ((Status = EcWaitEventIntr(sc, EC_EVENT_INPUT_BUFFER_EMPTY)) != AE_OK) {
- device_printf(sc->ec_dev, "EcRead: Failed waiting for EC to process read command.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRead: Failed waiting for EC to process read command.\n");
return(Status);
}
EC_SET_DATA(sc, Address);
if ((Status = EcWaitEventIntr(sc, EC_EVENT_OUTPUT_BUFFER_FULL)) != AE_OK) {
- device_printf(sc->ec_dev, "EcRead: Failed waiting for EC to send data.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRead: Failed waiting for EC to send data.\n");
return(Status);
}
@@ -783,25 +793,29 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data)
ACPI_STATUS Status;
if (!EcIsLocked(sc))
- device_printf(sc->ec_dev, "EcWrite called without EC lock!\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcWrite called without EC lock!\n");
/*EcBurstEnable(EmbeddedController);*/
EC_SET_CSR(sc, EC_COMMAND_WRITE);
if ((Status = EcWaitEventIntr(sc, EC_EVENT_INPUT_BUFFER_EMPTY)) != AE_OK) {
- device_printf(sc->ec_dev, "EcWrite: Failed waiting for EC to process write command.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcWrite: Failed waiting for EC to process write command.\n");
return(Status);
}
EC_SET_DATA(sc, Address);
if ((Status = EcWaitEventIntr(sc, EC_EVENT_INPUT_BUFFER_EMPTY)) != AE_OK) {
- device_printf(sc->ec_dev, "EcRead: Failed waiting for EC to process address.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcRead: Failed waiting for EC to process address.\n");
return(Status);
}
EC_SET_DATA(sc, *Data);
if ((Status = EcWaitEventIntr(sc, EC_EVENT_INPUT_BUFFER_EMPTY)) != AE_OK) {
- device_printf(sc->ec_dev, "EcWrite: Failed waiting for EC to process data.\n");
+ ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
+ "EcWrite: Failed waiting for EC to process data.\n");
return(Status);
}
diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c
index fc0cb74..c688137 100644
--- a/sys/dev/acpica/acpi_lid.c
+++ b/sys/dev/acpica/acpi_lid.c
@@ -122,13 +122,15 @@ acpi_lid_notify_status_changed(void *arg)
*/
if (acpi_EvaluateInteger(sc->lid_handle, "_LID", &sc->lid_status) != AE_OK)
return_VOID;
- device_printf(sc->lid_dev, "Lid %s\n", sc->lid_status ? "opened" : "closed");
acpi_sc = acpi_device_get_parent_softc(sc->lid_dev);
if (acpi_sc == NULL) {
return_VOID;
}
+ ACPI_VPRINT(sc->lid_dev, acpi_sc,
+ "Lid %s\n", sc->lid_status ? "opened" : "closed");
+
if (sc->lid_status == 0) {
EVENTHANDLER_INVOKE(acpi_sleep_event, acpi_sc->acpi_lid_switch_sx);
} else {
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index dc414bf..a2e10c8 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -47,11 +47,6 @@ MODULE_NAME("THERMAL")
#define TZ_ZEROC 2732
#define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), (((x) - TZ_ZEROC) % 10)
-#define TZ_DPRINT(dev, x...) do { \
- if (acpi_get_verbose(acpi_device_get_parent_softc(dev))) \
- device_printf(dev, x); \
-} while (0)
-
#define TZ_NOTIFY_TEMPERATURE 0x80
#define TZ_NOTIFY_DEVICES 0x81
#define TZ_NOTIFY_LEVELS 0x82
@@ -367,8 +362,9 @@ acpi_tz_monitor(struct acpi_tz_softc *sc)
* Get the current temperature.
*/
if ((status = acpi_EvaluateInteger(sc->tz_handle, "_TMP", &temp)) != AE_OK) {
- device_printf(sc->tz_dev, "error fetching current temperature -- %s\n",
- AcpiFormatException(status));
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "error fetching current temperature -- %s\n",
+ AcpiFormatException(status));
/* XXX disable zone? go to max cooling? */
return_VOID;
}
@@ -385,9 +381,9 @@ acpi_tz_monitor(struct acpi_tz_softc *sc)
if ((sc->tz_zone.ac[i] != -1) && (temp >= sc->tz_zone.ac[i])) {
newactive = i;
if (sc->tz_active != newactive) {
- TZ_DPRINT(sc->tz_dev,
- "_AC%d: temperature %d.%d >= setpoint %d.%d\n", i,
- TZ_KELVTOC(temp), TZ_KELVTOC(sc->tz_zone.ac[i]));
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "_AC%d: temperature %d.%d >= setpoint %d.%d\n", i,
+ TZ_KELVTOC(temp), TZ_KELVTOC(sc->tz_zone.ac[i]));
getnanotime(&sc->tz_cooling_started);
}
}
@@ -433,9 +429,10 @@ acpi_tz_monitor(struct acpi_tz_softc *sc)
if (newactive != TZ_ACTIVE_NONE)
acpi_ForeachPackageObject((ACPI_OBJECT *)sc->tz_zone.al[newactive].Pointer,
acpi_tz_switch_cooler_on, sc);
- TZ_DPRINT(sc->tz_dev, "switched from %s to %s: %d.%dC\n",
- acpi_tz_aclevel_string(sc->tz_active),
- acpi_tz_aclevel_string(newactive), TZ_KELVTOC(temp));
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "switched from %s to %s: %d.%dC\n",
+ acpi_tz_aclevel_string(sc->tz_active),
+ acpi_tz_aclevel_string(newactive), TZ_KELVTOC(temp));
sc->tz_active = newactive;
}
@@ -557,11 +554,13 @@ acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
*/
if (AcpiGetHandle(NULL, obj->String.Pointer, &cooler) == AE_OK) {
if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0))) {
- device_printf(sc->tz_dev, "failed to activate %s - %s\n",
- obj->String.Pointer, AcpiFormatException(status));
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "failed to activate %s - %s\n",
+ obj->String.Pointer, AcpiFormatException(status));
}
} else {
- device_printf(sc->tz_dev, "couldn't find %s\n", obj->String.Pointer);
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "couldn't find %s\n", obj->String.Pointer);
}
break;
@@ -665,7 +664,8 @@ acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, (OSD_EXECUTION_CALLBACK)acpi_tz_establish, sc);
break;
default:
- device_printf(sc->tz_dev, "unknown Notify event 0x%x\n", notify);
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "unknown Notify event 0x%x\n", notify);
break;
}
return_VOID;
@@ -725,8 +725,9 @@ acpi_tz_powerprofile(void *arg)
args.Pointer = &obj;
if (ACPI_FAILURE(status = AcpiEvaluateObject(sc->tz_handle, "_SCP", &args, NULL))) {
if (status != AE_NOT_FOUND)
- device_printf(sc->tz_dev, "can't evaluate %s._SCP - %s\n", acpi_name(sc->tz_handle),
- AcpiFormatException(status));
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "can't evaluate %s._SCP - %s\n", acpi_name(sc->tz_handle),
+ AcpiFormatException(status));
sc->tz_flags |= TZ_FLAG_NO_SCP;
} else {
/* we have to re-evaluate the entire zone now */
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 64e8ceb..72c264e 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -227,6 +227,11 @@ extern void acpi_EnterDebugger(void);
#define STEP(x)
#endif
+#define ACPI_VPRINT(dev, acpi_sc, x...) do { \
+ if (acpi_get_verbose(acpi_sc)) \
+ device_printf(dev, x); \
+} while (0)
+
extern BOOLEAN acpi_DeviceIsPresent(device_t dev);
extern BOOLEAN acpi_MatchHid(device_t dev, char *hid);
extern ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result);
OpenPOWER on IntegriCloud