Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Enable software LED control based on LED0 feature, n...



details:   https://anonhg.NetBSD.org/src/rev/7b7d404f0cc9
branches:  trunk
changeset: 526011:7b7d404f0cc9
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Apr 23 10:38:37 2002 +0000

description:
Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
>From Jason R Thorpe.

diffstat:

 sys/dev/ic/esiop.c            |  63 ++++++++++++++++++++++--------------------
 sys/dev/ic/siop.c             |  63 ++++++++++++++++++++++--------------------
 sys/dev/ic/siop_common.c      |  14 ++++----
 sys/dev/ic/siopvar_common.h   |   4 ++-
 sys/dev/pci/siop_pci_common.c |   7 +++-
 5 files changed, 81 insertions(+), 70 deletions(-)

diffs (263 lines):

diff -r 472166357fa1 -r 7b7d404f0cc9 sys/dev/ic/esiop.c
--- a/sys/dev/ic/esiop.c        Tue Apr 23 10:14:59 2002 +0000
+++ b/sys/dev/ic/esiop.c        Tue Apr 23 10:38:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esiop.c,v 1.3 2002/04/22 20:47:20 bouyer Exp $ */
+/*     $NetBSD: esiop.c,v 1.4 2002/04/23 10:38:37 bouyer Exp $ */
 
 /*
  * Copyright (c) 2002 Manuel Bouyer.
@@ -33,7 +33,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.3 2002/04/22 20:47:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.4 2002/04/23 10:38:37 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -306,17 +306,20 @@
                            E_abs_msgin2_Used[j] * 4, msgin_addr);
                }
 
-#ifdef SIOP_SYMLED
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_on1, esiop_led_on,
-                   sizeof(esiop_led_on) / sizeof(esiop_led_on[0]));
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_on2, esiop_led_on,
-                   sizeof(esiop_led_on) / sizeof(esiop_led_on[0]));
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_off, esiop_led_off,
-                   sizeof(esiop_led_off) / sizeof(esiop_led_off[0]));
-#endif
+               if (sc->sc_c.features & SF_CHIP_LED0) {
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_on1, esiop_led_on,
+                           sizeof(esiop_led_on) / sizeof(esiop_led_on[0]));
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_on2, esiop_led_on,
+                           sizeof(esiop_led_on) / sizeof(esiop_led_on[0]));
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_off, esiop_led_off,
+                           sizeof(esiop_led_off) / sizeof(esiop_led_off[0]));
+               }
        } else {
                for (j = 0;
                    j < (sizeof(esiop_script) / sizeof(esiop_script[0])); j++) {
@@ -335,23 +338,23 @@
                            htole32(msgin_addr);
                }
 
-#ifdef SIOP_SYMLED
-               for (j = 0;
-                   j < (sizeof(esiop_led_on) / sizeof(esiop_led_on[0])); j++)
-                       sc->sc_c.sc_script[
-                           Ent_led_on1 / sizeof(esiop_led_on[0]) + j
-                           ] = htole32(esiop_led_on[j]);
-               for (j = 0;
-                   j < (sizeof(esiop_led_on) / sizeof(esiop_led_on[0])); j++)
-                       sc->sc_c.sc_script[
-                           Ent_led_on2 / sizeof(esiop_led_on[0]) + j
-                           ] = htole32(esiop_led_on[j]);
-               for (j = 0;
-                   j < (sizeof(esiop_led_off) / sizeof(esiop_led_off[0])); j++)
-                       sc->sc_c.sc_script[
-                          Ent_led_off / sizeof(esiop_led_off[0]) + j
-                          ] = htole32(esiop_led_off[j]);
-#endif
+               if (sc->sc_c.features & SF_CHIP_LED0) {
+                       for (j = 0; j < (sizeof(esiop_led_on) /
+                           sizeof(esiop_led_on[0])); j++)
+                               sc->sc_c.sc_script[
+                                   Ent_led_on1 / sizeof(esiop_led_on[0]) + j
+                                   ] = htole32(esiop_led_on[j]);
+                       for (j = 0; j < (sizeof(esiop_led_on) /
+                           sizeof(esiop_led_on[0])); j++)
+                               sc->sc_c.sc_script[
+                                   Ent_led_on2 / sizeof(esiop_led_on[0]) + j
+                                   ] = htole32(esiop_led_on[j]);
+                       for (j = 0; j < (sizeof(esiop_led_off) /
+                           sizeof(esiop_led_off[0])); j++)
+                               sc->sc_c.sc_script[
+                                  Ent_led_off / sizeof(esiop_led_off[0]) + j
+                                  ] = htole32(esiop_led_off[j]);
+               }
        }
        /* get base of scheduler ring */
        addr = sc->sc_c.sc_scriptaddr + sc->sc_shedoffset * sizeof(u_int32_t);
