diff options
| author | bouyer <bouyer@NetBSD.org> | 2002-04-23 10:38:37 +0000 |
|---|---|---|
| committer | bouyer <bouyer@NetBSD.org> | 2002-04-23 10:38:37 +0000 |
| commit | cf06149dac0a4f7263cae74ecfeaa33ce8d981cd (patch) | |
| tree | 58032ac58f8ba299a2df692be7d3e003316e37ed /sys/dev | |
| parent | 19f6d0bbcb5b554244ce8f97a45fcea3243a2ec7 (diff) | |
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 (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/esiop.c | 63 | ||||
| -rw-r--r-- | sys/dev/ic/siop.c | 63 | ||||
| -rw-r--r-- | sys/dev/ic/siop_common.c | 14 | ||||
| -rw-r--r-- | sys/dev/ic/siopvar_common.h | 4 | ||||
| -rw-r--r-- | sys/dev/pci/siop_pci_common.c | 7 |
5 files changed, 81 insertions, 70 deletions
diff --git a/sys/dev/ic/esiop.c b/sys/dev/ic/esiop.c index af394b776d4..4e5d12877c7 100644 --- a/sys/dev/ic/esiop.c +++ b/sys/dev/ic/esiop.c @@ -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 @@ esiop_reset(sc) 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 @@ esiop_reset(sc) 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 --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index f7c80492031..d1b781b38b4 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -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 @@ siop_reset(sc) 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 @@ siop_reset(sc) 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 --git a/sys/dev/ic/siop_common.c b/sys/dev/ic/siop_common.c index 57b3afcf5f6..c29b7a19fd4 100644 --- a/sys/dev/ic/siop_common.c +++ b/sys/dev/ic/siop_common.c @@ -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 @@ siop_common_reset(sc) 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 --git a/sys/dev/ic/siopvar_common.h b/sys/dev/ic/siopvar_common.h index 21044832b76..9372d6679ad 100644 --- a/sys/dev/ic/siopvar_common.h +++ b/sys/dev/ic/siopvar_common.h @@ -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 --git a/sys/dev/pci/siop_pci_common.c b/sys/dev/pci/siop_pci_common.c index 6a124730723..e7a244ea5d0 100644 --- a/sys/dev/pci/siop_pci_common.c +++ b/sys/dev/pci/siop_pci_common.c @@ -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 @@ siop_pci_attach_common(pci_sc, siop_sc, pa, intr) } /* 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; |
