Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2015 06:52:01 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r278553 - projects/pmac_pmu/sys/powerpc/powermac
Message-ID:  <201502110652.t1B6q1Jg001604@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Feb 11 06:52:00 2015
New Revision: 278553
URL: https://svnweb.freebsd.org/changeset/base/278553

Log:
  Use symbolic constants instead of magic numbers for the device IDs.

Modified:
  projects/pmac_pmu/sys/powerpc/powermac/macio.c
  projects/pmac_pmu/sys/powerpc/powermac/maciovar.h

Modified: projects/pmac_pmu/sys/powerpc/powermac/macio.c
==============================================================================
--- projects/pmac_pmu/sys/powerpc/powermac/macio.c	Wed Feb 11 06:44:59 2015	(r278552)
+++ projects/pmac_pmu/sys/powerpc/powermac/macio.c	Wed Feb 11 06:52:00 2015	(r278553)
@@ -913,7 +913,7 @@ macio_suspend(device_t dev)
 	sc->sc_saved_fcrs[4] = bus_read_4(sc->sc_memr, KEYLARGO_FCR4);
 
 	/* KeyLargo doesn't have FCR5. */
-	if (sc->sc_devid != 0x22)
+	if (sc->sc_devid != KEYLARGO_DEVID)
 		sc->sc_saved_fcrs[5] = bus_read_4(sc->sc_memr, KEYLARGO_FCR5);
 
 	if (sc->sc_devid == 0x4f) {
@@ -924,13 +924,14 @@ macio_suspend(device_t dev)
 		sc->sc_saved_fcrs[10] = bus_read_4(sc->sc_memr, K2_FCR10);
 	}
 
-	if (sc->sc_devid == 0x22) {
+	if (sc->sc_devid == KEYLARGO_DEVID) {
 		return macio_suspend_keylargo(dev);
-	} else if (sc->sc_devid == 0x25) {
+	} else if (sc->sc_devid == PANGEA_DEVID) {
 		return macio_suspend_pangea(dev);
-	} else if (sc->sc_devid == 0x3e) {
+	} else if (sc->sc_devid == INTREPID_DEVID) {
 		return macio_suspend_intrepid(dev);
-	} else if (sc->sc_devid == 0x4f) {
+	} else if (sc->sc_devid == SHASTA_DEVID ||
+	    sc->sc_devid == K2_DEVID) {
 		return macio_suspend_k2(dev);
 	}
 
@@ -942,7 +943,7 @@ macio_resume(device_t dev)
 {
 	struct macio_softc *sc = device_get_softc(dev);
 
-	if (sc->sc_devid == 0x22)
+	if (sc->sc_devid == KEYLARGO_DEVID)
 		bus_write_4(sc->sc_memr, KEYLARGO_MEDIABAY, sc->sc_saved_mbcr);
 
 	bus_write_4(sc->sc_memr, KEYLARGO_FCR0, sc->sc_saved_fcrs[0]);

Modified: projects/pmac_pmu/sys/powerpc/powermac/maciovar.h
==============================================================================
--- projects/pmac_pmu/sys/powerpc/powermac/maciovar.h	Wed Feb 11 06:44:59 2015	(r278552)
+++ projects/pmac_pmu/sys/powerpc/powermac/maciovar.h	Wed Feb 11 06:52:00 2015	(r278553)
@@ -30,6 +30,11 @@
 #ifndef _MACIO_MACIOVAR_H_
 #define _MACIO_MACIOVAR_H_
 
+#define	KEYLARGO_DEVID	0x22
+#define	PANGEA_DEVID	0x25
+#define	INTREPID_DEVID	0x3e
+#define	K2_DEVID	0x41
+#define	SHASTA_DEVID	0x4f
 /*
  * The addr space size
  * XXX it would be better if this could be determined by querying the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502110652.t1B6q1Jg001604>