diff -r 472166357fa1 -r 7b7d404f0cc9 sys/dev/ic/siop.c
--- a/sys/dev/ic/siop.c Tue Apr 23 10:14:59 2002 +0000
+++ b/sys/dev/ic/siop.c Tue Apr 23 10:38:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop.c,v 1.55 2002/04/22 15:48:55 bouyer Exp $ */
+/*     $NetBSD: siop.c,v 1.56 2002/04/23 10:38:37 bouyer Exp $ */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -33,7 +33,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.55 2002/04/22 15:48:55 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.56 2002/04/23 10:38:37 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -280,17 +280,20 @@
                            E_abs_msgin_Used[j] * 4,
                            sc->sc_c.sc_scriptaddr + Ent_msgin_space);
                }
-#ifdef SIOP_SYMLED
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_on1, siop_led_on,
-                   sizeof(siop_led_on) / sizeof(siop_led_on[0]));
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_on2, siop_led_on,
-                   sizeof(siop_led_on) / sizeof(siop_led_on[0]));
-               bus_space_write_region_4(sc->sc_c.sc_ramt, sc->sc_c.sc_ramh,
-                   Ent_led_off, siop_led_off,
-                   sizeof(siop_led_off) / sizeof(siop_led_off[0]));
-#endif
+               if (sc->sc_c.features & SF_CHIP_LED0) {
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_on1, siop_led_on,
+                           sizeof(siop_led_on) / sizeof(siop_led_on[0]));
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_on2, siop_led_on,
+                           sizeof(siop_led_on) / sizeof(siop_led_on[0]));
+                       bus_space_write_region_4(sc->sc_c.sc_ramt,
+                           sc->sc_c.sc_ramh,
+                           Ent_led_off, siop_led_off,
+                           sizeof(siop_led_off) / sizeof(siop_led_off[0]));
+               }
        } else {
                for (j = 0;
                    j < (sizeof(siop_script) / sizeof(siop_script[0])); j++) {
@@ -302,23 +305,23 @@
                        sc->sc_c.sc_script[E_abs_msgin_Used[j]] =
                            htole32(sc->sc_c.sc_scriptaddr + Ent_msgin_space);
                }
-#ifdef SIOP_SYMLED
-               for (j = 0;
-                   j < (sizeof(siop_led_on) / sizeof(siop_led_on[0])); j++)
-                       sc->sc_c.sc_script[
-                           Ent_led_on1 / sizeof(siop_led_on[0]) + j
-                           ] = htole32(siop_led_on[j]);
-               for (j = 0;
-                   j < (sizeof(siop_led_on) / sizeof(siop_led_on[0])); j++)
-                       sc->sc_c.sc_script[
-                           Ent_led_on2 / sizeof(siop_led_on[0]) + j
-                           ] = htole32(siop_led_on[j]);
-               for (j = 0;
-                   j < (sizeof(siop_led_off) / sizeof(siop_led_off[0])); j++)
-                       sc->sc_c.sc_script[
-                          Ent_led_off / sizeof(siop_led_off[0]) + j
-                          ] = htole32(siop_led_off[j]);
-#endif
+               if (sc->sc_c.features & SF_CHIP_LED0) {
+                       for (j = 0; j < (sizeof(siop_led_on) /
+                           sizeof(siop_led_on[0])); j++)
+                               sc->sc_c.sc_script[
+                                   Ent_led_on1 / sizeof(siop_led_on[0]) + j
+                                   ] = htole32(siop_led_on[j]);
+                       for (j = 0; j < (sizeof(siop_led_on) /
+                           sizeof(siop_led_on[0])); j++)
+                               sc->sc_c.sc_script[
+                                   Ent_led_on2 / sizeof(siop_led_on[0]) + j
+                                   ] = htole32(siop_led_on[j]);
+                       for (j = 0; j < (sizeof(siop_led_off) /
+                           sizeof(siop_led_off[0])); j++)
+                               sc->sc_c.sc_script[
+                                  Ent_led_off / sizeof(siop_led_off[0]) + j
+                                  ] = htole32(siop_led_off[j]);
+               }
        }
        sc->script_free_lo = sizeof(siop_script) / sizeof(siop_script[0]);
        sc->script_free_hi = sc->sc_c.ram_size / 4;
