svn commit: r217624 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5312 ath_hal/ar5416

Adrian Chadd adrian at FreeBSD.org
Thu Jan 20 07:56:09 UTC 2011


Author: adrian
Date: Thu Jan 20 07:56:09 2011
New Revision: 217624
URL: http://svn.freebsd.org/changeset/base/217624

Log:
  Include the initial support for external EEPROMs.
  
  The AR9100 at least doesn't have an external serial EEPROM
  attached to the MAC; it instead stores the calibration data
  in the normal system flash.
  
  I believe earlier parts can do something similar but I haven't
  experienced it first-hand.
  
  This commit introduces an eepromdata pointer into the API but
  doesn't at all commit to using it. A future commit will
  include the glue needed to allow the AR9100 support code
  to use this data pointer as the EEPROM.

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ah.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -53,7 +53,7 @@ ath_hal_probe(uint16_t vendorid, uint16_
  */
 struct ath_hal*
 ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *error)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_STATUS *error)
 {
 	struct ath_hal_chip * const *pchip;
 
@@ -64,7 +64,7 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC
 		/* XXX don't have vendorid, assume atheros one works */
 		if (chip->probe(ATHEROS_VENDOR_ID, devid) == AH_NULL)
 			continue;
-		ah = chip->attach(devid, sc, st, sh, error);
+		ah = chip->attach(devid, sc, st, sh, eepromdata, error);
 		if (ah != AH_NULL) {
 			/* copy back private state to public area */
 			ah->ah_devid = AH_PRIVATE(ah)->ah_devid;

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ah.h	Thu Jan 20 07:56:09 2011	(r217624)
@@ -619,6 +619,8 @@ struct ath_hal {
 	uint16_t	ah_analog5GhzRev;/* 5GHz radio revision */
 	uint16_t	ah_analog2GhzRev;/* 2GHz radio revision */
 
+	uint16_t	*ah_eepromdata;	/* eeprom buffer, if needed */
+
 	const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
 				u_int mode);
 	void	  __ahdecl(*ah_detach)(struct ath_hal*);
@@ -817,7 +819,7 @@ extern	const char *__ahdecl ath_hal_prob
  * be returned if the status parameter is non-zero.
  */
 extern	struct ath_hal * __ahdecl ath_hal_attach(uint16_t devid, HAL_SOFTC,
-		HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status);
+		HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata, HAL_STATUS* status);
 
 extern	const char *ath_hal_mac_name(struct ath_hal *);
 extern	const char *ath_hal_rf_name(struct ath_hal *);

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ah_internal.h	Thu Jan 20 07:56:09 2011	(r217624)
@@ -80,7 +80,8 @@ struct ath_hal_chip {
 	const char	*name;
 	const char	*(*probe)(uint16_t vendorid, uint16_t devid);
 	struct ath_hal	*(*attach)(uint16_t devid, HAL_SOFTC,
-			    HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *error);
+			    HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata,
+			    HAL_STATUS *error);
 };
 #ifndef AH_CHIP
 #define	AH_CHIP(_name, _probe, _attach)				\

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -170,7 +170,7 @@ static HAL_BOOL ar5210FillCapabilityInfo
  */
 static struct ath_hal *
 ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
-	HAL_STATUS *status)
+	uint16_t *eepromdata, HAL_STATUS *status)
 {
 #define	N(a)	(sizeof(a)/sizeof(a[0]))
 	struct ath_hal_5210 *ahp;

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -189,7 +189,8 @@ ar5211GetRadioRev(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar5211Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 #define	N(a)	(sizeof(a)/sizeof(a[0]))
 	struct ath_hal_5211 *ahp;

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -295,7 +295,8 @@ ar5212IsMacSupported(uint8_t macVersion,
  */
 static struct ath_hal *
 ar5212Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 #define	AH_EEPROM_PROTECT(ah) \
 	(AH_PRIVATE(ah)->ah_ispcie)? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT)

Modified: head/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -61,7 +61,8 @@ ar5312AniSetup(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar5312Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 	struct ath_hal_5212 *ahp = AH_NULL;
 	struct ath_hal *ah;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -190,7 +190,8 @@ ar5416GetRadioRev(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar5416Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 	struct ath_hal_5416 *ahp5416;
 	struct ath_hal_5212 *ahp;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -89,7 +89,8 @@ ar9160AniSetup(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar9160Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 	struct ath_hal_5416 *ahp5416;
 	struct ath_hal_5212 *ahp;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -77,7 +77,8 @@ ar9280AniSetup(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar9280Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 	struct ath_hal_9280 *ahp9280;
 	struct ath_hal_5212 *ahp;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -79,7 +79,8 @@ ar9285AniSetup(struct ath_hal *ah)
  */
 static struct ath_hal *
 ar9285Attach(uint16_t devid, HAL_SOFTC sc,
-	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+	HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
+	HAL_STATUS *status)
 {
 	struct ath_hal_9285 *ahp9285;
 	struct ath_hal_5212 *ahp;

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/if_ath.c	Thu Jan 20 07:56:09 2011	(r217624)
@@ -374,7 +374,7 @@ ath_attach(u_int16_t devid, struct ath_s
 	if_initname(ifp, device_get_name(sc->sc_dev),
 		device_get_unit(sc->sc_dev));
 
-	ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh, &status);
+	ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh, sc->sc_eepromdata, &status);
 	if (ah == NULL) {
 		if_printf(ifp, "unable to attach hardware; HAL status %u\n",
 			status);

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Thu Jan 20 07:42:39 2011	(r217623)
+++ head/sys/dev/ath/if_athvar.h	Thu Jan 20 07:56:09 2011	(r217624)
@@ -342,6 +342,7 @@ struct ath_softc {
 	u_int			sc_tdmaslotlen;	/* TDMA slot length (usec) */
 	u_int32_t		sc_avgtsfdeltap;/* TDMA slot adjust (+) */
 	u_int32_t		sc_avgtsfdeltam;/* TDMA slot adjust (-) */
+	uint16_t		*sc_eepromdata;	/* Local eeprom data, if AR9100 */
 };
 
 #define	ATH_LOCK_INIT(_sc) \


More information about the svn-src-head mailing list