summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2014-01-23 17:43:28 +0000
committermsaitoh <msaitoh@NetBSD.org>2014-01-23 17:43:28 +0000
commit42e184e42a1fbb38d4e5b93dda9883754efa60cb (patch)
treece541df55178b0a74cd3eccf94f1aa2025e4a3d4 /sys/dev
parent52fda3754ed16f916a4ac550059ccb760bac682b (diff)
Add comments and KNF. No functional change.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/puccn.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/sys/dev/pci/puccn.c b/sys/dev/pci/puccn.c
index 74b82bb13b3..f233790d7d8 100644
--- a/sys/dev/pci/puccn.c
+++ b/sys/dev/pci/puccn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: puccn.c,v 1.11 2013/07/22 13:40:36 soren Exp $ */
+/* $NetBSD: puccn.c,v 1.12 2014/01/23 17:43:28 msaitoh Exp $ */
/*
* Derived from pci.c
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.11 2013/07/22 13:40:36 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.12 2014/01/23 17:43:28 msaitoh Exp $");
#include "opt_kgdb.h"
@@ -106,8 +106,7 @@ pucprobe_doit(struct consdev *cn)
puctag = pa.pa_iot;
pci_decompose_tag(pa.pa_pc, pa.pa_tag, &bus, &maxdev, NULL);
- /* scan through devices */
-
+ /* Scan through devices and find a communication class device. */
for (; dev <= maxdev ; dev++) {
pa.pa_tag = pci_make_tag(pa.pa_pc, bus, dev, 0);
reg = pci_conf_read(pa.pa_pc, pa.pa_tag, PCI_ID_REG);
@@ -139,17 +138,30 @@ resume_scan:
func = 0;
}
+
+ /*
+ * If all devices was scanned and couldn't find any communication
+ * device, return with 0.
+ */
if (!foundport)
return 0;
foundport = 0;
+ /* Check whether the device is in the puc device table or not */
desc = puc_find_description(PCI_VENDOR(pa.pa_id),
PCI_PRODUCT(pa.pa_id), PCI_VENDOR(subsys), PCI_PRODUCT(subsys));
+
+ /* If not, check the next communication device */
if (desc == NULL) {
+ /* Resume from the next function */
func++;
goto resume_scan;
}
+ /*
+ * We found a device and it's on the puc table. Set the tag and
+ * the base address.
+ */
for (i = 0; PUC_PORT_VALID(desc, i); i++)
{
if (desc->ports[i].type != PUC_PORT_TYPE_COM)
@@ -182,15 +194,17 @@ void comgdbinit(struct consdev *);
void
comgdbprobe(struct consdev *cn)
{
+
pucgdbbase = pucprobe_doit(cn);
}
void
comgdbinit(struct consdev *cn)
{
- if (pucgdbbase == 0) {
+
+ if (pucgdbbase == 0)
return;
- }
+
com_kgdb_attach(puctag, pucgdbbase, CONSPEED, COM_FREQ,
COM_TYPE_NORMAL, CONMODE);
}
@@ -199,15 +213,16 @@ comgdbinit(struct consdev *cn)
void
comcnprobe(struct consdev *cn)
{
+
puccnbase = pucprobe_doit(cn);
}
void
comcninit(struct consdev *cn)
{
- if (puccnbase == 0) {
+ if (puccnbase == 0)
return;
- }
+
comcnattach(puctag, puccnbase, CONSPEED, COM_FREQ, COM_TYPE_NORMAL,
CONMODE);
}