diff -r 472166357fa1 -r 7b7d404f0cc9 sys/dev/ic/siop_common.c
--- a/sys/dev/ic/siop_common.c  Tue Apr 23 10:14:59 2002 +0000
+++ b/sys/dev/ic/siop_common.c  Tue Apr 23 10:38:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop_common.c,v 1.20 2002/04/22 20:31:49 bouyer Exp $  */
+/*     $NetBSD: siop_common.c,v 1.21 2002/04/23 10:38:37 bouyer Exp $  */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -33,7 +33,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siop_common.c,v 1.20 2002/04/22 20:31:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siop_common.c,v 1.21 2002/04/23 10:38:37 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -120,11 +120,11 @@
                bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST5,
                    bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST5) |
                    CTEST5_DFS);
-#ifdef SIOP_SYMLED
-       /* Set GPIO0 as output if software LED control is required */
-       bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL,
-           bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL) & 0xfe);
-#endif
+       if (sc->features & SF_CHIP_LED0) {
+               /* Set GPIO0 as output if software LED control is required */
+               bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL,
+                   bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL) & 0xfe);
+       }
                
        sc->sc_reset(sc);
 }
diff -r 472166357fa1 -r 7b7d404f0cc9 sys/dev/ic/siopvar_common.h
--- a/sys/dev/ic/siopvar_common.h       Tue Apr 23 10:14:59 2002 +0000
+++ b/sys/dev/ic/siopvar_common.h       Tue Apr 23 10:38:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siopvar_common.h,v 1.15 2002/04/23 10:06:44 bouyer Exp $       */
+/*     $NetBSD: siopvar_common.h,v 1.16 2002/04/23 10:38:38 bouyer Exp $       */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -30,6 +30,8 @@
  *
  */
 
+#include "opt_siop.h"
+
 /* common struct and routines used by siop and esiop */
 
 #ifndef SIOP_DEFAULT_TARGET
diff -r 472166357fa1 -r 7b7d404f0cc9 sys/dev/pci/siop_pci_common.c
--- a/sys/dev/pci/siop_pci_common.c     Tue Apr 23 10:14:59 2002 +0000
+++ b/sys/dev/pci/siop_pci_common.c     Tue Apr 23 10:38:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop_pci_common.c,v 1.12 2002/04/23 10:11:39 bouyer Exp $      */
+/*     $NetBSD: siop_pci_common.c,v 1.13 2002/04/23 10:38:38 bouyer Exp $      */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -32,7 +32,7 @@
 /* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siop_pci_common.c,v 1.12 2002/04/23 10:11:39 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siop_pci_common.c,v 1.13 2002/04/23 10:38:38 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -244,6 +244,9 @@
        }
        /* copy interesting infos about the chip */
        siop_sc->features = pci_sc->sc_pp->features;
+#ifdef SIOP_SYMLED    /* XXX Should be a devprop! */
+       siop_sc->features |= SF_CHIP_LED0;
+#endif
        siop_sc->maxburst = pci_sc->sc_pp->maxburst;
        siop_sc->maxoff = pci_sc->sc_pp->maxoff;
        siop_sc->clock_div = pci_sc->sc_pp->clock_div;



Home | Main Index | Thread Index | Old Index