[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Apr 27 14:40:45 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/ebc3e50e485a
changeset: 475:ebc3e50e485a
user:      Aleksandr Rybalko <ray at ddteam.net>
date:      Fri Apr 27 17:39:34 2012 +0300
description:
revert local changes

diffstat:

 head/sys/dev/ath/ath_hal/ah_eeprom_9287.c       |  16 ++---
 head/sys/dev/ath/ath_hal/ah_eeprom_v14.c        |  69 ++++--------------------
 head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c |  13 ++++
 3 files changed, 33 insertions(+), 65 deletions(-)

diffs (172 lines):

diff -r 144379902bd6 -r ebc3e50e485a head/sys/dev/ath/ath_hal/ah_eeprom_9287.c
--- a/head/sys/dev/ath/ath_hal/ah_eeprom_9287.c	Wed Apr 25 21:52:53 2012 +0300
+++ b/head/sys/dev/ath/ath_hal/ah_eeprom_9287.c	Fri Apr 27 17:39:34 2012 +0300
@@ -297,8 +297,6 @@
 	u_int w, off, len;
 	uint32_t sum;
 
-	HALASSERT(ee == AH_NULL);
-
 	/*
 	 * Don't check magic if we're supplied with an EEPROM block,
 	 * typically this is from Howl but it may also be from later
@@ -310,12 +308,12 @@
 			    "%s Error reading Eeprom MAGIC\n", __func__);
 			return HAL_EEREAD;
 		}
-	}
-	HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
-	    __func__, magic);
-	if (magic != AR5416_EEPROM_MAGIC) {
-		HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n");
-		return HAL_EEMAGIC;
+		HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
+		    __func__, magic);
+		if (magic != AR5416_EEPROM_MAGIC) {
+			HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n");
+			return HAL_EEMAGIC;
+		}
 	}
 
 	ee = ath_hal_malloc(sizeof(HAL_EEPROM_9287));
@@ -357,7 +355,7 @@
 		len = ee->ee_base.baseEepHeader.length;
 	}
 	len = AH_MIN(len, sizeof(HAL_EEPROM_9287)) / sizeof(uint16_t);
-	
+
 	/* Apply the checksum, done in native eeprom format */
 	/* XXX - Need to check to make sure checksum calculation is done
 	 * in the correct endian format.  Right now, it seems it would
diff -r 144379902bd6 -r ebc3e50e485a head/sys/dev/ath/ath_hal/ah_eeprom_v14.c
--- a/head/sys/dev/ath/ath_hal/ah_eeprom_v14.c	Wed Apr 25 21:52:53 2012 +0300
+++ b/head/sys/dev/ath/ath_hal/ah_eeprom_v14.c	Fri Apr 27 17:39:34 2012 +0300
@@ -335,7 +335,7 @@
 #define	NW(a)	(sizeof(a) / sizeof(uint16_t))
 	HAL_EEPROM_v14 *ee = AH_PRIVATE(ah)->ah_eeprom;
 	uint16_t *eep_data, magic;
-	HAL_BOOL need_swap = 0;
+	HAL_BOOL need_swap;
 	u_int w, off, len;
 	uint32_t sum;
 
@@ -360,43 +360,6 @@
 		}
 	}
 
-
-
-	uint16_t misc_field = 0;
-	ath_hal_eepromRead(ah, owl_eep_start_loc+0, &misc_field);
-	printf("misc_field[0]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+1, &misc_field);
-	printf("misc_field[1]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+2, &misc_field);
-	printf("misc_field[2]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+3, &misc_field);
-	printf("misc_field[3]=0x%04x\n", misc_field);
-
-	ath_hal_eepromRead(ah, owl_eep_start_loc+0, &misc_field);
-	printf("misc_field[0]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+2, &misc_field);
-	printf("misc_field[2]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+4, &misc_field);
-	printf("misc_field[4]=0x%04x\n", misc_field);
-	ath_hal_eepromRead(ah, owl_eep_start_loc+6, &misc_field);
-	printf("misc_field[6]=0x%04x\n", misc_field);
-
-	off = owl_eep_start_loc +  3;	/* NB: AP71 starts at 0 */
-	if (!ath_hal_eepromRead(ah, off, &misc_field)) {
-			HALDEBUG(ah, HAL_DEBUG_ANY,
-			    "%s eeprom read error at offset 0x%x\n",
-			    __func__, off);
-			return HAL_EEREAD;
-	}
-
-	printf("misc_field=0x%04x\n", misc_field);
-	misc_field >>= 8;
-	int eeprom_be = 0;
-	eeprom_be = misc_field & AR5416_EEPMISC_BIG_ENDIAN;
-
-
-
-
 	ee = ath_hal_malloc(sizeof(HAL_EEPROM_v14));
 	if (ee == AH_NULL) {
 		/* XXX message */
@@ -412,32 +375,26 @@
 			    __func__, off);
 			return HAL_EEREAD;
 		}
