summaryrefslogtreecommitdiffstats
path: root/sys/i386/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-08-28 16:26:24 +0000
committernjl <njl@FreeBSD.org>2003-08-28 16:26:24 +0000
commitb40752df7c1dad079619a47994b285079e77cfd6 (patch)
tree024165b04bfe8d262e12330ba701bbad1bfc96d7 /sys/i386/acpica
parent17ad6b10fd3344dec348e35311baa247c5a93de8 (diff)
downloadFreeBSD-src-b40752df7c1dad079619a47994b285079e77cfd6.zip
FreeBSD-src-b40752df7c1dad079619a47994b285079e77cfd6.tar.gz
Style cleanups.
Diffstat (limited to 'sys/i386/acpica')
-rw-r--r--sys/i386/acpica/OsdEnvironment.c2
-rw-r--r--sys/i386/acpica/acpi_machdep.c74
-rw-r--r--sys/i386/acpica/acpi_wakecode.S1
-rw-r--r--sys/i386/acpica/acpi_wakeup.c30
4 files changed, 35 insertions, 72 deletions
diff --git a/sys/i386/acpica/OsdEnvironment.c b/sys/i386/acpica/OsdEnvironment.c
index 559ac74..66307bf 100644
--- a/sys/i386/acpica/OsdEnvironment.c
+++ b/sys/i386/acpica/OsdEnvironment.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
u_long i386_acpi_root;
SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &i386_acpi_root, 0,
- "The physical address of the RSDP");
+ "The physical address of the RSDP");
ACPI_STATUS
AcpiOsInitialize(void)
diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c
index dcdd5a9..3cff7a9 100644
--- a/sys/i386/acpica/acpi_machdep.c
+++ b/sys/i386/acpica/acpi_machdep.c
@@ -86,18 +86,16 @@ acpi_capm_convert_battstate(struct acpi_battinfo *battp)
state = 0xff; /* XXX unknown */
if (battp->state & ACPI_BATT_STAT_DISCHARG) {
- if (battp->cap >= 50) {
+ if (battp->cap >= 50)
state = 0; /* high */
- } else {
+ else
state = 1; /* low */
- }
}
- if (battp->state & ACPI_BATT_STAT_CRITICAL) {
+ if (battp->state & ACPI_BATT_STAT_CRITICAL)
state = 2; /* critical */
- }
- if (battp->state & ACPI_BATT_STAT_CHARGING) {
+ if (battp->state & ACPI_BATT_STAT_CHARGING)
state = 3; /* charging */
- }
+
return (state);
}
@@ -111,18 +109,15 @@ acpi_capm_convert_battflags(struct acpi_battinfo *battp)
if (battp->cap >= 50) {
flags |= APM_BATT_HIGH;
} else {
- if (battp->state & ACPI_BATT_STAT_CRITICAL) {
+ if (battp->state & ACPI_BATT_STAT_CRITICAL)
flags |= APM_BATT_CRITICAL;
- } else {
+ else
flags |= APM_BATT_LOW;
- }
}
- if (battp->state & ACPI_BATT_STAT_CHARGING) {
+ if (battp->state & ACPI_BATT_STAT_CHARGING)
flags |= APM_BATT_CHARGING;
- }
- if (battp->state == ACPI_BATT_STAT_NOT_PRESENT) {
+ if (battp->state == ACPI_BATT_STAT_NOT_PRESENT)
flags = APM_BATT_NOT_PRESENT;
- }
return (flags);
}
@@ -139,11 +134,10 @@ acpi_capm_get_info(apm_info_t aip)
aip->ai_status = apm_softc.active;
aip->ai_capabilities= 0xff00; /* XXX unknown */
- if (acpi_acad_get_acline(&acline)) {
+ if (acpi_acad_get_acline(&acline))
aip->ai_acline = 0xff; /* unknown */
- } else {
+ else
aip->ai_acline = acline; /* on/off */
- }
if (acpi_battery_get_battinfo(-1, &batt)) {
aip->ai_batt_stat = 0xff; /* unknown */
@@ -172,26 +166,23 @@ acpi_capm_get_pwstatus(apm_pwstatus_t app)
return (1);
}
- if (app->ap_device == PMDV_ALLDEV) {
+ if (app->ap_device == PMDV_ALLDEV)
batt_unit = -1; /* all units */
- } else {
+ else
batt_unit = app->ap_device - PMDV_BATT0;
- }
- if (acpi_battery_get_battinfo(batt_unit, &batt)) {
+ if (acpi_battery_get_battinfo(batt_unit, &batt))
return (1);
- }
app->ap_batt_stat = acpi_capm_convert_battstate(&batt);
app->ap_batt_flag = acpi_capm_convert_battflags(&batt);
app->ap_batt_life = batt.cap;
app->ap_batt_time = (batt.min == -1) ? -1 : batt.min * 60;
- if (acpi_acad_get_acline(&acline)) {
+ if (acpi_acad_get_acline(&acline))
app->ap_acline = 0xff; /* unknown */
- } else {
+ else
app->ap_acline = acline; /* on/off */
- }
return (0);
}
@@ -216,29 +207,26 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
struct apm_info info;
apm_info_old_t aiop;
- if ((acpi_sc = device_get_softc(acpi_dev)) == NULL) {
+ if ((acpi_sc = device_get_softc(acpi_dev)) == NULL)
return (ENXIO);
- }
switch (cmd) {
case APMIO_SUSPEND:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
if (apm_softc.active)
acpi_SetSleepState(acpi_sc, acpi_sc->acpi_suspend_sx);
else
error = EINVAL;
break;
-
case APMIO_STANDBY:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
if (apm_softc.active)
acpi_SetSleepState(acpi_sc, acpi_sc->acpi_standby_sx);
else
error = EINVAL;
break;
-
case APMIO_GETINFO_OLD:
if (acpi_capm_get_info(&info))
error = ENXIO;
@@ -250,47 +238,37 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
aiop->ai_batt_life = info.ai_batt_life;
aiop->ai_status = info.ai_status;
break;
-
case APMIO_GETINFO:
if (acpi_capm_get_info((apm_info_t)addr))
error = ENXIO;
-
break;
-
case APMIO_GETPWSTATUS:
if (acpi_capm_get_pwstatus((apm_pwstatus_t)addr))
error = ENXIO;
break;
-
case APMIO_ENABLE:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
apm_softc.active = 1;
break;
-
case APMIO_DISABLE:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
apm_softc.active = 0;
break;
-
case APMIO_HALTCPU:
break;
-
case APMIO_NOTHALTCPU:
break;
-
case APMIO_DISPLAY:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
break;
-
case APMIO_BIOS:
- if (!(flag & FWRITE))
+ if ((flag & FWRITE) == 0)
return (EPERM);
bzero(addr, sizeof(struct apm_bios_arg));
break;
-
default:
error = EINVAL;
break;
@@ -302,7 +280,6 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
static int
apmwrite(dev_t dev, struct uio *uio, int ioflag)
{
-
return (uio->uio_resid);
}
@@ -315,7 +292,6 @@ apmpoll(dev_t dev, int events, d_thread_t *td)
static void
acpi_capm_init(struct acpi_softc *sc)
{
-
make_dev(&apm_cdevsw, 0, 0, 5, 0664, "apm");
}
@@ -325,9 +301,8 @@ acpi_machdep_init(device_t dev)
struct acpi_softc *sc;
acpi_dev = dev;
- if ((sc = device_get_softc(acpi_dev)) == NULL) {
+ if ((sc = device_get_softc(acpi_dev)) == NULL)
return (ENXIO);
- }
/*
* XXX: Prevent the PnP BIOS code from interfering with
@@ -344,4 +319,3 @@ acpi_machdep_init(device_t dev)
#endif
return (0);
}
-
diff --git a/sys/i386/acpica/acpi_wakecode.S b/sys/i386/acpica/acpi_wakecode.S
index 4951985..6a251ff 100644
--- a/sys/i386/acpica/acpi_wakecode.S
+++ b/sys/i386/acpica/acpi_wakecode.S
@@ -216,4 +216,3 @@ previous_fs: .word 0
previous_gs: .word 0
previous_ss: .word 0
dummy: .word 0
-
diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c
index d68f51d..e2a029f 100644
--- a/sys/i386/acpica/acpi_wakeup.c
+++ b/sys/i386/acpica/acpi_wakeup.c
@@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$");
#include <i386/isa/intr_machdep.h>
#include "acpi.h"
-
#include <dev/acpica/acpica_support.h>
-
#include <dev/acpica/acpivar.h>
#include "acpi_wakecode.h"
@@ -156,7 +154,6 @@ acpi_savecpu: \n\
static void
acpi_printcpu(void)
{
-
printf("======== acpi_printcpu() debug dump ========\n");
printf("gdt[%04x:%08x] idt[%04x:%08x] ldt[%04x] tr[%04x] efl[%08x]\n",
r_gdt.rd_limit, r_gdt.rd_base, r_idt.rd_limit, r_idt.rd_base,
@@ -197,9 +194,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
u_long ef;
struct proc *p;
- if (sc->acpi_wakeaddr == 0) {
+ if (sc->acpi_wakeaddr == 0)
return (0);
- }
AcpiSetFirmwareWakingVector(sc->acpi_wakephys);
@@ -222,9 +218,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
}
oldphys = pmap_extract(pm, sc->acpi_wakephys);
- if (oldphys) {
+ if (oldphys)
opage = PHYS_TO_VM_PAGE(oldphys);
- }
page = PHYS_TO_VM_PAGE(sc->acpi_wakephys);
pmap_enter(pm, sc->acpi_wakephys, page,
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, 1);
@@ -232,7 +227,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
ret_addr = 0;
if (acpi_savecpu()) {
/* Execute Sleep */
- p_gdt = (struct region_descriptor *)(sc->acpi_wakeaddr + physical_gdt);
+ p_gdt = (struct region_descriptor *)
+ (sc->acpi_wakeaddr + physical_gdt);
p_gdt->rd_limit = r_gdt.rd_limit;
p_gdt->rd_base = vtophys(r_gdt.rd_base);
@@ -255,17 +251,15 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
WAKECODE_FIXUP(previous_gs, u_int16_t, r_gs);
WAKECODE_FIXUP(previous_ss, u_int16_t, r_ss);
- if (acpi_get_verbose(sc)) {
+ if (acpi_get_verbose(sc))
acpi_printcpu();
- }
ACPI_FLUSH_CPU_CACHE();
- if (state == ACPI_STATE_S4 && sc->acpi_s4bios) {
+ if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
status = AcpiEnterSleepStateS4Bios();
- } else {
+ else
status = AcpiEnterSleepState(state);
- }
if (status != AE_OK) {
device_printf(sc->acpi_dev,
@@ -316,7 +310,6 @@ static vm_offset_t acpi_wakeaddr = 0;
static void
acpi_alloc_wakeup_handler(void)
{
-
if (!cold)
return;
@@ -325,13 +318,13 @@ acpi_alloc_wakeup_handler(void)
/* highaddr */ BUS_SPACE_MAXADDR, NULL, NULL,
PAGE_SIZE, 1, PAGE_SIZE, 0, busdma_lock_mutex,
&Giant, &acpi_waketag) != 0) {
- printf("acpi_alloc_wakeup_handler: unable to create wake tag\n");
+ printf("acpi_alloc_wakeup_handler: can't create wake tag\n");
return;
}
if (bus_dmamem_alloc(acpi_waketag, (void **)&acpi_wakeaddr,
BUS_DMA_NOWAIT, &acpi_wakemap)) {
- printf("acpi_alloc_wakeup_handler: unable to allocate wake memory\n");
+ printf("acpi_alloc_wakeup_handler: can't alloc wake memory\n");
return;
}
}
@@ -353,10 +346,8 @@ acpi_realmodeinst(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
void
acpi_install_wakeup_handler(struct acpi_softc *sc)
{
-
- if (acpi_wakeaddr == 0) {
+ if (acpi_wakeaddr == 0)
return;
- }
sc->acpi_waketag = acpi_waketag;
sc->acpi_wakeaddr = acpi_wakeaddr;
@@ -366,4 +357,3 @@ acpi_install_wakeup_handler(struct acpi_softc *sc)
(void *)sc->acpi_wakeaddr, PAGE_SIZE,
acpi_realmodeinst, sc, 0);
}
-
OpenPOWER on IntegriCloud