summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-04-14 03:39:08 +0000
committernjl <njl@FreeBSD.org>2004-04-14 03:39:08 +0000
commitd84baf420ab9d0dce8a19fec7ef7920b2c3aa69b (patch)
tree2cb002820acafdd8dddb4959bbd0721cef15424f
parentad7733a68ac4ec500c2ed5b490d1dc61efe5fc42 (diff)
downloadFreeBSD-src-d84baf420ab9d0dce8a19fec7ef7920b2c3aa69b.zip
FreeBSD-src-d84baf420ab9d0dce8a19fec7ef7920b2c3aa69b.tar.gz
Style cleanups to reduce diffs to locking tree.
-rw-r--r--sys/dev/acpica/Osd/OsdDebug.c30
-rw-r--r--sys/dev/acpica/Osd/OsdHardware.c114
-rw-r--r--sys/dev/acpica/Osd/OsdMemory.c50
-rw-r--r--sys/dev/acpica/Osd/OsdStream.c5
-rw-r--r--sys/dev/acpica/acpivar.h3
5 files changed, 91 insertions, 111 deletions
diff --git a/sys/dev/acpica/Osd/OsdDebug.c b/sys/dev/acpica/Osd/OsdDebug.c
index 3df9e45..cb303a6 100644
--- a/sys/dev/acpica/Osd/OsdDebug.c
+++ b/sys/dev/acpica/Osd/OsdDebug.c
@@ -33,17 +33,9 @@
#include "opt_ddb.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/cons.h>
#include <sys/kernel.h>
-
#include <sys/bus.h>
-#include <machine/resource.h>
#include <machine/bus.h>
-#include <sys/rman.h>
-
-#include <ddb/ddb.h>
-#include <ddb/db_output.h>
#include "acpi.h"
#include "acdebug.h"
@@ -59,29 +51,28 @@ AcpiOsGetLine(char *Buffer)
for (cp = Buffer; *cp != 0; cp++)
if (*cp == '\n')
*cp = 0;
- return(AE_OK);
+ return (AE_OK);
#else
printf("AcpiOsGetLine called but no input support");
- return(AE_NOT_EXIST);
-#endif
+ return (AE_NOT_EXIST);
+#endif /* DDB */
}
void
-AcpiOsDbgAssert(void *FailedAssertion, void *FileName, UINT32 LineNumber, char *Message)
+AcpiOsDbgAssert(void *FailedAssertion, void *FileName, UINT32 LineNumber,
+ char *Message)
{
printf("ACPI: %s:%d - %s\n", (char *)FileName, LineNumber, Message);
printf("ACPI: assertion %s\n", (char *)FailedAssertion);
}
ACPI_STATUS
-AcpiOsSignal (
- UINT32 Function,
- void *Info)
+AcpiOsSignal(UINT32 Function, void *Info)
{
ACPI_SIGNAL_FATAL_INFO *fatal;
char *message;
- switch(Function) {
+ switch (Function) {
case ACPI_SIGNAL_FATAL:
fatal = (ACPI_SIGNAL_FATAL_INFO *)Info;
printf("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x",
@@ -95,9 +86,10 @@ AcpiOsSignal (
break;
default:
- return(AE_BAD_PARAMETER);
+ return (AE_BAD_PARAMETER);
}
- return(AE_OK);
+
+ return (AE_OK);
}
#ifdef ACPI_DEBUGGER
@@ -116,4 +108,4 @@ acpi_EnterDebugger(void)
printf("Entering ACPICA debugger...\n");
AcpiDbUserCommands('A', &obj);
}
-#endif
+#endif /* ACPI_DEBUGGER */
diff --git a/sys/dev/acpica/Osd/OsdHardware.c b/sys/dev/acpica/Osd/OsdHardware.c
index d5af511..c2380f6 100644
--- a/sys/dev/acpica/Osd/OsdHardware.c
+++ b/sys/dev/acpica/Osd/OsdHardware.c
@@ -67,34 +67,31 @@
#endif
ACPI_STATUS
-AcpiOsReadPort (
- ACPI_IO_ADDRESS InPort,
- UINT32 *Value,
- UINT32 Width)
+AcpiOsReadPort(ACPI_IO_ADDRESS InPort, UINT32 *Value, UINT32 Width)
{
switch (Width) {
case 8:
- *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO,
+ ACPI_BUS_HANDLE, InPort);
break;
case 16:
- *(u_int16_t *)Value = bus_space_read_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ *(u_int16_t *)Value = bus_space_read_2(ACPI_BUS_SPACE_IO,
+ ACPI_BUS_HANDLE, InPort);
break;
case 32:
- *(u_int32_t *)Value = bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ *(u_int32_t *)Value = bus_space_read_4(ACPI_BUS_SPACE_IO,
+ ACPI_BUS_HANDLE, InPort);
break;
default:
/* debug trap goes here */
break;
}
- return(AE_OK);
+ return (AE_OK);
}
ACPI_STATUS
-AcpiOsWritePort (
- ACPI_IO_ADDRESS OutPort,
- UINT32 Value,
- UINT32 Width)
+AcpiOsWritePort(ACPI_IO_ADDRESS OutPort, UINT32 Value, UINT32 Width)
{
switch (Width) {
case 8:
@@ -111,23 +108,21 @@ AcpiOsWritePort (
break;
}
- return(AE_OK);
+ return (AE_OK);
}
ACPI_STATUS
-AcpiOsReadPciConfiguration (
- ACPI_PCI_ID *PciId,
- UINT32 Register,
- void *Value,
- UINT32 Width)
+AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Register, void *Value,
+ UINT32 Width)
{
u_int32_t byte_width = Width / 8;
u_int32_t val;
if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
+ return (AE_NOT_EXIST);
- val = pci_cfgregread(PciId->Bus, PciId->Device, PciId->Function, Register, byte_width);
+ val = pci_cfgregread(PciId->Bus, PciId->Device, PciId->Function, Register,
+ byte_width);
switch (Width) {
case 8:
*(u_int8_t *)Value = val & 0xff;
@@ -143,26 +138,23 @@ AcpiOsReadPciConfiguration (
break;
}
-
- return(AE_OK);
+ return (AE_OK);
}
ACPI_STATUS
-AcpiOsWritePciConfiguration (
- ACPI_PCI_ID *PciId,
- UINT32 Register,
- ACPI_INTEGER Value,
- UINT32 Width)
+AcpiOsWritePciConfiguration (ACPI_PCI_ID *PciId, UINT32 Register,
+ ACPI_INTEGER Value, UINT32 Width)
{
u_int32_t byte_width = Width / 8;
if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
+ return (AE_NOT_EXIST);
- pci_cfgregwrite(PciId->Bus, PciId->Device, PciId->Function, Register, Value, byte_width);
+ pci_cfgregwrite(PciId->Bus, PciId->Device, PciId->Function, Register,
+ Value, byte_width);
- return(AE_OK);
+ return (AE_OK);
}
/* XXX should use acpivar.h but too many include dependencies */
@@ -176,33 +168,37 @@ static int
acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId)
{
ACPI_HANDLE parent;
+ ACPI_STATUS status;
ACPI_OBJECT_TYPE type;
UINT32 adr;
int bus, slot, func, class, subclass, header;
- /* Try to get the _BBN object of the root, otherwise assume it is 0 */
+ /* Try to get the _BBN object of the root, otherwise assume it is 0. */
bus = 0;
if (root == curr) {
- if (ACPI_FAILURE(acpi_GetInteger(root, "_BBN", &bus)) &&
- bootverbose)
- printf("acpi_bus_number: root bus has no _BBN, assuming 0\n");
+ status = acpi_GetInteger(root, "_BBN", &bus);
+ if (ACPI_FAILURE(status) && bootverbose)
+ printf("acpi_bus_number: root bus has no _BBN, assuming 0\n");
return (bus);
}
- if (ACPI_FAILURE(AcpiGetParent(curr, &parent)))
- return (bus);
+ status = AcpiGetParent(curr, &parent);
+ if (ACPI_FAILURE(status))
+ return (bus);
- /* First, recurse up the tree until we find the host bus */
+ /* First, recurse up the tree until we find the host bus. */
bus = acpi_bus_number(root, parent, PciId);
- /* Validate parent bus device type */
+ /* Validate parent bus device type. */
if (ACPI_FAILURE(AcpiGetType(parent, &type)) || type != ACPI_TYPE_DEVICE) {
- printf("acpi_bus_number: not a device, type %d\n", type);
- return (bus);
+ printf("acpi_bus_number: not a device, type %d\n", type);
+ return (bus);
}
- /* Get the parent's slot and function */
- if (ACPI_FAILURE(acpi_GetInteger(parent, "_ADR", &adr))) {
- printf("acpi_bus_number: can't get _ADR\n");
- return (bus);
+
+ /* Get the parent's slot and function. */
+ status = acpi_GetInteger(parent, "_ADR", &adr);
+ if (ACPI_FAILURE(status)) {
+ printf("acpi_bus_number: can't get _ADR\n");
+ return (bus);
}
slot = ACPI_HIWORD(adr);
func = ACPI_LOWORD(adr);
@@ -210,14 +206,15 @@ acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId)
/* Is this a PCI-PCI or Cardbus-PCI bridge? */
class = pci_cfgregread(bus, slot, func, PCIR_CLASS, 1);
if (class != PCIC_BRIDGE)
- return (bus);
+ return (bus);
subclass = pci_cfgregread(bus, slot, func, PCIR_SUBCLASS, 1);
- /* Find the header type, masking off the multifunction bit */
+
+ /* Find the header type, masking off the multifunction bit. */
header = pci_cfgregread(bus, slot, func, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE;
if (header == PCIM_HDRTYPE_BRIDGE && subclass == PCIS_BRIDGE_PCI)
- bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_1, 1);
+ bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_1, 1);
if (header == PCIM_HDRTYPE_CARDBUS && subclass == PCIS_BRIDGE_CARDBUS)
- bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_2, 1);
+ bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_2, 1);
return (bus);
}
@@ -229,24 +226,23 @@ acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId)
* PciId: pointer to device slot and function, we fill out bus
*/
void
-AcpiOsDerivePciId (
- ACPI_HANDLE rhandle,
- ACPI_HANDLE chandle,
- ACPI_PCI_ID **PciId)
+AcpiOsDerivePciId(ACPI_HANDLE rhandle, ACPI_HANDLE chandle, ACPI_PCI_ID **PciId)
{
ACPI_HANDLE parent;
+ ACPI_STATUS status;
int bus;
if (pci_cfgregopen() == 0)
- panic("AcpiOsDerivePciId unable to initialize pci bus");
+ panic("AcpiOsDerivePciId unable to initialize pci bus");
/* Try to read _BBN for bus number if we're at the root */
bus = 0;
if (rhandle == chandle) {
- if (ACPI_FAILURE(acpi_GetInteger(rhandle, "_BBN", &bus)) &&
- bootverbose)
- printf("AcpiOsDerivePciId: root bus has no _BBN, assuming 0\n");
+ status = acpi_GetInteger(rhandle, "_BBN", &bus);
+ if (ACPI_FAILURE(status) && bootverbose)
+ printf("AcpiOsDerivePciId: root bus has no _BBN, assuming 0\n");
}
+
/*
* Get the parent handle and call the recursive case. It is not
* clear why we seem to be getting a chandle that points to a child
@@ -254,10 +250,10 @@ AcpiOsDerivePciId (
* here works.
*/
if (ACPI_SUCCESS(AcpiGetParent(chandle, &parent)))
- bus = acpi_bus_number(rhandle, parent, *PciId);
+ bus = acpi_bus_number(rhandle, parent, *PciId);
(*PciId)->Bus = bus;
if (bootverbose) {
- printf("AcpiOsDerivePciId: bus %d dev %d func %d\n",
- (*PciId)->Bus, (*PciId)->Device, (*PciId)->Function);
+ printf("AcpiOsDerivePciId: bus %d dev %d func %d\n",
+ (*PciId)->Bus, (*PciId)->Device, (*PciId)->Function);
}
}
diff --git a/sys/dev/acpica/Osd/OsdMemory.c b/sys/dev/acpica/Osd/OsdMemory.c
index 8fe1a44..e32dc59 100644
--- a/sys/dev/acpica/Osd/OsdMemory.c
+++ b/sys/dev/acpica/Osd/OsdMemory.c
@@ -39,40 +39,42 @@
#include <vm/vm.h>
#include <vm/pmap.h>
-static MALLOC_DEFINE(M_ACPICA, "acpica", "ACPI CA memory pool");
+MALLOC_DEFINE(M_ACPICA, "acpica", "ACPI CA memory pool");
void *
AcpiOsAllocate(ACPI_SIZE Size)
{
- return(malloc(Size, M_ACPICA, M_NOWAIT));
+ return (malloc(Size, M_ACPICA, M_NOWAIT));
}
void
-AcpiOsFree (void *Memory)
+AcpiOsFree(void *Memory)
{
free(Memory, M_ACPICA);
}
ACPI_STATUS
-AcpiOsMapMemory (ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length, void **LogicalAddress)
+AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length,
+ void **LogicalAddress)
{
*LogicalAddress = pmap_mapdev((vm_offset_t)PhysicalAddress, Length);
if (*LogicalAddress == NULL)
- return(AE_BAD_ADDRESS);
- return(AE_OK);
+ return (AE_BAD_ADDRESS);
+ return (AE_OK);
}
void
-AcpiOsUnmapMemory (void *LogicalAddress, ACPI_SIZE Length)
+AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Length)
{
pmap_unmapdev((vm_offset_t)LogicalAddress, Length);
}
ACPI_STATUS
-AcpiOsGetPhysicalAddress(void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+AcpiOsGetPhysicalAddress(void *LogicalAddress,
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
{
- /* we can't necessarily do this, so cop out */
- return(AE_BAD_ADDRESS);
+ /* We can't necessarily do this, so cop out. */
+ return (AE_BAD_ADDRESS);
}
/*
@@ -82,26 +84,22 @@ AcpiOsGetPhysicalAddress(void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAd
BOOLEAN
AcpiOsReadable (void *Pointer, ACPI_SIZE Length)
{
- return(TRUE);
+ return (TRUE);
}
BOOLEAN
AcpiOsWritable (void *Pointer, ACPI_SIZE Length)
{
- return(TRUE);
+ return (TRUE);
}
ACPI_STATUS
-AcpiOsReadMemory (
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 *Value,
- UINT32 Width)
+AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width)
{
void *LogicalAddress;
- if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK) {
- return(AE_NOT_EXIST);
- }
+ if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK)
+ return (AE_NOT_EXIST);
switch (Width) {
case 8:
@@ -123,20 +121,16 @@ AcpiOsReadMemory (
AcpiOsUnmapMemory(LogicalAddress, Width / 8);
- return(AE_OK);
+ return (AE_OK);
}
ACPI_STATUS
-AcpiOsWriteMemory (
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 Value,
- UINT32 Width)
+AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width)
{
void *LogicalAddress;
- if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK) {
- return(AE_NOT_EXIST);
- }
+ if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK)
+ return (AE_NOT_EXIST);
switch (Width) {
case 8:
@@ -158,5 +152,5 @@ AcpiOsWriteMemory (
AcpiOsUnmapMemory(LogicalAddress, Width / 8);
- return(AE_OK);
+ return (AE_OK);
}
diff --git a/sys/dev/acpica/Osd/OsdStream.c b/sys/dev/acpica/Osd/OsdStream.c
index 7c9acde..b4150cf 100644
--- a/sys/dev/acpica/Osd/OsdStream.c
+++ b/sys/dev/acpica/Osd/OsdStream.c
@@ -34,7 +34,7 @@
#include "acpi.h"
void
-AcpiOsPrintf (const char *Format, ...)
+AcpiOsPrintf(const char *Format, ...)
{
va_list ap;
@@ -44,8 +44,7 @@ AcpiOsPrintf (const char *Format, ...)
}
void
-AcpiOsVprintf (const char *Format, va_list Args)
+AcpiOsVprintf(const char *Format, va_list Args)
{
vprintf(Format, Args);
}
-
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index a00aa48..10fa91a 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -70,7 +70,6 @@ struct acpi_softc {
int acpi_sleep_delay;
int acpi_s4bios;
int acpi_disable_on_poweroff;
-
int acpi_verbose;
bus_dma_tag_t acpi_waketag;
@@ -88,7 +87,7 @@ struct acpi_device {
int ad_magic;
void *ad_private;
- /* resources */
+ /* Resources */
struct resource_list ad_rl;
};
OpenPOWER on IntegriCloud