-		if (eeprom_be)
-			eep_data[w] = le16toh(eep_data[w]); /* Octeon translate endianess on PCI */
-			/* eep_data[w] = be16toh(eep_data[w]); */
-		else
-			eep_data[w] = le16toh(eep_data[w]);
 	}
 	/* Convert to eeprom native eeprom endian format */
 	/* XXX this is likely incorrect but will do for now to get howl/ap83 working. */
-//	if (ah->ah_eepromdata == NULL && isBigEndian()) {
-//		for (w = 0; w < NW(struct ar5416eeprom); w++)
-//			eep_data[w] = __bswap16(eep_data[w]);
-//			eep_data[w] = eep_data[w];
-//	}
+	if (ah->ah_eepromdata == NULL && isBigEndian()) {
+		for (w = 0; w < NW(struct ar5416eeprom); w++)
+			eep_data[w] = __bswap16(eep_data[w]);
+	}
 
 	/*
 	 * At this point, we're in the native eeprom endian format
 	 * Now, determine the eeprom endian by looking at byte 26??
 	 */
-//	need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian();
-//	if (need_swap) {
-//		HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM,
-//		    "Byte swap EEPROM contents.\n");
+	need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian();
+	if (need_swap) {
+		HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM,
+		    "Byte swap EEPROM contents.\n");
 		len = __bswap16(ee->ee_base.baseEepHeader.length);
-//	} else {
-//		len = ee->ee_base.baseEepHeader.length;
-//	}
+	} else {
+		len = ee->ee_base.baseEepHeader.length;
+	}
 	len = AH_MIN(len, sizeof(struct ar5416eeprom)) / sizeof(uint16_t);
 	
 	/* Apply the checksum, done in native eeprom format */
@@ -457,7 +414,7 @@
 		return HAL_EEBADSUM;
 	}
 
-	if (need_swap || 1)
+	if (need_swap)
 		eepromSwap(&ee->ee_base);	/* byte swap multi-byte data */
 
 	/* swap words 0+2 so version is at the front */
diff -r 144379902bd6 -r ebc3e50e485a head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
--- a/head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c	Wed Apr 25 21:52:53 2012 +0300
+++ b/head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c	Fri Apr 27 17:39:34 2012 +0300
@@ -135,6 +135,19 @@
 
 	ar5416InitState(AH5416(ah), devid, sc, st, sh, status);
 
+	/*
+	 * Use the "local" EEPROM data given to us by the higher layers.
+	 * This is a private copy out of system flash. The Linux ath9k
+	 * commit for the initial AR9130 support mentions MMIO flash
+	 * access is "unreliable." -adrian
+	 */
+	if (eepromdata != AH_NULL) {
+		AH_PRIVATE((ah))->ah_eepromRead = ath_hal_EepromDataRead;
+		AH_PRIVATE((ah))->ah_eepromWrite = NULL;
+		ah->ah_eepromdata = eepromdata;
+	}
+
+	printf("%d: e_rd=%p\n", __LINE__, AH_PRIVATE((ah))->ah_eepromRead);
 	/* XXX override with 9280 specific state */
 	/* override 5416 methods for our needs */
 	AH5416(ah)->ah_initPLL = ar9280InitPLL;


More information about the Zrouter-src-freebsd mailing list