소스 검색

qcacmn: Add check for supported register

Register offsets have 2 possible invalid values.
need to check for both values.

Change-Id: I6168aa46c4af66169284b98dee26ab56e4ed12c5
CRs-Fixed: 1012824
Houston Hoffman 9 년 전
부모
커밋
056d452238
3개의 변경된 파일18개의 추가작업 그리고 3개의 파일을 삭제
  1. 15 0
      hif/inc/reg_struct.h
  2. 1 1
      hif/inc/target_reg_init.h
  3. 2 2
      hif/src/ce/ce_main.c

+ 15 - 0
hif/inc/reg_struct.h

@@ -19,6 +19,21 @@
 #ifndef REG_STRUCT_H
 #define REG_STRUCT_H
 
+#define MISSING_REGISTER 0
+#define UNSUPPORTED_REGISTER_OFFSET 0xffffffff
+
+/**
+ * is_register_supported() - return true if the register offset is valid
+ * @reg: register address being checked
+ *
+ * Return: true if the register offset is valid
+ */
+static inline bool is_register_supported(uint32_t reg)
+{
+	return (reg != MISSING_REGISTER) &&
+		(reg != UNSUPPORTED_REGISTER_OFFSET);
+}
+
 struct targetdef_s {
 	uint32_t d_RTC_SOC_BASE_ADDRESS;
 	uint32_t d_RTC_WMAC_BASE_ADDRESS;

+ 1 - 1
hif/inc/target_reg_init.h

@@ -25,7 +25,7 @@ typedef struct targetdef_s TARGET_REGISTER_TABLE;
 
 
 
-#define ATH_UNSUPPORTED_REG_OFFSET 0xffffffff
+#define ATH_UNSUPPORTED_REG_OFFSET UNSUPPORTED_REGISTER_OFFSET
 #define ATH_SUPPORTED_BY_TARGET(reg_offset) \
 	((reg_offset) != ATH_UNSUPPORTED_REG_OFFSET)
 

+ 2 - 2
hif/src/ce/ce_main.c

@@ -713,7 +713,7 @@ struct CE_handle *ce_init(struct hif_softc *scn,
 				 (uint32_t)(dma_addr & 0xFFFFFFFF));
 
 			/* if SR_BA_ADDRESS_HIGH register exists */
-			if (SR_BA_ADDRESS_HIGH) {
+			if (is_register_supported(SR_BA_ADDRESS_HIGH)) {
 				uint32_t tmp;
 				tmp = CE_SRC_RING_BASE_ADDR_HIGH_GET(
 				   scn, ctrl_addr);
@@ -852,7 +852,7 @@ struct CE_handle *ce_init(struct hif_softc *scn,
 				 (uint32_t)(dma_addr & 0xFFFFFFFF));
 
 			/* if DR_BA_ADDRESS_HIGH exists */
-			if (DR_BA_ADDRESS_HIGH) {
+			if (is_register_supported(DR_BA_ADDRESS_HIGH)) {
 				uint32_t tmp;
 				tmp = CE_DEST_RING_BASE_ADDR_HIGH_GET(scn,
 						ctrl_addr);