1 /* ============================================================================
2 * Copyright (C) 2004 -Infineon Technologies AG.
5 * ============================================================================
7 *============================================================================
8 * Licensed under GNU GPL v2
9 * ============================================================================
13 /* ===========================================================================
15 * File Name: amazon_mei.c
18 * ===========================================================================
22 * ===========================================================================
23 * Contents:This file implements the MEI driver for Amazon ADSL/ADSL2+
26 * ===========================================================================
32 /* ===========================================================================
34 * 12/1/2005 : Ritesh Banerjee
35 * - Create a kernel thread kmibpoll to poll for periodic RFC 2662
36 * and RFC 3440 counters. Removes the need for user space
37 * adsl_mibpoll_daemon and saves atleast 30KB of RAM.
40 * ===========================================================================
44 * ===========================================================================
46 * ===========================================================================
48 //000002:fchang 2005/6/2 joelin 04/27/2005 for pcm clock
49 //000003:fchang 2005/6/2 Henry added for Amazon-E support
50 //165001:henryhsu 2005/9/6 Modify for adsl firmware version 1.2.1.2.0.1 DATA_LED can't flash.
51 // 509221:tc.chen 2005/09/22 Reset DFE added when MEI_TO_ARC_CS_DONE not cleared by ARC
52 // 603221:tc.chen 2006/03/21 added APIs to support the WEB related parameters for ADSL Statistics
57 #define AMAZON_MEI_MIB_RFC3440
59 #include <linux/config.h>
60 #include <linux/kernel.h>
61 #include <linux/module.h>
62 #include <linux/version.h>
63 #include <linux/types.h>
66 #include <linux/errno.h>
67 #include <linux/interrupt.h>
68 #include <linux/netdevice.h>
69 #include <linux/etherdevice.h>
71 #include <asm/segment.h>
72 #include <asm/semaphore.h>
73 #include <linux/init.h>
74 #include <linux/ioport.h>
75 #include <asm/uaccess.h>
76 #include <linux/proc_fs.h>
78 #include <linux/vmalloc.h>
79 #include <linux/delay.h>
80 #include <linux/poll.h>
81 #include <linux/list.h>
82 #include <linux/time.h>
84 #include <asm/amazon/amazon.h>
86 #include <asm/amazon/irq.h>
87 #include <asm/amazon/amazon_mei.h>
88 #include <asm/amazon/amazon_mei_app.h>
89 #include <asm/amazon/amazon_mei_ioctl.h>
90 #include <asm/amazon/amazon_mei_app_ioctl.h>
92 #define SET_BIT(reg, mask) reg |= (mask)
93 #define CLEAR_BIT(reg, mask) reg &= (~mask)
94 #define CLEAR_BITS(reg, mask) CLEAR_BIT(reg, mask)
95 #define SET_BITS(reg, mask) SET_BIT(reg, mask)
96 #define SET_BITFIELD(reg, mask, off, val) {reg &= (~mask); reg |= (val << off);}
98 extern void mask_and_ack_amazon_irq(unsigned int irq_nr
);
100 #ifdef AMAZON_CHECK_LINK
102 extern int (*adsl_link_notify
)(int);
103 #endif //AMAZON_CHECK_LINK
105 // for ARC memory access
106 #define WHILE_DELAY 20000
107 #define AMAZON_DMA_DEBUG_MUTEX
112 #define ARC_READY_ACK
114 static amazon_mei_mib
* current_intvl
;
115 static struct list_head interval_list
;
116 static amazon_mei_mib
* mei_mib
;
118 static int reboot_firsttime
=1;//000002:fchang
121 #define PCM_CHANNEL_NUM 2 //1 rx, 1 tx
122 static pcm_data_struct pcm_data
[PCM_CHANNEL_NUM
]__attribute__ ((aligned(4))); //0=tx0, 1=rx0, 2=tx1, 3=rx1
123 static u32 pcm_start_addr
;
124 //#define PCM_HRT_TIME_HZ 4000 //?us
125 #define PCM_ACCESS_DEBUG
126 static int irqtimes
=0;
127 #undef DATA_LED_ON_MODE
128 #define ADSL_LED_SUPPORT //joelin for adsl led
129 #ifdef ADSL_LED_SUPPORT
130 static int firmware_support_led
=0; //joelin version check for adsl led
131 static int stop_led_module
=0; //wakeup and clean led module
132 static int led_support_check
=0; //1.1.2.7.1.1
133 #endif //ADSL_LED_SUPPORT
134 #define IFX_DYING_GASP
135 #ifdef IFX_DYING_GASP
136 static wait_queue_head_t wait_queue_dying_gasp
; //dying gasp
137 //struct tq_struct dying_gasp_task; //dying gasp
138 static wait_queue_head_t wait_queue_uas_poll
; //joelin 04/16/2005
139 static u16 unavailable_seconds
=0; //joelin 04/16/2005
140 static meidebug lop_debugwr
; //dying gasp
141 #endif //IFX_DYING_GASP
142 static int dbg_int
=0;
143 //#define DEBUG_ACCESS_DELAY for(dbg_int=0;dbg_int<100;dbg_int++){;}
144 #define DEBUG_ACCESS_DELAY
145 static u8 sampledata
[512];
146 static int firsttime
[PCM_CHANNEL_NUM
]={0,1};
147 static int num_cmp
[PCM_CHANNEL_NUM
]={0,0};
148 static int pcm_start_loc
[PCM_CHANNEL_NUM
]={0,0};
151 //#define MEI_CLREOC_BUFF_SIZE 512 //double the receive fifo size, bytes
152 //static u8 clreoc[MEI_CLREOC_BUFF_SIZE]__attribute__ ((aligned(4))); //buffer to hold clearEoC data in bytes
153 #undef AMAZON_CLEAR_EOC
154 #ifdef AMAZON_CLEAR_EOC
155 extern void ifx_push_eoc(struct sk_buff
* pkt
);
157 static int meiResetArc(void);
158 #define IFX_POP_EOC_DONE 0
159 #define IFX_POP_EOC_FAIL -1
160 static struct list_head clreoc_list
;
161 static amazon_clreoc_pkt
* clreoc_pkt
;
162 #define CLREOC_BUFF_SIZE 12 //number of clreoc commands being buffered
163 //static int clreoc_wr=0;
164 //static int clreoc_rd=0; //used to control clreoc circular buffer
165 static wait_queue_head_t wait_queue_clreoc
;
166 #ifdef ADSL_LED_SUPPORT
167 static wait_queue_head_t wait_queue_led
; //adsl led
168 static wait_queue_head_t wait_queue_led_polling
;// adsl led
169 struct tq_struct led_task
; // adsl led
170 static DECLARE_TASK_QUEUE(tq_ifx_led
); // task
171 int adsl_led_flash_task(void *ptr
); // adsl led
172 #endif //ADSL_LED_SUPPORT
173 static void * clreoc_command_pkt
=NULL
;
174 static int clreoc_max_tx_len
=0;
176 // 603221:tc.chen start
177 #define ME_HDLC_IDLE 0
178 #define ME_HDLC_INVALID_MSG 1
179 #define ME_HDLC_MSG_QUEUED 2
180 #define ME_HDLC_MSG_SENT 3
181 #define ME_HDLC_RESP_RCVD 4
182 #define ME_HDLC_RESP_TIMEOUT 5
183 #define ME_HDLC_RX_BUF_OVERFLOW 6
184 #define ME_HDLC_UNRESOLVED 1
185 #define ME_HDLC_RESOLVED 2
186 // 603221:tc.chen end
189 static int reboot_lock
=0;
192 static mib_previous_read mib_pread
={0,0,0,0,0,0,0,0,0,0,0,0};
193 static mib_flags_pretime mib_pflagtime
;// initialized when module loaded
195 static u32 ATUC_PERF_LOFS
=0;
196 static u32 ATUC_PERF_LOSS
=0;
197 static u32 ATUC_PERF_ESS
=0;
198 static u32 ATUC_PERF_INITS
=0;
199 static u32 ATUR_PERF_LOFS
=0;
200 static u32 ATUR_PERF_LOSS
=0;
201 static u32 ATUR_PERF_LPR
=0;
202 static u32 ATUR_PERF_ESS
=0;
203 static u32 ATUR_CHAN_RECV_BLK
=0;
204 static u32 ATUR_CHAN_TX_BLK
=0;
205 static u32 ATUR_CHAN_CORR_BLK
=0;
206 static u32 ATUR_CHAN_UNCORR_BLK
=0;
208 static u32 ATUC_PERF_STAT_FASTR
=0;
209 static u32 ATUC_PERF_STAT_FAILED_FASTR
=0;
210 static u32 ATUC_PERF_STAT_SESL
=0;
211 static u32 ATUC_PERF_STAT_UASL
=0;
212 static u32 ATUR_PERF_STAT_SESL
=0;
213 static u32 ATUR_PERF_STAT_UASL
=0;
215 static adslChanPrevTxRate PrevTxRate
={0,0};
216 static adslPhysCurrStatus CurrStatus
={0,0};
217 static ChanType chantype
={0,0};
218 static adslLineAlarmConfProfileEntry AlarmConfProfile
={"No Name\0",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
219 // 603221:tc.chen start
220 static adslFarEndPerfStats FarendStatsData
;
221 struct timeval FarendData_acquire_time
={0};
222 static u32 adsl_mode
,adsl_mode_extend
; // adsl mode : adsl/ 2/ 2+
223 static adslInitStats AdslInitStatsData
;
225 static u32 loop_diagnostics_mode
=0;
226 static wait_queue_head_t wait_queue_loop_diagnostic
;
227 #ifdef AMAZON_MEI_MIB_RFC3440
228 static adslLineAlarmConfProfileExtEntry AlarmConfProfileExt
={"No Name\0",0,0,0,0,0,0};
231 static int showtime
=0;
232 static int loop_diagnostics_completed
=0;
233 //////////////////////////////////////////////////////////////////////////////////
234 static int phy_mei_net_init(struct net_device
* dev
);
235 static int interleave_mei_net_init(struct net_device
* dev
);
236 static int fast_mei_net_init(struct net_device
* dev
);
237 static struct net_device_stats
* phy_mei_net_get_stats(struct net_device
* dev
);
238 static struct net_device_stats
* interleave_mei_net_get_stats(struct net_device
* dev
);
239 static struct net_device_stats
* fast_mei_net_get_stats(struct net_device
* dev
);
241 typedef struct mei_priv
{
242 struct net_device_stats stats
;
245 static struct net_device phy_mei_net
= { init
: phy_mei_net_init
, name
: "MEI_PHY"};
246 static struct net_device interleave_mei_net
= { init
: interleave_mei_net_init
, name
: "MEI_INTL"};
247 static struct net_device fast_mei_net
= { init
: fast_mei_net_init
, name
: "MEI_FAST"};
248 ///////////////////////////////////////////////////////////////////////////////////
250 static int major
=AMAZON_MEI_MAJOR
;
252 static struct semaphore mei_sema
;
254 // Mei to ARC CMV count, reply count, ARC Indicator count
255 static int indicator_count
=0;
256 static int cmv_count
=0;
257 static int reply_count
=0;
258 static u16 Recent_indicator
[MSG_LENGTH
];
260 // Used in interrupt handler as flags
261 static int arcmsgav
=0;
262 static int cmv_reply
=0;
263 static int cmv_waiting
=0;
267 long mei_debug_mode
= 0; //509221:tc.chen for adsl firmware debug
269 // to wait for arc cmv reply, sleep on wait_queue_arcmsgav;
270 static wait_queue_head_t wait_queue_arcmsgav
;
271 static wait_queue_head_t wait_queue_codeswap
;
272 static wait_queue_head_t wait_queue_mibdaemon
;
273 static wait_queue_head_t wait_queue_reboot
;
274 static u32
* image_buffer
=NULL
; // holding adsl firmware image
275 static u16 RxMessage
[MSG_LENGTH
]__attribute__ ((aligned(4)));
276 static u16 TxMessage
[MSG_LENGTH
]__attribute__ ((aligned(4)));
277 static u32
* mei_arc_swap_buff
=NULL
; // holding swap pages
278 static ARC_IMG_HDR
* img_hdr
;
279 static int reboot_flag
;
286 ///////////////// net device ///////////////////////////////////////////////////
287 static int phy_mei_net_init(struct net_device
* dev
)
290 dev
->get_stats
= phy_mei_net_get_stats
;
297 dev
->priv
= kmalloc(sizeof(struct mei_priv
), GFP_KERNEL
);
298 if(dev
->priv
== NULL
)
300 memset(dev
->priv
, 0, sizeof(struct mei_priv
));
304 static int interleave_mei_net_init(struct net_device
* dev
)
307 dev
->get_stats
= interleave_mei_net_get_stats
;
311 dev
->priv
= kmalloc(sizeof(struct mei_priv
), GFP_KERNEL
);
312 if(dev
->priv
== NULL
)
314 memset(dev
->priv
, 0, sizeof(struct mei_priv
));
318 static int fast_mei_net_init(struct net_device
* dev
)
321 dev
->get_stats
= fast_mei_net_get_stats
;
325 dev
->priv
= kmalloc(sizeof(struct mei_priv
), GFP_KERNEL
);
326 if(dev
->priv
== NULL
)
328 memset(dev
->priv
, 0, sizeof(struct mei_priv
));
332 static struct net_device_stats
* phy_mei_net_get_stats(struct net_device
* dev
)
334 struct mei_priv
* priv
;
335 priv
= (struct mei_priv
*)dev
->priv
;
337 (priv
->stats
).rx_packets
= ATUR_CHAN_RECV_BLK
;
338 (priv
->stats
).tx_packets
= ATUR_CHAN_TX_BLK
;
339 (priv
->stats
).rx_errors
= ATUR_CHAN_CORR_BLK
+ ATUR_CHAN_UNCORR_BLK
;
340 (priv
->stats
).rx_dropped
= ATUR_CHAN_UNCORR_BLK
;
342 return &(priv
->stats
);
345 static struct net_device_stats
* interleave_mei_net_get_stats(struct net_device
* dev
)
347 struct mei_priv
* priv
;
348 priv
= (struct mei_priv
*)dev
->priv
;
350 (priv
->stats
).rx_packets
= ATUR_CHAN_RECV_BLK
;
351 (priv
->stats
).tx_packets
= ATUR_CHAN_TX_BLK
;
352 (priv
->stats
).rx_errors
= ATUR_CHAN_CORR_BLK
+ ATUR_CHAN_UNCORR_BLK
;
353 (priv
->stats
).rx_dropped
= ATUR_CHAN_UNCORR_BLK
;
355 return &(priv
->stats
);
358 static struct net_device_stats
* fast_mei_net_get_stats(struct net_device
* dev
)
360 struct mei_priv
* priv
;
361 priv
= (struct mei_priv
*)dev
->priv
;
363 (priv
->stats
).rx_packets
= ATUR_CHAN_RECV_BLK
;
364 (priv
->stats
).tx_packets
= ATUR_CHAN_TX_BLK
;
365 (priv
->stats
).rx_errors
= ATUR_CHAN_CORR_BLK
+ ATUR_CHAN_UNCORR_BLK
;
366 (priv
->stats
).rx_dropped
= ATUR_CHAN_UNCORR_BLK
;
368 return &(priv
->stats
);
370 ///////////////// mei access Rd/Wr methods ///////////////////////////////////////////////////
371 void meiLongwordWrite(u32 ul_address
, u32 ul_data
)
373 *((volatile u32
*)ul_address
) = ul_data
;
376 } // end of "meiLongwordWrite(..."
378 void meiLongwordRead(u32 ul_address
, u32
*pul_data
)
380 *pul_data
= *((volatile u32
*)ul_address
);
383 } // end of "meiLongwordRead(..."
385 MEI_ERROR
meiDMAWrite(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
394 #ifdef AMAZON_DMA_DEBUG_MUTEX
400 // Set the write transfer address
401 meiLongwordWrite(MEI_XFR_ADDR
, destaddr
);
403 // Write the data pushed across DMA
404 while (databuffsize
--)
407 if(databuff
==(u32
*)TxMessage
) // swap half word
408 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);
409 meiLongwordWrite(MEI_DATA_XFR
, temp
);
411 } // end of "while(..."
413 #ifdef AMAZON_DMA_DEBUG_MUTEX
414 restore_flags(flags
);
419 } // end of "meiDMAWrite(..."
421 MEI_ERROR
meiDMAWrite_16(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
430 #ifdef AMAZON_DMA_DEBUG_MUTEX
436 // Set the write transfer address
437 meiLongwordWrite(MEI_XFR_ADDR
, destaddr
);
439 // Write the data pushed across DMA
440 while (databuffsize
--)
443 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);//swap half word
444 meiLongwordWrite(MEI_DATA_XFR
, temp
);
446 } // end of "while(..."
448 #ifdef AMAZON_DMA_DEBUG_MUTEX
449 restore_flags(flags
);
454 } // end of "meiDMAWrite_16(..."
456 MEI_ERROR
meiDMAWrite_8(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
465 #ifdef AMAZON_DMA_DEBUG_MUTEX
471 // Set the write transfer address
472 meiLongwordWrite(MEI_XFR_ADDR
, destaddr
);
474 // Write the data pushed across DMA
475 while (databuffsize
--)
478 temp
= ((temp
& 0xff)<<24) + ((temp
& 0xff00)<<8)+ ((temp
& 0xff0000)>>8)+ ((temp
& 0xff000000)>>24);//swap byte
479 meiLongwordWrite(MEI_DATA_XFR
, temp
);
481 } // end of "while(..."
483 #ifdef AMAZON_DMA_DEBUG_MUTEX
484 restore_flags(flags
);
489 } // end of "meiDMAWrite_8(..."
491 MEI_ERROR
meiDMARead(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
500 #ifdef AMAZON_DMA_DEBUG_MUTEX
506 // Set the read transfer address
507 meiLongwordWrite(MEI_XFR_ADDR
, srcaddr
);
509 // Read the data popped across DMA
510 while (databuffsize
--)
512 meiLongwordRead(MEI_DATA_XFR
, &temp
);
513 if(databuff
==(u32
*)RxMessage
) // swap half word
514 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);
517 } // end of "while(..."
519 #ifdef AMAZON_DMA_DEBUG_MUTEX
520 restore_flags(flags
);
525 } // end of "meiDMARead(..."
527 MEI_ERROR
meiDMARead_16(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
536 #ifdef AMAZON_DMA_DEBUG_MUTEX
542 // Set the read transfer address
543 meiLongwordWrite(MEI_XFR_ADDR
, srcaddr
);
545 // Read the data popped across DMA
546 while (databuffsize
--)
548 meiLongwordRead(MEI_DATA_XFR
, &temp
);
549 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);
552 } // end of "while(..."
554 #ifdef AMAZON_DMA_DEBUG_MUTEX
555 restore_flags(flags
);
560 } // end of "meiDMARead_16(..."
562 MEI_ERROR
meiDMARead_8(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
571 #ifdef AMAZON_DMA_DEBUG_MUTEX
577 // Set the read transfer address
578 meiLongwordWrite(MEI_XFR_ADDR
, srcaddr
);
580 // Read the data popped across DMA
581 while (databuffsize
--)
583 meiLongwordRead(MEI_DATA_XFR
, &temp
);
584 temp
= ((temp
& 0xff)<<24) + ((temp
& 0xff00)<<8)+ ((temp
& 0xff0000)>>8)+ ((temp
& 0xff000000)>>24);//swap byte
587 } // end of "while(..."
589 #ifdef AMAZON_DMA_DEBUG_MUTEX
590 restore_flags(flags
);
595 } // end of "meiDMARead_8(..."
597 void meiPollForDbgDone(void)
601 while (i
<WHILE_DELAY
)
603 meiLongwordRead(ARC_TO_MEI_INT
, &query
);
604 query
&= (ARC_TO_MEI_DBG_DONE
);
609 #ifdef AMAZON_MEI_DEBUG_ON
610 printk("\n\n PollforDbg fail");
615 meiLongwordWrite(ARC_TO_MEI_INT
, ARC_TO_MEI_DBG_DONE
); // to clear this interrupt
616 } // end of "meiPollForDbgDone(..."
618 MEI_ERROR
meiDebugWrite_8(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
626 #ifdef AMAZON_DMA_DEBUG_MUTEX
632 // Open the debug port before DMP memory write
633 meiLongwordRead(MEI_CONTROL
, &temp
);
636 meiLongwordWrite(MEI_CONTROL
, temp
);
638 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
641 // For the requested length, write the address and write the data
644 for (i
=0; i
< databuffsize
; i
++)
646 meiLongwordWrite(MEI_DEBUG_WAD
, address
);
649 temp
= ((temp
& 0xff)<<24) + ((temp
& 0xff00)<<8)+ ((temp
& 0xff0000)>>8)+ ((temp
& 0xff000000)>>24);//swap byte
650 meiLongwordWrite(MEI_DEBUG_DATA
, temp
);
655 } // end of "for(..."
657 // Close the debug port after DMP memory write
658 meiLongwordRead(MEI_CONTROL
, &temp
);
660 temp
&= ~(HOST_MSTR
);
661 meiLongwordWrite(MEI_CONTROL
, temp
);
664 #ifdef AMAZON_DMA_DEBUG_MUTEX
665 restore_flags(flags
);
671 } // end of "meiDebugWrite_8(..."
673 MEI_ERROR
meiDebugRead_8(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
681 #ifdef AMAZON_DMA_DEBUG_MUTEX
687 // Open the debug port before DMP memory read
688 meiLongwordRead(MEI_CONTROL
, &temp
);
691 meiLongwordWrite(MEI_CONTROL
, temp
);
693 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP2_MASK
);
696 // For the requested length, write the address and read the data
699 for (i
=0; i
<databuffsize
; i
++)
701 meiLongwordWrite(MEI_DEBUG_RAD
, address
);
704 meiLongwordRead(MEI_DEBUG_DATA
, &temp
);
706 temp
= ((temp
& 0xff)<<24) + ((temp
& 0xff00)<<8)+ ((temp
& 0xff0000)>>8)+ ((temp
& 0xff000000)>>24);//swap byte
710 } // end of "for(..."
712 // Close the debug port after DMP memory read
713 meiLongwordRead(MEI_CONTROL
, &temp
);
715 temp
&= ~(HOST_MSTR
);
716 meiLongwordWrite(MEI_CONTROL
, temp
);
719 #ifdef AMAZON_DMA_DEBUG_MUTEX
720 restore_flags(flags
);
726 } // end of "meiDebugRead_8(..."
728 MEI_ERROR
meiDebugWrite_16(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
736 #ifdef AMAZON_DMA_DEBUG_MUTEX
742 // Open the debug port before DMP memory write
743 meiLongwordRead(MEI_CONTROL
, &temp
);
746 meiLongwordWrite(MEI_CONTROL
, temp
);
748 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
751 // For the requested length, write the address and write the data
754 for (i
=0; i
< databuffsize
; i
++)
756 meiLongwordWrite(MEI_DEBUG_WAD
, address
);
759 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);//swap half word
760 meiLongwordWrite(MEI_DEBUG_DATA
, temp
);
765 } // end of "for(..."
767 // Close the debug port after DMP memory write
768 meiLongwordRead(MEI_CONTROL
, &temp
);
770 temp
&= ~(HOST_MSTR
);
771 meiLongwordWrite(MEI_CONTROL
, temp
);
774 #ifdef AMAZON_DMA_DEBUG_MUTEX
775 restore_flags(flags
);
781 } // end of "meiDebugWrite_16(..."
783 MEI_ERROR
meiDebugRead_16(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
791 #ifdef AMAZON_DMA_DEBUG_MUTEX
797 // Open the debug port before DMP memory read
798 meiLongwordRead(MEI_CONTROL
, &temp
);
801 meiLongwordWrite(MEI_CONTROL
, temp
);
803 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP2_MASK
);
806 // For the requested length, write the address and read the data
809 for (i
=0; i
<databuffsize
; i
++)
811 meiLongwordWrite(MEI_DEBUG_RAD
, address
);
814 meiLongwordRead(MEI_DEBUG_DATA
, &temp
);
816 temp
= ((temp
& 0xffff)<<16) + ((temp
& 0xffff0000)>>16);//swap half word
820 } // end of "for(..."
822 // Close the debug port after DMP memory read
823 meiLongwordRead(MEI_CONTROL
, &temp
);
825 temp
&= ~(HOST_MSTR
);
826 meiLongwordWrite(MEI_CONTROL
, temp
);
829 #ifdef AMAZON_DMA_DEBUG_MUTEX
830 restore_flags(flags
);
836 } // end of "meiDebugRead_16(..."
838 MEI_ERROR
meiDebugWrite(u32 destaddr
, u32
*databuff
, u32 databuffsize
)
846 #ifdef AMAZON_DMA_DEBUG_MUTEX
852 // Open the debug port before DMP memory write
853 meiLongwordRead(MEI_CONTROL
, &temp
);
856 meiLongwordWrite(MEI_CONTROL
, temp
);
858 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
861 // For the requested length, write the address and write the data
864 for (i
=0; i
< databuffsize
; i
++)
866 meiLongwordWrite(MEI_DEBUG_WAD
, address
);
869 meiLongwordWrite(MEI_DEBUG_DATA
, temp
);
874 } // end of "for(..."
876 // Close the debug port after DMP memory write
877 meiLongwordRead(MEI_CONTROL
, &temp
);
879 temp
&= ~(HOST_MSTR
);
880 meiLongwordWrite(MEI_CONTROL
, temp
);
883 #ifdef AMAZON_DMA_DEBUG_MUTEX
884 restore_flags(flags
);
890 } // end of "meiDebugWrite(..."
892 MEI_ERROR
meiDebugRead(u32 srcaddr
, u32
*databuff
, u32 databuffsize
)
900 #ifdef AMAZON_DMA_DEBUG_MUTEX
906 // Open the debug port before DMP memory read
907 meiLongwordRead(MEI_CONTROL
, &temp
);
910 meiLongwordWrite(MEI_CONTROL
, temp
);
912 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP2_MASK
);
915 // For the requested length, write the address and read the data
918 for (i
=0; i
<databuffsize
; i
++)
920 meiLongwordWrite(MEI_DEBUG_RAD
, address
);
923 meiLongwordRead(MEI_DEBUG_DATA
, &temp
);
928 } // end of "for(..."
930 // Close the debug port after DMP memory read
931 meiLongwordRead(MEI_CONTROL
, &temp
);
933 temp
&= ~(HOST_MSTR
);
934 meiLongwordWrite(MEI_CONTROL
, temp
);
937 #ifdef AMAZON_DMA_DEBUG_MUTEX
938 restore_flags(flags
);
944 } // end of "meiDebugRead(..."
945 EXPORT_SYMBOL(meiDebugRead
);
947 void meiMailboxInterruptsDisable(void)
949 meiLongwordWrite(ARC_TO_MEI_INT_MASK
, 0x0);
950 } // end of "meiMailboxInterruptsDisable(..."
952 void meiMailboxInterruptsEnable(void)
954 meiLongwordWrite(ARC_TO_MEI_INT_MASK
, MSGAV_EN
);
955 } // end of "meiMailboxInterruptsEnable(..."
957 MEI_ERROR
meiMailboxWrite(u16
*msgsrcbuffer
, u16 msgsize
)
960 u32 arc_mailbox_status
= 0x0;
962 MEI_ERROR meiMailboxError
= MEI_SUCCESS
;
964 // Check arc if mailbox write can be initiated
965 /* meiLongwordRead(MEI_TO_ARC_INT, &arc_mailbox_status);
966 if ((arc_mailbox_status & MEI_TO_ARC_MSGAV))
968 return MEI_MAILBOX_FULL;
972 meiMailboxError
= meiDMAWrite(MEI_TO_ARC_MAILBOX
, (u32
*)msgsrcbuffer
, msgsize
/2);
973 meiMailboxError
= meiDMAWrite(MEI_TO_ARC_MAILBOXR
, (u32
*)(&temp
), 1);
975 // Notify arc that mailbox write completed
977 meiLongwordWrite(MEI_TO_ARC_INT
, MEI_TO_ARC_MSGAV
);
980 while(i
<WHILE_DELAY
){ // wait for ARC to clear the bit
981 meiLongwordRead(MEI_TO_ARC_INT
, &arc_mailbox_status
);
982 if((arc_mailbox_status
& MEI_TO_ARC_MSGAV
) != MEI_TO_ARC_MSGAV
)
986 #ifdef AMAZON_MEI_DEBUG_ON
987 printk("\n\n MEI_TO_ARC_MSGAV not cleared by ARC");
989 meiMailboxError
= MEI_FAILURE
;
991 for(i
=0;i
<msgsize
;i
++)
992 printk("\n %8x", (*(msgsrcbuffer
+i
)));
998 return meiMailboxError
;
1000 } // end of "meiMailboxWrite(..."
1002 MEI_ERROR
meiMailboxRead(u16
*msgdestbuffer
, u16 msgsize
)
1004 //u32 arc_mailbox_status = 0x0;
1005 //u32 *mei_arc_msgbuff = 0x0;
1006 MEI_ERROR meiMailboxError
= MEI_SUCCESS
;
1009 // Check arc if mailbox read can be initiated
1010 meiLongwordRead(ARC_TO_MEI_INT, &arc_mailbox_status);
1011 if ((arc_mailbox_status & ARC_TO_MEI_MSGAV) == 0)
1013 return MEI_MAILBOX_EMPTY;
1014 } // end of "if(..."
1017 // Read from mailbox
1018 meiMailboxError
= meiDMARead(ARC_TO_MEI_MAILBOX
, (u32
*)msgdestbuffer
, msgsize
/2);
1020 // Notify arc that mailbox read completed
1021 meiLongwordWrite(ARC_TO_MEI_INT
, ARC_TO_MEI_MSGAV
);
1024 return meiMailboxError
;
1026 } // end of "meiMailboxRead(..."
1028 MEI_ERROR
meiHaltArc(void)
1030 u32 arc_control_mode
= 0x0;
1031 u32 arc_debug_addr
= 0x5;
1032 u32 arc_debug_data
= 0x0;
1034 // Switch arc control from JTAG mode to MEI mode- write '1' to bit0
1035 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1036 arc_control_mode
|= (HOST_MSTR
);
1037 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1039 // Write arc aux reg access mask (0x0) into debug addr decode reg
1040 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_AUX_MASK
);
1042 // Write arc debug reg addr (0x5) into debug read addr reg
1043 meiLongwordWrite(MEI_DEBUG_RAD
, arc_debug_addr
);
1044 meiPollForDbgDone();
1046 // Read debug data reg and save content
1047 meiLongwordRead(MEI_DEBUG_DATA
, &arc_debug_data
);
1049 // Write arc debug reg addr (0x5) into debug write addr reg
1050 meiLongwordWrite(MEI_DEBUG_WAD
, arc_debug_addr
);
1052 // Write debug data reg with content ORd with 0x2 (halt bit set)
1053 arc_debug_data
|= (BIT1
);
1054 meiLongwordWrite(MEI_DEBUG_DATA
, arc_debug_data
);
1055 meiPollForDbgDone();
1057 // Switch arc control from MEI mode to JTAG mode- write '0' to bit0
1058 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1059 arc_control_mode
&= ~(HOST_MSTR
);
1060 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1065 } // end of "meiHalt(..."
1067 MEI_ERROR
meiDownloadBootCode(void)
1069 u32 arc_control_mode
;
1074 u32 arc_debug_addr
= 0x31F00;
1075 u32 arc_debug_data
= 0x10;
1079 //MEI_ERROR meiDMAError = MEI_SUCCESS;
1081 // Disable mask for arc codeswap interrupts
1082 meiMailboxInterruptsDisable();
1084 // Switch arc control from JTAG mode to MEI mode- write '1' to bit0
1085 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1086 arc_control_mode
|= (HOST_MSTR
);
1087 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1089 // Write (0x10) to CRI_CCR0(0x31F00) to enable ac_clk signal
1090 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
1091 meiLongwordWrite(MEI_DEBUG_RAD
, arc_debug_addr
);
1092 meiPollForDbgDone();
1093 meiLongwordRead(MEI_DEBUG_DATA
, &temp
);
1094 temp
|=arc_debug_data
;
1096 meiLongwordWrite(MEI_DEBUG_WAD
, arc_debug_addr
);
1097 meiLongwordWrite(MEI_DEBUG_DATA
, temp
);
1098 meiPollForDbgDone();
1099 //meiLongwordWrite(MEI_DEBUG_DEC, MEI_DEBUG_DEC_AUX_MASK);
1101 // Switch arc control from MEI mode to JTAG mode- write '0' to bit0
1102 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1103 arc_control_mode
&= ~(HOST_MSTR
);
1104 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1106 #ifdef AMAZON_MEI_DEBUG_ON //to test ac_clk setting correctness
1107 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1108 arc_control_mode
|= (HOST_MSTR
);
1109 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1111 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
1112 meiLongwordWrite(MEI_DEBUG_RAD
, arc_debug_addr
);
1113 meiPollForDbgDone();
1114 meiLongwordRead(MEI_DEBUG_DATA
, &arc_debug_data
);
1116 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1117 arc_control_mode
&= ~(HOST_MSTR
);
1118 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1120 // printk("\n\n ac_clk is %8x\n", arc_debug_data);
1124 ** DMA the boot code page(s)
1126 #ifdef AMAZON_MEI_DEBUG_ON
1127 // printk("\n\n start download pages");
1129 for( boot_loop
= 0; boot_loop
< img_hdr
->count
; boot_loop
++)
1131 if( img_hdr
->page
[boot_loop
].p_size
& BOOT_FLAG
)
1133 page_size
= meiGetPage( boot_loop
, GET_PROG
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
1136 meiDMAWrite(dest_addr
, mei_arc_swap_buff
, page_size
);
1139 if( img_hdr
->page
[boot_loop
].d_size
& BOOT_FLAG
)
1141 page_size
= meiGetPage( boot_loop
, GET_DATA
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
1144 meiDMAWrite( dest_addr
, mei_arc_swap_buff
, page_size
);
1148 #ifdef AMAZON_MEI_DEBUG_ON
1149 // printk("\n\n pages downloaded");
1153 } // end of "meiDownloadBootCode(..."
1155 MEI_ERROR
meiRunArc(void)
1157 u32 arc_control_mode
= 0x0;
1158 u32 arc_debug_addr
= 0x0;
1159 u32 arc_debug_data
= 0x0;
1161 // Switch arc control from JTAG mode to MEI mode- write '1' to bit0
1162 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1163 arc_control_mode
|= (HOST_MSTR
);
1164 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1166 // Write arc aux reg access mask (0x0) into debug addr decode reg
1167 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_AUX_MASK
);
1169 // Write arc status aux reg addr (0x0) into debug read addr reg
1170 meiLongwordWrite(MEI_DEBUG_RAD
, arc_debug_addr
);
1171 meiPollForDbgDone();
1173 // Read debug data reg and save content
1174 meiLongwordRead(MEI_DEBUG_DATA
, &arc_debug_data
);
1176 // Write arc status aux reg addr (0x0) into debug write addr reg
1177 meiLongwordWrite(MEI_DEBUG_WAD
, arc_debug_addr
);
1179 // Write debug data reg with content ANDd with 0xFDFFFFFF (halt bit cleared)
1180 arc_debug_data
&= ~(BIT25
);
1181 meiLongwordWrite(MEI_DEBUG_DATA
, arc_debug_data
);
1182 meiPollForDbgDone();
1184 // Switch arc control from MEI mode to JTAG mode- write '0' to bit0
1185 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1186 arc_control_mode
&= ~(HOST_MSTR
);
1187 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1189 // Enable mask for arc codeswap interrupts
1190 meiMailboxInterruptsEnable();
1195 } // end of "meiActivate(..."
1197 int meiGetPage( u32 Page
, u32 data
, u32 MaxSize
, u32
*Buffer
, u32
*Dest
)
1203 if( Page
> img_hdr
->count
)
1207 ** Get program or data size, depending on "data" flag
1209 size
= (data
== GET_DATA
) ? img_hdr
->page
[ Page
].d_size
: img_hdr
->page
[ Page
].p_size
;
1211 size
&= BOOT_FLAG_MASK
; // Clear boot bit!
1218 ** Get program or data offset, depending on "data" flag
1220 i
= data
? img_hdr
->page
[ Page
].d_offset
: img_hdr
->page
[ Page
].p_offset
;
1223 ** Copy data/program to buffer
1226 i
/= 4; // Adjust offset for byte-to-UINT for array operation
1228 p
= (u32
*)img_hdr
+ i
;
1229 for(i
= 0; i
< size
; i
++)
1232 ** Pass back data/program destination address
1234 *Dest
= data
? img_hdr
->page
[Page
].d_dest
: img_hdr
->page
[Page
].p_dest
;
1239 MEI_ERROR
meiCMV(u16
* request
, int reply
) // write cmv to arc, if reply needed, wait for reply
1246 meierror
= meiMailboxWrite(request
, MSG_LENGTH
);
1248 if(meierror
!= MEI_SUCCESS
){
1249 #ifdef AMAZON_MEI_DEBUG_ON
1250 printk("\n\n MailboxWrite Fail.");
1258 if(cmv_reply
== NO_REPLY
)
1261 init_waitqueue_entry(&wait
, current
);
1262 add_wait_queue(&wait_queue_arcmsgav
, &wait
);
1263 set_current_state(TASK_INTERRUPTIBLE
);
1267 set_current_state(TASK_RUNNING
);
1268 remove_wait_queue(&wait_queue_arcmsgav
, &wait
);
1271 schedule_timeout(CMV_TIMEOUT
);
1272 remove_wait_queue(&wait_queue_arcmsgav
, &wait
);
1274 if(arcmsgav
==0){//CMV_timeout
1277 #ifdef AMAZON_MEI_DEBUG_ON
1278 printk("\nmeiCMV: MEI_MAILBOX_TIMEOUT\n");
1280 return MEI_MAILBOX_TIMEOUT
;
1289 //TODO, for loopback test
1291 #define mte_reg_base (0x4800*4+0x20000)
1293 /* Iridia Registers Address Constants */
1294 #define MTE_Reg(r) (int)(mte_reg_base + (r*4))
1296 #define IT_AMODE MTE_Reg(0x0004)
1299 #define OMBOX_BASE 0x15F80
1300 #define IMBOX_BASE 0x15FC0
1302 #define TIMER_DELAY (1024)
1303 #define BC0_BYTES (32)
1304 #define BC1_BYTES (30)
1306 #define TIMEOUT_VALUE 2000
1308 void BFMWait (u32 cycle
) {
1310 for (i
= 0 ; i
< cycle
; i
++);
1313 void WriteRegLong(u32 addr
, u32 data
){
1314 //printk("[%8x] <= %8x \n\n", addr, data);
1315 *((volatile u32
*)(addr
)) = data
;
1318 u32
ReadRegLong (u32 addr
) {
1321 rd_val
= *((volatile u32
*)(addr
));
1322 //printk("[%8x] => %8x \n\n", addr, rd_val);
1327 /* This routine writes the mailbox with the data in an input array */
1328 void WriteMbox(u32
*mboxarray
,u32 size
) {
1331 WriteRegLong(MEI_XFR_ADDR
,IMBOX_BASE
);
1332 for (i
=0;i
<size
;i
++) {
1333 WriteRegLong(MEI_DATA_XFR
,*(mboxarray
+i
));
1337 /* This routine reads the output mailbox and places the results into an array */
1338 void ReadMbox(u32
*mboxarray
,u32 size
) {
1341 WriteRegLong(MEI_XFR_ADDR
,OMBOX_BASE
);
1342 for (i
=0;i
<size
;i
++) {
1343 mboxarray
[i
] = ReadRegLong(MEI_DATA_XFR
);
1347 void MEIWriteARCValue(u32 address
, u32 value
)
1350 /* Write address register */
1351 *((volatile u32
*)MEI_DEBUG_WAD
) = address
;
1353 /* Write data register */
1354 *((volatile u32
*)MEI_DEBUG_DATA
) = value
;
1356 /* wait until complete - timeout at 40*/
1357 for (i
=0;i
<40;i
++) {
1358 check
= *((volatile u32
*)ARC_TO_MEI_INT
);
1359 if ((check
& 0x20)) break;
1360 //printk("MEIWriteARCValue: check:%8x\n\n", check);
1363 /* clear the flag */
1364 *((volatile u32
*)ARC_TO_MEI_INT
) = 0x20;
1369 void post_mei_init(void)
1371 u32 mailbox
[NUM_MB
];
1373 mailbox
[0] = TIMER_DELAY
;
1375 /* set bytes per bearer channel */
1376 mailbox
[1] = BC0_BYTES
;
1377 mailbox
[2] = BC1_BYTES
;
1378 WriteMbox(mailbox
, 3);
1380 WriteRegLong(AAI_ACCESS
, 0x00000001);
1382 /* enable ADSL block clock, ac_clk */
1383 WriteRegLong(MEI_CONTROL
, 0x01);
1384 WriteRegLong(MEI_DEBUG_DEC
, 0x00000001); // select ld/st space
1385 MEIWriteARCValue(0x31F00, 0x00000010); // write CRI_CCR0 to enable ac_clk
1387 /* set the MTE to register start */
1388 MEIWriteARCValue(IT_AMODE
, 0xF);
1395 u32 mailbox
[NUM_MB
];
1396 /* wait for ATM sync to be achieved on both BC0 and BC1 */
1398 ReadMbox(mailbox
, 1);
1399 u32 readval
= mailbox
[0];
1400 while( ((readval
& 0xFFFFFFFF) == 0) && (timeout
< TIMEOUT_VALUE
) ) {
1402 //printk("wait_sync\n\n");
1403 ReadMbox(mailbox
, 1);
1404 readval
= mailbox
[0];
1407 if(timeout
== TIMEOUT_VALUE
)return 0;
1410 #endif //DFE_LOOPBACK
1411 //end of TODO, for loopback test
1413 MEI_ERROR
meiForceRebootAdslModem(void)
1416 //#ifdef ARC_READY_ACK
1417 if(down_interruptible(&mei_sema
)) //disable CMV access until ARC ready
1419 return -ERESTARTSYS
;
1422 if(reboot_firsttime
==1){//000002:fchang Start
1424 *((volatile u32
*)0xB0100910) = 0x80; //reset DFE
1426 *((volatile u32
*)0xB0100910) = 0x0;
1428 if((*((volatile u32
*)0xB0100910))!=0x0)
1429 #ifdef AMAZON_MEI_DEBUG_ON
1430 printk("\n reset DFE fail");
1434 meiLongwordWrite(MEI_CONTROL
, SOFT_RESET
);
1436 meiLongwordWrite(MEI_CONTROL
, 0);
1439 } //000002:fchang End
1441 img_hdr
=(ARC_IMG_HDR
*)lp_image
;
1443 img_hdr
=(ARC_IMG_HDR
*)image_buffer
;
1445 // printk("\n\n enter haltarc");
1447 // printk("\n\n haltarc done");
1448 //000002:fchang Start
1449 if(reboot_firsttime
==0){
1450 printk("\n\n new reboot");
1454 if(reboot_firsttime
==1)
1455 meiDownloadBootCode();
1457 mei_ioctl((struct inode
*)NULL
, (struct file
*)NULL
, AMAZON_MEI_DOWNLOAD
, (unsigned long)NULL
);
1460 #ifdef AMAZON_MEI_DEBUG_ON
1461 // printk("\n\n Download Done");
1468 // sema_init(&mei_sema, 1);
1471 // enable_irq(AMAZON_MEI_INT);
1474 //000002:fchang Start
1475 if(reboot_firsttime
==0){
1476 meiEnalbeMailboxInt();
1480 #ifdef AMAZON_MEI_DEBUG_ON
1481 // printk("\n\n ARC Running");
1484 #ifdef AMAZON_MEI_DEBUG_ON //to test ac_clk setting correctness
1486 u32 arc_control_mode
;
1487 u32 arc_debug_addr
= 0x31F00;
1488 u32 arc_debug_data
= 0x10;
1489 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1490 arc_control_mode
|= (HOST_MSTR
);
1491 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1493 meiLongwordWrite(MEI_DEBUG_DEC
, MEI_DEBUG_DEC_DMP1_MASK
);
1494 meiLongwordWrite(MEI_DEBUG_RAD
, arc_debug_addr
);
1495 meiPollForDbgDone();
1496 meiLongwordRead(MEI_DEBUG_DATA
, &arc_debug_data
);
1498 meiLongwordRead(MEI_CONTROL
, &arc_control_mode
);
1499 arc_control_mode
&= ~(HOST_MSTR
);
1500 meiLongwordWrite(MEI_CONTROL
, arc_control_mode
);
1502 // printk("\n\n ac_clk is %8x\n", arc_debug_data);
1508 if (wait_sync() == 0){
1509 printk("ARC fails to run: time out\n\n");
1511 // printk("ARC is ready\n\n");
1514 if(reboot_firsttime
==1) //000002:fchang
1515 reboot_firsttime
=0; //000002:fchang
1520 //////////////////// procfs debug ////////////////////////////////////////////////////////
1521 #define MEI_DIRNAME "mei"
1522 static struct proc_dir_entry
*meidir
;
1524 static ssize_t
proc_write(struct file
*, const char *, size_t, loff_t
*);
1525 static ssize_t
proc_read(struct file
*, char *, size_t, loff_t
*);
1527 static struct file_operations proc_operations
= {
1532 typedef struct reg_entry
{
1534 char name
[30]; // big enough to hold names
1535 char description
[100]; // big enough to hold description
1536 unsigned short low_ino
;
1539 static reg_entry_t regs
[PROC_ITEMS
]; // total items to be monitored by /proc/mei
1541 #define NUM_OF_REG_ENTRY (sizeof(regs)/sizeof(reg_entry_t))
1543 static int proc_read(struct file
* file
, char * buf
, size_t nbytes
, loff_t
*ppos
)
1545 int i_ino
= (file
->f_dentry
->d_inode
)->i_ino
;
1550 reg_entry_t
* current_reg
=NULL
;
1552 for (i
=0;i
<NUM_OF_REG_ENTRY
;i
++) {
1553 if (regs
[i
].low_ino
==i_ino
) {
1554 current_reg
= ®s
[i
];
1558 if (current_reg
==NULL
)
1561 if (current_reg
->flag
== (int *) 8){
1564 //Firmware version: major.minor.sub_version.int_version.rel_state.spl_appl
1565 //Firmware Date Time Code: date/month min:hour
1566 if (*ppos
>0) /* Assume reading completed in previous read*/
1567 return 0; // indicates end of file
1568 if(down_interruptible(&mei_sema
))
1569 return -ERESTARTSYS
;
1571 //if (indicator_count != 1){
1572 if (indicator_count
< 1){
1578 makeCMV(H2D_CMV_READ
, INFO
, 54, 0, 1, NULL
);
1579 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
1581 #ifdef AMAZON_MEI_DEBUG_ON
1582 printk("\n\n WINHOST CMV fail");
1588 version
= RxMessage
[4];
1589 count
= sprintf(outputbuf
, "%d.%d.",(version
)&0xff,(version
>>8)&0xff);
1591 //sub_version:bits 4-7
1592 //int_version:bits 0-3
1593 //spl_appl:bits 8-13
1594 //rel_state:bits 14-15
1595 makeCMV(H2D_CMV_READ
, INFO
, 54, 1, 1, NULL
);
1596 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
1598 #ifdef AMAZON_MEI_DEBUG_ON
1599 printk("\n\n WINHOST CMV fail");
1605 version
=RxMessage
[4];
1606 count
+= sprintf(outputbuf
+count
, "%d.%d.%d.%d",
1611 #ifdef ADSL_LED_SUPPORT
1612 // version check -start for adsl led
1613 if ((((version
>>4)&0xf)==2)&&((version
&0xf)>=3)&&((version
&0xf)<7)) firmware_support_led
=1;
1614 else if ((((version
>>4)&0xf)==2)&&((version
&0xf)>=7)) firmware_support_led
=2;
1615 else if (((version
>>4)&0xf)>2) firmware_support_led
=2;
1617 //165001:henryhsu:20050906:Modify for adsl firmware version 1.2.1.2.0.1 DATA_LED can't flash.
1618 //else firmware_support_led=0;
1619 else firmware_support_led
=2;
1623 // version check -end
1627 makeCMV(H2D_CMV_READ
, INFO
, 55, 0, 1, NULL
);
1628 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
1630 #ifdef AMAZON_MEI_DEBUG_ON
1631 printk("\n\n WINHOST CMV fail");
1637 version
= RxMessage
[4];
1641 makeCMV(H2D_CMV_READ
, INFO
, 55, 1, 1, NULL
);
1642 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
1644 #ifdef AMAZON_MEI_DEBUG_ON
1645 printk("\n\n WINHOST CMV fail");
1651 version
+= (RxMessage
[4]<<16);
1652 count
+= sprintf(outputbuf
+count
, " %d/%d %d:%d\n"
1656 ,(version
>>16)&0xff);
1661 }else if(current_reg
->flag
!= (int *)Recent_indicator
){
1662 if (*ppos
>0) /* Assume reading completed in previous read*/
1663 return 0; // indicates end of file
1664 count
= sprintf(outputbuf
, "0x%08X\n\n", *(current_reg
->flag
));
1666 if (count
>nbytes
) /* Assume output can be read at one time */
1669 if((int)(*ppos
)/((int)7)==16)
1670 return 0; // indicate end of the message
1671 count
= sprintf(outputbuf
, "0x%04X\n\n", *(((u16
*)(current_reg
->flag
))+ (int)(*ppos
)/((int)7)));
1674 if (copy_to_user(buf
, outputbuf
, count
))
1679 static ssize_t
proc_write(struct file
* file
, const char * buffer
, size_t count
, loff_t
*ppos
)
1681 int i_ino
= (file
->f_dentry
->d_inode
)->i_ino
;
1682 reg_entry_t
* current_reg
=NULL
;
1684 unsigned long newRegValue
;
1687 for (i
=0;i
<NUM_OF_REG_ENTRY
;i
++) {
1688 if (regs
[i
].low_ino
==i_ino
) {
1689 current_reg
= ®s
[i
];
1693 if ((current_reg
==NULL
) || (current_reg
->flag
== (int *)Recent_indicator
))
1696 newRegValue
= simple_strtoul(buffer
,&endp
,0);
1697 *(current_reg
->flag
)=(int)newRegValue
;
1698 return (count
+endp
-buffer
);
1700 ////////////////makeCMV(Opcode, Group, Address, Index, Size, Data), CMV in u16 TxMessage[MSG_LENGTH]///////////////////////////
1701 void makeCMV(u8 opcode
, u8 group
, u16 address
, u16 index
, int size
, u16
* data
)
1703 memset(TxMessage
, 0, MSG_LENGTH
*2);
1704 TxMessage
[0]= (opcode
<<4) + (size
&0xf);
1705 TxMessage
[1]= (((index
==0)?0:1)<<7) + (group
&0x7f);
1706 TxMessage
[2]= address
;
1707 TxMessage
[3]= index
;
1708 if(opcode
== H2D_CMV_WRITE
)
1709 memcpy(TxMessage
+4, data
, size
*2);
1713 ////////////////makeCMV(Opcode, Group, Address, Index, Size, Data), CMV in u16 TxMessage[MSG_LENGTH]///////////////////////////
1714 void makeCMV_local(u8 opcode
, u8 group
, u16 address
, u16 index
, int size
, u16
* data
,u16
*CMVMSG
)
1716 memset(CMVMSG
, 0, MSG_LENGTH
*2);
1717 CMVMSG
[0]= (opcode
<<4) + (size
&0xf);
1718 CMVMSG
[1]= (((index
==0)?0:1)<<7) + (group
&0x7f);
1721 if(opcode
== H2D_CMV_WRITE
)
1722 memcpy(CMVMSG
+4, data
, size
*2);
1726 //////////////// Driver Structure /////////////////////////////////////////////////////////////////////////////
1727 static ssize_t
mei_write(struct file
*, const char *, size_t, loff_t
*);
1728 static int mei_ioctl(struct inode
*, struct file
*, unsigned int, unsigned long);
1730 static struct file_operations mei_operations
= {
1736 static ssize_t
mei_write(struct file
* filp
, const char * buf
, size_t size
, loff_t
* loff
)
1738 // printk("\n\n mei_write entered");
1739 // image_buffer = (u32 *)kmalloc(size, GFP_KERNEL);
1740 image_buffer
= (u32
*)vmalloc(size
);
1741 // printk("\n\n image_buffer kmalloc done");
1742 if(image_buffer
== NULL
){
1743 #ifdef AMAZON_MEI_DEBUG_ON
1744 // printk("\n\n kmalloc for firmware image fail");
1745 printk("\n\n vmalloc for firmware image fail");
1749 copy_from_user((char *)image_buffer
, buf
, size
);
1750 // printk("\n\n copy_from_user done");
1754 ////////// ISR GPTU Timer 6 for high resolution timer /////////////
1755 void amazon_timer6_interrupt_MEI(int irq
, void *dev_id
, struct pt_regs
*regs
)
1760 u16 rdindex
, wrindex
;
1761 u16 num_rd
=0; //num of byte can be read
1764 // printk("\n\nenter timer\n\n");
1766 // printk("\n%d\n",irqtimes);
1770 #ifdef PCM_ACCESS_DEBUG
1771 meiDebugRead_8(0x30f20, &temp, 1);
1773 meiDMARead_8(0x30f20, &temp, 1);
1775 if((temp&0x4000)!=0){
1777 #ifdef PCM_ACCESS_DEBUG
1778 meiDebugWrite_8(0x30f20, &temp, 1);
1780 meiDMAWrite_8(0x30f20, &temp, 1);
1782 #ifdef PCM_ACCESS_DEBUG
1783 meiDebugRead_8(0x30f20, &temp, 1);
1785 meiDMARead_8(0x30f20, &temp, 1);
1787 if((temp&0x4000)!=0)
1788 printk("\nER_ERR not cleared");
1792 for(i
=PCM_CHANNEL_NUM
-1;i
>=0;i
--){// start from last channel, which is rx
1793 #ifdef PCM_ACCESS_DEBUG
1794 meiDebugRead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
1796 meiDMARead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
1798 wrindex
= (u16
)((temp
& 0xffff0000)>>16);
1799 // printk(" %d",wrindex);
1800 #ifdef PCM_ACCESS_DEBUG
1801 meiDebugRead_16(pcm_start_addr
+i
*16+8, &temp
, 1);
1803 meiDMARead_16(pcm_start_addr
+i
*16+8, &temp
, 1);
1805 rdindex
= (u16
)(temp
& 0xffff);
1806 // printk(" %d",rdindex);
1807 if(rdindex
<=wrindex
)
1808 num_rd
=((wrindex
-rdindex
)/4)*4; //read multiply of 4 bytes
1810 num_rd
=((pcm_data
[i
].len
-(rdindex
-wrindex
))/4)*4; //read multiply of 4 bytes
1812 if(i
%2!=0){//rx channel
1813 pcm_data
[i
].point
=0;
1814 for(j
=0;j
<num_rd
/4;j
++){
1815 if(pcm_data
[i
].finish
!=1){
1816 if((rdindex
+j
*4)>=pcm_data
[i
].len
)
1817 temp16
=(rdindex
+j
*4) - pcm_data
[i
].len
;
1820 #ifdef PCM_ACCESS_DEBUG
1821 meiDebugRead_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16))+temp16
, (u32
*)(pcm_data
[i
].buff
+pcm_data
[i
].point
), 1);
1823 meiDMARead_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16))+temp16
, (u32
*)(pcm_data
[i
].buff
+pcm_data
[i
].point
), 1);
1825 // printk(" %8x", *((u32*)(pcm_data[i].buff+pcm_data[i].point)));
1826 /* if(pcm_data[i].point==0){
1827 if(pcm_data[i].buff[0]==0xA5){// start of loopback data
1828 pcm_data[i].point+=4;
1829 printk("\nstart receive data");
1833 pcm_data
[i
].point
+=4;
1834 /* if(pcm_data[i].point==PCM_BUFF_SIZE){ //finish rx
1835 pcm_data[i].finish=1;
1836 printk("\nchannel[%d] finished", i);
1840 if(firsttime
[i
]==1){
1841 for(j
=0;j
<num_rd
;j
++){
1842 if(pcm_data
[i
].buff
[j
]==0x1){
1843 num_cmp
[i
]=num_rd
-j
;
1848 if(memcmp(sampledata
+1, pcm_data
[i
].buff
+j
, num_cmp
[i
])!=0)
1849 printk("\n\ndata wrong,1st\n\n");
1851 pcm_start_loc
[i
] = num_cmp
[i
]+1;
1854 if(memcmp(sampledata
+pcm_start_loc
[i
], pcm_data
[i
].buff
, num_rd
)!=0)
1855 printk("\n\ndata wrong\n\n");
1857 pcm_start_loc
[i
]+=num_rd
;
1858 if(pcm_start_loc
[i
]>=256)
1859 pcm_start_loc
[i
]=pcm_start_loc
[i
]-256;
1864 if(rdindex
>=pcm_data
[i
].len
)
1865 rdindex
=rdindex
-pcm_data
[i
].len
;
1866 #ifdef PCM_ACCESS_DEBUG
1867 meiDebugRead_16(pcm_start_addr
+i
*16+8, &temp
, 1);
1869 meiDMARead_16(pcm_start_addr
+i
*16+8, &temp
, 1);
1871 temp
= (temp
& 0xffff0000) + rdindex
;
1872 #ifdef PCM_ACCESS_DEBUG
1873 meiDebugWrite_16(pcm_start_addr
+i
*16+8, &temp
, 1); // update rdindex
1875 meiDMAWrite_16(pcm_start_addr
+i
*16+8, &temp
, 1); // update rdindex
1878 bytes_to_wr
= num_rd
;
1880 // if(bytes_to_wr>0){
1881 // printk(" %d", num_rd);
1882 // printk(" %d", rdindex);
1883 // printk("\n\nrdindex = %d", rdindex);
1887 // if((bytes_to_wr + num_rd) < pcm_data[i].len){
1888 for(j
=0;j
<bytes_to_wr
/4;j
++){
1889 if(pcm_data
[i
].finish
!=1){
1890 if((wrindex
+j
*4)>=pcm_data
[i
].len
)
1891 temp16
=(wrindex
+j
*4) - pcm_data
[i
].len
;
1893 temp16
=wrindex
+ j
*4;
1895 #ifdef PCM_ACCESS_DEBUG
1896 meiDebugWrite_8((((u32)(pcm_data[i].LSW))+(((u32)(pcm_data[i].MSW))<<16))+temp16,(u32*)(pcm_data[i+1].buff+j*4), 1);
1898 meiDMAWrite_8((((u32)(pcm_data[i].LSW))+(((u32)(pcm_data[i].MSW))<<16))+temp16,(u32*)(pcm_data[i+1].buff+j*4), 1);
1901 #ifdef PCM_ACCESS_DEBUG
1902 meiDebugWrite_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16))+temp16
,(u32
*)(pcm_data
[i
].buff
+pcm_data
[i
].point
), 1);
1903 // meiDebugWrite_8((((u32)(pcm_data[i].LSW))+(((u32)(pcm_data[i].MSW))<<16))+temp16,(u32*)(pcm_data[i].buff), 1);
1905 meiDMAWrite_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16))+temp16
,(u32
*)(pcm_data
[i
].buff
+pcm_data
[i
].point
), 1);
1907 pcm_data
[i
].point
+=4;
1908 if(pcm_data
[i
].point
==PCM_BUFF_SIZE
){
1909 // pcm_data[i].finish=1;
1910 // printk("\nchannel[%d] finished", i);
1911 pcm_data
[i
].point
=0;
1915 wrindex
+=bytes_to_wr
;
1916 if(wrindex
>=pcm_data
[i
].len
)
1917 wrindex
=wrindex
-pcm_data
[i
].len
;
1918 #ifdef PCM_ACCESS_DEBUG
1919 meiDebugRead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
1921 meiDMARead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
1923 temp
=(temp
&0xffff) + (wrindex
<<16);
1924 #ifdef PCM_ACCESS_DEBUG
1925 meiDebugWrite_16(pcm_start_addr
+i
*16+12, &temp
, 1); // update wrindex
1927 meiDMAWrite_16(pcm_start_addr
+i
*16+12, &temp
, 1); // update wrindex
1930 //if(bytes_to_wr>0){
1931 // printk(" %d", bytes_to_wr);
1932 // printk(" %d", wrindex);
1933 // printk("\n\nwrindex = %d", wrindex);
1940 //000002:fchang Start
1941 static int meiResetArc(void)
1949 meiLongwordWrite(MEI_CONTROL
, 1);
1950 meiLongwordWrite(MEI_DEBUG_DEC
, 3);
1951 meiLongwordWrite(MEI_DEBUG_WAD
, 0x3c);
1952 meiLongwordWrite(MEI_DEBUG_DATA
, 0x10);
1953 meiPollForDbgDone();
1954 meiLongwordWrite(MEI_DEBUG_DEC
, 0x0);
1955 meiLongwordWrite(MEI_DEBUG_WAD
, 0x2);
1956 meiLongwordWrite(MEI_DEBUG_DATA
, 0x0);
1957 meiPollForDbgDone();
1958 meiLongwordWrite(MEI_DEBUG_WAD
, 0x3);
1959 meiLongwordWrite(MEI_DEBUG_DATA
, 0x0);
1960 meiPollForDbgDone();
1961 meiLongwordWrite(MEI_DEBUG_DEC
, 0x0);
1962 meiLongwordWrite(MEI_DEBUG_RAD
, 0x0);
1963 meiPollForDbgDone();
1964 meiLongwordRead(MEI_DEBUG_DATA
, &auxreg0
);
1965 auxreg0
= auxreg0
& 0x03ffffff;
1966 meiLongwordWrite(MEI_DEBUG_WAD
, 0x0);
1967 meiLongwordWrite(MEI_DEBUG_DATA
, auxreg0
);
1968 meiPollForDbgDone();
1969 meiLongwordWrite(MEI_DEBUG_WAD
, 0x10a);
1970 meiLongwordWrite(MEI_DEBUG_DATA
, 0x0);
1971 meiPollForDbgDone();
1972 meiLongwordWrite(MEI_DEBUG_DEC
, 0x2);
1973 meiLongwordWrite(MEI_DEBUG_WAD
, 0xfffc);
1974 meiLongwordWrite(MEI_DEBUG_DATA
, 0x1fffffff);
1975 meiPollForDbgDone();
1977 meiLongwordWrite(MEI_DEBUG_DEC
, 0x0);
1978 meiLongwordWrite(MEI_DEBUG_RAD
, 0x0);
1979 meiPollForDbgDone();
1980 meiLongwordRead(MEI_DEBUG_DATA
, &auxreg0
);
1981 auxreg0
= auxreg0
& 0xff000000;
1982 auxreg0
= auxreg0
| 0x3fff;
1983 meiLongwordWrite(MEI_DEBUG_WAD
, 0x0);
1984 meiLongwordWrite(MEI_DEBUG_DATA
, auxreg0
);
1985 meiPollForDbgDone();
1987 meiLongwordWrite(MEI_DEBUG_DEC
, 0x0);
1988 meiLongwordWrite(MEI_DEBUG_RAD
, 0x5);
1989 meiPollForDbgDone();
1990 meiLongwordRead(MEI_DEBUG_DATA
, &auxreg5
);
1991 auxreg5
= auxreg5
| 0x801;
1992 meiLongwordWrite(MEI_DEBUG_WAD
, 0x5);
1993 meiLongwordWrite(MEI_DEBUG_DATA
, auxreg5
);
1994 meiPollForDbgDone();
1995 meiLongwordWrite(MEI_DEBUG_RAD
, 0x0);
1996 meiPollForDbgDone();
1997 meiLongwordRead(MEI_DEBUG_DATA
, &auxreg0
);
1998 auxreg0
= auxreg0
& 0x00ffffff;
1999 if(auxreg0
== 0x4000)
2000 flshcnt
= flshcnt
+1;
2003 flshcnt1
= flshcnt1
+1;
2005 flshcnt2
= flshcnt2
+1;
2012 static int meiResetCore(void)
2014 meiLongwordWrite(MEI_CONTROL
, 0x1);
2015 meiLongwordWrite(MEI_DEBUG_DEC
, 0x2);
2016 meiLongwordWrite(MEI_DEBUG_WAD
, 0x31f10);
2017 meiLongwordWrite(MEI_DEBUG_DATA
, 0xf);
2018 meiPollForDbgDone();
2019 meiLongwordWrite(MEI_DEBUG_WAD
, 0x31f10);
2020 meiLongwordWrite(MEI_DEBUG_DATA
, 0x0);
2021 meiPollForDbgDone();
2022 meiLongwordWrite(MEI_DEBUG_WAD
, 0x31f00);
2023 meiLongwordWrite(MEI_DEBUG_DATA
, 0x55);
2024 meiPollForDbgDone();
2028 static int meiEnalbeMailboxInt(void)
2031 meiLongwordRead(ARC_TO_MEI_INT_MASK
, &arc2meiintmsk
);
2032 arc2meiintmsk
= arc2meiintmsk
| 0x1;
2033 meiLongwordWrite(ARC_TO_MEI_INT_MASK
, arc2meiintmsk
);
2034 meiLongwordWrite(MEI_CONTROL
, 0x0);
2042 static int mei_ioctl(struct inode
* ino
, struct file
* fil
, unsigned int command
, unsigned long lon
)
2052 amazon_clreoc_pkt
* current_clreoc
;
2053 struct timeval time_now
;
2054 struct timeval time_fini
;
2055 struct list_head
* ptr
;
2056 amazon_mei_mib
* mib_ptr
;
2057 // u16 buff[MSG_LENGTH]__attribute__ ((aligned(4)));
2059 int meierr
=MEI_SUCCESS
;
2060 u16 data
[12]; //used in makeCMV, to pass in payload when CMV set, ignored when CMV read.
2063 amazon_mei_mib
* temp_intvl
;
2064 struct sk_buff
* eoc_skb
;
2065 // 603221:tc.chen start
2067 u16 hdlc_rx_buffer
[32];
2069 // 603221:tc.chen end
2071 int from_kernel
= 0;//joelin
2072 if (ino
== (struct inode
*)0) from_kernel
= 1;//joelin
2074 // printk("\n switch.command = %i\n", command);
2076 case GET_ADSL_LINE_CODE
:
2077 pts
.adslLineTableEntry_pt
= (adslLineTableEntry
*)kmalloc(sizeof(adslLineTableEntry
), GFP_KERNEL
);
2078 copy_from_user((char *)pts
.adslLineTableEntry_pt
, (char *)lon
, sizeof(adslLineTableEntry
));
2079 if(IS_FLAG_SET((&(pts
.adslLineTableEntry_pt
->flags
)), LINE_CODE_FLAG
)){
2080 pts
.adslLineTableEntry_pt
->adslLineCode
= 2;
2082 copy_to_user((char *)lon
, (char *)pts
.adslLineTableEntry_pt
, sizeof(adslLineTableEntry
));
2083 kfree(pts
.adslLineTableEntry_pt
);
2085 #ifdef AMAZON_MEI_MIB_RFC3440
2086 case GET_ADSL_ATUC_LINE_EXT
:
2087 if(down_interruptible(&mei_sema
))
2088 return -ERESTARTSYS
;
2089 pts
.adslLineExtTableEntry_pt
= (adslLineExtTableEntry
*)kmalloc(sizeof(adslLineExtTableEntry
), GFP_KERNEL
);
2090 copy_from_user((char *)pts
.adslLineExtTableEntry_pt
, (char *)lon
, sizeof(adslLineExtTableEntry
));
2091 if(IS_FLAG_SET((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CAP_FLAG
)){
2092 ATUC_LINE_TRANS_CAP_FLAG_MAKECMV
;
2093 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2094 #ifdef AMAZON_MEI_DEBUG_ON
2095 printk("\n\nCMV fail, Group 3 Address 67 Index 0");
2097 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CAP_FLAG
);
2100 memcpy((&(pts
.adslLineExtTableEntry_pt
->adslLineTransAtucCap
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2103 if(IS_FLAG_SET((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CONFIG_FLAG
)){
2104 ATUC_LINE_TRANS_CONFIG_FLAG_MAKECMV
;
2105 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2106 #ifdef AMAZON_MEI_DEBUG_ON
2107 printk("\n\nCMV fail, Group 3 Address 67 Index 0");
2109 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CONFIG_FLAG
);
2112 memcpy((&(pts
.adslLineExtTableEntry_pt
->adslLineTransAtucConfig
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2115 if(IS_FLAG_SET((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_ACTUAL_FLAG
)){
2116 ATUC_LINE_TRANS_ACTUAL_FLAG_MAKECMV
;
2117 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2118 #ifdef AMAZON_MEI_DEBUG_ON
2119 printk("\n\nCMV fail, Group 2 Address 1 Index 0");
2121 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_ACTUAL_FLAG
);
2124 memcpy((&(pts
.adslLineExtTableEntry_pt
->adslLineTransAtucActual
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2127 if(IS_FLAG_SET((&(pts
.adslLineExtTableEntry_pt
->flags
)), LINE_GLITE_POWER_STATE_FLAG
)){ // not supported currently
2129 LINE_GLITE_POWER_STATE_FLAG_MAKECMV;
2130 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS){
2131 #ifdef AMAZON_MEI_DEBUG_ON
2132 printk("\n\nCMV fail, Group 2 Address 0 Index 0");
2134 CLR_FLAG((&(pts.adslLineExtTableEntry_pt->flags)), LINE_GLITE_POWER_STATE_FLAG);
2137 memcpy((&(pts.adslLineExtTableEntry_pt->adslLineGlitePowerState)), RxMessage+4, ((RxMessage[0]&0xf)*2));
2140 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), LINE_GLITE_POWER_STATE_FLAG
);
2142 copy_to_user((char *)lon
, (char *)pts
.adslLineExtTableEntry_pt
, sizeof(adslLineExtTableEntry
));
2143 kfree(pts
.adslLineTableEntry_pt
);
2148 #ifdef AMAZON_MEI_MIB_RFC3440
2149 case SET_ADSL_ATUC_LINE_EXT
:
2150 if(down_interruptible(&mei_sema
))
2151 return -ERESTARTSYS
;
2152 pts
.adslLineExtTableEntry_pt
= (adslLineExtTableEntry
*)kmalloc(sizeof(adslLineExtTableEntry
), GFP_KERNEL
);
2153 copy_from_user((char *)pts
.adslLineExtTableEntry_pt
, (char *)lon
, sizeof(adslLineExtTableEntry
));
2155 //only adslLineTransAtucConfig can be set.
2156 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CAP_FLAG
);
2157 if(IS_FLAG_SET((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CONFIG_FLAG
)){
2158 memcpy(data
,(&(pts
.adslLineExtTableEntry_pt
->adslLineTransAtucConfig
)), 2);
2159 ATUC_LINE_TRANS_CONFIG_FLAG_MAKECMV_WR
;
2160 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2161 #ifdef AMAZON_MEI_DEBUG_ON
2162 printk("\n\nCMV fail, Group 3 Address 67 Index 0");
2164 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_CONFIG_FLAG
);
2167 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), ATUC_LINE_TRANS_ACTUAL_FLAG
);
2168 CLR_FLAG((&(pts
.adslLineExtTableEntry_pt
->flags
)), LINE_GLITE_POWER_STATE_FLAG
);
2170 copy_to_user((char *)lon
, (char *)pts
.adslLineExtTableEntry_pt
, sizeof(adslLineExtTableEntry
));
2171 kfree(pts
.adslLineTableEntry_pt
);
2176 case GET_ADSL_ATUC_PHY
:
2177 if(down_interruptible(&mei_sema
))
2178 return -ERESTARTSYS
;
2180 pts
.adslAtucPhysEntry_pt
= (adslAtucPhysEntry
*)kmalloc(sizeof(adslAtucPhysEntry
), GFP_KERNEL
);
2181 copy_from_user((char *)pts
.adslAtucPhysEntry_pt
, (char *)lon
, sizeof(adslAtucPhysEntry
));
2182 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_SER_NUM_FLAG
)){
2183 ATUC_PHY_SER_NUM_FLAG_MAKECMV1
;
2184 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2185 #ifdef AMAZON_MEI_DEBUG_ON
2186 printk("\n\nCMV fail, Group 3 Address 57 Index 0");
2188 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_SER_NUM_FLAG
);
2191 memcpy(pts
.adslAtucPhysEntry_pt
->serial_no
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2193 ATUC_PHY_SER_NUM_FLAG_MAKECMV2
;
2194 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2195 #ifdef AMAZON_MEI_DEBUG_ON
2196 printk("\n\nCMV fail, Group 3 Address 57 Index 12");
2198 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_SER_NUM_FLAG
);
2201 memcpy((pts
.adslAtucPhysEntry_pt
->serial_no
+24), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2204 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_VENDOR_ID_FLAG
)){
2205 ATUC_PHY_VENDOR_ID_FLAG_MAKECMV
;
2206 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2207 #ifdef AMAZON_MEI_DEBUG_ON
2208 printk("\n\nCMV fail, Group 3 Address 64 Index 0");
2210 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_VENDOR_ID_FLAG
);
2213 memcpy(pts
.adslAtucPhysEntry_pt
->vendor_id
.vendor_id
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2216 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_VER_NUM_FLAG
)){
2217 ATUC_PHY_VER_NUM_FLAG_MAKECMV
;
2218 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2219 #ifdef AMAZON_MEI_DEBUG_ON
2220 printk("\n\nCMV fail, Group 3 Address 58 Index 0");
2222 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_PHY_VER_NUM_FLAG
);
2225 memcpy(pts
.adslAtucPhysEntry_pt
->version_no
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2228 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_CURR_STAT_FLAG
)){
2229 pts
.adslAtucPhysEntry_pt
->status
= CurrStatus
.adslAtucCurrStatus
;
2231 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_CURR_OUT_PWR_FLAG
)){
2232 ATUC_CURR_OUT_PWR_FLAG_MAKECMV
;
2233 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2234 #ifdef AMAZON_MEI_DEBUG_ON
2235 printk("\n\nCMV fail, Group 3 Address 68 Index 5");
2237 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_CURR_OUT_PWR_FLAG
);
2240 memcpy((&(pts
.adslAtucPhysEntry_pt
->outputPwr
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2243 if(IS_FLAG_SET((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_CURR_ATTR_FLAG
)){
2244 ATUC_CURR_ATTR_FLAG_MAKECMV
;
2245 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2246 #ifdef AMAZON_MEI_DEBUG_ON
2247 printk("\n\nCMV fail, Group 3 Address 69 Index 0");
2249 CLR_FLAG((&(pts
.adslAtucPhysEntry_pt
->flags
)), ATUC_CURR_ATTR_FLAG
);
2252 memcpy((&(pts
.adslAtucPhysEntry_pt
->attainableRate
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2255 copy_to_user((char *)lon
, (char *)pts
.adslAtucPhysEntry_pt
, sizeof(adslAtucPhysEntry
));
2256 kfree(pts
.adslAtucPhysEntry_pt
);
2260 case GET_ADSL_ATUR_PHY
:
2261 if(down_interruptible(&mei_sema
))
2262 return -ERESTARTSYS
;
2264 pts
.adslAturPhysEntry_pt
= (adslAturPhysEntry
*)kmalloc(sizeof(adslAturPhysEntry
), GFP_KERNEL
);
2265 copy_from_user((char *)pts
.adslAturPhysEntry_pt
, (char *)lon
, sizeof(adslAturPhysEntry
));
2266 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_SER_NUM_FLAG
)){
2267 ATUR_PHY_SER_NUM_FLAG_MAKECMV1
;
2268 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2269 #ifdef AMAZON_MEI_DEBUG_ON
2270 printk("\n\nCMV fail, Group 3 Address 62 Index 0");
2272 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_SER_NUM_FLAG
);
2275 memcpy(pts
.adslAturPhysEntry_pt
->serial_no
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2277 ATUR_PHY_SER_NUM_FLAG_MAKECMV2
;
2278 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2279 #ifdef AMAZON_MEI_DEBUG_ON
2280 printk("\n\nCMV fail, Group 3 Address 62 Index 12");
2282 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_SER_NUM_FLAG
);
2285 memcpy((pts
.adslAturPhysEntry_pt
->serial_no
+24), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2288 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_VENDOR_ID_FLAG
)){
2289 ATUR_PHY_VENDOR_ID_FLAG_MAKECMV
;
2290 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2291 #ifdef AMAZON_MEI_DEBUG_ON
2292 printk("\n\nCMV fail, Group 3 Address 65 Index 0");
2294 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_VENDOR_ID_FLAG
);
2297 memcpy(pts
.adslAturPhysEntry_pt
->vendor_id
.vendor_id
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2300 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_VER_NUM_FLAG
)){
2301 ATUR_PHY_VER_NUM_FLAG_MAKECMV
;
2302 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2303 #ifdef AMAZON_MEI_DEBUG_ON
2304 printk("\n\nCMV fail, Group 3 Address 61 Index 0");
2306 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_PHY_VER_NUM_FLAG
);
2309 memcpy(pts
.adslAturPhysEntry_pt
->version_no
, RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2312 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_SNRMGN_FLAG
)){
2313 ATUR_SNRMGN_FLAG_MAKECMV
;
2314 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2315 #ifdef AMAZON_MEI_DEBUG_ON
2316 printk("\n\nCMV fail, Group 3 Address 68 Index 4");
2318 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_SNRMGN_FLAG
);
2321 memcpy((&(pts
.adslAturPhysEntry_pt
->SnrMgn
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2324 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_ATTN_FLAG
)){
2325 ATUR_ATTN_FLAG_MAKECMV
;
2326 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2327 #ifdef AMAZON_MEI_DEBUG_ON
2328 printk("\n\nCMV fail, Group 3 Address 68 Index 2");
2330 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_ATTN_FLAG
);
2333 memcpy((&(pts
.adslAturPhysEntry_pt
->Attn
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2336 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_CURR_STAT_FLAG
)){
2337 pts
.adslAturPhysEntry_pt
->status
= CurrStatus
.adslAturCurrStatus
;
2339 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_CURR_OUT_PWR_FLAG
)){
2340 ATUR_CURR_OUT_PWR_FLAG_MAKECMV
;
2341 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2342 #ifdef AMAZON_MEI_DEBUG_ON
2343 printk("\n\nCMV fail, Group 3 Address 69 Index 5");
2345 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_CURR_OUT_PWR_FLAG
);
2348 memcpy((&(pts
.adslAturPhysEntry_pt
->outputPwr
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2351 if(IS_FLAG_SET((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_CURR_ATTR_FLAG
)){
2352 ATUR_CURR_ATTR_FLAG_MAKECMV
;
2353 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2354 #ifdef AMAZON_MEI_DEBUG_ON
2355 printk("\n\nCMV fail, Group 3 Address 68 Index 0");
2357 CLR_FLAG((&(pts
.adslAturPhysEntry_pt
->flags
)), ATUR_CURR_ATTR_FLAG
);
2360 memcpy((&(pts
.adslAturPhysEntry_pt
->attainableRate
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2363 copy_to_user((char *)lon
, (char *)pts
.adslAturPhysEntry_pt
, sizeof(adslAturPhysEntry
));
2364 kfree(pts
.adslAturPhysEntry_pt
);
2368 case GET_ADSL_ATUC_CHAN_INFO
:
2369 if(down_interruptible(&mei_sema
))
2370 return -ERESTARTSYS
;
2372 pts
.adslAtucChanInfo_pt
= (adslAtucChanInfo
*)kmalloc(sizeof(adslAtucChanInfo
), GFP_KERNEL
);
2373 copy_from_user((char *)pts
.adslAtucChanInfo_pt
, (char *)lon
, sizeof(adslAtucChanInfo
));
2374 if(IS_FLAG_SET((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_INTLV_DELAY_FLAG
)){
2375 if((chantype
.interleave
!=1) || (chantype
.fast
==1)){
2376 CLR_FLAG((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_INTLV_DELAY_FLAG
);
2379 ATUC_CHAN_INTLV_DELAY_FLAG_MAKECMV
;
2380 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2381 #ifdef AMAZON_MEI_DEBUG_ON
2382 printk("\n\nCMV fail, Group 6 Address 3 Index 1");
2384 CLR_FLAG((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_INTLV_DELAY_FLAG
);
2387 memcpy((&(pts
.adslAtucChanInfo_pt
->interleaveDelay
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2391 if(IS_FLAG_SET((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_CURR_TX_RATE_FLAG
)){
2392 ATUC_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
2393 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2394 #ifdef AMAZON_MEI_DEBUG_ON
2395 printk("\n\nCMV fail, Group 6 Address 1 Index 0");
2397 CLR_FLAG((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_CURR_TX_RATE_FLAG
);
2400 pts
.adslAtucChanInfo_pt
->currTxRate
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
2403 if(IS_FLAG_SET((&(pts
.adslAtucChanInfo_pt
->flags
)), ATUC_CHAN_PREV_TX_RATE_FLAG
)){
2404 pts
.adslAtucChanInfo_pt
->prevTxRate
= PrevTxRate
.adslAtucChanPrevTxRate
;
2406 copy_to_user((char *)lon
, (char *)pts
.adslAtucChanInfo_pt
, sizeof(adslAtucChanInfo
));
2407 kfree(pts
.adslAtucChanInfo_pt
);
2411 case GET_ADSL_ATUR_CHAN_INFO
:
2412 if(down_interruptible(&mei_sema
))
2413 return -ERESTARTSYS
;
2415 pts
.adslAturChanInfo_pt
= (adslAturChanInfo
*)kmalloc(sizeof(adslAturChanInfo
), GFP_KERNEL
);
2416 copy_from_user((char *)pts
.adslAturChanInfo_pt
, (char *)lon
, sizeof(adslAturChanInfo
));
2417 if(IS_FLAG_SET((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_INTLV_DELAY_FLAG
)){
2418 if((chantype
.interleave
!=1) || (chantype
.fast
==1)){
2419 CLR_FLAG((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_INTLV_DELAY_FLAG
);
2422 ATUR_CHAN_INTLV_DELAY_FLAG_MAKECMV
;
2423 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2424 #ifdef AMAZON_MEI_DEBUG_ON
2425 printk("\n\nCMV fail, Group 6 Address 2 Index 1");
2427 CLR_FLAG((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_INTLV_DELAY_FLAG
);
2430 memcpy((&(pts
.adslAturChanInfo_pt
->interleaveDelay
)), RxMessage
+4, ((RxMessage
[0]&0xf)*2));
2434 if(IS_FLAG_SET((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_CURR_TX_RATE_FLAG
)){
2435 ATUR_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
2436 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
2437 #ifdef AMAZON_MEI_DEBUG_ON
2438 printk("\n\nCMV fail, Group 6 Address 0 Index 0");
2440 CLR_FLAG((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_CURR_TX_RATE_FLAG
);
2443 pts
.adslAturChanInfo_pt
->currTxRate
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
2446 if(IS_FLAG_SET((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_PREV_TX_RATE_FLAG
)){
2447 pts
.adslAturChanInfo_pt
->prevTxRate
= PrevTxRate
.adslAturChanPrevTxRate
;
2449 if(IS_FLAG_SET((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_CRC_BLK_LEN_FLAG
)){
2450 // ? no CMV to update this
2451 CLR_FLAG((&(pts
.adslAturChanInfo_pt
->flags
)), ATUR_CHAN_CRC_BLK_LEN_FLAG
);
2453 copy_to_user((char *)lon
, (char *)pts
.adslAturChanInfo_pt
, sizeof(adslAturChanInfo
));
2454 kfree(pts
.adslAturChanInfo_pt
);
2458 case GET_ADSL_ATUC_PERF_DATA
:
2459 pts
.atucPerfDataEntry_pt
= (atucPerfDataEntry
*)kmalloc(sizeof(atucPerfDataEntry
), GFP_KERNEL
);
2460 copy_from_user((char *)pts
.atucPerfDataEntry_pt
, (char *)lon
, sizeof(atucPerfDataEntry
));
2461 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_LOFS_FLAG
)){
2462 pts
.atucPerfDataEntry_pt
->adslAtucPerfLofs
=ATUC_PERF_LOFS
;
2464 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_LOSS_FLAG
)){
2465 pts
.atucPerfDataEntry_pt
->adslAtucPerfLoss
=ATUC_PERF_LOSS
;
2467 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_ESS_FLAG
)){
2468 pts
.atucPerfDataEntry_pt
->adslAtucPerfESs
=ATUC_PERF_ESS
;
2470 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_INITS_FLAG
)){
2471 pts
.atucPerfDataEntry_pt
->adslAtucPerfInits
=ATUC_PERF_INITS
;
2473 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_VALID_INTVLS_FLAG
)){
2475 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
2480 pts
.atucPerfDataEntry_pt
->adslAtucPerfValidIntervals
=i
;
2482 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_INVALID_INTVLS_FLAG
)){
2483 pts
.atucPerfDataEntry_pt
->adslAtucPerfInvalidIntervals
=0;
2485 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_TIME_ELAPSED_FLAG
)){
2486 do_gettimeofday(&time_now
);
2487 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr15MinTimeElapsed
=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
2489 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_LOFS_FLAG
)){
2490 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr15MinLofs
=current_intvl
->AtucPerfLof
;
2492 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_LOSS_FLAG
)){
2493 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr15MinLoss
=current_intvl
->AtucPerfLos
;
2495 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_ESS_FLAG
)){
2496 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr15MinESs
=current_intvl
->AtucPerfEs
;
2498 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_INIT_FLAG
)){
2499 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr15MinInits
=current_intvl
->AtucPerfInit
;
2501 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_TIME_ELAPSED_FLAG
)){
2503 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
2506 do_gettimeofday(&time_now
);
2507 i
+=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
2509 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayTimeElapsed
=i
-86400;
2511 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayTimeElapsed
=i
;
2513 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_LOFS_FLAG
)){
2516 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2517 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2518 j
+=mib_ptr
->AtucPerfLof
;
2523 j
+=current_intvl
->AtucPerfLof
;
2524 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayLofs
=j
;
2526 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_LOSS_FLAG
)){
2529 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2530 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2531 j
+=mib_ptr
->AtucPerfLos
;
2536 j
+=current_intvl
->AtucPerfLos
;
2537 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayLoss
=j
;
2539 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_ESS_FLAG
)){
2542 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2543 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2544 j
+=mib_ptr
->AtucPerfEs
;
2549 j
+=current_intvl
->AtucPerfEs
;
2550 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayESs
=j
;
2552 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_INIT_FLAG
)){
2555 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2556 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2557 j
+=mib_ptr
->AtucPerfInit
;
2562 j
+=current_intvl
->AtucPerfInit
;
2563 pts
.atucPerfDataEntry_pt
->adslAtucPerfCurr1DayInits
=j
;
2565 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_MON_SEC_FLAG
)){
2567 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2571 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayMoniSecs
=86400;
2573 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayMoniSecs
=0;
2575 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_LOFS_FLAG
)){
2578 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2579 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2580 j
+=mib_ptr
->AtucPerfLof
;
2586 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayLofs
=j
;
2588 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayLofs
=0;
2590 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_LOSS_FLAG
)){
2593 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2594 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2595 j
+=mib_ptr
->AtucPerfLos
;
2601 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayLoss
=j
;
2603 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayLoss
=0;
2605 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_ESS_FLAG
)){
2608 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2609 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2610 j
+=mib_ptr
->AtucPerfEs
;
2616 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayESs
=j
;
2618 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayESs
=0;
2620 if(IS_FLAG_SET((&(pts
.atucPerfDataEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_INITS_FLAG
)){
2623 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2624 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2625 j
+=mib_ptr
->AtucPerfInit
;
2631 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayInits
=j
;
2633 pts
.atucPerfDataEntry_pt
->adslAtucPerfPrev1DayInits
=0;
2636 copy_to_user((char *)lon
, (char *)pts
.atucPerfDataEntry_pt
, sizeof(atucPerfDataEntry
));
2637 kfree(pts
.atucPerfDataEntry_pt
);
2639 #ifdef AMAZON_MEI_MIB_RFC3440
2640 case GET_ADSL_ATUC_PERF_DATA_EXT
: //??? CMV mapping not available
2641 pts
.atucPerfDataExtEntry_pt
= (atucPerfDataExtEntry
*)kmalloc(sizeof(atucPerfDataExtEntry
), GFP_KERNEL
);
2642 copy_from_user((char *)pts
.atucPerfDataExtEntry_pt
, (char *)lon
, sizeof(atucPerfDataExtEntry
));
2643 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_STAT_FASTR_FLAG
)){
2644 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfStatFastR
=ATUC_PERF_STAT_FASTR
;
2646 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_STAT_FAILED_FASTR_FLAG
)){
2647 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfStatFailedFastR
=ATUC_PERF_STAT_FAILED_FASTR
;
2649 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_STAT_SESL_FLAG
)){
2650 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfStatSesL
=ATUC_PERF_STAT_SESL
;
2652 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_STAT_UASL_FLAG
)){
2653 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfStatUasL
=ATUC_PERF_STAT_UASL
;
2655 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_FASTR_FLAG
)){
2656 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr15MinFastR
=current_intvl
->AtucPerfStatFastR
;
2658 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_FAILED_FASTR_FLAG
)){
2659 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr15MinFailedFastR
=current_intvl
->AtucPerfStatFailedFastR
;
2661 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_SESL_FLAG
)){
2662 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr15MinSesL
=current_intvl
->AtucPerfStatSesL
;
2664 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_15MIN_UASL_FLAG
)){
2665 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr15MinUasL
=current_intvl
->AtucPerfStatUasL
;
2667 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_FASTR_FLAG
)){
2670 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2671 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2672 j
+=mib_ptr
->AtucPerfStatFastR
;
2677 j
+=current_intvl
->AtucPerfStatFastR
;
2678 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr1DayFastR
=j
;
2680 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_FAILED_FASTR_FLAG
)){
2683 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2684 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2685 j
+=mib_ptr
->AtucPerfStatFailedFastR
;
2690 j
+=current_intvl
->AtucPerfStatFailedFastR
;
2691 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr1DayFailedFastR
=j
;
2693 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_SESL_FLAG
)){
2696 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2697 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2698 j
+=mib_ptr
->AtucPerfStatSesL
;
2703 j
+=current_intvl
->AtucPerfStatSesL
;
2704 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr1DaySesL
=j
;
2706 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_CURR_1DAY_UASL_FLAG
)){
2709 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2710 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2711 j
+=mib_ptr
->AtucPerfStatUasL
;
2716 j
+=current_intvl
->AtucPerfStatUasL
;
2717 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfCurr1DayUasL
=j
;
2719 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_FASTR_FLAG
)){
2722 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2723 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2724 j
+=mib_ptr
->AtucPerfStatFastR
;
2730 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayFastR
=j
;
2732 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayFastR
=0;
2734 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_FAILED_FASTR_FLAG
)){
2737 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2738 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2739 j
+=mib_ptr
->AtucPerfStatFailedFastR
;
2745 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayFailedFastR
=j
;
2747 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayFailedFastR
=0;
2749 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_SESL_FLAG
)){
2752 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2753 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2754 j
+=mib_ptr
->AtucPerfStatSesL
;
2760 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DaySesL
=j
;
2762 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DaySesL
=0;
2764 if(IS_FLAG_SET((&(pts
.atucPerfDataExtEntry_pt
->flags
)), ATUC_PERF_PREV_1DAY_UASL_FLAG
)){
2767 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2768 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2769 j
+=mib_ptr
->AtucPerfStatUasL
;
2775 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayUasL
=j
;
2777 pts
.atucPerfDataExtEntry_pt
->adslAtucPerfPrev1DayUasL
=0;
2779 copy_to_user((char *)lon
, (char *)pts
.atucPerfDataExtEntry_pt
, sizeof(atucPerfDataExtEntry
));
2780 kfree(pts
.atucPerfDataExtEntry_pt
);
2783 case GET_ADSL_ATUR_PERF_DATA
:
2784 pts
.aturPerfDataEntry_pt
= (aturPerfDataEntry
*)kmalloc(sizeof(aturPerfDataEntry
), GFP_KERNEL
);
2785 copy_from_user((char *)pts
.aturPerfDataEntry_pt
, (char *)lon
, sizeof(aturPerfDataEntry
));
2786 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_LOFS_FLAG
)){
2787 pts
.aturPerfDataEntry_pt
->adslAturPerfLofs
=ATUR_PERF_LOFS
;
2789 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_LOSS_FLAG
)){
2790 pts
.aturPerfDataEntry_pt
->adslAturPerfLoss
=ATUR_PERF_LOSS
;
2792 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_LPR_FLAG
)){
2793 pts
.aturPerfDataEntry_pt
->adslAturPerfLprs
=ATUR_PERF_LPR
;
2795 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_ESS_FLAG
)){
2796 pts
.aturPerfDataEntry_pt
->adslAturPerfESs
=ATUR_PERF_ESS
;
2798 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_VALID_INTVLS_FLAG
)){
2800 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
2805 pts
.aturPerfDataEntry_pt
->adslAturPerfValidIntervals
=i
;
2807 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_INVALID_INTVLS_FLAG
)){
2808 pts
.aturPerfDataEntry_pt
->adslAturPerfInvalidIntervals
=0;
2810 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_TIME_ELAPSED_FLAG
)){
2811 do_gettimeofday(&time_now
);
2812 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr15MinTimeElapsed
=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
2814 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_LOFS_FLAG
)){
2815 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr15MinLofs
=current_intvl
->AturPerfLof
;
2817 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_LOSS_FLAG
)){
2818 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr15MinLoss
=current_intvl
->AturPerfLos
;
2820 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_LPR_FLAG
)){
2821 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr15MinLprs
=current_intvl
->AturPerfLpr
;
2823 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_ESS_FLAG
)){
2824 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr15MinESs
=current_intvl
->AturPerfEs
;
2826 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_TIME_ELAPSED_FLAG
)){
2828 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
2831 do_gettimeofday(&time_now
);
2832 i
+=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
2834 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayTimeElapsed
=i
-86400;
2836 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayTimeElapsed
=i
;
2838 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_LOFS_FLAG
)){
2841 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2842 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2843 j
+=mib_ptr
->AturPerfLof
;
2848 j
+=current_intvl
->AturPerfLof
;
2849 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayLofs
=j
;
2851 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_LOSS_FLAG
)){
2854 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2855 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2856 j
+=mib_ptr
->AturPerfLos
;
2861 j
+=current_intvl
->AturPerfLos
;
2862 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayLoss
=j
;
2864 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_LPR_FLAG
)){
2867 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2868 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2869 j
+=mib_ptr
->AturPerfLpr
;
2874 j
+=current_intvl
->AturPerfLpr
;
2875 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayLprs
=j
;
2877 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_ESS_FLAG
)){
2880 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2881 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2882 j
+=mib_ptr
->AturPerfEs
;
2887 j
+=current_intvl
->AturPerfEs
;
2888 pts
.aturPerfDataEntry_pt
->adslAturPerfCurr1DayESs
=j
;
2890 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_MON_SEC_FLAG
)){
2892 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2896 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayMoniSecs
=86400;
2898 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayMoniSecs
=0;
2900 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_LOFS_FLAG
)){
2903 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2904 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2905 j
+=mib_ptr
->AturPerfLof
;
2911 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLofs
=j
;
2913 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLofs
=0;
2915 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_LOSS_FLAG
)){
2918 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2919 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2920 j
+=mib_ptr
->AturPerfLos
;
2926 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLoss
=j
;
2928 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLoss
=0;
2930 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_LPR_FLAG
)){
2933 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2934 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2935 j
+=mib_ptr
->AturPerfLpr
;
2941 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLprs
=j
;
2943 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayLprs
=0;
2945 if(IS_FLAG_SET((&(pts
.aturPerfDataEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_ESS_FLAG
)){
2948 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2949 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2950 j
+=mib_ptr
->AturPerfEs
;
2956 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayESs
=j
;
2958 pts
.aturPerfDataEntry_pt
->adslAturPerfPrev1DayESs
=0;
2961 copy_to_user((char *)lon
, (char *)pts
.aturPerfDataEntry_pt
, sizeof(aturPerfDataEntry
));
2962 kfree(pts
.aturPerfDataEntry_pt
);
2964 #ifdef AMAZON_MEI_MIB_RFC3440
2965 case GET_ADSL_ATUR_PERF_DATA_EXT
:
2966 pts
.aturPerfDataExtEntry_pt
= (aturPerfDataExtEntry
*)kmalloc(sizeof(aturPerfDataExtEntry
), GFP_KERNEL
);
2967 copy_from_user((char *)pts
.aturPerfDataExtEntry_pt
, (char *)lon
, sizeof(aturPerfDataExtEntry
));
2968 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_STAT_SESL_FLAG
)){
2969 pts
.aturPerfDataExtEntry_pt
->adslAturPerfStatSesL
=ATUR_PERF_STAT_SESL
;
2971 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_STAT_UASL_FLAG
)){
2972 pts
.aturPerfDataExtEntry_pt
->adslAturPerfStatUasL
=ATUR_PERF_STAT_UASL
;
2974 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_SESL_FLAG
)){
2975 pts
.aturPerfDataExtEntry_pt
->adslAturPerfCurr15MinSesL
=current_intvl
->AturPerfStatSesL
;
2977 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_CURR_15MIN_UASL_FLAG
)){
2978 pts
.aturPerfDataExtEntry_pt
->adslAturPerfCurr15MinUasL
=current_intvl
->AturPerfStatUasL
;
2980 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_SESL_FLAG
)){
2983 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2984 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2985 j
+=mib_ptr
->AturPerfStatSesL
;
2990 j
+=current_intvl
->AturPerfStatSesL
;
2991 pts
.aturPerfDataExtEntry_pt
->adslAturPerfCurr1DaySesL
=j
;
2993 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_CURR_1DAY_UASL_FLAG
)){
2996 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
2997 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
2998 j
+=mib_ptr
->AturPerfStatUasL
;
3003 j
+=current_intvl
->AturPerfStatUasL
;
3004 pts
.aturPerfDataExtEntry_pt
->adslAturPerfCurr1DayUasL
=j
;
3006 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_SESL_FLAG
)){
3009 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3010 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3011 j
+=mib_ptr
->AturPerfStatSesL
;
3017 pts
.aturPerfDataExtEntry_pt
->adslAturPerfPrev1DaySesL
=j
;
3019 pts
.aturPerfDataExtEntry_pt
->adslAturPerfPrev1DaySesL
=0;
3021 if(IS_FLAG_SET((&(pts
.aturPerfDataExtEntry_pt
->flags
)), ATUR_PERF_PREV_1DAY_UASL_FLAG
)){
3024 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3025 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3026 j
+=mib_ptr
->AturPerfStatUasL
;
3032 pts
.aturPerfDataExtEntry_pt
->adslAturPerfPrev1DayUasL
=j
;
3034 pts
.aturPerfDataExtEntry_pt
->adslAturPerfPrev1DayUasL
=0;
3036 copy_to_user((char *)lon
, (char *)pts
.aturPerfDataExtEntry_pt
, sizeof(aturPerfDataExtEntry
));
3037 kfree(pts
.aturPerfDataExtEntry_pt
);
3040 case GET_ADSL_ATUC_INTVL_INFO
:
3041 pts
.adslAtucIntvlInfo_pt
= (adslAtucIntvlInfo
*)kmalloc(sizeof(adslAtucIntvlInfo
), GFP_KERNEL
);
3042 copy_from_user((char *)pts
.adslAtucIntvlInfo_pt
, (char *)lon
, sizeof(adslAtucIntvlInfo
));
3044 if(pts
.adslAtucIntvlInfo_pt
->IntervalNumber
<1){
3045 pts
.adslAtucIntvlInfo_pt
->intervalLOF
= ATUC_PERF_LOFS
;
3046 pts
.adslAtucIntvlInfo_pt
->intervalLOS
= ATUC_PERF_LOSS
;
3047 pts
.adslAtucIntvlInfo_pt
->intervalES
= ATUC_PERF_ESS
;
3048 pts
.adslAtucIntvlInfo_pt
->intervalInits
= ATUC_PERF_INITS
;
3049 pts
.adslAtucIntvlInfo_pt
->intervalValidData
= 1;
3053 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3055 if(i
==pts
.adslAtucIntvlInfo_pt
->IntervalNumber
){
3056 temp_intvl
= list_entry(ptr
, amazon_mei_mib
, list
);
3057 pts
.adslAtucIntvlInfo_pt
->intervalLOF
= temp_intvl
->AtucPerfLof
;
3058 pts
.adslAtucIntvlInfo_pt
->intervalLOS
= temp_intvl
->AtucPerfLos
;
3059 pts
.adslAtucIntvlInfo_pt
->intervalES
= temp_intvl
->AtucPerfEs
;
3060 pts
.adslAtucIntvlInfo_pt
->intervalInits
= temp_intvl
->AtucPerfInit
;
3061 pts
.adslAtucIntvlInfo_pt
->intervalValidData
= 1;
3065 if(ptr
==&interval_list
){
3066 pts
.adslAtucIntvlInfo_pt
->intervalValidData
= 0;
3067 pts
.adslAtucIntvlInfo_pt
->flags
= 0;
3068 pts
.adslAtucIntvlInfo_pt
->intervalLOF
= 0;
3069 pts
.adslAtucIntvlInfo_pt
->intervalLOS
= 0;
3070 pts
.adslAtucIntvlInfo_pt
->intervalES
= 0;
3071 pts
.adslAtucIntvlInfo_pt
->intervalInits
= 0;
3075 copy_to_user((char *)lon
, (char *)pts
.adslAtucIntvlInfo_pt
, sizeof(adslAtucIntvlInfo
));
3076 kfree(pts
.adslAtucIntvlInfo_pt
);
3078 #ifdef AMAZON_MEI_MIB_RFC3440
3079 case GET_ADSL_ATUC_INTVL_EXT_INFO
:
3080 pts
.adslAtucInvtlExtInfo_pt
= (adslAtucInvtlExtInfo
*)kmalloc(sizeof(adslAtucInvtlExtInfo
), GFP_KERNEL
);
3081 copy_from_user((char *)pts
.adslAtucInvtlExtInfo_pt
, (char *)lon
, sizeof(adslAtucInvtlExtInfo
));
3082 if(pts
.adslAtucInvtlExtInfo_pt
->IntervalNumber
<1){
3083 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFastR
= ATUC_PERF_STAT_FASTR
;
3084 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFailedFastR
= ATUC_PERF_STAT_FAILED_FASTR
;
3085 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalSesL
= ATUC_PERF_STAT_SESL
;
3086 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalUasL
= ATUC_PERF_STAT_UASL
;
3087 // pts.adslAtucInvtlExtInfo_pt->intervalValidData = 1;
3091 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3093 if(i
==pts
.adslAtucInvtlExtInfo_pt
->IntervalNumber
){
3094 temp_intvl
= list_entry(ptr
, amazon_mei_mib
, list
);
3095 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFastR
= temp_intvl
->AtucPerfStatFastR
;
3096 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFailedFastR
= temp_intvl
->AtucPerfStatFailedFastR
;
3097 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalSesL
= temp_intvl
->AtucPerfStatSesL
;
3098 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalUasL
= temp_intvl
->AtucPerfStatUasL
;
3099 // pts.adslAtucInvtlExtInfo_pt->intervalValidData = 1;
3103 if(ptr
==&interval_list
){
3104 // pts.adslAtucInvtlExtInfo_pt->intervalValidData = 0;
3105 pts
.adslAtucInvtlExtInfo_pt
->flags
= 0;
3106 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFastR
= 0;
3107 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalFailedFastR
= 0;
3108 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalSesL
= 0;
3109 pts
.adslAtucInvtlExtInfo_pt
->adslAtucIntervalUasL
= 0;
3112 copy_to_user((char *)lon
, (char *)pts
.adslAtucInvtlExtInfo_pt
, sizeof(adslAtucInvtlExtInfo
));
3113 kfree(pts
.adslAtucInvtlExtInfo_pt
);
3116 case GET_ADSL_ATUR_INTVL_INFO
:
3117 pts
.adslAturIntvlInfo_pt
= (adslAturIntvlInfo
*)kmalloc(sizeof(adslAturIntvlInfo
), GFP_KERNEL
);
3118 copy_from_user((char *)pts
.adslAturIntvlInfo_pt
, (char *)lon
, sizeof(adslAturIntvlInfo
));
3120 if(pts
.adslAturIntvlInfo_pt
->IntervalNumber
<1){
3121 pts
.adslAturIntvlInfo_pt
->intervalLOF
= ATUR_PERF_LOFS
;
3122 pts
.adslAturIntvlInfo_pt
->intervalLOS
= ATUR_PERF_LOSS
;
3123 pts
.adslAturIntvlInfo_pt
->intervalES
= ATUR_PERF_ESS
;
3124 pts
.adslAturIntvlInfo_pt
->intervalLPR
= ATUR_PERF_LPR
;
3125 pts
.adslAturIntvlInfo_pt
->intervalValidData
= 1;
3129 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3131 if(i
==pts
.adslAturIntvlInfo_pt
->IntervalNumber
){
3132 temp_intvl
= list_entry(ptr
, amazon_mei_mib
, list
);
3133 pts
.adslAturIntvlInfo_pt
->intervalLOF
= temp_intvl
->AturPerfLof
;
3134 pts
.adslAturIntvlInfo_pt
->intervalLOS
= temp_intvl
->AturPerfLos
;
3135 pts
.adslAturIntvlInfo_pt
->intervalES
= temp_intvl
->AturPerfEs
;
3136 pts
.adslAturIntvlInfo_pt
->intervalLPR
= temp_intvl
->AturPerfLpr
;
3137 pts
.adslAturIntvlInfo_pt
->intervalValidData
= 1;
3141 if(ptr
==&interval_list
){
3142 pts
.adslAturIntvlInfo_pt
->intervalValidData
= 0;
3143 pts
.adslAturIntvlInfo_pt
->flags
= 0;
3144 pts
.adslAturIntvlInfo_pt
->intervalLOF
= 0;
3145 pts
.adslAturIntvlInfo_pt
->intervalLOS
= 0;
3146 pts
.adslAturIntvlInfo_pt
->intervalES
= 0;
3147 pts
.adslAturIntvlInfo_pt
->intervalLPR
= 0;
3151 copy_to_user((char *)lon
, (char *)pts
.adslAturIntvlInfo_pt
, sizeof(adslAturIntvlInfo
));
3152 kfree(pts
.adslAturIntvlInfo_pt
);
3154 #ifdef AMAZON_MEI_MIB_RFC3440
3155 case GET_ADSL_ATUR_INTVL_EXT_INFO
:
3156 pts
.adslAturInvtlExtInfo_pt
= (adslAturInvtlExtInfo
*)kmalloc(sizeof(adslAturInvtlExtInfo
), GFP_KERNEL
);
3157 copy_from_user((char *)pts
.adslAturInvtlExtInfo_pt
, (char *)lon
, sizeof(adslAturInvtlExtInfo
));
3159 if(pts
.adslAturInvtlExtInfo_pt
->IntervalNumber
<1){
3160 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalSesL
= ATUR_PERF_STAT_SESL
;
3161 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalUasL
= ATUR_PERF_STAT_UASL
;
3162 // pts.adslAturInvtlExtInfo_pt->intervalValidData = 1;
3166 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3168 if(i
==pts
.adslAturInvtlExtInfo_pt
->IntervalNumber
){
3169 temp_intvl
= list_entry(ptr
, amazon_mei_mib
, list
);
3170 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalSesL
= temp_intvl
->AturPerfStatSesL
;
3171 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalUasL
= temp_intvl
->AturPerfStatUasL
;
3172 // pts.adslAturInvtlExtInfo_pt->intervalValidData = 1;
3176 if(ptr
==&interval_list
){
3177 // pts.adslAturInvtlExtInfo_pt->intervalValidData = 0;
3178 pts
.adslAturInvtlExtInfo_pt
->flags
= 0;
3179 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalSesL
= 0;
3180 pts
.adslAturInvtlExtInfo_pt
->adslAturIntervalUasL
= 0;
3184 copy_to_user((char *)lon
, (char *)pts
.adslAturInvtlExtInfo_pt
, sizeof(adslAturInvtlExtInfo
));
3185 kfree(pts
.adslAturInvtlExtInfo_pt
);
3188 case GET_ADSL_ATUC_CHAN_PERF_DATA
:
3189 pts
.atucChannelPerfDataEntry_pt
= (atucChannelPerfDataEntry
*)kmalloc(sizeof(atucChannelPerfDataEntry
), GFP_KERNEL
);
3190 copy_from_user((char *)pts
.atucChannelPerfDataEntry_pt
, (char *)lon
, sizeof(atucChannelPerfDataEntry
));
3192 pts
.atucChannelPerfDataEntry_pt
->flags
= 0;
3194 copy_to_user((char *)lon
, (char *)pts
.atucChannelPerfDataEntry_pt
, sizeof(atucChannelPerfDataEntry
));
3195 kfree(pts
.atucChannelPerfDataEntry_pt
);
3197 case GET_ADSL_ATUR_CHAN_PERF_DATA
:
3198 pts
.aturChannelPerfDataEntry_pt
= (aturChannelPerfDataEntry
*)kmalloc(sizeof(aturChannelPerfDataEntry
), GFP_KERNEL
);
3199 copy_from_user((char *)pts
.aturChannelPerfDataEntry_pt
, (char *)lon
, sizeof(aturChannelPerfDataEntry
));
3200 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_RECV_BLK_FLAG
)){
3201 pts
.aturChannelPerfDataEntry_pt
->adslAturChanReceivedBlks
=ATUR_CHAN_RECV_BLK
;
3203 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_TX_BLK_FLAG
)){
3204 pts
.aturChannelPerfDataEntry_pt
->adslAturChanTransmittedBlks
=ATUR_CHAN_TX_BLK
;
3206 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_CORR_BLK_FLAG
)){
3207 pts
.aturChannelPerfDataEntry_pt
->adslAturChanCorrectedBlks
=ATUR_CHAN_CORR_BLK
;
3209 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_UNCORR_BLK_FLAG
)){
3210 pts
.aturChannelPerfDataEntry_pt
->adslAturChanUncorrectBlks
=ATUR_CHAN_UNCORR_BLK
;
3212 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_VALID_INTVL_FLAG
)){
3214 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3219 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfValidIntervals
=i
;
3221 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_INVALID_INTVL_FLAG
)){
3222 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfInvalidIntervals
=0;
3224 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_15MIN_TIME_ELAPSED_FLAG
)){
3225 do_gettimeofday(&time_now
);
3226 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr15MinTimeElapsed
=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
3228 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_15MIN_RECV_BLK_FLAG
)){
3229 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr15MinReceivedBlks
=current_intvl
->AturChanPerfRxBlk
;
3231 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_15MIN_TX_BLK_FLAG
)){
3232 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr15MinTransmittedBlks
=current_intvl
->AturChanPerfTxBlk
;
3234 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_15MIN_CORR_BLK_FLAG
)){
3235 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr15MinCorrectedBlks
=current_intvl
->AturChanPerfCorrBlk
;
3237 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_15MIN_UNCORR_BLK_FLAG
)){
3238 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr15MinUncorrectBlks
=current_intvl
->AturChanPerfUncorrBlk
;
3240 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_1DAY_TIME_ELAPSED_FLAG
)){
3242 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3245 do_gettimeofday(&time_now
);
3246 i
+=time_now
.tv_sec
- (current_intvl
->start_time
).tv_sec
;
3248 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayTimeElapsed
=i
-86400;
3250 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayTimeElapsed
=i
;
3252 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_1DAY_RECV_BLK_FLAG
)){
3255 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3256 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3257 j
+=mib_ptr
->AturChanPerfRxBlk
;
3262 j
+=current_intvl
->AturChanPerfRxBlk
;
3263 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayReceivedBlks
=j
;
3265 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_1DAY_TX_BLK_FLAG
)){
3268 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3269 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3270 j
+=mib_ptr
->AturChanPerfTxBlk
;
3275 j
+=current_intvl
->AturChanPerfTxBlk
;
3276 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayTransmittedBlks
=j
;
3278 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_1DAY_CORR_BLK_FLAG
)){
3281 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3282 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3283 j
+=mib_ptr
->AturChanPerfCorrBlk
;
3288 j
+=current_intvl
->AturChanPerfCorrBlk
;
3289 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayCorrectedBlks
=j
;
3291 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_CURR_1DAY_UNCORR_BLK_FLAG
)){
3294 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3295 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3296 j
+=mib_ptr
->AturChanPerfUncorrBlk
;
3301 j
+=current_intvl
->AturChanPerfUncorrBlk
;
3302 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfCurr1DayUncorrectBlks
=j
;
3304 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_PREV_1DAY_MONI_SEC_FLAG
)){
3306 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3310 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayMoniSecs
=86400;
3312 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayMoniSecs
=0;
3314 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_PREV_1DAY_RECV_BLK_FLAG
)){
3317 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3318 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3319 j
+=mib_ptr
->AturChanPerfRxBlk
;
3325 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayReceivedBlks
=j
;
3327 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayReceivedBlks
=0;
3329 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_PREV_1DAY_TRANS_BLK_FLAG
)){
3332 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3333 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3334 j
+=mib_ptr
->AturChanPerfTxBlk
;
3340 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayTransmittedBlks
=j
;
3342 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayTransmittedBlks
=0;
3344 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_PREV_1DAY_CORR_BLK_FLAG
)){
3347 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3348 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3349 j
+=mib_ptr
->AturChanPerfCorrBlk
;
3355 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayCorrectedBlks
=j
;
3357 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayCorrectedBlks
=0;
3359 if(IS_FLAG_SET((&(pts
.aturChannelPerfDataEntry_pt
->flags
)), ATUR_CHAN_PERF_PREV_1DAY_UNCORR_BLK_FLAG
)){
3362 for(ptr
=interval_list
.next
; ptr
!=&(current_intvl
->list
); ptr
=ptr
->next
){
3363 mib_ptr
= list_entry(ptr
, amazon_mei_mib
, list
);
3364 j
+=mib_ptr
->AturChanPerfUncorrBlk
;
3370 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayUncorrectBlks
=j
;
3372 pts
.aturChannelPerfDataEntry_pt
->adslAturChanPerfPrev1DayUncorrectBlks
=0;
3375 copy_to_user((char *)lon
, (char *)pts
.aturChannelPerfDataEntry_pt
, sizeof(aturChannelPerfDataEntry
));
3376 kfree(pts
.aturChannelPerfDataEntry_pt
);
3378 case GET_ADSL_ATUC_CHAN_INTVL_INFO
:
3379 pts
.adslAtucChanIntvlInfo_pt
= (adslAtucChanIntvlInfo
*)kmalloc(sizeof(adslAtucChanIntvlInfo
), GFP_KERNEL
);
3380 copy_from_user((char *)pts
.adslAtucChanIntvlInfo_pt
, (char *)lon
, sizeof(adslAtucChanIntvlInfo
));
3382 pts
.adslAtucChanIntvlInfo_pt
->flags
= 0;
3384 copy_to_user((char *)lon
, (char *)pts
.adslAtucChanIntvlInfo_pt
, sizeof(adslAtucChanIntvlInfo
));
3385 kfree(pts
.adslAtucChanIntvlInfo_pt
);
3387 case GET_ADSL_ATUR_CHAN_INTVL_INFO
:
3388 pts
.adslAturChanIntvlInfo_pt
= (adslAturChanIntvlInfo
*)kmalloc(sizeof(adslAturChanIntvlInfo
), GFP_KERNEL
);
3389 copy_from_user((char *)pts
.adslAturChanIntvlInfo_pt
, (char *)lon
, sizeof(adslAturChanIntvlInfo
));
3391 if(pts
.adslAturChanIntvlInfo_pt
->IntervalNumber
<1){
3392 pts
.adslAturChanIntvlInfo_pt
->chanIntervalRecvdBlks
= ATUR_CHAN_RECV_BLK
;
3393 pts
.adslAturChanIntvlInfo_pt
->chanIntervalXmitBlks
= ATUR_CHAN_TX_BLK
;
3394 pts
.adslAturChanIntvlInfo_pt
->chanIntervalCorrectedBlks
= ATUR_CHAN_CORR_BLK
;
3395 pts
.adslAturChanIntvlInfo_pt
->chanIntervalUncorrectBlks
= ATUR_CHAN_UNCORR_BLK
;
3396 pts
.adslAturChanIntvlInfo_pt
->intervalValidData
= 1;
3400 for(ptr
=(current_intvl
->list
).prev
; ptr
!=&interval_list
; ptr
=ptr
->prev
){
3402 if(i
==pts
.adslAturChanIntvlInfo_pt
->IntervalNumber
){
3403 temp_intvl
= list_entry(ptr
, amazon_mei_mib
, list
);
3404 pts
.adslAturChanIntvlInfo_pt
->chanIntervalRecvdBlks
= temp_intvl
->AturChanPerfRxBlk
;
3405 pts
.adslAturChanIntvlInfo_pt
->chanIntervalXmitBlks
= temp_intvl
->AturChanPerfTxBlk
;
3406 pts
.adslAturChanIntvlInfo_pt
->chanIntervalCorrectedBlks
= temp_intvl
->AturChanPerfCorrBlk
;
3407 pts
.adslAturChanIntvlInfo_pt
->chanIntervalUncorrectBlks
= temp_intvl
->AturChanPerfUncorrBlk
;
3408 pts
.adslAturChanIntvlInfo_pt
->intervalValidData
= 1;
3412 if(ptr
==&interval_list
){
3413 pts
.adslAturChanIntvlInfo_pt
->intervalValidData
= 0;
3414 pts
.adslAturChanIntvlInfo_pt
->flags
= 0;
3418 copy_to_user((char *)lon
, (char *)pts
.adslAturChanIntvlInfo_pt
, sizeof(adslAturChanIntvlInfo
));
3419 kfree(pts
.adslAturChanIntvlInfo_pt
);
3421 case GET_ADSL_ALRM_CONF_PROF
:
3422 pts
.adslLineAlarmConfProfileEntry_pt
= (adslLineAlarmConfProfileEntry
*)kmalloc(sizeof(adslLineAlarmConfProfileEntry
), GFP_KERNEL
);
3423 copy_from_user((char *)pts
.adslLineAlarmConfProfileEntry_pt
, (char *)lon
, sizeof(adslLineAlarmConfProfileEntry
));
3425 strncpy(pts
.adslLineAlarmConfProfileEntry_pt
->adslLineAlarmConfProfileName
, AlarmConfProfile
.adslLineAlarmConfProfileName
, 32);
3426 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_LOFS_FLAG
)){
3427 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinLofs
=AlarmConfProfile
.adslAtucThresh15MinLofs
;
3429 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_LOSS_FLAG
)){
3430 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinLoss
=AlarmConfProfile
.adslAtucThresh15MinLoss
;
3432 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_ESS_FLAG
)){
3433 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinESs
=AlarmConfProfile
.adslAtucThresh15MinESs
;
3435 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_FAST_RATEUP_FLAG
)){
3436 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshFastRateUp
=AlarmConfProfile
.adslAtucThreshFastRateUp
;
3438 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_INTERLEAVE_RATEUP_FLAG
)){
3439 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshInterleaveRateUp
=AlarmConfProfile
.adslAtucThreshInterleaveRateUp
;
3441 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_FAST_RATEDOWN_FLAG
)){
3442 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshFastRateDown
=AlarmConfProfile
.adslAtucThreshFastRateDown
;
3444 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_INTERLEAVE_RATEDOWN_FLAG
)){
3445 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshInterleaveRateDown
=AlarmConfProfile
.adslAtucThreshInterleaveRateDown
;
3447 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_INIT_FAILURE_TRAP_ENABLE_FLAG
)){
3448 pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucInitFailureTrapEnable
=AlarmConfProfile
.adslAtucInitFailureTrapEnable
;
3450 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LOFS_FLAG
)){
3451 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLofs
=AlarmConfProfile
.adslAturThresh15MinLofs
;
3453 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LOSS_FLAG
)){
3454 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLoss
=AlarmConfProfile
.adslAturThresh15MinLoss
;
3456 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LPRS_FLAG
)){
3457 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLprs
=AlarmConfProfile
.adslAturThresh15MinLprs
;
3459 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_ESS_FLAG
)){
3460 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinESs
=AlarmConfProfile
.adslAturThresh15MinESs
;
3462 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_FAST_RATEUP_FLAG
)){
3463 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshFastRateUp
=AlarmConfProfile
.adslAturThreshFastRateUp
;
3465 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_INTERLEAVE_RATEUP_FLAG
)){
3466 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshInterleaveRateUp
=AlarmConfProfile
.adslAturThreshInterleaveRateUp
;
3468 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_FAST_RATEDOWN_FLAG
)){
3469 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshFastRateDown
=AlarmConfProfile
.adslAturThreshFastRateDown
;
3471 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_INTERLEAVE_RATEDOWN_FLAG
)){
3472 pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshInterleaveRateDown
=AlarmConfProfile
.adslAturThreshInterleaveRateDown
;
3474 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), LINE_ALARM_CONF_PROFILE_ROWSTATUS_FLAG
)){
3475 pts
.adslLineAlarmConfProfileEntry_pt
->adslLineAlarmConfProfileRowStatus
=AlarmConfProfile
.adslLineAlarmConfProfileRowStatus
;
3477 copy_to_user((char *)lon
, (char *)pts
.adslLineAlarmConfProfileEntry_pt
, sizeof(adslLineAlarmConfProfileEntry
));
3478 kfree(pts
.adslLineAlarmConfProfileEntry_pt
);
3480 #ifdef AMAZON_MEI_MIB_RFC3440
3481 case GET_ADSL_ALRM_CONF_PROF_EXT
:
3482 pts
.adslLineAlarmConfProfileExtEntry_pt
= (adslLineAlarmConfProfileExtEntry
*)kmalloc(sizeof(adslLineAlarmConfProfileExtEntry
), GFP_KERNEL
);
3483 copy_from_user((char *)pts
.adslLineAlarmConfProfileExtEntry_pt
, (char *)lon
, sizeof(adslLineAlarmConfProfileExtEntry
));
3484 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_FAILED_FASTR_FLAG
)){
3485 pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinFailedFastR
=AlarmConfProfileExt
.adslAtucThreshold15MinFailedFastR
;
3487 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_SESL_FLAG
)){
3488 pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinSesL
=AlarmConfProfileExt
.adslAtucThreshold15MinSesL
;
3490 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_UASL_FLAG
)){
3491 pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinUasL
=AlarmConfProfileExt
.adslAtucThreshold15MinUasL
;
3493 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUR_THRESH_15MIN_SESL_FLAG
)){
3494 pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAturThreshold15MinSesL
=AlarmConfProfileExt
.adslAturThreshold15MinSesL
;
3496 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUR_THRESH_15MIN_UASL_FLAG
)){
3497 pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAturThreshold15MinUasL
=AlarmConfProfileExt
.adslAturThreshold15MinUasL
;
3499 copy_to_user((char *)lon
, (char *)pts
.adslLineAlarmConfProfileExtEntry_pt
, sizeof(adslLineAlarmConfProfileExtEntry
));
3500 kfree(pts
.adslLineAlarmConfProfileExtEntry_pt
);
3503 case SET_ADSL_ALRM_CONF_PROF
:
3504 pts
.adslLineAlarmConfProfileEntry_pt
= (adslLineAlarmConfProfileEntry
*)kmalloc(sizeof(adslLineAlarmConfProfileEntry
), GFP_KERNEL
);
3505 copy_from_user((char *)pts
.adslLineAlarmConfProfileEntry_pt
, (char *)lon
, sizeof(adslLineAlarmConfProfileEntry
));
3507 strncpy(AlarmConfProfile
.adslLineAlarmConfProfileName
, pts
.adslLineAlarmConfProfileEntry_pt
->adslLineAlarmConfProfileName
, 32);
3508 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_LOFS_FLAG
)){
3509 AlarmConfProfile
.adslAtucThresh15MinLofs
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinLofs
;
3511 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_LOSS_FLAG
)){
3512 AlarmConfProfile
.adslAtucThresh15MinLoss
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinLoss
;
3514 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_15MIN_ESS_FLAG
)){
3515 AlarmConfProfile
.adslAtucThresh15MinESs
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThresh15MinESs
;
3517 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_FAST_RATEUP_FLAG
)){
3518 AlarmConfProfile
.adslAtucThreshFastRateUp
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshFastRateUp
;
3520 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_INTERLEAVE_RATEUP_FLAG
)){
3521 AlarmConfProfile
.adslAtucThreshInterleaveRateUp
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshInterleaveRateUp
;
3523 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_FAST_RATEDOWN_FLAG
)){
3524 AlarmConfProfile
.adslAtucThreshFastRateDown
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshFastRateDown
;
3526 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_THRESH_INTERLEAVE_RATEDOWN_FLAG
)){
3527 AlarmConfProfile
.adslAtucThreshInterleaveRateDown
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucThreshInterleaveRateDown
;
3529 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUC_INIT_FAILURE_TRAP_ENABLE_FLAG
)){
3530 AlarmConfProfile
.adslAtucInitFailureTrapEnable
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAtucInitFailureTrapEnable
;
3532 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LOFS_FLAG
)){
3533 AlarmConfProfile
.adslAturThresh15MinLofs
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLofs
;
3535 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LOSS_FLAG
)){
3536 AlarmConfProfile
.adslAturThresh15MinLoss
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLoss
;
3538 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_LPRS_FLAG
)){
3539 AlarmConfProfile
.adslAturThresh15MinLprs
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinLprs
;
3541 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_15MIN_ESS_FLAG
)){
3542 AlarmConfProfile
.adslAturThresh15MinESs
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThresh15MinESs
;
3544 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_FAST_RATEUP_FLAG
)){
3545 AlarmConfProfile
.adslAturThreshFastRateUp
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshFastRateUp
;
3547 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_INTERLEAVE_RATEUP_FLAG
)){
3548 AlarmConfProfile
.adslAturThreshInterleaveRateUp
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshInterleaveRateUp
;
3550 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_FAST_RATEDOWN_FLAG
)){
3551 AlarmConfProfile
.adslAturThreshFastRateDown
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshFastRateDown
;
3553 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), ATUR_THRESH_INTERLEAVE_RATEDOWN_FLAG
)){
3554 AlarmConfProfile
.adslAturThreshInterleaveRateDown
=pts
.adslLineAlarmConfProfileEntry_pt
->adslAturThreshInterleaveRateDown
;
3556 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileEntry_pt
->flags
)), LINE_ALARM_CONF_PROFILE_ROWSTATUS_FLAG
)){
3557 AlarmConfProfile
.adslLineAlarmConfProfileRowStatus
=pts
.adslLineAlarmConfProfileEntry_pt
->adslLineAlarmConfProfileRowStatus
;
3559 copy_to_user((char *)lon
, (char *)pts
.adslLineAlarmConfProfileEntry_pt
, sizeof(adslLineAlarmConfProfileEntry
));
3560 kfree(pts
.adslLineAlarmConfProfileEntry_pt
);
3563 #ifdef AMAZON_MEI_MIB_RFC3440
3564 case SET_ADSL_ALRM_CONF_PROF_EXT
:
3565 pts
.adslLineAlarmConfProfileExtEntry_pt
= (adslLineAlarmConfProfileExtEntry
*)kmalloc(sizeof(adslLineAlarmConfProfileExtEntry
), GFP_KERNEL
);
3566 copy_from_user((char *)pts
.adslLineAlarmConfProfileExtEntry_pt
, (char *)lon
, sizeof(adslLineAlarmConfProfileExtEntry
));
3567 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_FAILED_FASTR_FLAG
)){
3568 AlarmConfProfileExt
.adslAtucThreshold15MinFailedFastR
=pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinFailedFastR
;
3570 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_SESL_FLAG
)){
3571 AlarmConfProfileExt
.adslAtucThreshold15MinSesL
=pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinSesL
;
3573 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUC_THRESH_15MIN_UASL_FLAG
)){
3574 AlarmConfProfileExt
.adslAtucThreshold15MinUasL
=pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAtucThreshold15MinUasL
;
3576 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUR_THRESH_15MIN_SESL_FLAG
)){
3577 AlarmConfProfileExt
.adslAturThreshold15MinSesL
=pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAturThreshold15MinSesL
;
3579 if(IS_FLAG_SET((&(pts
.adslLineAlarmConfProfileExtEntry_pt
->flags
)), ATUR_THRESH_15MIN_UASL_FLAG
)){
3580 AlarmConfProfileExt
.adslAturThreshold15MinUasL
=pts
.adslLineAlarmConfProfileExtEntry_pt
->adslAturThreshold15MinUasL
;
3582 copy_to_user((char *)lon
, (char *)pts
.adslLineAlarmConfProfileExtEntry_pt
, sizeof(adslLineAlarmConfProfileExtEntry
));
3583 kfree(pts
.adslLineAlarmConfProfileExtEntry_pt
);
3587 case ADSL_ATUR_TRAPS
:
3588 if(down_interruptible(&mei_sema
))
3589 return -ERESTARTSYS
;
3592 if(AlarmConfProfile
.adslAtucThresh15MinLofs
!=0 && current_intvl
->AtucPerfLof
>=AlarmConfProfile
.adslAtucThresh15MinLofs
)
3593 trapsflag
|=ATUC_PERF_LOFS_THRESH_FLAG
;
3594 if(AlarmConfProfile
.adslAtucThresh15MinLoss
!=0 && current_intvl
->AtucPerfLos
>=AlarmConfProfile
.adslAtucThresh15MinLoss
)
3595 trapsflag
|=ATUC_PERF_LOSS_THRESH_FLAG
;
3596 if(AlarmConfProfile
.adslAtucThresh15MinESs
!=0 && current_intvl
->AtucPerfEs
>=AlarmConfProfile
.adslAtucThresh15MinESs
)
3597 trapsflag
|=ATUC_PERF_ESS_THRESH_FLAG
;
3598 if(chantype
.fast
==1){
3599 if(AlarmConfProfile
.adslAtucThreshFastRateUp
!=0 || AlarmConfProfile
.adslAtucThreshFastRateDown
!=0){
3600 ATUC_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
3601 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3602 #ifdef AMAZON_MEI_DEBUG_ON
3603 printk("\n\nCMV fail, Group 6 Address 1 Index 0");
3607 temp
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3608 if((AlarmConfProfile
.adslAtucThreshFastRateUp
!=0) && (temp
>=PrevTxRate
.adslAtucChanPrevTxRate
+AlarmConfProfile
.adslAtucThreshFastRateUp
)){
3609 trapsflag
|=ATUC_RATE_CHANGE_FLAG
;
3610 PrevTxRate
.adslAtucChanPrevTxRate
= temp
;
3612 if((AlarmConfProfile
.adslAtucThreshFastRateDown
!=0) && (temp
<=PrevTxRate
.adslAtucChanPrevTxRate
-AlarmConfProfile
.adslAtucThreshFastRateDown
)){
3613 trapsflag
|=ATUC_RATE_CHANGE_FLAG
;
3614 PrevTxRate
.adslAtucChanPrevTxRate
= temp
;
3619 if(chantype
.interleave
==1){
3620 if(AlarmConfProfile
.adslAtucThreshInterleaveRateUp
!=0 || AlarmConfProfile
.adslAtucThreshInterleaveRateDown
!=0){
3621 ATUC_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
3622 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3623 #ifdef AMAZON_MEI_DEBUG_ON
3624 printk("\n\nCMV fail, Group 6 Address 1 Index 0");
3628 temp
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3629 if((AlarmConfProfile
.adslAtucThreshInterleaveRateUp
!=0) && (temp
>=PrevTxRate
.adslAtucChanPrevTxRate
+AlarmConfProfile
.adslAtucThreshInterleaveRateUp
)){
3630 trapsflag
|=ATUC_RATE_CHANGE_FLAG
;
3631 PrevTxRate
.adslAtucChanPrevTxRate
= temp
;
3633 if((AlarmConfProfile
.adslAtucThreshInterleaveRateDown
!=0) && (temp
<=PrevTxRate
.adslAtucChanPrevTxRate
-AlarmConfProfile
.adslAtucThreshInterleaveRateDown
)){
3634 trapsflag
|=ATUC_RATE_CHANGE_FLAG
;
3635 PrevTxRate
.adslAtucChanPrevTxRate
= temp
;
3640 if(AlarmConfProfile
.adslAturThresh15MinLofs
!=0 && current_intvl
->AturPerfLof
>=AlarmConfProfile
.adslAturThresh15MinLofs
)
3641 trapsflag
|=ATUR_PERF_LOFS_THRESH_FLAG
;
3642 if(AlarmConfProfile
.adslAturThresh15MinLoss
!=0 && current_intvl
->AturPerfLos
>=AlarmConfProfile
.adslAturThresh15MinLoss
)
3643 trapsflag
|=ATUR_PERF_LOSS_THRESH_FLAG
;
3644 if(AlarmConfProfile
.adslAturThresh15MinLprs
!=0 && current_intvl
->AturPerfLpr
>=AlarmConfProfile
.adslAturThresh15MinLprs
)
3645 trapsflag
|=ATUR_PERF_LPRS_THRESH_FLAG
;
3646 if(AlarmConfProfile
.adslAturThresh15MinESs
!=0 && current_intvl
->AturPerfEs
>=AlarmConfProfile
.adslAturThresh15MinESs
)
3647 trapsflag
|=ATUR_PERF_ESS_THRESH_FLAG
;
3648 if(chantype
.fast
==1){
3649 if(AlarmConfProfile
.adslAturThreshFastRateUp
!=0 || AlarmConfProfile
.adslAturThreshFastRateDown
!=0){
3650 ATUR_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
3651 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3652 #ifdef AMAZON_MEI_DEBUG_ON
3653 printk("\n\nCMV fail, Group 6 Address 0 Index 0");
3657 temp
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3658 if((AlarmConfProfile
.adslAturThreshFastRateUp
!=0) && (temp
>=PrevTxRate
.adslAturChanPrevTxRate
+AlarmConfProfile
.adslAturThreshFastRateUp
)){
3659 trapsflag
|=ATUR_RATE_CHANGE_FLAG
;
3660 PrevTxRate
.adslAturChanPrevTxRate
= temp
;
3662 if((AlarmConfProfile
.adslAturThreshFastRateDown
!=0) && (temp
<=PrevTxRate
.adslAturChanPrevTxRate
-AlarmConfProfile
.adslAturThreshFastRateDown
)){
3663 trapsflag
|=ATUR_RATE_CHANGE_FLAG
;
3664 PrevTxRate
.adslAturChanPrevTxRate
= temp
;
3669 if(chantype
.interleave
==1){
3670 if(AlarmConfProfile
.adslAturThreshInterleaveRateUp
!=0 || AlarmConfProfile
.adslAturThreshInterleaveRateDown
!=0){
3671 ATUR_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
3672 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3673 #ifdef AMAZON_MEI_DEBUG_ON
3674 printk("\n\nCMV fail, Group 6 Address 0 Index 0");
3678 temp
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3679 if((AlarmConfProfile
.adslAturThreshInterleaveRateUp
!=0) && (temp
>=PrevTxRate
.adslAturChanPrevTxRate
+AlarmConfProfile
.adslAturThreshInterleaveRateUp
)){
3680 trapsflag
|=ATUR_RATE_CHANGE_FLAG
;
3681 PrevTxRate
.adslAturChanPrevTxRate
= temp
;
3683 if((AlarmConfProfile
.adslAturThreshInterleaveRateDown
!=0) && (temp
<=PrevTxRate
.adslAturChanPrevTxRate
-AlarmConfProfile
.adslAturThreshInterleaveRateDown
)){
3684 trapsflag
|=ATUR_RATE_CHANGE_FLAG
;
3685 PrevTxRate
.adslAturChanPrevTxRate
= temp
;
3690 copy_to_user((char *)lon
, (char *)(&trapsflag
), 2);
3695 #ifdef AMAZON_MEI_MIB_RFC3440
3696 case ADSL_ATUR_EXT_TRAPS
:
3698 if(AlarmConfProfileExt
.adslAtucThreshold15MinFailedFastR
!=0 && current_intvl
->AtucPerfStatFailedFastR
>=AlarmConfProfileExt
.adslAtucThreshold15MinFailedFastR
)
3699 trapsflag
|=ATUC_15MIN_FAILED_FASTR_TRAP_FLAG
;
3700 if(AlarmConfProfileExt
.adslAtucThreshold15MinSesL
!=0 && current_intvl
->AtucPerfStatSesL
>=AlarmConfProfileExt
.adslAtucThreshold15MinSesL
)
3701 trapsflag
|=ATUC_15MIN_SESL_TRAP_FLAG
;
3702 if(AlarmConfProfileExt
.adslAtucThreshold15MinUasL
!=0 && current_intvl
->AtucPerfStatUasL
>=AlarmConfProfileExt
.adslAtucThreshold15MinUasL
)
3703 trapsflag
|=ATUC_15MIN_UASL_TRAP_FLAG
;
3704 if(AlarmConfProfileExt
.adslAturThreshold15MinSesL
!=0 && current_intvl
->AturPerfStatSesL
>=AlarmConfProfileExt
.adslAturThreshold15MinSesL
)
3705 trapsflag
|=ATUR_15MIN_SESL_TRAP_FLAG
;
3706 if(AlarmConfProfileExt
.adslAturThreshold15MinUasL
!=0 && current_intvl
->AturPerfStatUasL
>=AlarmConfProfileExt
.adslAturThreshold15MinUasL
)
3707 trapsflag
|=ATUR_15MIN_UASL_TRAP_FLAG
;
3708 copy_to_user((char *)lon
, (char *)(&trapsflag
), 2);
3712 // 603221:tc.chen start
3713 case GET_ADSL_LINE_STATUS
:
3714 if(down_interruptible(&mei_sema
))
3715 return -ERESTARTSYS
;
3717 pts
.adslLineStatusInfo_pt
= (adslLineStatusInfo
*)kmalloc(sizeof(adslLineStatusInfo
), GFP_KERNEL
);
3718 copy_from_user((char *)pts
.adslLineStatusInfo_pt
, (char *)lon
, sizeof(adslLineStatusInfo
));
3720 if(IS_FLAG_SET((&(pts
.adslLineStatusInfo_pt
->flags
)), LINE_STAT_MODEM_STATUS_FLAG
)){
3721 LINE_STAT_MODEM_STATUS_FLAG_MAKECMV
;
3722 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3723 #ifdef AMAZON_MEI_DEBUG_ON
3724 printk("\n\nCMV fail, Group STAT Address 0 Index 0");
3726 pts
.adslLineStatusInfo_pt
->adslModemStatus
= 0;
3729 pts
.adslLineStatusInfo_pt
->adslModemStatus
= RxMessage
[4];
3733 if(IS_FLAG_SET((&(pts
.adslLineStatusInfo_pt
->flags
)), LINE_STAT_MODE_SEL_FLAG
)){
3734 LINE_STAT_MODE_SEL_FLAG_MAKECMV
;
3735 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3736 #ifdef AMAZON_MEI_DEBUG_ON
3737 printk("\n\nCMV fail, Group STAT Address 1 Index 0");
3739 pts
.adslLineStatusInfo_pt
->adslModeSelected
= 0;
3742 pts
.adslLineStatusInfo_pt
->adslModeSelected
= RxMessage
[4];
3746 if(IS_FLAG_SET((&(pts
.adslLineStatusInfo_pt
->flags
)), LINE_STAT_TRELLCOD_ENABLE_FLAG
)){
3747 LINE_STAT_TRELLCOD_ENABLE_FLAG_MAKECMV
;
3748 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3749 #ifdef AMAZON_MEI_DEBUG_ON
3750 printk("\n\nCMV fail, Group OPTN Address 2 Index 0");
3752 pts
.adslLineStatusInfo_pt
->adslTrellisCodeEnable
= 0;
3756 pts
.adslLineStatusInfo_pt
->adslTrellisCodeEnable
= (RxMessage
[4]>>13)&0x1==0x1?0:1;
3760 if(IS_FLAG_SET((&(pts
.adslLineStatusInfo_pt
->flags
)), LINE_STAT_LATENCY_FLAG
)){
3761 LINE_STAT_LATENCY_FLAG_MAKECMV
;
3762 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3763 #ifdef AMAZON_MEI_DEBUG_ON
3764 printk("\n\nCMV fail, Group STAT Address 12 Index 0");
3766 pts
.adslLineStatusInfo_pt
->adslLatency
= 0;
3769 pts
.adslLineStatusInfo_pt
->adslLatency
= RxMessage
[4];
3773 copy_to_user((char *)lon
, (char *)pts
.adslLineStatusInfo_pt
, sizeof(adslLineStatusInfo
));
3774 kfree(pts
.adslLineStatusInfo_pt
);
3780 case GET_ADSL_LINE_RATE
:
3782 return -ERESTARTSYS
;
3783 if(down_interruptible(&mei_sema
))
3784 return -ERESTARTSYS
;
3786 pts
.adslLineRateInfo_pt
= (adslLineRateInfo
*)kmalloc(sizeof(adslLineRateInfo
), GFP_KERNEL
);
3787 copy_from_user((char *)pts
.adslLineRateInfo_pt
, (char *)lon
, sizeof(adslLineRateInfo
));
3789 if(IS_FLAG_SET((&(pts
.adslLineRateInfo_pt
->flags
)), LINE_RATE_DATA_RATEDS_FLAG
)){
3790 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
3792 if (chantype
.interleave
)
3793 LINE_RATE_DATA_RATEDS_FLAG_ADSL1_LP0_MAKECMV
;
3795 LINE_RATE_DATA_RATEDS_FLAG_ADSL1_LP1_MAKECMV
;
3797 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3798 #ifdef AMAZON_MEI_DEBUG_ON
3799 printk("\n\nCMV fail, Group RATE Address 1 Index 0");
3801 pts
.adslLineRateInfo_pt
->adslDataRateds
= 0;
3804 pts
.adslLineRateInfo_pt
->adslDataRateds
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3808 unsigned long Mp
,Lp
,Tp
,Rp
,Kp
,Bpn
,DataRate
,DataRate_remain
;
3809 Mp
=Lp
=Tp
=Rp
=Kp
=Bpn
=DataRate
=DataRate_remain
=0;
3810 //// up stream data rate
3812 if (chantype
.interleave
)
3814 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_LP_LP0_MAKECMV
;
3815 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3816 #ifdef AMAZON_MEI_DEBUG_ON
3817 printk("\n\nCMV fail, Group CNFG Address 25 Index 0");
3823 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_RP_LP0_MAKECMV
;
3824 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3825 #ifdef AMAZON_MEI_DEBUG_ON
3826 printk("\n\nCMV fail, Group CNFG Address 23 Index 0");
3832 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_MP_LP0_MAKECMV
;
3833 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3834 #ifdef AMAZON_MEI_DEBUG_ON
3835 printk("\n\nCMV fail, Group CNFG Address 24 Index 0");
3841 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_TP_LP0_MAKECMV
;
3842 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3843 #ifdef AMAZON_MEI_DEBUG_ON
3844 printk("\n\nCMV fail, Group CNFG Address 26 Index 0");
3850 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_KP_LP0_MAKECMV
;
3851 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3852 #ifdef AMAZON_MEI_DEBUG_ON
3853 printk("\n\nCMV fail, Group CNFG Address 28 Index 0");
3858 Kp
=RxMessage
[4]+ RxMessage
[5]+1;
3859 Bpn
=RxMessage
[4]+ RxMessage
[5];
3863 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_LP_LP1_MAKECMV
;
3864 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3865 #ifdef AMAZON_MEI_DEBUG_ON
3866 printk("\n\nCMV fail, Group CNFG Address 25 Index 1");
3872 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_RP_LP1_MAKECMV
;
3873 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3874 #ifdef AMAZON_MEI_DEBUG_ON
3875 printk("\n\nCMV fail, Group CNFG Address 23 Index 1");
3881 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_MP_LP1_MAKECMV
;
3882 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3883 #ifdef AMAZON_MEI_DEBUG_ON
3884 printk("\n\nCMV fail, Group CNFG Address 24 Index 1");
3890 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_TP_LP1_MAKECMV
;
3891 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3892 #ifdef AMAZON_MEI_DEBUG_ON
3893 printk("\n\nCMV fail, Group CNFG Address 26 Index 1");
3899 LINE_RATE_DATA_RATEUS_FLAG_ADSL2_KP_LP1_MAKECMV
;
3900 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3901 #ifdef AMAZON_MEI_DEBUG_ON
3902 printk("\n\nCMV fail, Group CNFG Address 28 Index 2");
3907 Kp
=RxMessage
[4]+ RxMessage
[5]+1;
3908 Bpn
=RxMessage
[4]+ RxMessage
[5];
3911 DataRate
=((Tp
*(Bpn
+1)-1)*Mp
*Lp
*4)/(Tp
*(Kp
*Mp
+Rp
));
3912 //DataRate_remain=((((Tp*(Bpn+1)-1)*Mp*Lp*4)%(Tp*(Kp*Mp+Rp)))*1000)/(Tp*(Kp*Mp+Rp));
3913 //pts.adslLineRateInfo_pt->adslDataRateds = DataRate * 1000 + DataRate_remain;
3914 pts
.adslLineRateInfo_pt
->adslDataRateds
= DataRate
;
3918 if(IS_FLAG_SET((&(pts
.adslLineRateInfo_pt
->flags
)), LINE_RATE_DATA_RATEUS_FLAG
)){
3919 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
3921 if (chantype
.interleave
)
3922 LINE_RATE_DATA_RATEUS_FLAG_ADSL1_LP0_MAKECMV
;
3924 LINE_RATE_DATA_RATEUS_FLAG_ADSL1_LP1_MAKECMV
;
3926 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3927 #ifdef AMAZON_MEI_DEBUG_ON
3928 printk("\n\nCMV fail, Group RATE Address 0 Index 0");
3930 pts
.adslLineRateInfo_pt
->adslDataRateus
= 0;
3933 pts
.adslLineRateInfo_pt
->adslDataRateus
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
3937 unsigned long Mp
,Lp
,Tp
,Rp
,Kp
,Bpn
,DataRate
,DataRate_remain
;
3938 Mp
=Lp
=Tp
=Rp
=Kp
=Bpn
=DataRate
=DataRate_remain
=0;
3939 //// down stream data rate
3941 if (chantype
.interleave
)
3943 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_LP_LP0_MAKECMV
;
3944 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3945 #ifdef AMAZON_MEI_DEBUG_ON
3946 printk("\n\nCMV fail, Group CNFG Address 14 Index 0");
3952 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_RP_LP0_MAKECMV
;
3953 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3954 #ifdef AMAZON_MEI_DEBUG_ON
3955 printk("\n\nCMV fail, Group CNFG Address 12 Index 0");
3961 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_MP_LP0_MAKECMV
;
3962 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3963 #ifdef AMAZON_MEI_DEBUG_ON
3964 printk("\n\nCMV fail, Group CNFG Address 13 Index 0");
3970 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_TP_LP0_MAKECMV
;
3971 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3972 #ifdef AMAZON_MEI_DEBUG_ON
3973 printk("\n\nCMV fail, Group CNFG Address 15 Index 0");
3979 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_KP_LP0_MAKECMV
;
3980 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3981 #ifdef AMAZON_MEI_DEBUG_ON
3982 printk("\n\nCMV fail, Group CNFG Address 17 Index 0");
3987 Kp
=RxMessage
[4]+ RxMessage
[5]+1;
3988 Bpn
=RxMessage
[4]+ RxMessage
[5];
3992 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_LP_LP1_MAKECMV
;
3993 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
3994 #ifdef AMAZON_MEI_DEBUG_ON
3995 printk("\n\nCMV fail, Group CNFG Address 14 Index 1");
4001 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_RP_LP1_MAKECMV
;
4002 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4003 #ifdef AMAZON_MEI_DEBUG_ON
4004 printk("\n\nCMV fail, Group CNFG Address 12 Index 1");
4010 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_MP_LP1_MAKECMV
;
4011 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4012 #ifdef AMAZON_MEI_DEBUG_ON
4013 printk("\n\nCMV fail, Group CNFG Address 13 Index 1");
4019 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_TP_LP1_MAKECMV
;
4020 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4021 #ifdef AMAZON_MEI_DEBUG_ON
4022 printk("\n\nCMV fail, Group CNFG Address 15 Index 1");
4028 LINE_RATE_DATA_RATEDS_FLAG_ADSL2_KP_LP1_MAKECMV
;
4029 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4030 #ifdef AMAZON_MEI_DEBUG_ON
4031 printk("\n\nCMV fail, Group CNFG Address 17 Index 2");
4036 Kp
=RxMessage
[4]+ RxMessage
[5]+1;
4037 Bpn
=RxMessage
[4]+ RxMessage
[5];
4040 DataRate
=((Tp
*(Bpn
+1)-1)*Mp
*Lp
*4)/(Tp
*(Kp
*Mp
+Rp
));
4041 //DataRate_remain=((((Tp*(Bpn+1)-1)*Mp*Lp*4)%(Tp*(Kp*Mp+Rp)))*1000)/(Tp*(Kp*Mp+Rp));
4042 //pts.adslLineRateInfo_pt->adslDataRateus = DataRate * 1000 + DataRate_remain;
4043 pts
.adslLineRateInfo_pt
->adslDataRateus
= DataRate
;
4047 if(IS_FLAG_SET((&(pts
.adslLineRateInfo_pt
->flags
)), LINE_RATE_ATTNDRDS_FLAG
)){
4048 LINE_RATE_ATTNDRDS_FLAG_MAKECMV
;
4049 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4050 #ifdef AMAZON_MEI_DEBUG_ON
4051 printk("\n\nCMV fail, Group INFO Address 68 Index 4");
4053 pts
.adslLineRateInfo_pt
->adslATTNDRds
= 0;
4056 pts
.adslLineRateInfo_pt
->adslATTNDRds
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
4060 if(IS_FLAG_SET((&(pts
.adslLineRateInfo_pt
->flags
)), LINE_RATE_ATTNDRUS_FLAG
)){
4061 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
4063 LINE_RATE_ATTNDRUS_FLAG_MAKECMV
;
4064 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4065 #ifdef AMAZON_MEI_DEBUG_ON
4066 printk("\n\nCMV fail, Group INFO Address 69 Index 4");
4068 pts
.adslLineRateInfo_pt
->adslATTNDRus
= 0;
4071 pts
.adslLineRateInfo_pt
->adslATTNDRus
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
4078 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4080 set_current_state(TASK_INTERRUPTIBLE
);
4081 schedule_timeout(1);
4083 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4084 if (hdlc_rx_len
<=0)
4086 meierr
= -ERESTARTSYS
;
4087 goto GET_ADSL_LINE_RATE_END
;
4089 pts
.adslLineRateInfo_pt
->adslATTNDRus
= (u32
)le16_to_cpu(hdlc_rx_buffer
[1])<<16 | (u32
)le16_to_cpu(hdlc_rx_buffer
[2]);
4091 if(down_interruptible(&mei_sema
))
4093 meierr
= -ERESTARTSYS
;
4094 goto GET_ADSL_LINE_RATE_END
;
4098 copy_to_user((char *)lon
, (char *)pts
.adslLineRateInfo_pt
, sizeof(adslLineRateInfo
));
4101 GET_ADSL_LINE_RATE_END
:
4102 kfree(pts
.adslLineRateInfo_pt
);
4105 case GET_ADSL_LINE_INFO
:
4107 return -ERESTARTSYS
;
4108 if(down_interruptible(&mei_sema
))
4109 return -ERESTARTSYS
;
4111 pts
.adslLineInfo_pt
= (adslLineInfo
*)kmalloc(sizeof(adslLineInfo
), GFP_KERNEL
);
4112 copy_from_user((char *)pts
.adslLineInfo_pt
, (char *)lon
, sizeof(adslLineInfo
));
4114 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_INTLV_DEPTHDS_FLAG
)){
4115 if (chantype
.interleave
)
4116 LINE_INFO_INTLV_DEPTHDS_FLAG_LP0_MAKECMV
;
4118 LINE_INFO_INTLV_DEPTHDS_FLAG_LP1_MAKECMV
;
4120 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4121 #ifdef AMAZON_MEI_DEBUG_ON
4122 printk("\n\nCMV fail, Group CNFG Address 27 Index 0");
4124 pts
.adslLineInfo_pt
->adslInterleaveDepthds
= 0;
4127 pts
.adslLineInfo_pt
->adslInterleaveDepthds
= RxMessage
[4];
4131 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_INTLV_DEPTHUS_FLAG
)){
4132 if (chantype
.interleave
)
4133 LINE_INFO_INTLV_DEPTHUS_FLAG_LP0_MAKECMV
;
4135 LINE_INFO_INTLV_DEPTHUS_FLAG_LP1_MAKECMV
;
4137 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4138 #ifdef AMAZON_MEI_DEBUG_ON
4139 printk("\n\nCMV fail, Group CNFG Address 16 Index 0");
4141 pts
.adslLineInfo_pt
->adslInterleaveDepthus
= 0;
4144 pts
.adslLineInfo_pt
->adslInterleaveDepthus
= RxMessage
[4];
4148 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_LATNDS_FLAG
)){
4149 LINE_INFO_LATNDS_FLAG_MAKECMV
;
4150 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4151 #ifdef AMAZON_MEI_DEBUG_ON
4152 printk("\n\nCMV fail, Group INFO Address 68 Index 1");
4154 pts
.adslLineInfo_pt
->adslLATNds
= 0;
4157 pts
.adslLineInfo_pt
->adslLATNds
= RxMessage
[4];
4161 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_LATNUS_FLAG
)){
4162 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
4164 LINE_INFO_LATNUS_FLAG_MAKECMV
;
4165 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4166 #ifdef AMAZON_MEI_DEBUG_ON
4167 printk("\n\nCMV fail, Group INFO Address 69 Index 1");
4169 pts
.adslLineInfo_pt
->adslLATNus
= 0;
4172 pts
.adslLineInfo_pt
->adslLATNus
= RxMessage
[4];
4179 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4181 set_current_state(TASK_INTERRUPTIBLE
);
4182 schedule_timeout(1);
4184 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4185 if (hdlc_rx_len
<=0)
4187 meierr
= -ERESTARTSYS
;
4188 goto GET_ADSL_LINE_INFO_END
;
4190 pts
.adslLineInfo_pt
->adslLATNus
= le16_to_cpu(hdlc_rx_buffer
[1]);
4192 if(down_interruptible(&mei_sema
))
4194 meierr
= -ERESTARTSYS
;
4195 goto GET_ADSL_LINE_INFO_END
;
4200 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_SATNDS_FLAG
)){
4201 LINE_INFO_SATNDS_FLAG_MAKECMV
;
4202 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4203 #ifdef AMAZON_MEI_DEBUG_ON
4204 printk("\n\nCMV fail, Group INFO Address 68 Index 2");
4206 pts
.adslLineInfo_pt
->adslSATNds
= 0;
4209 pts
.adslLineInfo_pt
->adslSATNds
= RxMessage
[4];
4213 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_SATNUS_FLAG
)){
4214 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
4216 LINE_INFO_SATNUS_FLAG_MAKECMV
;
4217 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4218 #ifdef AMAZON_MEI_DEBUG_ON
4219 printk("\n\nCMV fail, Group INFO Address 69 Index 2");
4221 pts
.adslLineInfo_pt
->adslSATNus
= 0;
4224 pts
.adslLineInfo_pt
->adslSATNus
= RxMessage
[4];
4231 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4233 set_current_state(TASK_INTERRUPTIBLE
);
4234 schedule_timeout(1);
4236 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4237 if (hdlc_rx_len
<=0)
4239 meierr
= -ERESTARTSYS
;
4240 goto GET_ADSL_LINE_INFO_END
;
4242 pts
.adslLineInfo_pt
->adslSATNus
= le16_to_cpu(hdlc_rx_buffer
[1]);
4244 if(down_interruptible(&mei_sema
))
4246 meierr
= -ERESTARTSYS
;
4247 goto GET_ADSL_LINE_INFO_END
;
4252 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_SNRMNDS_FLAG
)){
4253 if (adsl_mode
<=8 && adsl_mode_extend
==0) // adsl mode
4255 LINE_INFO_SNRMNDS_FLAG_ADSL1_MAKECMV
;
4257 else if ((adsl_mode
== 0x4000) || (adsl_mode
== 0x8000) || adsl_mode_extend
> 0)
4259 LINE_INFO_SNRMNDS_FLAG_ADSL2PLUS_MAKECMV
;
4263 LINE_INFO_SNRMNDS_FLAG_ADSL2_MAKECMV
;
4265 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4266 #ifdef AMAZON_MEI_DEBUG_ON
4267 printk("\n\nCMV fail, Group INFO Address 68 Index 3");
4269 pts
.adslLineInfo_pt
->adslSNRMds
= 0;
4272 if (adsl_mode
>8 || adsl_mode_extend
>0)
4274 int SNRMds
,SNRMds_remain
;
4275 SNRMds
=RxMessage
[4];
4276 SNRMds_remain
=((SNRMds
&0xff)*1000)/256;
4277 SNRMds
=(SNRMds
>>8)&0xff;
4278 if ((SNRMds_remain
%100)>=50) SNRMds_remain
=(SNRMds_remain
/100)+1;
4279 else SNRMds_remain
=(SNRMds_remain
/100);
4280 pts
.adslLineInfo_pt
->adslSNRMds
= SNRMds
*10 + SNRMds_remain
;
4283 pts
.adslLineInfo_pt
->adslSNRMds
= RxMessage
[4];
4288 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_SNRMNUS_FLAG
)){
4289 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4291 LINE_INFO_SNRMNUS_FLAG_MAKECMV
;
4292 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4293 #ifdef AMAZON_MEI_DEBUG_ON
4294 printk("\n\nCMV fail, Group INFO Address 69 Index 3");
4296 pts
.adslLineInfo_pt
->adslSNRMus
= 0;
4299 pts
.adslLineInfo_pt
->adslSNRMus
= RxMessage
[4];
4306 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4308 set_current_state(TASK_INTERRUPTIBLE
);
4309 schedule_timeout(1);
4311 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4312 if (hdlc_rx_len
<=0)
4314 meierr
= -ERESTARTSYS
;
4315 goto GET_ADSL_LINE_INFO_END
;
4317 pts
.adslLineInfo_pt
->adslSNRMus
= le16_to_cpu(hdlc_rx_buffer
[1]);
4319 if(down_interruptible(&mei_sema
))
4321 meierr
= -ERESTARTSYS
;
4322 goto GET_ADSL_LINE_INFO_END
;
4327 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_ACATPDS_FLAG
)){
4328 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4330 LINE_INFO_ACATPDS_FLAG_MAKECMV
;
4331 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4332 #ifdef AMAZON_MEI_DEBUG_ON
4333 printk("\n\nCMV fail, Group INFO Address 68 Index 6");
4335 pts
.adslLineInfo_pt
->adslACATPds
= 0;
4338 pts
.adslLineInfo_pt
->adslACATPds
= RxMessage
[4];
4345 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4347 set_current_state(TASK_INTERRUPTIBLE
);
4348 schedule_timeout(1);
4350 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4351 if (hdlc_rx_len
<=0)
4353 meierr
= -ERESTARTSYS
;
4354 goto GET_ADSL_LINE_INFO_END
;
4356 pts
.adslLineInfo_pt
->adslACATPds
= le16_to_cpu(hdlc_rx_buffer
[1]);
4358 if(down_interruptible(&mei_sema
))
4360 meierr
= -ERESTARTSYS
;
4361 goto GET_ADSL_LINE_INFO_END
;
4366 if(IS_FLAG_SET((&(pts
.adslLineInfo_pt
->flags
)), LINE_INFO_ACATPUS_FLAG
)){
4367 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4369 LINE_INFO_ACATPUS_FLAG_MAKECMV
;
4370 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4371 #ifdef AMAZON_MEI_DEBUG_ON
4372 printk("\n\nCMV fail, Group INFO Address 69 Index 6");
4374 pts
.adslLineInfo_pt
->adslACATPus
= 0;
4377 pts
.adslLineInfo_pt
->adslACATPus
= RxMessage
[4];
4384 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],4)!= -EBUSY
)
4386 set_current_state(TASK_INTERRUPTIBLE
);
4387 schedule_timeout(1);
4389 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4390 if (hdlc_rx_len
<=0)
4392 meierr
= -ERESTARTSYS
;
4393 goto GET_ADSL_LINE_INFO_END
;
4395 pts
.adslLineInfo_pt
->adslACATPus
= le16_to_cpu(hdlc_rx_buffer
[1]);
4397 if(down_interruptible(&mei_sema
))
4399 meierr
= -ERESTARTSYS
;
4400 goto GET_ADSL_LINE_INFO_END
;
4405 copy_to_user((char *)lon
, (char *)pts
.adslLineInfo_pt
, sizeof(adslLineInfo
));
4408 GET_ADSL_LINE_INFO_END
:
4409 kfree(pts
.adslLineInfo_pt
);
4412 case GET_ADSL_NEAREND_STATS
:
4414 return -ERESTARTSYS
;
4415 if(down_interruptible(&mei_sema
))
4416 return -ERESTARTSYS
;
4418 pts
.adslNearEndPerfStats_pt
= (adslNearEndPerfStats
*)kmalloc(sizeof(adslNearEndPerfStats
), GFP_KERNEL
);
4419 copy_from_user((char *)pts
.adslNearEndPerfStats_pt
, (char *)lon
, sizeof(adslNearEndPerfStats
));
4421 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_SUPERFRAME_FLAG
)){
4422 NEAREND_PERF_SUPERFRAME_FLAG_LSW_MAKECMV
;
4423 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4424 #ifdef AMAZON_MEI_DEBUG_ON
4425 printk("\n\nCMV fail, Group PLAM Address 20 Index 0");
4427 pts
.adslNearEndPerfStats_pt
->adslSuperFrames
= 0;
4430 pts
.adslNearEndPerfStats_pt
->adslSuperFrames
= (u32
)(RxMessage
[4]);
4432 NEAREND_PERF_SUPERFRAME_FLAG_MSW_MAKECMV
;
4433 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4434 #ifdef AMAZON_MEI_DEBUG_ON
4435 printk("\n\nCMV fail, Group PLAM Address 21 Index 0");
4437 pts
.adslNearEndPerfStats_pt
->adslSuperFrames
= 0;
4440 pts
.adslNearEndPerfStats_pt
->adslSuperFrames
+= (((u32
)(RxMessage
[4]))<<16);
4444 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LOS_FLAG
) ||
4445 IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LOF_FLAG
) ||
4446 IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LPR_FLAG
) ||
4447 IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_NCD_FLAG
) ||
4448 IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LCD_FLAG
) ){
4449 NEAREND_PERF_LOS_FLAG_MAKECMV
;
4450 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4451 #ifdef AMAZON_MEI_DEBUG_ON
4452 printk("\n\nCMV fail, Group PLAM Address 0 Index 0");
4456 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LOS_FLAG
)){
4457 if( (RxMessage
[4]&0x1) == 0x1)
4458 pts
.adslNearEndPerfStats_pt
->adslneLOS
= 1;
4460 pts
.adslNearEndPerfStats_pt
->adslneLOS
= 0;
4463 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LOF_FLAG
)){
4464 if( (RxMessage
[4]&0x2) == 0x2)
4465 pts
.adslNearEndPerfStats_pt
->adslneLOF
= 1;
4467 pts
.adslNearEndPerfStats_pt
->adslneLOF
= 0;
4470 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LPR_FLAG
)){
4471 if( (RxMessage
[4]&0x4) == 0x4)
4472 pts
.adslNearEndPerfStats_pt
->adslneLPR
= 1;
4474 pts
.adslNearEndPerfStats_pt
->adslneLPR
= 0;
4477 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_NCD_FLAG
)){
4478 pts
.adslNearEndPerfStats_pt
->adslneNCD
= (RxMessage
[4]>>4)&0x3;
4481 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LCD_FLAG
)){
4482 pts
.adslNearEndPerfStats_pt
->adslneLCD
= (RxMessage
[4]>>6)&0x3;
4486 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_CRC_FLAG
)){
4487 if (chantype
.interleave
)
4488 NEAREND_PERF_CRC_FLAG_LP0_MAKECMV
;
4490 NEAREND_PERF_CRC_FLAG_LP1_MAKECMV
;
4491 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4492 #ifdef AMAZON_MEI_DEBUG_ON
4493 printk("\n\nCMV fail, Group PLAM Address 2 Index 0");
4495 pts
.adslNearEndPerfStats_pt
->adslneCRC
= 0;
4498 pts
.adslNearEndPerfStats_pt
->adslneCRC
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
4502 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_RSCORR_FLAG
)){
4503 if (chantype
.interleave
)
4504 NEAREND_PERF_RSCORR_FLAG_LP0_MAKECMV
;
4506 NEAREND_PERF_RSCORR_FLAG_LP1_MAKECMV
;
4508 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4509 #ifdef AMAZON_MEI_DEBUG_ON
4510 printk("\n\nCMV fail, Group PLAM Address 3 Index 0");
4512 pts
.adslNearEndPerfStats_pt
->adslneRSCorr
= 0;
4515 pts
.adslNearEndPerfStats_pt
->adslneRSCorr
= RxMessage
[4];
4519 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_FECS_FLAG
)){
4520 NEAREND_PERF_FECS_FLAG_MAKECMV
;
4521 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4522 #ifdef AMAZON_MEI_DEBUG_ON
4523 printk("\n\nCMV fail, Group PLAM Address 6 Index 0");
4525 pts
.adslNearEndPerfStats_pt
->adslneFECS
= 0;
4528 pts
.adslNearEndPerfStats_pt
->adslneFECS
= RxMessage
[4];
4532 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_ES_FLAG
)){
4533 NEAREND_PERF_ES_FLAG_MAKECMV
;
4534 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4535 #ifdef AMAZON_MEI_DEBUG_ON
4536 printk("\n\nCMV fail, Group PLAM Address 7 Index 0");
4538 pts
.adslNearEndPerfStats_pt
->adslneES
= 0;
4541 pts
.adslNearEndPerfStats_pt
->adslneES
= RxMessage
[4];
4545 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_SES_FLAG
)){
4546 NEAREND_PERF_SES_FLAG_MAKECMV
;
4547 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4548 #ifdef AMAZON_MEI_DEBUG_ON
4549 printk("\n\nCMV fail, Group PLAM Address 8 Index 0");
4551 pts
.adslNearEndPerfStats_pt
->adslneSES
= 0;
4554 pts
.adslNearEndPerfStats_pt
->adslneSES
= RxMessage
[4];
4558 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_LOSS_FLAG
)){
4559 NEAREND_PERF_LOSS_FLAG_MAKECMV
;
4560 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4561 #ifdef AMAZON_MEI_DEBUG_ON
4562 printk("\n\nCMV fail, Group PLAM Address 9 Index 0");
4564 pts
.adslNearEndPerfStats_pt
->adslneLOSS
= 0;
4567 pts
.adslNearEndPerfStats_pt
->adslneLOSS
= RxMessage
[4];
4571 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_UAS_FLAG
)){
4572 NEAREND_PERF_UAS_FLAG_MAKECMV
;
4573 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4574 #ifdef AMAZON_MEI_DEBUG_ON
4575 printk("\n\nCMV fail, Group PLAM Address 10 Index 0");
4577 pts
.adslNearEndPerfStats_pt
->adslneUAS
= 0;
4580 pts
.adslNearEndPerfStats_pt
->adslneUAS
= RxMessage
[4];
4584 if(IS_FLAG_SET((&(pts
.adslNearEndPerfStats_pt
->flags
)), NEAREND_PERF_HECERR_FLAG
)){
4585 if (chantype
.bearchannel0
)
4587 NEAREND_PERF_HECERR_FLAG_BC0_MAKECMV
;
4588 }else if (chantype
.bearchannel1
)
4590 NEAREND_PERF_HECERR_FLAG_BC1_MAKECMV
;
4592 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4593 #ifdef AMAZON_MEI_DEBUG_ON
4594 printk("\n\nCMV fail, Group PLAM Address 11 Index 0");
4596 pts
.adslNearEndPerfStats_pt
->adslneHECErrors
= 0;
4599 pts
.adslNearEndPerfStats_pt
->adslneHECErrors
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
4603 copy_to_user((char *)lon
, (char *)pts
.adslNearEndPerfStats_pt
, sizeof(adslNearEndPerfStats
));
4604 kfree(pts
.adslNearEndPerfStats_pt
);
4609 case GET_ADSL_FAREND_STATS
:
4612 return -ERESTARTSYS
;
4614 if (adsl_mode
>8 || adsl_mode_extend
> 0)
4616 do_gettimeofday(&time_now
);
4617 if( FarendData_acquire_time
.tv_sec
==0 || time_now
.tv_sec
- FarendData_acquire_time
.tv_sec
>=1)
4621 if (ifx_me_hdlc_send((unsigned char *)&hdlc_cmd
[0],2)!= -EBUSY
)
4623 set_current_state(TASK_INTERRUPTIBLE
);
4624 schedule_timeout(1);
4626 hdlc_rx_len
= ifx_mei_hdlc_read(&hdlc_rx_buffer
,32*2);
4627 if (hdlc_rx_len
<=0)
4629 return -ERESTARTSYS
;
4631 FarendStatsData
.adslfeRSCorr
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[1]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[2]);
4632 FarendStatsData
.adslfeCRC
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[3]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[4]);
4633 FarendStatsData
.adslfeFECS
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[5]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[6]);
4634 FarendStatsData
.adslfeES
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[7]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[8]);
4635 FarendStatsData
.adslfeSES
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[9]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[10]);
4636 FarendStatsData
.adslfeLOSS
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[11]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[12]);
4637 FarendStatsData
.adslfeUAS
= ((u32
)le16_to_cpu(hdlc_rx_buffer
[13]) << 16) + (u32
)le16_to_cpu(hdlc_rx_buffer
[14]);
4638 do_gettimeofday(&FarendData_acquire_time
);
4644 if(down_interruptible(&mei_sema
))
4645 return -ERESTARTSYS
;
4646 pts
.adslFarEndPerfStats_pt
= (adslFarEndPerfStats
*)kmalloc(sizeof(adslFarEndPerfStats
), GFP_KERNEL
);
4647 copy_from_user((char *)pts
.adslFarEndPerfStats_pt
, (char *)lon
, sizeof(adslFarEndPerfStats
));
4648 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LOS_FLAG
) ||
4649 IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LOF_FLAG
) ||
4650 IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LPR_FLAG
) ||
4651 IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_NCD_FLAG
) ||
4652 IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LCD_FLAG
) ){
4653 FAREND_PERF_LOS_FLAG_MAKECMV
;
4654 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4655 #ifdef AMAZON_MEI_DEBUG_ON
4656 printk("\n\nCMV fail, Group PLAM Address 1 Index 0");
4660 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LOS_FLAG
)){
4661 if((RxMessage
[4]&0x1) == 0x1)
4662 pts
.adslFarEndPerfStats_pt
->adslfeLOS
= 1;
4664 pts
.adslFarEndPerfStats_pt
->adslfeLOS
= 0;
4667 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LOF_FLAG
)){
4668 if((RxMessage
[4]&0x2) == 0x2)
4669 pts
.adslFarEndPerfStats_pt
->adslfeLOF
= 1;
4671 pts
.adslFarEndPerfStats_pt
->adslfeLOF
= 0;
4674 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LPR_FLAG
)){
4675 if((RxMessage
[4]&0x4) == 0x4)
4676 pts
.adslFarEndPerfStats_pt
->adslfeLPR
= 1;
4678 pts
.adslFarEndPerfStats_pt
->adslfeLPR
= 0;
4681 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_NCD_FLAG
)){
4682 pts
.adslFarEndPerfStats_pt
->adslfeNCD
= (RxMessage
[4]>>4)&0x3;
4685 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LCD_FLAG
)){
4686 pts
.adslFarEndPerfStats_pt
->adslfeLCD
= (RxMessage
[4]>>6)&0x3;
4690 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_CRC_FLAG
)){
4691 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4693 if (chantype
.interleave
)
4695 FAREND_PERF_CRC_FLAG_LP0_MAKECMV
;
4699 FAREND_PERF_CRC_FLAG_LP1_MAKECMV
;
4701 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4702 #ifdef AMAZON_MEI_DEBUG_ON
4703 printk("\n\nCMV fail, Group PLAM Address 24 Index 0");
4705 pts
.adslFarEndPerfStats_pt
->adslfeCRC
= 0;
4708 pts
.adslFarEndPerfStats_pt
->adslfeCRC
= RxMessage
[4];
4712 pts
.adslFarEndPerfStats_pt
->adslfeCRC
= FarendStatsData
.adslfeCRC
;
4716 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_RSCORR_FLAG
)){
4717 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4719 if (chantype
.interleave
)
4720 FAREND_PERF_RSCORR_FLAG_LP0_MAKECMV
;
4722 FAREND_PERF_RSCORR_FLAG_LP1_MAKECMV
;
4723 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4724 #ifdef AMAZON_MEI_DEBUG_ON
4725 printk("\n\nCMV fail, Group PLAM Address 28 Index 0");
4727 pts
.adslFarEndPerfStats_pt
->adslfeRSCorr
= 0;
4730 pts
.adslFarEndPerfStats_pt
->adslfeRSCorr
= RxMessage
[4];
4736 pts
.adslFarEndPerfStats_pt
->adslfeRSCorr
= FarendStatsData
.adslfeRSCorr
;
4740 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_FECS_FLAG
)){
4741 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4743 FAREND_PERF_FECS_FLAG_MAKECMV
;
4744 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4745 #ifdef AMAZON_MEI_DEBUG_ON
4746 printk("\n\nCMV fail, Group PLAM Address 32 Index 0");
4748 pts
.adslFarEndPerfStats_pt
->adslfeFECS
= 0;
4751 pts
.adslFarEndPerfStats_pt
->adslfeFECS
= RxMessage
[4];
4754 pts
.adslFarEndPerfStats_pt
->adslfeFECS
= FarendStatsData
.adslfeFECS
;
4758 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_ES_FLAG
)){
4759 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4761 FAREND_PERF_ES_FLAG_MAKECMV
;
4762 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4763 #ifdef AMAZON_MEI_DEBUG_ON
4764 printk("\n\nCMV fail, Group PLAM Address 33 Index 0");
4766 pts
.adslFarEndPerfStats_pt
->adslfeES
= 0;
4769 pts
.adslFarEndPerfStats_pt
->adslfeES
= RxMessage
[4];
4773 pts
.adslFarEndPerfStats_pt
->adslfeES
= FarendStatsData
.adslfeES
;
4777 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_SES_FLAG
)){
4778 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4780 FAREND_PERF_SES_FLAG_MAKECMV
;
4781 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4782 #ifdef AMAZON_MEI_DEBUG_ON
4783 printk("\n\nCMV fail, Group PLAM Address 34 Index 0");
4785 pts
.adslFarEndPerfStats_pt
->adslfeSES
= 0;
4788 pts
.adslFarEndPerfStats_pt
->adslfeSES
= RxMessage
[4];
4793 pts
.adslFarEndPerfStats_pt
->adslfeSES
= FarendStatsData
.adslfeSES
;
4797 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_LOSS_FLAG
)){
4798 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4800 FAREND_PERF_LOSS_FLAG_MAKECMV
;
4801 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4802 #ifdef AMAZON_MEI_DEBUG_ON
4803 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
4805 pts
.adslFarEndPerfStats_pt
->adslfeLOSS
= 0;
4808 pts
.adslFarEndPerfStats_pt
->adslfeLOSS
= RxMessage
[4];
4813 pts
.adslFarEndPerfStats_pt
->adslfeLOSS
= FarendStatsData
.adslfeLOSS
;
4817 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_UAS_FLAG
)){
4818 if (adsl_mode
<=8 && adsl_mode_extend
== 0)
4820 FAREND_PERF_UAS_FLAG_MAKECMV
;
4821 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4822 #ifdef AMAZON_MEI_DEBUG_ON
4823 printk("\n\nCMV fail, Group PLAM Address 36 Index 0");
4825 pts
.adslFarEndPerfStats_pt
->adslfeUAS
= 0;
4828 pts
.adslFarEndPerfStats_pt
->adslfeUAS
= RxMessage
[4];
4833 pts
.adslFarEndPerfStats_pt
->adslfeUAS
= FarendStatsData
.adslfeUAS
;
4837 if(IS_FLAG_SET((&(pts
.adslFarEndPerfStats_pt
->flags
)), FAREND_PERF_HECERR_FLAG
)){
4838 if (chantype
.bearchannel0
)
4840 FAREND_PERF_HECERR_FLAG_BC0_MAKECMV
;
4841 }else if (chantype
.bearchannel1
)
4843 FAREND_PERF_HECERR_FLAG_BC1_MAKECMV
;
4845 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4846 #ifdef AMAZON_MEI_DEBUG_ON
4847 printk("\n\nCMV fail, Group PLAM Address 37 Index 0");
4849 pts
.adslFarEndPerfStats_pt
->adslfeHECErrors
= 0;
4852 pts
.adslFarEndPerfStats_pt
->adslfeHECErrors
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
4856 copy_to_user((char *)lon
, (char *)pts
.adslFarEndPerfStats_pt
, sizeof(adslFarEndPerfStats
));
4857 kfree(pts
.adslFarEndPerfStats_pt
);
4862 // 603221:tc.chen end
4863 case GET_ADSL_LOOP_DIAGNOSTICS_MODE
:
4864 //lon = loop_diagnostics_mode;
4865 copy_to_user((char *)lon
, (char *)&loop_diagnostics_mode
, sizeof(int));
4868 case IS_ADSL_LOOP_DIAGNOSTICS_MODE_COMPLETE
:
4869 copy_to_user((char *)lon
, (char *)&loop_diagnostics_completed
, sizeof(int));
4873 case LOOP_DIAGNOSTIC_MODE_COMPLETE
:
4874 loop_diagnostics_completed
= 1;
4876 makeCMV(H2D_CMV_READ
, STAT
, 1, 0, 1, data
);
4877 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4878 #ifdef AMAZON_MEI_DEBUG_ON
4879 printk("\n\nCMV fail, Group STAT Address 1 Index 0");
4882 adsl_mode
= RxMessage
[4];
4884 makeCMV(H2D_CMV_READ
, STAT
, 17, 0, 1, data
);
4885 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4886 #ifdef AMAZON_MEI_DEBUG_ON
4887 printk("\n\nCMV fail, Group STAT Address 1 Index 0");
4890 adsl_mode_extend
= RxMessage
[4];
4891 wake_up_interruptible(&wait_queue_loop_diagnostic
);
4893 case SET_ADSL_LOOP_DIAGNOSTICS_MODE
:
4894 if (lon
!= loop_diagnostics_mode
)
4896 loop_diagnostics_completed
= 0;
4897 loop_diagnostics_mode
= lon
;
4899 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_REBOOT
, NULL
);
4903 case GET_ADSL_ATUR_SUBCARRIER_STATS
:
4904 if (loop_diagnostics_completed
== 0)
4906 interruptible_sleep_on_timeout(&wait_queue_loop_diagnostic
,300*HZ
);
4907 if (loop_diagnostics_completed
==0)
4909 return -ERESTARTSYS
;
4912 if(down_interruptible(&mei_sema
))
4913 return -ERESTARTSYS
;
4915 pts
.adslATURSubcarrierInfo_pt
= (adslATURSubcarrierInfo
*)kmalloc(sizeof(adslATURSubcarrierInfo
), GFP_KERNEL
);
4916 copy_from_user((char *)pts
.adslATURSubcarrierInfo_pt
, (char *)lon
, sizeof(adslATURSubcarrierInfo
));
4918 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_HLINSC
)){
4919 FAREND_HLINSC_MAKECMV(H2D_CMV_READ
);
4920 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4921 #ifdef AMAZON_MEI_DEBUG_ON
4922 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
4924 pts
.adslATURSubcarrierInfo_pt
->HLINSCds
= 0;
4927 pts
.adslATURSubcarrierInfo_pt
->HLINSCds
= RxMessage
[4];
4931 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_HLINPS
)){
4932 int index
=0,size
=12;
4933 //printk("FAREND_HLINPS\n");
4934 for (index
=0;index
<1024;index
+=size
)
4936 if (index
+size
>=1024)
4938 FAREND_HLINPS_MAKECMV(H2D_CMV_READ
,index
,size
);
4939 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4940 #ifdef AMAZON_MEI_DEBUG_ON
4941 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
4945 memcpy(&pts
.adslATURSubcarrierInfo_pt
->HLINpsds
[index
],&RxMessage
[4],size
*2);
4948 for(msg_idx
=0;msg_idx
<size
;msg_idx
++)
4949 printk("index:%d ,cmv_result: %04X\n",index
+msg_idx
,RxMessage
[4+msg_idx
]);
4955 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_HLOGMT
)){
4956 FAREND_HLOGMT_MAKECMV(H2D_CMV_READ
);
4957 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4958 #ifdef AMAZON_MEI_DEBUG_ON
4959 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
4961 pts
.adslATURSubcarrierInfo_pt
->HLOGMTds
= 0;
4964 pts
.adslATURSubcarrierInfo_pt
->HLOGMTds
= RxMessage
[4];
4969 /////////////////////////////////////////////////////////////////////////
4970 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_HLOGPS
)){
4971 //printk("FAREND_HLOGPS\n");
4972 int index
=0,size
=12;
4973 for (index
=0;index
<256;index
+=size
)
4975 if (index
+size
>=256)
4978 FAREND_HLOGPS_MAKECMV(H2D_CMV_READ
,index
,size
);
4979 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
4980 #ifdef AMAZON_MEI_DEBUG_ON
4981 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
4985 if (adsl_mode
< 0x4000 && adsl_mode_extend
==0)//adsl2 mode
4987 memcpy(&pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[index
],&RxMessage
[4],size
*2);
4991 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
4993 pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[(index
+msg_idx
)*2+1] = RxMessage
[4+msg_idx
];
4994 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
4999 if (adsl_mode
>= 0x4000 || adsl_mode_extend
>0)//adsl2+ mode
5001 pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[0] = pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[1];
5002 for (index
=1;index
<256;index
++)
5004 pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[index
*2] = (pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[(index
)*2-1] + pts
.adslATURSubcarrierInfo_pt
->HLOGpsds
[(index
)*2+1] +1) >>1;
5008 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_QLNMT
)){
5009 FAREND_QLNMT_MAKECMV(H2D_CMV_READ
);
5010 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5011 #ifdef AMAZON_MEI_DEBUG_ON
5012 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5014 pts
.adslATURSubcarrierInfo_pt
->QLNMTds
= 0;
5017 pts
.adslATURSubcarrierInfo_pt
->QLNMTds
= RxMessage
[4];
5021 /////////////////////////////////////////////////////////////////////////
5022 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_QLNPS
)){
5023 int index
=0,size
=12;
5024 //printk("FAREND_QLNPS\n");
5025 for (index
=0;index
<128;index
+=size
)
5027 if (index
+size
>=128)
5029 FAREND_QLNPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5030 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5031 #ifdef AMAZON_MEI_DEBUG_ON
5032 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5037 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5039 //memcpy(&pts.adslATURSubcarrierInfo_pt->QLNpsds[index],&RxMessage[4],size*2);
5040 if (adsl_mode
< 0x4000 && adsl_mode_extend
==0)//adsl2 mode
5042 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
+msg_idx
)*2] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5043 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
+msg_idx
)*2+1] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5046 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
+msg_idx
)*4+1] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5047 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
+msg_idx
)*4+3] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5048 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
5055 if (adsl_mode
>= 0x4000 || adsl_mode_extend
>0)//adsl2+ mode
5057 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[0] = pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[1];
5058 for (index
=1;index
<256;index
++)
5060 pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[index
*2] = (pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
)*2-1] + pts
.adslATURSubcarrierInfo_pt
->QLNpsds
[(index
)*2+1]) >>1;
5064 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_SNRMT
)){
5065 FAREND_SNRMT_MAKECMV(H2D_CMV_READ
);
5066 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5067 #ifdef AMAZON_MEI_DEBUG_ON
5068 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5070 pts
.adslATURSubcarrierInfo_pt
->SNRMTds
= 0;
5073 pts
.adslATURSubcarrierInfo_pt
->SNRMTds
= RxMessage
[4];
5076 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_SNRPS
)){
5077 int index
=0,size
=12;
5078 //printk("FAREND_SNRPS\n");
5079 for (index
=0;index
<512;index
+=size
)
5081 if (index
+size
>=512)
5083 FAREND_SNRPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5084 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5085 #ifdef AMAZON_MEI_DEBUG_ON
5086 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5090 //memcpy(&pts.adslATURSubcarrierInfo_pt->SNRpsds[index],&RxMessage[4],size*2);
5092 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5094 pts
.adslATURSubcarrierInfo_pt
->SNRpsds
[index
+msg_idx
] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5095 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
5101 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_BITPS
)){
5102 int index
=0,size
=12;
5103 //printk("FAREND_BITPS\n");
5104 for (index
=0;index
<256;index
+=size
)
5106 if (index
+size
>=256)
5108 FAREND_BITPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5109 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5110 #ifdef AMAZON_MEI_DEBUG_ON
5111 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5116 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5118 pts
.adslATURSubcarrierInfo_pt
->BITpsds
[(index
+msg_idx
)*2] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5119 pts
.adslATURSubcarrierInfo_pt
->BITpsds
[(index
+msg_idx
)*2+1] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5120 //printk("index:%d ,cmv_result: %04X, %d\n",index+msg_idx,RxMessage[4+msg_idx],RxMessage[4+msg_idx]);
5127 if(IS_FLAG_SET((&(pts
.adslATURSubcarrierInfo_pt
->flags
)), FAREND_GAINPS
)){
5128 int index
=0,size
=12;
5129 //printk("FAREND_GAINPS\n");
5130 for (index
=0;index
<512;index
+=size
)
5132 FAREND_GAINPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5133 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5134 #ifdef AMAZON_MEI_DEBUG_ON
5135 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5141 for (msg_idx=0;msg_idx<size;msg_idx++)
5143 pts.adslATURSubcarrierInfo_pt->GAINpsds[(index+msg_idx)*2] = RxMessage[4+msg_idx]&0xFF;
5144 pts.adslATURSubcarrierInfo_pt->GAINpsds[(index+msg_idx)*2+1] = (RxMessage[4+msg_idx]>>8)&0xFF;
5148 memcpy(&pts
.adslATURSubcarrierInfo_pt
->GAINpsds
[index
],&RxMessage
[4],size
*2);
5151 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5153 printk("index:%d ,cmv_result: %04X\n",index
+msg_idx
,RxMessage
[4+msg_idx
]);
5160 copy_to_user((char *)lon
, (char *)pts
.adslATURSubcarrierInfo_pt
, sizeof(adslATURSubcarrierInfo
));
5161 kfree(pts
.adslATURSubcarrierInfo_pt
);
5165 case GET_ADSL_ATUC_SUBCARRIER_STATS
:
5166 if (loop_diagnostics_completed
== 0)
5168 interruptible_sleep_on_timeout(&wait_queue_loop_diagnostic
,300*HZ
);
5169 if (loop_diagnostics_completed
==0)
5171 return -ERESTARTSYS
;
5174 if(down_interruptible(&mei_sema
))
5175 return -ERESTARTSYS
;
5176 pts
.adslATUCSubcarrierInfo_pt
= (adslATUCSubcarrierInfo
*)kmalloc(sizeof(adslATUCSubcarrierInfo
), GFP_KERNEL
);
5177 copy_from_user((char *)pts
.adslATUCSubcarrierInfo_pt
, (char *)lon
, sizeof(adslATUCSubcarrierInfo
));
5180 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_HLINSC
)){
5181 NEAREND_HLINSC_MAKECMV(H2D_CMV_READ
);
5182 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5183 #ifdef AMAZON_MEI_DEBUG_ON
5184 printk("\n\nCMV fail, Group INFO Address 71 Index 2");
5186 pts
.adslATUCSubcarrierInfo_pt
->HLINSCus
= 0;
5189 pts
.adslATUCSubcarrierInfo_pt
->HLINSCus
= RxMessage
[4];
5193 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_HLINPS
)){
5194 int index
=0,size
=12;
5195 //printk("NEAREND_HLINPS\n");
5196 for (index
=0;index
<128;index
+=size
)
5198 if (index
+size
>=128)
5200 NEAREND_HLINPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5201 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5202 #ifdef AMAZON_MEI_DEBUG_ON
5203 printk("\n\nCMV fail, Group INFO Address 73 Index 0");
5207 memcpy(&pts
.adslATUCSubcarrierInfo_pt
->HLINpsus
[index
],&RxMessage
[4],size
*2);
5210 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5212 printk("index:%d ,cmv_result: %04X\n",index
+msg_idx
,RxMessage
[4+msg_idx
]);
5219 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_HLOGMT
)){
5220 NEAREND_HLOGMT_MAKECMV(H2D_CMV_READ
);
5221 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5222 #ifdef AMAZON_MEI_DEBUG_ON
5223 printk("\n\nCMV fail, Group INFO Address 80 Index 0");
5225 pts
.adslATUCSubcarrierInfo_pt
->HLOGMTus
= 0;
5228 pts
.adslATUCSubcarrierInfo_pt
->HLOGMTus
= RxMessage
[4];
5233 /////////////////////////////////////////////////////////////////////////
5234 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_HLOGPS
)){
5235 int index
=0,size
=12;
5236 //printk("NEAREND_HLOGPS\n");
5237 for (index
=0;index
<64;index
+=size
)
5241 NEAREND_HLOGPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5242 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5243 #ifdef AMAZON_MEI_DEBUG_ON
5244 printk("\n\nCMV fail, Group INFO Address 75 Index 0");
5249 if (adsl_mode
<0x4000)//adsl /adsl2 mode
5252 memcpy(&pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[index
],&RxMessage
[4],size
*2);
5257 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5259 //pts.adslATUCSubcarrierInfo_pt->HLOGpsus[(index+msg_idx)*2+1] = RxMessage[4+msg_idx];
5260 pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[(index
+msg_idx
)] = RxMessage
[4+msg_idx
];
5267 if (adsl_mode
>= 0x4000)//adsl2 mode
5269 pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[0] = pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[1];
5270 for (index
=1;index
<64;index
++)
5272 pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[index
*2] = (pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[(index
)*2-1] + pts
.adslATUCSubcarrierInfo_pt
->HLOGpsus
[(index
)*2+1]) >>1;
5277 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_QLNMT
)){
5278 NEAREND_QLNMT_MAKECMV(H2D_CMV_READ
);
5279 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5280 #ifdef AMAZON_MEI_DEBUG_ON
5281 printk("\n\nCMV fail, Group INFO Address 80 Index 1");
5283 pts
.adslATUCSubcarrierInfo_pt
->QLNMTus
= 0;
5286 pts
.adslATUCSubcarrierInfo_pt
->QLNMTus
= RxMessage
[4];
5290 /////////////////////////////////////////////////////////////////////////
5291 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_QLNPS
)){
5292 int index
=0,size
=12;
5293 //printk("NEAREND_QLNPS\n");
5294 for (index
=0;index
<32;index
+=size
)
5298 NEAREND_QLNPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5299 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5300 #ifdef AMAZON_MEI_DEBUG_ON
5301 printk("\n\nCMV fail, Group INFO Address 77 Index 0");
5306 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5310 //memcpy(&pts.adslATUCSubcarrierInfo_pt->QLNpsds[index],&RxMessage[4],size*2);
5311 if (adsl_mode
== 0x200 || adsl_mode
== 0x800 || adsl_mode
==0x2000 || adsl_mode
==0x4000 || (adsl_mode
== 0 && (adsl_mode_extend
== 0x4 || adsl_mode_extend
== 0x2))//ADSL 2 Annex B(0x200)/J(0x800)/M(0x2000) //ADSL 2+ B,J,M
5312 if (adsl_mode
< 0x4000 && adsl_mode_extend
==0)//adsl2 mode
5314 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
+msg_idx
)*4+1] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5315 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
+msg_idx
)*4+3] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5319 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
+msg_idx
)*2] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5320 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
+msg_idx
)*2+1] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5321 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
5329 //if (adsl_mode <0x4000)//Annex I/J/L/M
5330 if (adsl_mode
== 0x200 || adsl_mode
== 0x800 || adsl_mode
==0x2000 || adsl_mode
==0x4000 || (adsl_mode
== 0 && (adsl_mode_extend
== 0x4 || adsl_mode_extend
== 0x2))//ADSL 2 Annex B(0x200)/J(0x800)/M(0x2000) //ADSL 2+ B,J,M
5332 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[0] = pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[1];
5333 for (index
=1;index
<64;index
++)
5335 pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[index
*2] = (pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
)*2-1] + pts
.adslATUCSubcarrierInfo_pt
->QLNpsus
[(index
)*2+1]) >>1;
5340 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_SNRMT
)){
5341 NEAREND_SNRMT_MAKECMV(H2D_CMV_READ
);
5342 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5343 #ifdef AMAZON_MEI_DEBUG_ON
5344 printk("\n\nCMV fail, Group INFO Address 80 Index 2");
5346 pts
.adslATUCSubcarrierInfo_pt
->SNRMTus
= 0;
5349 pts
.adslATUCSubcarrierInfo_pt
->SNRMTus
= RxMessage
[4];
5352 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_SNRPS
)){
5353 int index
=0,size
=12;
5354 //printk("NEAREND_SNRPS\n");
5355 for (index
=0;index
<64;index
+=size
)
5359 NEAREND_SNRPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5360 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5361 #ifdef AMAZON_MEI_DEBUG_ON
5362 printk("\n\nCMV fail, Group INFO Address 78 Index 0");
5366 //memcpy(&pts.adslATUCSubcarrierInfo_pt->SNRpsus[index],&RxMessage[4],size*2);
5368 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5370 pts
.adslATUCSubcarrierInfo_pt
->SNRpsus
[index
+msg_idx
] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5371 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
5377 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_BITPS
)){
5378 int index
=0,size
=12;
5379 //printk("NEAREND_BITPS\n");
5380 for (index
=0;index
<32;index
+=size
)
5384 NEAREND_BITPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5385 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5386 #ifdef AMAZON_MEI_DEBUG_ON
5387 printk("\n\nCMV fail, Group INFO Address 22 Index 0");
5392 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5394 pts
.adslATUCSubcarrierInfo_pt
->BITpsus
[(index
+msg_idx
)*2] = (u16
)(RxMessage
[4+msg_idx
]&0xFF);
5395 pts
.adslATUCSubcarrierInfo_pt
->BITpsus
[(index
+msg_idx
)*2+1] = (u16
)((RxMessage
[4+msg_idx
]>>8)&0xFF);
5396 //printk("index:%d ,cmv_result: %04X\n",index+msg_idx,RxMessage[4+msg_idx]);
5402 if(IS_FLAG_SET((&(pts
.adslATUCSubcarrierInfo_pt
->flags
)), NEAREND_GAINPS
)){
5403 int index
=0,size
=12;
5404 //printk("NEAREND_GAINPS\n");
5405 for (index
=0;index
<64;index
+=size
)
5409 NEAREND_GAINPS_MAKECMV(H2D_CMV_READ
,index
,size
);
5410 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5411 #ifdef AMAZON_MEI_DEBUG_ON
5412 printk("\n\nCMV fail, Group INFO Address 24 Index 0");
5418 for (msg_idx=0;msg_idx<size;msg_idx++)
5420 pts.adslATUCSubcarrierInfo_pt->GAINpsds[(index+msg_idx)*2] = RxMessage[4+msg_idx]&0xFF;
5421 pts.adslATUCSubcarrierInfo_pt->GAINpsds[(index+msg_idx)*2+1] = (RxMessage[4+msg_idx]>>8)&0xFF;
5425 memcpy(&pts
.adslATUCSubcarrierInfo_pt
->GAINpsus
[index
],&RxMessage
[4],size
*2);
5428 for (msg_idx
=0;msg_idx
<size
;msg_idx
++)
5430 printk("index:%d ,cmv_result: %04X\n",index
+msg_idx
,RxMessage
[4+msg_idx
]);
5436 copy_to_user((char *)lon
, (char *)pts
.adslATUCSubcarrierInfo_pt
, sizeof(adslATUCSubcarrierInfo
));
5437 kfree(pts
.adslATUCSubcarrierInfo_pt
);
5440 case GET_ADSL_LINE_INIT_STATS
:
5441 copy_to_user((char *)lon
, (char *)&AdslInitStatsData
, sizeof(AdslInitStatsData
));
5444 case GET_ADSL_POWER_SPECTRAL_DENSITY
:
5445 if(down_interruptible(&mei_sema
))
5446 return -ERESTARTSYS
;
5448 pts
.adslPowerSpectralDensity_pt
= (adslPowerSpectralDensity
*)kmalloc(sizeof(adslPowerSpectralDensity
), GFP_KERNEL
);
5449 memset((char *)pts
.adslPowerSpectralDensity_pt
, 0, sizeof(adslPowerSpectralDensity
));
5453 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5454 #ifdef AMAZON_MEI_DEBUG_ON
5455 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5463 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5464 #ifdef AMAZON_MEI_DEBUG_ON
5465 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5473 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5474 #ifdef AMAZON_MEI_DEBUG_ON
5475 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5480 k
=(int16_t)RxMessage
[4];
5484 pts
.adslPowerSpectralDensity_pt
->ACTPSDus
= ((int )(j
*256 - temp
*10*256 + k
*10)) /256;
5490 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5491 #ifdef AMAZON_MEI_DEBUG_ON
5492 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5500 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5501 #ifdef AMAZON_MEI_DEBUG_ON
5502 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5510 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5511 #ifdef AMAZON_MEI_DEBUG_ON
5512 printk("\n\nCMV fail, Group PLAM Address 35 Index 0");
5517 //temp2=RxMessage[4];
5518 k
=(int16_t)RxMessage
[4];
5522 pts
.adslPowerSpectralDensity_pt
->ACTPSDds
= ((int )(j
*256 - temp
*10*256 + k
*10)) /256;
5524 copy_to_user((char *)lon
, (char *)pts
.adslPowerSpectralDensity_pt
, sizeof(adslPowerSpectralDensity
));
5525 kfree(pts
.adslPowerSpectralDensity_pt
);
5528 case AMAZON_MEI_START
:
5530 loop_diagnostics_completed
= 0;
5531 #ifdef ARC_READY_ACK
5535 if(down_trylock(&mei_sema
)!=0)
5538 printk("lock fail\n");
5542 set_current_state(TASK_INTERRUPTIBLE
);
5543 schedule_timeout(10);
5547 printk("Force to Reboot ADSL!\n");
5549 set_current_state(TASK_INTERRUPTIBLE
);
5550 schedule_timeout(1000);
5551 sema_init(&mei_sema
, 1); // semaphore initialization, mutex
5558 if(down_interruptible(&mei_sema
)) //disable CMV access until ARC ready
5560 return -ERESTARTSYS
;
5564 //CLEAR_BIT((*((volatile u32 *)0xB0100B40)), 0x40); //Warning LED GPIO ON
5565 if(chantype
.interleave
==1){
5566 kfree(interleave_mei_net
.priv
);
5567 unregister_netdev(&interleave_mei_net
);
5569 else if(chantype
.fast
==1){
5570 kfree(fast_mei_net
.priv
);
5571 unregister_netdev(&fast_mei_net
);
5573 chantype
.interleave
=0;
5575 meiMailboxInterruptsDisable(); //disable all MEI interrupts
5576 if(mei_arc_swap_buff
== NULL
){
5577 mei_arc_swap_buff
= (u32
*)kmalloc(MAXSWAPSIZE
*4, GFP_KERNEL
);
5578 if(mei_arc_swap_buff
==NULL
){
5579 #ifdef AMAZON_MEI_DEBUG_ON
5580 printk("\n\n malloc fail for codeswap buff");
5585 if(meiForceRebootAdslModem() != MEI_SUCCESS
){
5586 #ifdef AMAZON_MEI_DEBUG_ON
5587 printk("\n\n meiForceRebootAdslModem() error...");
5591 interruptible_sleep_on(&wait_queue_codeswap
);
5594 case AMAZON_MEI_MIB_DAEMON
:
5595 #ifdef IFX_SMALL_FOOTPRINT /* [ */
5597 #else /* ][ !IFX_SMALL_FOOTPRINT */
5601 interruptible_sleep_on_timeout(&wait_queue_mibdaemon
, ((MIB_INTERVAL
-i
)/(1000/HZ
)));
5604 // printk("\n\n update mib");
5606 do_gettimeofday(&time_now
);
5607 if(time_now
.tv_sec
- current_intvl
->start_time
.tv_sec
>=900){
5608 if(current_intvl
->list
.next
!=&interval_list
){
5609 current_intvl
= list_entry(current_intvl
->list
.next
, amazon_mei_mib
, list
);
5610 do_gettimeofday(&(current_intvl
->start_time
));
5613 mib_ptr
= list_entry(interval_list
.next
, amazon_mei_mib
, list
);
5614 list_del(interval_list
.next
);
5615 memset(mib_ptr
, 0, sizeof(amazon_mei_mib
));
5616 list_add_tail(&(mib_ptr
->list
), &interval_list
);
5617 if(current_intvl
->list
.next
==&interval_list
)
5618 #ifdef AMAZON_MEI_DEBUG_ON
5619 printk("\n\nlink list error");
5621 current_intvl
= list_entry(current_intvl
->list
.next
, amazon_mei_mib
, list
);
5622 do_gettimeofday(&(current_intvl
->start_time
));
5626 if(down_interruptible(&mei_sema
))
5627 return -ERESTARTSYS
;
5629 ATUC_PERF_LO_FLAG_MAKECMV;
5630 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS){
5631 #ifdef AMAZON_MEI_DEBUG_ON
5632 printk("\n\nCMV fail, Group 7 Address 0 Index 0");
5636 if(RxMessage[4]&PLAM_LOS_FailureBit){
5637 current_intvl->AtucPerfLos++;
5639 CurrStatus.adslAtucCurrStatus = 2;
5641 if(RxMessage[4]&PLAM_LOF_FailureBit){
5642 current_intvl->AtucPerfLof++;
5644 CurrStatus.adslAtucCurrStatus = 1;
5646 if(!(RxMessage[4]&(PLAM_LOS_FailureBit|PLAM_LOF_FailureBit)))
5647 CurrStatus.adslAtucCurrStatus = 0;
5650 ATUC_PERF_ESS_FLAG_MAKECMV
;
5651 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5652 #ifdef AMAZON_MEI_DEBUG_ON
5653 printk("\n\nCMV fail, Group 7 Address 7 Index 0");
5657 temp
= RxMessage
[4]-mib_pread
.ATUC_PERF_ESS
;
5659 current_intvl
->AtucPerfEs
+=temp
;
5660 ATUC_PERF_ESS
+=temp
;
5661 mib_pread
.ATUC_PERF_ESS
= RxMessage
[4];
5664 current_intvl
->AtucPerfEs
+=0xffff-mib_pread
.ATUC_PERF_ESS
+RxMessage
[4];
5665 ATUC_PERF_ESS
+=0xffff-mib_pread
.ATUC_PERF_ESS
+RxMessage
[4];
5666 mib_pread
.ATUC_PERF_ESS
= RxMessage
[4];
5670 ATUR_PERF_LO_FLAG_MAKECMV;
5671 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS){
5672 #ifdef AMAZON_MEI_DEBUG_ON
5673 printk("\n\nCMV fail, Group 7 Address 1 Index 0");
5677 if(RxMessage[4]&PLAM_LOS_FailureBit){
5678 current_intvl->AturPerfLos++;
5680 CurrStatus.adslAturCurrStatus = 2;
5682 if(RxMessage[4]&PLAM_LOF_FailureBit){
5683 current_intvl->AturPerfLof++;
5685 CurrStatus.adslAturCurrStatus = 1;
5687 if(RxMessage[4]&PLAM_LPR_FailureBit){
5688 current_intvl->AturPerfLpr++;
5690 CurrStatus.adslAturCurrStatus = 3;
5692 if(!(RxMessage[4]&(PLAM_LOS_FailureBit|PLAM_LOF_FailureBit|PLAM_LPR_FailureBit)))
5693 CurrStatus.adslAturCurrStatus = 0;
5696 ATUR_PERF_ESS_FLAG_MAKECMV
;
5697 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5698 #ifdef AMAZON_MEI_DEBUG_ON
5699 printk("\n\nCMV fail, Group 7 Address 33 Index 0");
5703 temp
= RxMessage
[4]-mib_pread
.ATUR_PERF_ESS
;
5705 current_intvl
->AturPerfEs
+=temp
;
5706 ATUR_PERF_ESS
+=temp
;
5707 mib_pread
.ATUR_PERF_ESS
= RxMessage
[4];
5710 current_intvl
->AturPerfEs
+=0xffff-mib_pread
.ATUR_PERF_ESS
+RxMessage
[4];
5711 ATUR_PERF_ESS
+= 0xffff-mib_pread
.ATUR_PERF_ESS
+RxMessage
[4];
5712 mib_pread
.ATUR_PERF_ESS
=RxMessage
[4];
5715 // to update rx/tx blocks
5716 ATUR_CHAN_RECV_BLK_FLAG_MAKECMV_LSW
;
5717 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5718 #ifdef AMAZON_MEI_DEBUG_ON
5719 printk("\n\nCMV fail, Group 7 Address 20 Index 0");
5723 temp
= RxMessage
[4];
5725 ATUR_CHAN_RECV_BLK_FLAG_MAKECMV_MSW
;
5726 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5727 #ifdef AMAZON_MEI_DEBUG_ON
5728 printk("\n\nCMV fail, Group 7 Address 21 Index 0");
5732 temp2
= RxMessage
[4];
5734 if((temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
)>=0){
5735 current_intvl
->AturChanPerfRxBlk
+=temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
;
5736 ATUR_CHAN_RECV_BLK
+=temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
;
5737 mib_pread
.ATUR_CHAN_RECV_BLK
= temp
+ (temp2
<<16);
5740 current_intvl
->AturChanPerfRxBlk
+=0xffffffff - mib_pread
.ATUR_CHAN_RECV_BLK
+(temp
+ (temp2
<<16));
5741 ATUR_CHAN_RECV_BLK
+=0xffffffff - mib_pread
.ATUR_CHAN_RECV_BLK
+(temp
+ (temp2
<<16));
5742 mib_pread
.ATUR_CHAN_RECV_BLK
= temp
+ (temp2
<<16);
5744 current_intvl
->AturChanPerfTxBlk
= current_intvl
->AturChanPerfRxBlk
;
5745 ATUR_CHAN_TX_BLK
= ATUR_CHAN_RECV_BLK
;
5747 ATUR_CHAN_TX_BLK_FLAG_MAKECMV_LSW;
5748 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS)
5749 printk("\n\nCMV fail, Group 7 Address 20 Index 0");
5752 current_intvl->AturChanPerfTxBlk+=RxMessage[4];
5753 ATUR_CHAN_TX_BLK+=RxMessage[4];
5756 ATUR_CHAN_TX_BLK_FLAG_MAKECMV_MSW;
5757 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS)
5758 printk("\n\nCMV fail, Group 7 Address 21 Index 0");
5761 current_intvl->AturChanPerfTxBlk+=(int)((RxMessage[4])<<16);
5762 ATUR_CHAN_TX_BLK+=(int)((RxMessage[4])<<16);
5766 if(chantype
.interleave
== 1){
5767 ATUR_CHAN_CORR_BLK_FLAG_MAKECMV_INTL
;
5768 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5769 #ifdef AMAZON_MEI_DEBUG_ON
5770 printk("\n\nCMV fail, Group 7 Address 3 Index 0");
5774 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
;
5776 current_intvl
->AturChanPerfCorrBlk
+=temp
;
5777 ATUR_CHAN_CORR_BLK
+=temp
;
5778 mib_pread
.ATUR_CHAN_CORR_BLK_INTL
= RxMessage
[4];
5781 current_intvl
->AturChanPerfCorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
+RxMessage
[4];
5782 ATUR_CHAN_CORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
+RxMessage
[4];
5783 mib_pread
.ATUR_CHAN_CORR_BLK_INTL
= RxMessage
[4];
5787 else if(chantype
.fast
== 1){
5788 ATUR_CHAN_CORR_BLK_FLAG_MAKECMV_FAST
;
5789 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5790 #ifdef AMAZON_MEI_DEBUG_ON
5791 printk("\n\nCMV fail, Group 7 Address 3 Index 1");
5795 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
;
5797 current_intvl
->AturChanPerfCorrBlk
+=temp
;
5798 ATUR_CHAN_CORR_BLK
+=temp
;
5799 mib_pread
.ATUR_CHAN_CORR_BLK_FAST
= RxMessage
[4];
5802 current_intvl
->AturChanPerfCorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
+ RxMessage
[4];
5803 ATUR_CHAN_CORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
+ RxMessage
[4];
5804 mib_pread
.ATUR_CHAN_CORR_BLK_FAST
= RxMessage
[4];
5809 if(chantype
.interleave
== 1){
5810 ATUR_CHAN_UNCORR_BLK_FLAG_MAKECMV_INTL
;
5811 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5812 #ifdef AMAZON_MEI_DEBUG_ON
5813 printk("\n\nCMV fail, Group 7 Address 2 Index 0");
5817 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
;
5819 current_intvl
->AturChanPerfUncorrBlk
+=temp
;
5820 ATUR_CHAN_UNCORR_BLK
+=temp
;
5821 mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
= RxMessage
[4];
5824 current_intvl
->AturChanPerfUncorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
+ RxMessage
[4];
5825 ATUR_CHAN_UNCORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
+ RxMessage
[4];
5826 mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
= RxMessage
[4];
5830 else if(chantype
.fast
== 1){
5831 ATUR_CHAN_UNCORR_BLK_FLAG_MAKECMV_FAST
;
5832 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5833 #ifdef AMAZON_MEI_DEBUG_ON
5834 printk("\n\nCMV fail, Group 7 Address 2 Index 1");
5838 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
;
5840 current_intvl
->AturChanPerfUncorrBlk
+=temp
;
5841 ATUR_CHAN_UNCORR_BLK
+=temp
;
5842 mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
= RxMessage
[4];
5845 current_intvl
->AturChanPerfUncorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
+ RxMessage
[4];
5846 ATUR_CHAN_UNCORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
+ RxMessage
[4];
5847 mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
= RxMessage
[4];
5854 #ifdef AMAZON_MEI_MIB_RFC3440
5855 ATUC_PERF_STAT_FASTR_FLAG_MAKECMV
; //???
5856 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5857 #ifdef AMAZON_MEI_DEBUG_ON
5858 printk("\n\nCMV fail, Group 0 Address 0 Index 0");
5862 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_FASTR
;
5864 current_intvl
->AtucPerfStatFastR
+=temp
;
5865 ATUC_PERF_STAT_FASTR
+=temp
;
5866 mib_pread
.ATUC_PERF_STAT_FASTR
= RxMessage
[4];
5869 current_intvl
->AtucPerfStatFastR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FASTR
+ RxMessage
[4];
5870 ATUC_PERF_STAT_FASTR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FASTR
+ RxMessage
[4];
5871 mib_pread
.ATUC_PERF_STAT_FASTR
= RxMessage
[4];
5874 ATUC_PERF_STAT_FAILED_FASTR_FLAG_MAKECMV
; //???
5875 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5876 #ifdef AMAZON_MEI_DEBUG_ON
5877 printk("\n\nCMV fail, Group 0 Address 0 Index 0");
5881 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
;
5883 current_intvl
->AtucPerfStatFailedFastR
+=temp
;
5884 ATUC_PERF_STAT_FAILED_FASTR
+=temp
;
5885 mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
= RxMessage
[4];
5888 current_intvl
->AtucPerfStatFailedFastR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
+ RxMessage
[4];
5889 ATUC_PERF_STAT_FAILED_FASTR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
+ RxMessage
[4];
5890 mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
= RxMessage
[4];
5893 ATUC_PERF_STAT_SESL_FLAG_MAKECMV
;
5894 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5895 #ifdef AMAZON_MEI_DEBUG_ON
5896 printk("\n\nCMV fail, Group 7 Address 8 Index 0");
5900 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_SESL
;
5902 current_intvl
->AtucPerfStatSesL
+=temp
;
5903 ATUC_PERF_STAT_SESL
+=temp
;
5904 mib_pread
.ATUC_PERF_STAT_SESL
= RxMessage
[4];
5907 current_intvl
->AtucPerfStatSesL
+=0xffff - mib_pread
.ATUC_PERF_STAT_SESL
+ RxMessage
[4];
5908 ATUC_PERF_STAT_SESL
+=0xffff - mib_pread
.ATUC_PERF_STAT_SESL
+ RxMessage
[4];
5909 mib_pread
.ATUC_PERF_STAT_SESL
= RxMessage
[4];
5912 ATUC_PERF_STAT_UASL_FLAG_MAKECMV
;
5913 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5914 #ifdef AMAZON_MEI_DEBUG_ON
5915 printk("\n\nCMV fail, Group 7 Address 10 Index 0");
5919 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_UASL
;
5921 current_intvl
->AtucPerfStatUasL
+=temp
;
5922 ATUC_PERF_STAT_UASL
+=temp
;
5923 mib_pread
.ATUC_PERF_STAT_UASL
= RxMessage
[4];
5926 current_intvl
->AtucPerfStatUasL
+=0xffff - mib_pread
.ATUC_PERF_STAT_UASL
+ RxMessage
[4];
5927 ATUC_PERF_STAT_UASL
+=0xffff - mib_pread
.ATUC_PERF_STAT_UASL
+ RxMessage
[4];
5928 mib_pread
.ATUC_PERF_STAT_UASL
= RxMessage
[4];
5931 ATUR_PERF_STAT_SESL_FLAG_MAKECMV
;
5932 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
5933 #ifdef AMAZON_MEI_DEBUG_ON
5934 printk("\n\nCMV fail, Group 7 Address 34 Index 0");
5938 temp
= RxMessage
[4] - mib_pread
.ATUR_PERF_STAT_SESL
;
5940 current_intvl
->AtucPerfStatUasL
+=temp
;
5941 ATUC_PERF_STAT_UASL
+=temp
;
5942 mib_pread
.ATUR_PERF_STAT_SESL
= RxMessage
[4];
5945 current_intvl
->AtucPerfStatUasL
+=0xffff - mib_pread
.ATUR_PERF_STAT_SESL
+ RxMessage
[4];
5946 ATUC_PERF_STAT_UASL
+=0xffff - mib_pread
.ATUR_PERF_STAT_SESL
+ RxMessage
[4];
5947 mib_pread
.ATUR_PERF_STAT_SESL
= RxMessage
[4];
5954 do_gettimeofday(&time_fini
);
5955 i
= ((int)((time_fini
.tv_sec
-time_now
.tv_sec
)*1000)) + ((int)((time_fini
.tv_usec
-time_now
.tv_usec
)/1000)) ; //msec
5959 #endif /* ] !IFX_SMALL_FOOTPRINT */
5960 case AMAZON_MEI_RESET
:
5961 case AMAZON_MEI_REBOOT
:
5962 case AMAZON_MEI_SHOWTIME
:
5963 /* if(mei_arc_swap_buff !=NULL){
5964 kfree(mei_arc_swap_buff);
5965 mei_arc_swap_buff=NULL;
5967 if(image_buffer !=NULL){
5968 // kfree(image_buffer);
5969 vfree(image_buffer);
5973 if(clreoc_command_pkt
!=NULL
){
5974 kfree(clreoc_command_pkt
);
5975 clreoc_command_pkt
=NULL
;
5977 for(i
=0;i
<CLREOC_BUFF_SIZE
;i
++)
5978 clreoc_pkt
[i
].len
=0; //flush all remaining clreoc commands in buffer
5980 memset(mei_mib, 0, (sizeof(amazon_mei_mib)*INTERVAL_NUM));
5981 INIT_LIST_HEAD(&interval_list);
5982 for(i=0;i<INTERVAL_NUM;i++)
5983 list_add_tail(&(mei_mib[i].list), &interval_list);
5984 current_intvl = list_entry(interval_list.next, amazon_mei_mib, list);
5985 do_gettimeofday(&(current_intvl->start_time));
5994 ATUR_CHAN_RECV_BLK=0;
5996 ATUR_CHAN_CORR_BLK=0;
5997 ATUR_CHAN_UNCORR_BLK=0;
5998 memset((((u8 *)&AlarmConfProfile)+32), 0, 16*4);
5999 AlarmConfProfile.adslLineAlarmConfProfileRowStatus=1;
6001 PrevTxRate
.adslAtucChanPrevTxRate
=0;
6002 PrevTxRate
.adslAturChanPrevTxRate
=0;
6003 CurrStatus
.adslAtucCurrStatus
=0;
6004 CurrStatus
.adslAturCurrStatus
=0;
6006 if((command
==AMAZON_MEI_RESET
) || (command
==AMAZON_MEI_REBOOT
)){
6007 #ifdef AMAZON_CHECK_LINK
6008 if (adsl_link_notify
){
6009 (*adsl_link_notify
)(0);
6013 //CLEAR_BIT((*((volatile u32 *)0xB0100B40)), 0x40); //Warning LED GPIO ON
6014 // disconnect net_dev
6015 if(chantype
.interleave
==1){
6016 kfree(interleave_mei_net
.priv
);
6017 unregister_netdev(&interleave_mei_net
);
6018 // if(unregister_netdev(&interleave_mei_net)!=0)
6019 // printk("\n unregister interleave fail");
6021 else if(chantype
.fast
==1){
6022 kfree(fast_mei_net
.priv
);
6023 unregister_netdev(&fast_mei_net
);
6024 // if(unregister_netdev(&fast_mei_net)!=0)
6025 // printk("\n unregister fast fail");
6027 chantype
.interleave
=0;
6029 // 603221:tc.chen start
6030 chantype
.bearchannel0
= 0;
6031 chantype
.bearchannel1
= 0;
6033 // 603221:tc.chen end
6037 makeCMV(H2D_CMV_READ
, STAT
, 0, 0, 1, NULL
); //maximum allowed tx message length, in bytes
6038 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6039 //printk("AdslInitStatsData.FullInitializationCount++\n");
6040 AdslInitStatsData
.FullInitializationCount
++;
6041 //printk("AdslInitStatsData.FailedFullInitializationCount++\n");
6042 AdslInitStatsData
.FailedFullInitializationCount
++;
6043 //printk("AdslInitStatsData.LINIT_Errors++\n");
6044 AdslInitStatsData
.LINIT_Errors
++;
6047 //printk("RxMessage=%X\n",RxMessage[4]);
6048 if ( RxMessage
[4]!=0x1)
6050 //printk("AdslInitStatsData.FullInitializationCount++\n");
6051 AdslInitStatsData
.FullInitializationCount
++;
6052 if ( RxMessage
[4] != 0x7)
6054 //printk("AdslInitStatsData.LINIT_Errors++\n");
6055 AdslInitStatsData
.LINIT_Errors
++;
6056 //printk("AdslInitStatsData.FailedFullInitializationCount++\n");
6057 AdslInitStatsData
.FailedFullInitializationCount
++;
6064 wake_up_interruptible(&wait_queue_codeswap
); //wake up codeswap daemon
6066 interruptible_sleep_on_timeout(&wait_queue_reboot
, 1*HZ
); // sleep until arc ready
6067 #ifdef ARC_READY_ACK
6073 printk("\n reboot retry");
6080 else{ //AMAZON_MEI_SHOWTIME
6081 if(down_interruptible(&mei_sema
))
6082 return -ERESTARTSYS
;
6085 makeCMV(H2D_CMV_READ
, INFO
, 83, 0, 1, data
); //maximum allowed tx message length, in bytes
6086 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6087 #ifdef AMAZON_MEI_DEBUG_ON
6088 printk("\n\nCMV fail, Group 3 Address 83 Index 0");
6092 clreoc_max_tx_len
= (int)RxMessage
[4];
6093 clreoc_command_pkt
= kmalloc((clreoc_max_tx_len
*CLREOC_BUFF_SIZE
), GFP_KERNEL
);
6094 if(clreoc_command_pkt
== NULL
){
6095 #ifdef AMAZON_MEI_DEBUG_ON
6096 printk("kmalloc error for clreoc_command_pkt\n\n");
6101 for(i
=0;i
<CLREOC_BUFF_SIZE
;i
++){
6102 clreoc_pkt
[i
].command
= (u8
*)(((u8
*)clreoc_command_pkt
) + (clreoc_max_tx_len
*i
));
6103 clreoc_pkt
[i
].len
=0;
6107 // decide what channel, then register
6108 makeCMV(H2D_CMV_READ
, STAT
, 12, 0, 1, data
);
6109 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6110 #ifdef AMAZON_MEI_DEBUG_ON
6111 printk("\n\nCMV fail, Group 2 Address 12 Index 0");
6115 if((RxMessage
[4]&0x1)==1){
6116 if(register_netdev(&interleave_mei_net
)!=0){
6117 #ifdef AMAZON_MEI_DEBUG_ON
6118 printk("\n\n Register interleave Device Failed.");
6122 chantype
.interleave
= 1;
6124 #ifdef AMAZON_MEI_DEBUG_ON
6125 printk("\n channel is interleave");
6129 else if((RxMessage
[4]&0x2)==2){
6130 if(register_netdev(&fast_mei_net
)!=0){
6131 #ifdef AMAZON_MEI_DEBUG_ON
6132 printk("\n\n Register fast Device Failed.");
6137 chantype
.interleave
= 0;
6138 #ifdef AMAZON_MEI_DEBUG_ON
6139 printk("\n channel is fast");
6144 #ifdef AMAZON_MEI_DEBUG_ON
6145 printk("\nunknown channel type, 0x%8x", RxMessage
[4]);
6148 // 603221:tc.chen start
6149 if ( (RxMessage
[4]&0x100) == 0x100)
6151 chantype
.bearchannel0
= 1;
6152 }else if ( (RxMessage
[4]&0x100) == 0x200)
6154 chantype
.bearchannel1
= 1;
6156 // 603221:tc.chen end
6158 // 603221:tc.chen start
6160 makeCMV(H2D_CMV_READ
, STAT
, 1, 0, 1, data
);
6161 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6162 #ifdef AMAZON_MEI_DEBUG_ON
6163 printk("\n\nCMV fail, Group STAT Address 1 Index 0");
6166 adsl_mode
= RxMessage
[4];
6167 // 603221:tc.chen end
6168 makeCMV(H2D_CMV_READ
, STAT
, 17, 0, 1, data
);
6169 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6170 #ifdef AMAZON_MEI_DEBUG_ON
6171 printk("\n\nCMV fail, Group STAT Address 1 Index 0");
6174 adsl_mode_extend
= RxMessage
[4];
6176 // update previous channel tx rate
6177 ATUC_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
6178 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6179 #ifdef AMAZON_MEI_DEBUG_ON
6180 printk("\n\nCMV fail, Group 6 Address 1 Index 0");
6182 PrevTxRate
.adslAtucChanPrevTxRate
= 0;
6185 PrevTxRate
.adslAtucChanPrevTxRate
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
6187 ATUR_CHAN_CURR_TX_RATE_FLAG_MAKECMV
;
6188 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6189 #ifdef AMAZON_MEI_DEBUG_ON
6190 printk("\n\nCMV fail, Group 6 Address 0 Index 0");
6192 PrevTxRate
.adslAturChanPrevTxRate
= 0;
6195 PrevTxRate
.adslAturChanPrevTxRate
= (u32
)(RxMessage
[4]) + (((u32
)(RxMessage
[5]))<<16);
6201 //SET_BIT((*((volatile u32 *)0xB0100B40)), 0x40); //Warning LED GPIO OFF
6203 #ifdef IFX_DYING_GASP
6204 lop_debugwr
.buffer
[0]=0xffffffff; //dying gasp
6205 lop_debugwr
.iCount
=1; //dying gasp
6206 makeCMV(H2D_CMV_READ
, INFO
, 66, 4, 1, NULL
);
6207 //mei_ioctl((struct inode *)0,NULL, AMAZON_MEI_CMV_WINHOST, &RxMessage);
6208 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6209 #ifdef AMAZON_MEI_DEBUG_ON
6210 printk("\n\nCMV fail, Group 3 Address 66 Index 4");
6213 lop_debugwr
.iAddress
=(u32
)RxMessage
[4];
6214 makeCMV(H2D_CMV_READ
, INFO
, 66, 5, 1, NULL
);
6215 //mei_ioctl((struct inode *)0,NULL, AMAZON_MEI_CMV_WINHOST, &RxMessage);
6216 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6217 #ifdef AMAZON_MEI_DEBUG_ON
6218 printk("\n\nCMV fail, Group 3 Address 66 Index 5");
6221 lop_debugwr
.iAddress
+=((u32
)RxMessage
[4])<<16;
6224 #endif // IFX_DYING_GASP
6226 //joelin 04/16/2005-start
6227 makeCMV(H2D_CMV_WRITE
, PLAM
, 10, 0, 1, &unavailable_seconds
);
6228 //mei_ioctl((struct inode *)0,NULL, AMAZON_MEI_CMV_WINHOST, &RxMessage);
6229 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6230 #ifdef AMAZON_MEI_DEBUG_ON
6231 printk("\n\nCMV fail, Group 7 Address 10 Index 0");
6237 //joelin 04/16/2005-end
6240 #ifdef AMAZON_CHECK_LINK
6241 if (adsl_link_notify
){
6242 (*adsl_link_notify
)(1);
6250 case AMAZON_MEI_REPLY:
6251 copy_from_user((char *)buff, (char *)lon, MSG_LENGTH * 2);
6252 if(meiCMV(buff, YES_REPLY) != MEI_SUCCESS){
6253 printk("\n\n meiCMV no reply back");
6257 copy_to_user((char *)lon, (char *)RxMessage, MSG_LENGTH * 2);
6259 case AMAZON_MEI_NOREPLY:
6260 copy_from_user((char *)buff, (char *)lon, MSG_LENGTH * 2);
6261 if(meiCMV(buff, NO_REPLY) != MEI_SUCCESS){
6262 printk("\n\n meiCMV Host to DSP failed");
6268 case AMAZON_MEI_HALT
:
6271 case AMAZON_MEI_CMV_WINHOST
:
6272 if(down_interruptible(&mei_sema
))
6273 return -ERESTARTSYS
;
6276 copy_from_user((char *)TxMessage
, (char *)lon
, MSG_LENGTH
*2);//joelin
6278 memcpy(TxMessage
,(char *)lon
,MSG_LENGTH
*2);
6281 // if((TxMessage[0]&0xff0)==0x0a0){
6283 printk("\nTxMessage[%i]=%8x", i
, TxMessage
[i
]);
6288 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
6289 #ifdef AMAZON_MEI_DEBUG_ON
6290 // printk("\n\n WINHOST CMV fail ");
6291 printk("\n\nWINHOST CMV fail :TxMessage:%X %X %X %X, RxMessage:%X %X %X %X %X\n",TxMessage
[0],TxMessage
[1],TxMessage
[2],TxMessage
[3],RxMessage
[0],RxMessage
[1],RxMessage
[2],RxMessage
[3],RxMessage
[4]);
6293 meierr
= MEI_FAILURE
;
6297 if (!from_kernel
) //joelin
6298 copy_to_user((char *)lon
, (char *)RxMessage
, MSG_LENGTH
*2);
6300 memcpy((char *)lon
,(char *)RxMessage
,MSG_LENGTH
*2);
6305 #ifdef AMAZON_MEI_CMV_EXTRA
6306 case AMAZON_MEI_CMV_READ
:
6307 copy_from_user((char *)(®rdwr
), (char *)lon
, sizeof(meireg
));
6308 meiLongwordRead(regrdwr
.iAddress
, &(regrdwr
.iData
));
6310 // printk("\n\n iAddress = %8x",regrdwr.iAddress);
6312 copy_to_user((char *)lon
, (char *)(®rdwr
), sizeof(meireg
));
6314 // printk("\n\n iData readback = %8x", regrdwr.iData);
6319 #ifdef AMAZON_MEI_CMV_EXTRA
6320 case AMAZON_MEI_CMV_WRITE
:
6321 copy_from_user((char *)(®rdwr
), (char *)lon
, sizeof(meireg
));
6323 // printk("\n\n iAddress = %8x",regrdwr.iAddress);
6324 // printk("\n\n iData = %8x",regrdwr.iData);
6326 meiLongwordWrite(regrdwr
.iAddress
, regrdwr
.iData
);
6330 #ifdef AMAZON_MEI_CMV_EXTRA
6331 case AMAZON_MEI_REMOTE
:
6332 copy_from_user((char *)(&i
), (char *)lon
, sizeof(int));
6334 meiMailboxInterruptsEnable();
6339 meiMailboxInterruptsDisable();
6340 if(down_interruptible(&mei_sema
))
6341 return -ERESTARTSYS
;
6344 #ifdef AMAZON_MEI_DEBUG_ON
6345 printk("\n\n AMAZON_MEI_REMOTE argument error");
6352 #ifdef AMAZON_MEI_CMV_EXTRA
6353 case AMAZON_MEI_READDEBUG
:
6354 case AMAZON_MEI_WRITEDEBUG
:
6355 if(down_interruptible(&mei_sema
))
6356 return -ERESTARTSYS
;
6357 #ifdef IFX_DYING_GASP
6358 if (!from_kernel
) copy_from_user((char *)(&debugrdwr
), (char *)lon
, sizeof(debugrdwr
));//dying gasp
6359 else memcpy((char *)(&debugrdwr
), (char *)lon
, sizeof(debugrdwr
));
6360 #else //IFX_DYING_GASP
6361 copy_from_user((char *)(&debugrdwr
), (char *)lon
, sizeof(debugrdwr
));
6363 #endif //IFX_DYING_GASP
6365 printk("\nIN iAddress: %8x, iCount:%8x\n", debugrdwr
.iAddress
, debugrdwr
.iCount
);
6368 if(command
==AMAZON_MEI_READDEBUG
)
6369 meiDebugRead(debugrdwr
.iAddress
, debugrdwr
.buffer
, debugrdwr
.iCount
);
6371 meiDebugWrite(debugrdwr
.iAddress
, debugrdwr
.buffer
, debugrdwr
.iCount
);
6373 #ifdef IFX_DYING_GASP
6374 if (!from_kernel
) copy_to_user((char *)lon
, (char*)(&debugrdwr
), sizeof(debugrdwr
));//dying gasp
6375 #else //IFX_DYING_GASP
6376 copy_to_user((char *)lon
, (char*)(&debugrdwr
), sizeof(debugrdwr
));
6377 #endif //IFX_DYING_GASP
6381 printk("\nOUT iAddress: %8x, iCount:%8x\n", debugrdwr
.iAddress
, debugrdwr
.iCount
);
6382 for(i
=0;i
<debugrdwr
.iCount
;i
++)
6383 printk("\n %8x",debugrdwr
.buffer
[i
]);
6388 case AMAZON_MEI_LOP
:
6389 //GPIO31 :dying gasp event indication
6390 // (1) logic high: dying gasp event is false (default)
6391 // (2) logic low: dying gasp event is true
6392 #ifdef IFX_DYING_GASP
6395 CLEAR_BIT((*((volatile u32
*)0xB0100B48)), 0x8000);
6396 CLEAR_BIT((*((volatile u32
*)0xB0100B4C)), 0x8000);
6397 CLEAR_BIT((*((volatile u32
*)0xB0100B50)), 0x8000);
6398 SET_BIT((*((volatile u32
*)0xB0100B54)), 0x8000);
6400 if(((*((volatile u32
*)0xB0100B44))&0x8000)==0x0)
6401 meierr
=MEI_FAILURE
; //return - to indicate loss of power
6403 #endif //#ifdef IFX_DYING_GASP
6406 case AMAZON_MEI_PCM_SETUP
:
6409 *AMAZON_GPIO_P0_DIR
|=1<<15;
6410 *AMAZON_GPIO_P0_ALTSEL0
|=1<<15;
6411 *AMAZON_GPIO_P0_ALTSEL1
&=~(1<<15);
6412 *AMAZON_GPIO_P0_OD
|=1<<15;
6415 *AMAZON_GPIO_P1_DIR
&=~1;
6416 *AMAZON_GPIO_P1_ALTSEL0
|=1;
6417 *AMAZON_GPIO_P1_ALTSEL1
&=~1;
6419 /*GPIO 17 TDM_DCL */
6420 *AMAZON_GPIO_P1_DIR
|=0x02;
6421 *AMAZON_GPIO_P1_ALTSEL0
|=0x02;
6422 *AMAZON_GPIO_P1_ALTSEL1
&=(u32
)~0x02;
6423 *AMAZON_GPIO_P1_OD
|=0x02;
6426 *AMAZON_GPIO_P1_DIR
|=0x04;
6427 *AMAZON_GPIO_P1_ALTSEL0
|=0x04;
6428 *AMAZON_GPIO_P1_ALTSEL1
&=(u32
)~0x04;
6429 *AMAZON_GPIO_P1_OD
|=0x04;
6433 sampledata
[i
*256+j
]=j
;
6436 pcm_start_addr
= lon
;
6438 printk("\n\n pcm_start_addr is %8x", lon
);
6440 for(i
=0;i
<PCM_CHANNEL_NUM
;i
++){
6441 #ifdef PCM_ACCESS_DEBUG
6442 meiDebugRead_16((pcm_start_addr
+i
*16), (u32
*)(pcm_data
+i
), 4);
6444 meiDMARead_16((pcm_start_addr
+i
*16), (u32
*)(pcm_data
+i
), 4);
6446 if((pcm_data
[i
].S
!=8)||(pcm_data
[i
].len
<1)||(pcm_data
[i
].rdindex
!=0)||(pcm_data
[i
].wrindex
!=0)||(pcm_data
[i
].flow
!=0))
6447 printk("\n\n pcm_data fill in wrongly\n\n");
6448 printk("\npcm_data %d",i
);
6449 printk("\n S = %d", pcm_data
[i
].S
);
6450 printk("\n LSW = %4x", pcm_data
[i
].LSW
);
6451 printk("\n MSW = %4x", pcm_data
[i
].MSW
);
6452 printk("\n len = %d", pcm_data
[i
].len
);
6453 printk("\n rdindex = %d", pcm_data
[i
].rdindex
);
6454 printk("\n wrindex = %d", pcm_data
[i
].wrindex
);
6455 printk("\n flow = %d", pcm_data
[i
].flow
);
6456 pcm_data
[i
].finish
=0;
6457 if(i
%2==0){//tx channel
6458 for(j
=0;j
<PCM_BUFF_SIZE
/256;j
++){
6460 pcm_data
[i
].buff
[j
*256+k
]=k
;
6462 pcm_data[i].buff[j*256+k]=0xaa;
6464 pcm_data[i].buff[j*256+k]=0x55;*/
6467 #ifdef PCM_ACCESS_DEBUG
6468 meiDebugWrite_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16)), (u32
*)(pcm_data
[i
].buff
),((pcm_data
[i
].len
/4)/2));//fill half first
6469 // meiDebugWrite_8((((u32)(pcm_data[i].LSW))+(((u32)(pcm_data[i].MSW))<<16)), (u32*)(pcm_data[i].buff),2);//fill half first
6471 meiDMAWrite_8((((u32
)(pcm_data
[i
].LSW
))+(((u32
)(pcm_data
[i
].MSW
))<<16)), (u32
*)(pcm_data
[i
].buff
),((pcm_data
[i
].len
/4)/2));//fill half first
6472 // meiDMAWrite_8((((u32)(pcm_data[i].LSW))+(((u32)(pcm_data[i].MSW))<<16)), (u32*)(pcm_data[i].buff),2);//fill half first
6474 pcm_data
[i
].point
=(pcm_data
[i
].len
)/2;
6475 // pcm_data[i].point=8;
6476 #ifdef PCM_ACCESS_DEBUG
6477 meiDebugRead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
6479 meiDMARead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
6481 temp
= (temp
&0xffff) + (((u32
)(pcm_data
[i
].point
))<<16);
6482 #ifdef PCM_ACCESS_DEBUG
6483 meiDebugWrite_16(pcm_start_addr
+i
*16+12,&temp
, 1);//update wrindex
6485 meiDMAWrite_16(pcm_start_addr
+i
*16+12,&temp
, 1);//update wrindex
6489 pcm_data
[i
].point
=0;
6493 case AMAZON_MEI_PCM_START_TIMER
:
6495 /* enable the timer in the PMU */
6496 *(AMAZON_PMU_PWDCR
) = (*(AMAZON_PMU_PWDCR
))| AMAZON_PMU_PWDCR_GPT
|AMAZON_PMU_PWDCR_FPI
;
6497 /* setup the GPTU for timer tick f_fpi == f_gptu*/
6498 *(AMAZON_GPTU_CLC
) = 0x100;
6499 //reload value = fpi/(HZ * P), timer mode, Prescaler = 4 ( T6I = 000, T6BPS2 = 0)
6500 *(AMAZON_GPTU_CAPREL
) = (int)(117500000/(lon
*4));
6501 *(AMAZON_GPTU_T6CON
) = 0x80C0;
6503 if (request_irq(AMAZON_TIMER6_INT
, amazon_timer6_interrupt_MEI
,0, "hrt", NULL
)!=0){
6504 #ifdef AMAZON_MEI_DEBUG_ON
6505 printk("\n\n unable to register irq for hrt!!!");
6509 enable_irq(AMAZON_TIMER6_INT
);
6511 case AMAZON_MEI_PCM_STOP_TIMER
:
6512 disable_irq(AMAZON_TIMER6_INT
);
6513 free_irq(AMAZON_TIMER6_INT
, NULL
);
6515 case AMAZON_MEI_PCM_CHECK
:
6516 for(i
=0;i
<PCM_CHANNEL_NUM
;i
++){
6517 if(pcm_data
[i
].finish
!=1)
6520 for(i
=0;i
<PCM_CHANNEL_NUM
/2;i
++){
6523 if((pcm_data
[i
*2+1].buff
[j
]==0x0) && (pcm_data
[i
*2+1].buff
[j
+1]==0x1)&& (pcm_data
[i
*2+1].buff
[j
+2]==0x2))
6528 printk("\n j=%d", j
);
6530 for(k
=0;k
<((PCM_BUFF_SIZE
-j
)/4);k
++){
6531 if(memcmp(pcm_data
[i
*2].buff
+k
*4, pcm_data
[i
*2+1].buff
+j
+k
*4, 4)!=0){
6533 printk("\n\n%2x %2x %2x %2x %2x %2x %2x %2x\n\n", *((u8
*)(pcm_data
[i
*2].buff
+k
*4)), *((u8
*)(pcm_data
[i
*2].buff
+k
*4+1)),*((u8
*)(pcm_data
[i
*2].buff
+k
*4+2)),*((u8
*)(pcm_data
[i
*2].buff
+k
*4+3)),*((u8
*)(pcm_data
[i
*2+1].buff
+j
+k
*4)),*((u8
*)(pcm_data
[i
*2+1].buff
+j
+k
*4+1)),*((u8
*)(pcm_data
[i
*2+1].buff
+j
+k
*4+2)),*((u8
*)(pcm_data
[i
*2+1].buff
+j
+k
*4+3)));
6538 printk("\n\n Channel pair %d not match: err32 %d\n\n", i
, temp
);
6540 printk("\n\n Channel pair %d match\n\n", i
);
6542 for(i
=0;i
<PCM_CHANNEL_NUM
;i
++){
6543 if(i
%2==1){//rx channel
6544 #ifdef PCM_ACCESS_DEBUG
6545 meiDebugRead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
6547 meiDMARead_16(pcm_start_addr
+i
*16+12, &temp
, 1);
6549 printk("\n\nRx channel %d: Overflow Bytes %d", i
, (temp
&0xffff));
6552 #ifdef PCM_ACCESS_DEBUG
6553 meiDebugRead_16(pcm_start_addr
+i
*16, &temp
, 1);
6555 meiDMARead_16(pcm_start_addr
+i
*16, &temp
, 1);
6557 printk("\n\nElectra Err: %d",(temp
&0xffff));
6560 //check electra overflow
6564 case AMAZON_MEI_PCM_GETDATA
:
6565 copy_to_user(lon
, pcm_data
[1].buff
, PCM_BUFF_SIZE
);
6567 case AMAZON_MEI_PCM_GPIO
:
6570 *AMAZON_GPIO_P0_DIR
|=1<<15;
6571 *AMAZON_GPIO_P0_ALTSEL0
|=1<<15;
6572 *AMAZON_GPIO_P0_ALTSEL1
&=~(1<<15);
6573 *AMAZON_GPIO_P0_OD
|=1<<15;
6576 *AMAZON_GPIO_P1_DIR
&=~1;
6577 *AMAZON_GPIO_P1_ALTSEL0
|=1;
6578 *AMAZON_GPIO_P1_ALTSEL1
&=~1;
6580 /*GPIO 17 TDM_DCL */
6581 *AMAZON_GPIO_P1_DIR
|=0x02;
6582 *AMAZON_GPIO_P1_ALTSEL0
|=0x02;
6583 *AMAZON_GPIO_P1_ALTSEL1
&=(u32
)~0x02;
6584 *AMAZON_GPIO_P1_OD
|=0x02;
6587 *AMAZON_GPIO_P1_DIR
|=0x04;
6588 *AMAZON_GPIO_P1_ALTSEL0
|=0x04;
6589 *AMAZON_GPIO_P1_ALTSEL1
&=(u32
)~0x04;
6590 *AMAZON_GPIO_P1_OD
|=0x04;
6596 #ifdef AMAZON_CLEAR_EOC
6597 case AMAZON_MEI_GET_EOC_LEN
:
6599 current_clreoc
= list_entry(clreoc_list
.next
, amazon_clreoc_pkt
, list
);
6600 if((current_clreoc
->len
)>0){
6601 copy_to_user((char *)lon
, (char*)(&(current_clreoc
->len
)), 4);
6604 else//wait for eoc data from higher layer
6605 interruptible_sleep_on(&wait_queue_clreoc
);
6608 case AMAZON_MEI_GET_EOC_DATA
:
6609 current_clreoc
= list_entry(clreoc_list
.next
, amazon_clreoc_pkt
, list
);
6610 if((current_clreoc
->len
)>0){
6611 copy_to_user((char*)lon
, (char*)(current_clreoc
->command
), current_clreoc
->len
);
6613 list_del(clreoc_list
.next
); //remove and add to end of list
6614 current_clreoc
->len
= 0;
6615 list_add_tail(&(current_clreoc
->list
), &clreoc_list
);
6620 case AMAZON_MEI_EOC_SEND
:
6621 copy_from_user((char *)(&debugrdwr
), (char *)lon
, sizeof(debugrdwr
));
6622 eoc_skb
= dev_alloc_skb(debugrdwr
.iCount
*4);
6624 printk("\n\nskb alloc fail");
6628 eoc_skb
->len
=debugrdwr
.iCount
*4;
6629 memcpy(skb_put(eoc_skb
, debugrdwr
.iCount
*4), (char *)debugrdwr
.buffer
, debugrdwr
.iCount
*4);
6631 ifx_push_eoc(eoc_skb
); //pass data to higher layer
6633 #endif //#ifdef AMAZON_CLEAR_EOC
6634 case AMAZON_MIB_LO_ATUC
:
6635 do_gettimeofday(&time_now
);
6637 if((time_now
.tv_sec
-(mib_pflagtime
.ATUC_PERF_LOSS_PTIME
).tv_sec
)>2){
6638 current_intvl
->AtucPerfLos
++;
6640 CurrStatus
.adslAtucCurrStatus
= 2;
6642 (mib_pflagtime
.ATUC_PERF_LOSS_PTIME
).tv_sec
= time_now
.tv_sec
;
6645 if((time_now
.tv_sec
-(mib_pflagtime
.ATUC_PERF_LOFS_PTIME
).tv_sec
)>2){
6646 current_intvl
->AtucPerfLof
++;
6648 CurrStatus
.adslAtucCurrStatus
= 1;
6650 (mib_pflagtime
.ATUC_PERF_LOFS_PTIME
).tv_sec
= time_now
.tv_sec
;
6653 CurrStatus
.adslAtucCurrStatus
= 0;
6655 case AMAZON_MIB_LO_ATUR
:
6656 do_gettimeofday(&time_now
);
6658 if((time_now
.tv_sec
-(mib_pflagtime
.ATUR_PERF_LOSS_PTIME
).tv_sec
)>2){
6659 current_intvl
->AturPerfLos
++;
6661 CurrStatus
.adslAturCurrStatus
= 2;
6663 (mib_pflagtime
.ATUR_PERF_LOSS_PTIME
).tv_sec
= time_now
.tv_sec
;
6666 if((time_now
.tv_sec
-(mib_pflagtime
.ATUR_PERF_LOFS_PTIME
).tv_sec
)>2){
6667 current_intvl
->AturPerfLof
++;
6669 CurrStatus
.adslAturCurrStatus
= 1;
6671 (mib_pflagtime
.ATUR_PERF_LOFS_PTIME
).tv_sec
= time_now
.tv_sec
;
6674 if((time_now
.tv_sec
-(mib_pflagtime
.ATUR_PERF_LPR_PTIME
).tv_sec
)>2){
6675 current_intvl
->AturPerfLpr
++;
6677 CurrStatus
.adslAturCurrStatus
= 3;
6679 (mib_pflagtime
.ATUR_PERF_LPR_PTIME
).tv_sec
= time_now
.tv_sec
;
6682 CurrStatus
.adslAturCurrStatus
= 0;
6684 case AMAZON_MEI_DOWNLOAD
:
6685 // DMA the boot code page(s)
6686 #ifdef AMAZON_MEI_DEBUG_ON
6687 printk("\n\n start download pages");
6689 for( boot_loop
= 0; boot_loop
< img_hdr
->count
; boot_loop
++){
6690 if( img_hdr
->page
[boot_loop
].p_size
& BOOT_FLAG
){
6691 page_size
= meiGetPage( boot_loop
, GET_PROG
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
6693 meiDMAWrite(dest_addr
, mei_arc_swap_buff
, page_size
);
6696 if( img_hdr
->page
[boot_loop
].d_size
& BOOT_FLAG
){
6697 page_size
= meiGetPage( boot_loop
, GET_DATA
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
6699 meiDMAWrite( dest_addr
, mei_arc_swap_buff
, page_size
);
6703 #ifdef AMAZON_MEI_DEBUG_ON
6704 printk("\n\n pages downloaded");
6707 //509221:tc.chen start
6708 case AMAZON_MEI_DEBUG_MODE
:
6709 mei_debug_mode
= lon
;
6711 //509221:tc.chen end
6717 ////////////////////// Interrupt handler /////////////////////////////////////////////////////
6718 static void mei_interrupt_arcmsgav(int,void *,struct pt_regs
*);
6719 static void mei_interrupt_arcmsgav(int int1
, void * void0
, struct pt_regs
* regs
)
6728 meiDebugRead(ARC_MEI_MAILBOXR
, &scratch
, 1);
6729 if(scratch
& OMB_CODESWAP_MESSAGE_MSG_TYPE_MASK
)
6732 #ifdef AMAZON_MEI_DEBUG_ON
6733 printk("\n\n Code Swap Request After ShowTime !!!");
6737 #ifdef AMAZON_MEI_DEBUG_ON
6738 // printk("\n\n Code Swap Request");
6740 fetchpage
= scratch
& ~OMB_CODESWAP_MESSAGE_MSG_TYPE_MASK
;
6741 size
= meiGetPage( fetchpage
, GET_PROG
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
6744 #ifdef AMAZON_MEI_DEBUG_ON
6745 // printk(" : prom page num %d",fetchpage);
6747 meiDMAWrite( dest_addr
, mei_arc_swap_buff
, size
);
6750 size
= meiGetPage( fetchpage
, GET_DATA
, MAXSWAPSIZE
, mei_arc_swap_buff
, &dest_addr
);
6753 #ifdef AMAZON_MEI_DEBUG_ON
6754 // printk(" : data page num %d",fetchpage);
6756 meiDMAWrite( dest_addr
, mei_arc_swap_buff
, size
);
6759 // Notify arc that mailbox read complete
6760 meiLongwordWrite(ARC_TO_MEI_INT
, ARC_TO_MEI_MSGAV
);
6762 // Tell ARC Codeswap is done
6763 meiLongwordWrite(MEI_TO_ARC_INT
, MEI_TO_ARC_CS_DONE
);
6766 while(i
<WHILE_DELAY
){
6767 meiLongwordRead(MEI_TO_ARC_INT
, &temp
);
6768 if((temp
& MEI_TO_ARC_CS_DONE
) ==0){
6769 #ifdef AMAZON_MEI_DEBUG_ON
6770 // printk("\n\n Code Swap Done");
6776 #ifdef AMAZON_MEI_DEBUG_ON
6777 printk("\n\n MEI_TO_ARC_CS_DONE not cleared by ARC");
6778 //509221:tc.chen start
6779 if (!mei_debug_mode
)
6781 //printk("Reset Arc!\n");
6782 //printk("AdslInitStatsData.FullInitializationCount++\n");
6783 AdslInitStatsData
.FullInitializationCount
++;
6786 //printk("AdslInitStatsData.FailedFullInitializationCount++\n");
6787 AdslInitStatsData
.FailedFullInitializationCount
++;
6788 //printk("AdslInitStatsData.LINIT_Errors++\n");
6789 AdslInitStatsData
.LINIT_Errors
++;
6792 wake_up_interruptible(&wait_queue_codeswap
); // wait up ioctl reboot
6794 //509221:tc.chen end
6799 else{ // normal message
6800 // printk("\n\n interrupt");
6801 meiMailboxRead(RxMessage
, MSG_LENGTH
);
6805 wake_up_interruptible(&wait_queue_arcmsgav
);
6809 memcpy((char *)Recent_indicator
, (char *)RxMessage
, MSG_LENGTH
*2);
6810 #ifdef ARC_READY_ACK
6811 if(((RxMessage
[0]&0xff0)>>4)==D2H_AUTONOMOUS_MODEM_READY_MSG
){ //check ARC ready message
6817 up(&mei_sema
); // allow cmv access
6820 up(&mei_sema
); // allow cmv access
6823 //#ifdef ADSL_LED_SUPPORT
6825 led_support_check
=1;//adsl led for 1.1.2.7.1.1
6826 adsl_led_flash();//adsl led for 1.1.2.7.1.1
6828 wake_up_interruptible(&wait_queue_reboot
); // wait up ioctl reboot
6833 // meiLongwordWrite(ARC_TO_MEI_INT, ARC_TO_MEI_MSGAV);
6834 mask_and_ack_amazon_irq(AMAZON_MEI_INT
);
6838 // 603221:tc.chen start
6839 ////////////////////////hdlc ////////////////
6842 static unsigned int ifx_me_hdlc_status(void)
6844 u16 CMVMSG
[MSG_LENGTH
];
6850 makeCMV_local(H2D_CMV_READ
, STAT
, 14, 0, 1, NULL
,CMVMSG
); //Get HDLC status
6851 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6856 return CMVMSG
[4]&0x0F;
6859 int ifx_me_is_resloved(int status
)
6861 u16 CMVMSG
[MSG_LENGTH
];
6864 if (status
== ME_HDLC_MSG_QUEUED
|| status
== ME_HDLC_MSG_SENT
)
6865 return ME_HDLC_UNRESOLVED
;
6866 if (status
== ME_HDLC_IDLE
)
6868 makeCMV_local(H2D_CMV_READ
, CNTL
, 2, 0, 1, NULL
,CMVMSG
); //Get ME-HDLC Control
6869 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6872 return IFX_POP_EOC_FAIL
;
6874 if (CMVMSG
[4]&(1<<0))
6876 return ME_HDLC_UNRESOLVED
;
6880 return ME_HDLC_RESOLVED
;
6883 int _ifx_me_hdlc_send(unsigned char *hdlc_pkt
,int len
,int max_length
)
6886 u16 CMVMSG
[MSG_LENGTH
];
6889 if (pkt_len
> max_length
)
6891 printk("Exceed maximum eoc message length\n");
6894 //while(pkt_len > 0)
6896 makeCMV_local(H2D_CMV_WRITE
, INFO
, 81, 0, (pkt_len
+1)/2,(u16
*)hdlc_pkt
,CMVMSG
); //Write clear eoc message to ARC
6897 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6903 makeCMV_local(H2D_CMV_WRITE
, INFO
, 83, 2, 1,&pkt_len
,CMVMSG
); //Update tx message length
6904 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6911 makeCMV_local(H2D_CMV_WRITE
, CNTL
, 2, 0, 1,&data
,CMVMSG
); //Start to send
6912 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6921 static int ifx_me_hdlc_send(unsigned char *hdlc_pkt
,int hdlc_pkt_len
)
6924 u16 CMVMSG
[MSG_LENGTH
];
6925 int max_hdlc_tx_length
=0,ret
=0,retry
=0;
6929 hdlc_status
= ifx_me_hdlc_status();
6930 if (ifx_me_is_resloved(hdlc_status
)==ME_HDLC_RESOLVED
) // arc ready to send HDLC message
6932 makeCMV_local(H2D_CMV_READ
, INFO
, 83, 0, 1, NULL
,CMVMSG
); //Get Maximum Allowed HDLC Tx Message Length
6933 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6938 max_hdlc_tx_length
= CMVMSG
[4];
6939 ret
= _ifx_me_hdlc_send(hdlc_pkt
,hdlc_pkt_len
,max_hdlc_tx_length
);
6942 set_current_state(TASK_INTERRUPTIBLE
);
6943 schedule_timeout(10);
6948 int ifx_mei_hdlc_read(char *hdlc_pkt
,int max_hdlc_pkt_len
)
6950 u16 CMVMSG
[MSG_LENGTH
];
6951 int msg_read_len
,ret
=0,pkt_len
=0,retry
= 0;
6955 ret
= ifx_me_hdlc_status();
6956 if (ret
== ME_HDLC_RESP_RCVD
)
6959 makeCMV_local(H2D_CMV_READ
, INFO
, 83, 3, 1, NULL
,CMVMSG
); //Get EoC packet length
6960 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6966 pkt_len
= CMVMSG
[4];
6967 if (pkt_len
> max_hdlc_pkt_len
)
6972 while( current_size
< pkt_len
)
6974 if (pkt_len
- current_size
>(MSG_LENGTH
*2-8))
6975 msg_read_len
= (MSG_LENGTH
*2-8);
6977 msg_read_len
= pkt_len
- (current_size
);
6978 makeCMV_local(H2D_CMV_READ
, INFO
, 82, 0 + (current_size
/2), (msg_read_len
+1)/2, NULL
,CMVMSG
); //Get hdlc packet
6979 ret
= mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
6984 memcpy(hdlc_pkt
+current_size
,&CMVMSG
[4],msg_read_len
);
6985 current_size
+=msg_read_len
;
6995 set_current_state(TASK_INTERRUPTIBLE
);
6996 schedule_timeout(10);
7005 ////////////////////////hdlc ////////////////
7006 // 603221:tc.chen end
7008 /////////////////////// clearEoC, int ifx_pop_eoc(sk_buff * pkt) //////////
7009 int ifx_pop_eoc(struct sk_buff
* pkt
);
7010 int ifx_pop_eoc(struct sk_buff
* pkt
)
7012 amazon_clreoc_pkt
* current
;
7015 return IFX_POP_EOC_FAIL
;
7017 if((pkt
->len
)>clreoc_max_tx_len
){
7019 return IFX_POP_EOC_FAIL
;
7021 current
= list_entry(clreoc_list
.next
, amazon_clreoc_pkt
, list
);
7023 if(current
->len
==0){
7024 memcpy(current
->command
, pkt
->data
, pkt
->len
);
7025 current
->len
=pkt
->len
;
7029 if((current
->list
).next
==&clreoc_list
){
7031 return IFX_POP_EOC_FAIL
; //buffer full
7033 current
= list_entry((current
->list
).next
,amazon_clreoc_pkt
, list
);
7036 wake_up_interruptible(&wait_queue_clreoc
);
7039 return IFX_POP_EOC_DONE
;
7041 /* this is used in circular fifo mode */
7043 int ifx_pop_eoc(sk_buff * pkt);
7044 int ifx_pop_eoc(sk_buff * pkt)
7048 return IFX_POP_EOC_FAIL;
7050 if(clreoc_wr>=clreoc_rd)
7051 buff_space = (MEI_CLREOC_BUFF_SIZE-1)-(clreoc_wr - clreoc_rd);
7053 buff_space = clreoc_rd - clreoc_wr - 1;
7054 if((pkt->len)>buff_space)
7055 return IFX_POP_EOC_FAIL;
7057 if((clreoc_wr+pkt->len)>MEI_CLREOC_BUFF_SIZE){
7058 memcpy((clreoc+clreoc_wr), pkt->data, ((clreoc_wr+pkt->len)-MEI_CLREOC_BUFF_SIZE+1));
7059 memcpy(clreoc, (pkt->data)+((clreoc_wr+pkt->len)-MEI_CLREOC_BUFF_SIZE+1), (pkt->len)-((clreoc_wr+pkt->len)-MEI_CLREOC_BUFF_SIZE+1));
7060 clreoc_wr=(clreoc_wr+pkt->len)-MEI_CLREOC_BUFF_SIZE;
7063 memcpy((clreoc+clreoc_wr), pkt->data, pkt->len);
7064 if((clreoc_wr+pkt->len)=MEI_CLREOC_BUFF_SIZE)
7067 clreoc_wr+=pkt->len;
7069 wake_up_interruptible(&wait_queue_clreoc);
7070 return IFX_POP_EOC_DONE;
7075 ////////////////////////////////////////////////////////////////////////////
7076 //int amazon_mei_init_module (void);
7077 //void amazon_mei_cleanup_module (void);
7078 //int __init init_module (void);
7079 //void __exit cleanup_module (void);
7081 int __init
amazon_mei_init_module(void)
7082 //int __init init_module(void)
7084 struct proc_dir_entry
*entry
;
7088 #ifdef IFX_DYING_GASP
7090 //000003:fchang Start
7091 #ifdef CONFIG_CPU_AMAZON_E
7092 //GPIO31 :dying gasp event indication
7093 // (1) logic high: dying gasp event is false (default)
7094 // (2) logic low: dying gasp event is true
7095 CLEAR_BIT((*((volatile u32
*)0xB0100B18)), 0x4);
7096 CLEAR_BIT((*((volatile u32
*)0xB0100B1c)), 0x4);
7097 CLEAR_BIT((*((volatile u32
*)0xB0100B20)), 0x4);
7098 SET_BIT((*((volatile u32
*)0xB0100B24)), 0x4);
7100 #else //000003:fchang End
7102 //GPIO31 :dying gasp event indication
7103 // (1) logic high: dying gasp event is false (default)
7104 // (2) logic low: dying gasp event is true
7105 CLEAR_BIT((*((volatile u32
*)0xB0100B48)), 0x8000);
7106 CLEAR_BIT((*((volatile u32
*)0xB0100B4C)), 0x8000);
7107 CLEAR_BIT((*((volatile u32
*)0xB0100B50)), 0x8000);
7108 SET_BIT((*((volatile u32
*)0xB0100B54)), 0x8000);
7112 SET_BIT ((*((volatile u32
*)0xB0100B48)), 0x40);
7113 CLEAR_BIT((*((volatile u32
*)0xB0100B4C)), 0x40);
7114 CLEAR_BIT((*((volatile u32
*)0xB0100B50)), 0x40);
7115 SET_BIT((*((volatile u32
*)0xB0100B54)), 0x40);
7116 CLEAR_BIT((*((volatile u32
*)0xB0100B40)), 0x40); //GPIO ON
7117 printk("LED ON ON ON ON ON ON.....");
7121 #endif //000003:fchang
7123 #endif //IFX_DYING_GASP
7127 reg_entry_t regs_temp
[PROC_ITEMS
] = // Items being debugged
7129 /* { flag, name, description } */
7130 { &arcmsgav
, "arcmsgav", "arc to mei message ", 0 },
7131 { &cmv_reply
, "cmv_reply", "cmv needs reply", 0},
7132 { &cmv_waiting
, "cmv_waiting", "waiting for cmv reply from arc", 0},
7133 { &indicator_count
, "indicator_count", "ARC to MEI indicator count", 0},
7134 { &cmv_count
, "cmv_count", "MEI to ARC CMVs", 0},
7135 { &reply_count
, "reply_count", "ARC to MEI Reply", 0},
7136 { (int *)Recent_indicator
, "Recent_indicator", "most recent indicator", 0},
7137 { (int *)8, "version", "version of firmware", 0},
7139 memcpy((char *)regs
, (char *)regs_temp
, sizeof(regs_temp
));
7142 //sema_init(&mei_sema, 0); // semaphore initialization, mutex
7143 sema_init(&mei_sema
, 1); // semaphore initialization, mutex
7145 init_waitqueue_head(&wait_queue_arcmsgav
); // for ARCMSGAV
7146 init_waitqueue_head(&wait_queue_codeswap
); // for codeswap daemon
7147 init_waitqueue_head(&wait_queue_mibdaemon
); // for mib daemon
7148 init_waitqueue_head(&wait_queue_reboot
); // for ioctl reboot
7149 init_waitqueue_head(&wait_queue_clreoc
); // for clreoc_wr function
7150 init_waitqueue_head(&wait_queue_loop_diagnostic
); // for loop diagnostic function
7151 #ifdef ADSL_LED_SUPPORT
7152 init_waitqueue_head(&wait_queue_led
); // adsl led for led function
7153 init_waitqueue_head(&wait_queue_led_polling
); // adsl led for led function
7154 led_task
.routine
= adsl_led_flash_task
; // adsl led for led function
7155 led_poll_init(); // adsl led for led function
7156 #endif //ADSL_LED_SUPPORT
7157 #ifdef IFX_DYING_GASP
7158 init_waitqueue_head(&wait_queue_dying_gasp
); // IFX_DYING_GASP
7159 lop_poll_init(); // IFX_DYING_GASP
7160 #endif //IFX_DYING_GASP
7162 init_waitqueue_head(&wait_queue_uas_poll
);//joelin 04/16/2005
7163 unavailable_seconds_poll_init();//joelin 04/16/2005
7164 memset(&mib_pflagtime
, 0, (sizeof(mib_flags_pretime
)));
7166 // initialize link list for intervals
7167 mei_mib
= (amazon_mei_mib
*)kmalloc((sizeof(amazon_mei_mib
)*INTERVAL_NUM
), GFP_KERNEL
);
7168 if(mei_mib
== NULL
){
7169 #ifdef AMAZON_MEI_DEBUG_ON
7170 printk("kmalloc error for amazon_mei_mib\n\n");
7174 memset(mei_mib
, 0, (sizeof(amazon_mei_mib
)*INTERVAL_NUM
));
7175 INIT_LIST_HEAD(&interval_list
);
7176 for(i
=0;i
<INTERVAL_NUM
;i
++)
7177 list_add_tail(&(mei_mib
[i
].list
), &interval_list
);
7178 current_intvl
= list_entry(interval_list
.next
, amazon_mei_mib
, list
);
7179 do_gettimeofday(&(current_intvl
->start_time
));
7180 // initialize clreoc list
7181 clreoc_pkt
= (amazon_clreoc_pkt
*)kmalloc((sizeof(amazon_clreoc_pkt
)*CLREOC_BUFF_SIZE
), GFP_KERNEL
);
7182 if(clreoc_pkt
== NULL
){
7183 #ifdef AMAZON_MEI_DEBUG_ON
7184 printk("kmalloc error for clreoc_pkt\n\n");
7188 memset(clreoc_pkt
, 0, (sizeof(amazon_clreoc_pkt
)*CLREOC_BUFF_SIZE
));
7189 INIT_LIST_HEAD(&clreoc_list
);
7190 for(i
=0;i
<CLREOC_BUFF_SIZE
;i
++)
7191 list_add_tail(&(clreoc_pkt
[i
].list
), &clreoc_list
);
7193 memset(&AdslInitStatsData
, 0, sizeof(AdslInitStatsData
));
7194 if (register_chrdev(major
, "amazon_mei", &mei_operations
)!=0) {
7195 #ifdef AMAZON_MEI_DEBUG_ON
7196 printk("\n\n unable to register major for amazon_mei!!!");
7200 if (request_irq(AMAZON_MEI_INT
, mei_interrupt_arcmsgav
,0, "amazon_mei_arcmsgav", NULL
)!=0){
7201 #ifdef AMAZON_MEI_DEBUG_ON
7202 printk("\n\n unable to register irq for amazon_mei!!!");
7206 // disable_irq(AMAZON_MEI_INT);
7207 enable_irq(AMAZON_MEI_INT
);
7209 meidir
=proc_mkdir(MEI_DIRNAME
, &proc_root
);
7210 if ( meidir
== NULL
) {
7211 #ifdef AMAZON_MEI_DEBUG_ON
7212 printk(KERN_ERR
": can't create /proc/" MEI_DIRNAME
"\n\n");
7217 for(i
=0;i
<NUM_OF_REG_ENTRY
;i
++) {
7218 entry
= create_proc_entry(regs
[i
].name
,
7219 S_IWUSR
|S_IRUSR
| S_IRGRP
| S_IROTH
,
7222 regs
[i
].low_ino
= entry
->low_ino
;
7223 entry
->proc_fops
= &proc_operations
;
7225 #ifdef AMAZON_MEI_DEBUG_ON
7227 ": can't create /proc/" MEI_DIRNAME
7228 "/%s\n\n", regs
[i
].name
);
7233 ///////////////////////////////// register net device ////////////////////////////
7234 if(register_netdev(&phy_mei_net
)!=0){
7235 #ifdef AMAZON_MEI_DEBUG_ON
7236 printk("\n\n Register phy Device Failed.");
7241 if(register_netdev(&interleave_mei_net)!=0){
7242 printk("\n\n Register interleave Device Failed.");
7245 if(register_netdev(&fast_mei_net)!=0){
7246 printk("\n\n Register fast Device Failed.");
7251 mei_arc_swap_buff
= (u32
*)kmalloc(MAXSWAPSIZE
*4, GFP_KERNEL
);
7252 if (mei_arc_swap_buff
){
7253 #ifdef ARC_READY_ACK
7254 if(down_interruptible(&mei_sema
)) //disable CMV access until ARC ready
7256 return -ERESTARTSYS
;
7262 meiForceRebootAdslModem();
7263 kfree(mei_arc_swap_buff
);
7265 #ifdef AMAZON_MEI_DEBUG_ON
7266 printk("cannot load image: no memory\n\n");
7270 #ifdef IFX_SMALL_FOOTPRINT
7276 void __exit
amazon_mei_cleanup_module(void)
7277 //void __exit cleanup_module(void)
7280 #ifdef ADSL_LED_SUPPORT
7281 stop_led_module
=1; //wake up and clean led module
7282 led_support_check
=0;//joelin , clear task
7283 showtime
=0;//joelin,clear task
7284 //CLEAR_BIT((*((volatile u32 *)0xB0100B40)), 0x40); //Warning LED GPIO ON
7285 firmware_support_led
=0;//joelin ,clear task
7286 wake_up_interruptible(&wait_queue_led
); //wake up and clean led module
7287 wake_up_interruptible(&wait_queue_led_polling
); //wake up and clean led module
7289 for(i
=0;i
<NUM_OF_REG_ENTRY
;i
++)
7290 remove_proc_entry(regs
[i
].name
, meidir
);
7291 remove_proc_entry(MEI_DIRNAME
, &proc_root
);
7293 disable_irq(AMAZON_MEI_INT
);
7294 free_irq(AMAZON_MEI_INT
, NULL
);
7295 unregister_chrdev(major
, "amazon_mei");
7300 kfree(phy_mei_net
.priv
);
7301 unregister_netdev(&phy_mei_net
);
7305 #ifdef IFX_SMALL_FOOTPRINT
7308 int adsl_mib_poll(void *unused
)
7310 struct task_struct
*tsk
= current
;
7312 struct timeval time_now
;
7313 struct timeval time_fini
;
7316 amazon_mei_mib
* mib_ptr
;
7317 // u16 buff[MSG_LENGTH]__attribute__ ((aligned(4)));
7318 u16
* data
=NULL
; //used in makeCMV, to pass in payload when CMV set, ignored when CMV read.
7321 strcpy(tsk
->comm
, "kmibpoll");
7322 sigfillset(&tsk
->blocked
);
7324 printk("Inside mib poll loop ...\n");
7328 interruptible_sleep_on_timeout(&wait_queue_mibdaemon
, ((MIB_INTERVAL
-i
)/(1000/HZ
)));
7331 // printk("\n\n update mib");
7333 do_gettimeofday(&time_now
);
7334 if(time_now
.tv_sec
- current_intvl
->start_time
.tv_sec
>=900){
7335 if(current_intvl
->list
.next
!=&interval_list
){
7336 current_intvl
= list_entry(current_intvl
->list
.next
, amazon_mei_mib
, list
);
7337 do_gettimeofday(&(current_intvl
->start_time
));
7340 mib_ptr
= list_entry(interval_list
.next
, amazon_mei_mib
, list
);
7341 list_del(interval_list
.next
);
7342 memset(mib_ptr
, 0, sizeof(amazon_mei_mib
));
7343 list_add_tail(&(mib_ptr
->list
), &interval_list
);
7344 if(current_intvl
->list
.next
==&interval_list
)
7345 #ifdef AMAZON_MEI_DEBUG_ON
7346 printk("\n\nlink list error");
7348 current_intvl
= list_entry(current_intvl
->list
.next
, amazon_mei_mib
, list
);
7349 do_gettimeofday(&(current_intvl
->start_time
));
7353 if(down_interruptible(&mei_sema
))
7354 return -ERESTARTSYS
;
7356 ATUC_PERF_LO_FLAG_MAKECMV;
7357 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS){
7358 #ifdef AMAZON_MEI_DEBUG_ON
7359 printk("\n\nCMV fail, Group 7 Address 0 Index 0");
7363 if(RxMessage[4]&PLAM_LOS_FailureBit){
7364 current_intvl->AtucPerfLos++;
7366 CurrStatus.adslAtucCurrStatus = 2;
7368 if(RxMessage[4]&PLAM_LOF_FailureBit){
7369 current_intvl->AtucPerfLof++;
7371 CurrStatus.adslAtucCurrStatus = 1;
7373 if(!(RxMessage[4]&(PLAM_LOS_FailureBit|PLAM_LOF_FailureBit)))
7374 CurrStatus.adslAtucCurrStatus = 0;
7380 ATUC_PERF_ESS_FLAG_MAKECMV
;
7381 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7382 #ifdef AMAZON_MEI_DEBUG_ON
7383 printk("\n\nCMV fail, Group 7 Address 7 Index 0");
7387 temp
= RxMessage
[4]-mib_pread
.ATUC_PERF_ESS
;
7389 current_intvl
->AtucPerfEs
+=temp
;
7390 ATUC_PERF_ESS
+=temp
;
7391 mib_pread
.ATUC_PERF_ESS
= RxMessage
[4];
7394 current_intvl
->AtucPerfEs
+=0xffff-mib_pread
.ATUC_PERF_ESS
+RxMessage
[4];
7395 ATUC_PERF_ESS
+=0xffff-mib_pread
.ATUC_PERF_ESS
+RxMessage
[4];
7396 mib_pread
.ATUC_PERF_ESS
= RxMessage
[4];
7400 ATUR_PERF_LO_FLAG_MAKECMV;
7401 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS){
7402 #ifdef AMAZON_MEI_DEBUG_ON
7403 printk("\n\nCMV fail, Group 7 Address 1 Index 0");
7407 if(RxMessage[4]&PLAM_LOS_FailureBit){
7408 current_intvl->AturPerfLos++;
7410 CurrStatus.adslAturCurrStatus = 2;
7412 if(RxMessage[4]&PLAM_LOF_FailureBit){
7413 current_intvl->AturPerfLof++;
7415 CurrStatus.adslAturCurrStatus = 1;
7417 if(RxMessage[4]&PLAM_LPR_FailureBit){
7418 current_intvl->AturPerfLpr++;
7420 CurrStatus.adslAturCurrStatus = 3;
7422 if(!(RxMessage[4]&(PLAM_LOS_FailureBit|PLAM_LOF_FailureBit|PLAM_LPR_FailureBit)))
7423 CurrStatus.adslAturCurrStatus = 0;
7428 ATUR_PERF_ESS_FLAG_MAKECMV
;
7429 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7430 #ifdef AMAZON_MEI_DEBUG_ON
7431 printk("\n\nCMV fail, Group 7 Address 33 Index 0");
7435 temp
= RxMessage
[4]-mib_pread
.ATUR_PERF_ESS
;
7437 current_intvl
->AturPerfEs
+=temp
;
7438 ATUR_PERF_ESS
+=temp
;
7439 mib_pread
.ATUR_PERF_ESS
= RxMessage
[4];
7442 current_intvl
->AturPerfEs
+=0xffff-mib_pread
.ATUR_PERF_ESS
+RxMessage
[4];
7443 ATUR_PERF_ESS
+= 0xffff-mib_pread
.ATUR_PERF_ESS
+RxMessage
[4];
7444 mib_pread
.ATUR_PERF_ESS
=RxMessage
[4];
7449 // to update rx/tx blocks
7450 ATUR_CHAN_RECV_BLK_FLAG_MAKECMV_LSW
;
7451 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7452 #ifdef AMAZON_MEI_DEBUG_ON
7453 printk("\n\nCMV fail, Group 7 Address 20 Index 0");
7457 temp
= RxMessage
[4];
7461 ATUR_CHAN_RECV_BLK_FLAG_MAKECMV_MSW
;
7462 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7463 #ifdef AMAZON_MEI_DEBUG_ON
7464 printk("\n\nCMV fail, Group 7 Address 21 Index 0");
7468 temp2
= RxMessage
[4];
7470 if((temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
)>=0){
7471 current_intvl
->AturChanPerfRxBlk
+=temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
;
7472 ATUR_CHAN_RECV_BLK
+=temp
+ (temp2
<<16) - mib_pread
.ATUR_CHAN_RECV_BLK
;
7473 mib_pread
.ATUR_CHAN_RECV_BLK
= temp
+ (temp2
<<16);
7476 current_intvl
->AturChanPerfRxBlk
+=0xffffffff - mib_pread
.ATUR_CHAN_RECV_BLK
+(temp
+ (temp2
<<16));
7477 ATUR_CHAN_RECV_BLK
+=0xffffffff - mib_pread
.ATUR_CHAN_RECV_BLK
+(temp
+ (temp2
<<16));
7478 mib_pread
.ATUR_CHAN_RECV_BLK
= temp
+ (temp2
<<16);
7480 current_intvl
->AturChanPerfTxBlk
= current_intvl
->AturChanPerfRxBlk
;
7481 ATUR_CHAN_TX_BLK
= ATUR_CHAN_RECV_BLK
;
7483 ATUR_CHAN_TX_BLK_FLAG_MAKECMV_LSW;
7484 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS)
7485 printk("\n\nCMV fail, Group 7 Address 20 Index 0");
7488 current_intvl->AturChanPerfTxBlk+=RxMessage[4];
7489 ATUR_CHAN_TX_BLK+=RxMessage[4];
7492 ATUR_CHAN_TX_BLK_FLAG_MAKECMV_MSW;
7493 if(meiCMV(TxMessage, YES_REPLY)!=MEI_SUCCESS)
7494 printk("\n\nCMV fail, Group 7 Address 21 Index 0");
7497 current_intvl->AturChanPerfTxBlk+=(int)((RxMessage[4])<<16);
7498 ATUR_CHAN_TX_BLK+=(int)((RxMessage[4])<<16);
7502 if(chantype
.interleave
== 1){
7505 ATUR_CHAN_CORR_BLK_FLAG_MAKECMV_INTL
;
7506 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7507 #ifdef AMAZON_MEI_DEBUG_ON
7508 printk("\n\nCMV fail, Group 7 Address 3 Index 0");
7512 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
;
7514 current_intvl
->AturChanPerfCorrBlk
+=temp
;
7515 ATUR_CHAN_CORR_BLK
+=temp
;
7516 mib_pread
.ATUR_CHAN_CORR_BLK_INTL
= RxMessage
[4];
7519 current_intvl
->AturChanPerfCorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
+RxMessage
[4];
7520 ATUR_CHAN_CORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_INTL
+RxMessage
[4];
7521 mib_pread
.ATUR_CHAN_CORR_BLK_INTL
= RxMessage
[4];
7525 else if(chantype
.fast
== 1){
7528 ATUR_CHAN_CORR_BLK_FLAG_MAKECMV_FAST
;
7529 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7530 #ifdef AMAZON_MEI_DEBUG_ON
7531 printk("\n\nCMV fail, Group 7 Address 3 Index 1");
7535 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
;
7537 current_intvl
->AturChanPerfCorrBlk
+=temp
;
7538 ATUR_CHAN_CORR_BLK
+=temp
;
7539 mib_pread
.ATUR_CHAN_CORR_BLK_FAST
= RxMessage
[4];
7542 current_intvl
->AturChanPerfCorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
+ RxMessage
[4];
7543 ATUR_CHAN_CORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_CORR_BLK_FAST
+ RxMessage
[4];
7544 mib_pread
.ATUR_CHAN_CORR_BLK_FAST
= RxMessage
[4];
7549 if(chantype
.interleave
== 1){
7552 ATUR_CHAN_UNCORR_BLK_FLAG_MAKECMV_INTL
;
7553 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7554 #ifdef AMAZON_MEI_DEBUG_ON
7555 printk("\n\nCMV fail, Group 7 Address 2 Index 0");
7559 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
;
7561 current_intvl
->AturChanPerfUncorrBlk
+=temp
;
7562 ATUR_CHAN_UNCORR_BLK
+=temp
;
7563 mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
= RxMessage
[4];
7566 current_intvl
->AturChanPerfUncorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
+ RxMessage
[4];
7567 ATUR_CHAN_UNCORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
+ RxMessage
[4];
7568 mib_pread
.ATUR_CHAN_UNCORR_BLK_INTL
= RxMessage
[4];
7572 else if(chantype
.fast
== 1){
7575 ATUR_CHAN_UNCORR_BLK_FLAG_MAKECMV_FAST
;
7576 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7577 #ifdef AMAZON_MEI_DEBUG_ON
7578 printk("\n\nCMV fail, Group 7 Address 2 Index 1");
7582 temp
= RxMessage
[4] - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
;
7584 current_intvl
->AturChanPerfUncorrBlk
+=temp
;
7585 ATUR_CHAN_UNCORR_BLK
+=temp
;
7586 mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
= RxMessage
[4];
7589 current_intvl
->AturChanPerfUncorrBlk
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
+ RxMessage
[4];
7590 ATUR_CHAN_UNCORR_BLK
+=0xffff - mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
+ RxMessage
[4];
7591 mib_pread
.ATUR_CHAN_UNCORR_BLK_FAST
= RxMessage
[4];
7598 #ifdef AMAZON_MEI_MIB_RFC3440
7601 ATUC_PERF_STAT_FASTR_FLAG_MAKECMV
; //???
7602 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7603 #ifdef AMAZON_MEI_DEBUG_ON
7604 printk("\n\nCMV fail, Group 0 Address 0 Index 0");
7608 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_FASTR
;
7610 current_intvl
->AtucPerfStatFastR
+=temp
;
7611 ATUC_PERF_STAT_FASTR
+=temp
;
7612 mib_pread
.ATUC_PERF_STAT_FASTR
= RxMessage
[4];
7615 current_intvl
->AtucPerfStatFastR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FASTR
+ RxMessage
[4];
7616 ATUC_PERF_STAT_FASTR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FASTR
+ RxMessage
[4];
7617 mib_pread
.ATUC_PERF_STAT_FASTR
= RxMessage
[4];
7622 ATUC_PERF_STAT_FAILED_FASTR_FLAG_MAKECMV
; //???
7623 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7624 #ifdef AMAZON_MEI_DEBUG_ON
7625 printk("\n\nCMV fail, Group 0 Address 0 Index 0");
7629 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
;
7631 current_intvl
->AtucPerfStatFailedFastR
+=temp
;
7632 ATUC_PERF_STAT_FAILED_FASTR
+=temp
;
7633 mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
= RxMessage
[4];
7636 current_intvl
->AtucPerfStatFailedFastR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
+ RxMessage
[4];
7637 ATUC_PERF_STAT_FAILED_FASTR
+=0xffff - mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
+ RxMessage
[4];
7638 mib_pread
.ATUC_PERF_STAT_FAILED_FASTR
= RxMessage
[4];
7643 ATUC_PERF_STAT_SESL_FLAG_MAKECMV
;
7644 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7645 #ifdef AMAZON_MEI_DEBUG_ON
7646 printk("\n\nCMV fail, Group 7 Address 8 Index 0");
7650 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_SESL
;
7652 current_intvl
->AtucPerfStatSesL
+=temp
;
7653 ATUC_PERF_STAT_SESL
+=temp
;
7654 mib_pread
.ATUC_PERF_STAT_SESL
= RxMessage
[4];
7657 current_intvl
->AtucPerfStatSesL
+=0xffff - mib_pread
.ATUC_PERF_STAT_SESL
+ RxMessage
[4];
7658 ATUC_PERF_STAT_SESL
+=0xffff - mib_pread
.ATUC_PERF_STAT_SESL
+ RxMessage
[4];
7659 mib_pread
.ATUC_PERF_STAT_SESL
= RxMessage
[4];
7664 ATUC_PERF_STAT_UASL_FLAG_MAKECMV
;
7665 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7666 #ifdef AMAZON_MEI_DEBUG_ON
7667 printk("\n\nCMV fail, Group 7 Address 10 Index 0");
7671 temp
= RxMessage
[4] - mib_pread
.ATUC_PERF_STAT_UASL
;
7673 current_intvl
->AtucPerfStatUasL
+=temp
;
7674 ATUC_PERF_STAT_UASL
+=temp
;
7675 mib_pread
.ATUC_PERF_STAT_UASL
= RxMessage
[4];
7678 current_intvl
->AtucPerfStatUasL
+=0xffff - mib_pread
.ATUC_PERF_STAT_UASL
+ RxMessage
[4];
7679 ATUC_PERF_STAT_UASL
+=0xffff - mib_pread
.ATUC_PERF_STAT_UASL
+ RxMessage
[4];
7680 mib_pread
.ATUC_PERF_STAT_UASL
= RxMessage
[4];
7685 ATUR_PERF_STAT_SESL_FLAG_MAKECMV
;
7686 if(meiCMV(TxMessage
, YES_REPLY
)!=MEI_SUCCESS
){
7687 #ifdef AMAZON_MEI_DEBUG_ON
7688 printk("\n\nCMV fail, Group 7 Address 34 Index 0");
7692 temp
= RxMessage
[4] - mib_pread
.ATUR_PERF_STAT_SESL
;
7694 current_intvl
->AtucPerfStatUasL
+=temp
;
7695 ATUC_PERF_STAT_UASL
+=temp
;
7696 mib_pread
.ATUR_PERF_STAT_SESL
= RxMessage
[4];
7699 current_intvl
->AtucPerfStatUasL
+=0xffff - mib_pread
.ATUR_PERF_STAT_SESL
+ RxMessage
[4];
7700 ATUC_PERF_STAT_UASL
+=0xffff - mib_pread
.ATUR_PERF_STAT_SESL
+ RxMessage
[4];
7701 mib_pread
.ATUR_PERF_STAT_SESL
= RxMessage
[4];
7709 do_gettimeofday(&time_fini
);
7710 i
= ((int)((time_fini
.tv_sec
-time_now
.tv_sec
)*1000)) + ((int)((time_fini
.tv_usec
-time_now
.tv_usec
)/1000)) ; //msec
7715 int mib_poll_init(void)
7717 printk("Starting mib_poll...\n");
7719 kernel_thread(adsl_mib_poll
, NULL
, CLONE_FS
| CLONE_FILES
| CLONE_SIGNAL
);
7722 #endif //IFX_SMALL_FOOTPRINT
7723 //EXPORT_NO_SYMBOLS;
7725 #ifdef ADSL_LED_SUPPORT
7727 int led_status_on
=0,led_need_to_flash
=0;
7728 int led_current_flashing
=0;
7729 unsigned long led_delay
=0;
7730 static int led_poll(void *unused
)
7732 stop_led_module
=0; //begin polling ...
7733 while(!stop_led_module
){
7734 if ((!led_status_on
)&&(!led_need_to_flash
)) interruptible_sleep_on_timeout (&wait_queue_led_polling
,1000); //10 seconds timeout for waiting wakeup
7735 // else printk("direct running task, no waiting");
7736 run_task_queue(&tq_ifx_led
);//joelin task
7737 // printk("led and LOP polling...\n");
7741 static int led_poll_init(void)
7743 // printk("Starting adsl led polling...\n");
7746 // CLEAR_BIT((*((volatile u32 *)0xB0100B40)), 0x40); //Warning LED GPIO ON
7749 kernel_thread(led_poll
, NULL
, CLONE_FS
| CLONE_FILES
| CLONE_SIGNAL
);
7753 int adsl_led_flash(void)
7756 if (!firmware_support_led
) return 0; //joelin version check
7758 if (led_status_on
== 0 && led_need_to_flash
== 0)
7760 queue_task(&led_task
, &tq_ifx_led
);//joelin task
7761 wake_up_interruptible(&wait_queue_led_polling
); //wake up and clean led module
7762 // printk("queue Task 1...\n"); //joelin test
7764 led_need_to_flash
=1;//asking to flash led
7769 int adsl_led_flash_task(void *ptr
)
7776 u16 CMVMSG
[MSG_LENGTH
];
7777 //adsl-led-start for >v1.1.2.7.1.1
7778 // printk("Task Running...\n"); //joelin test
7779 if ((firmware_support_led
==2)&&(led_support_check
))
7781 led_support_check
=0;
7783 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 0, 1, &data
,CMVMSG
); //configure GPIO9 GPIO10 as outputs
7784 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
7786 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 2, 1, &data
,CMVMSG
); //enable writing to bit 9 and bit10
7787 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
7790 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 4, 1, &data
,CMVMSG
); //use GPIO10 for TR68 .Enable and don't invert.
7791 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
7793 #ifdef DATA_LED_ON_MODE
7794 data
=0x0903;//tecom //use GPIO9 for TR68 data led .turn on.
7798 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 5, 1, &data
,CMVMSG
); //use GPIO9 for TR68 data led .turn off.
7799 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, CMVMSG
);
7802 if (!showtime
) {led_need_to_flash
=0; return 0;}
7803 //adsl-led-end for >v1.1.2.7.1.1
7805 if (led_status_on
== 0 || led_need_to_flash
== 1)
7808 if (led_current_flashing
==0)
7810 if (firmware_support_led
==1){//>1.1.2.3.1.1
7811 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 0, 1, &one
,CMVMSG
); //flash
7812 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, &CMVMSG
);
7814 else if (firmware_support_led
==2){//>1.1.2.7.1.1
7816 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 5, 1, &data
,CMVMSG
); //use GPIO9 for TR68 data led .flash.
7817 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, &CMVMSG
);
7819 }//(firmware_support_led==2)
7820 led_current_flashing
= 1;//turn on led
7824 do{//do nothing , waiting untill no data traffic
7825 led_need_to_flash
=0;
7826 interruptible_sleep_on_timeout(&wait_queue_led
, 25); //the time for LED Off , if no data traffic
7827 }while(led_need_to_flash
==1);
7829 }else if (led_status_on
== 1 && led_need_to_flash
==0)
7831 if (led_current_flashing
==1)
7833 if (firmware_support_led
==1){//>1.1.2.3.1.1
7834 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 0, 1, &zero
,CMVMSG
);//off
7835 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, &CMVMSG
);
7837 else if (firmware_support_led
==2){//>1.1.2.7.1.1
7838 #ifdef DATA_LED_ON_MODE
7839 data
=0x0903;//tecom //use GPIO9 for TR68 data led .turn on.
7843 makeCMV_local(H2D_CMV_WRITE
, INFO
, 91, 5, 1, &data
,CMVMSG
); //use GPIO9 for TR68 data led .off.
7844 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_CMV_WINHOST
, &CMVMSG
);
7846 }//(firmware_support_led==2)
7848 led_current_flashing
= 0;
7852 if (led_status_on
== 1 || led_need_to_flash
)
7853 {//led flash job on going or led need to flash
7854 queue_task(&led_task
, &tq_ifx_led
); //joelin task
7855 // printk("queue Task 2...\n"); //joelin test
7859 //joelin adsl led-end
7861 int adsl_led_flash(void)
7865 #endif //ADSL_LED_SUPPORT
7866 #ifdef IFX_DYING_GASP
7867 static int lop_poll(void *unused
)
7872 interruptible_sleep_on_timeout(&wait_queue_dying_gasp
, 1);
7873 #ifdef CONFIG_CPU_AMAZON_E //000003:fchang
7874 if(showtime
&&((*((volatile u32
*)0xB0100B14))&0x4)==0x0) {//000003:fchang
7875 #else //000003:fchang
7876 if(showtime
&&((*((volatile u32
*)0xB0100B44))&0x8000)==0x0) {
7877 #endif //CONFIG_CPU_AMAZON_E
7878 mei_ioctl((struct inode
*)0,NULL
, AMAZON_MEI_WRITEDEBUG
, &lop_debugwr
);
7879 printk("send dying gasp..\n");}
7884 static int lop_poll_init(void)
7886 // printk("Starting LOP polling...\n");
7887 kernel_thread(lop_poll
, NULL
, CLONE_FS
| CLONE_FILES
| CLONE_SIGNAL
);
7891 #endif //IFX_DYING_GASP
7893 //joelin 04/16/2005-satrt
7894 static int unavailable_seconds_poll(void *unused
)
7897 interruptible_sleep_on_timeout (&wait_queue_uas_poll
,100); //1 second timeout for waiting wakeup
7898 if (!showtime
) unavailable_seconds
++;
7902 static int unavailable_seconds_poll_init(void)
7905 kernel_thread(unavailable_seconds_poll
, NULL
, CLONE_FS
| CLONE_FILES
| CLONE_SIGNAL
);
7910 //joelin 04/16/2005-end
7911 EXPORT_SYMBOL(meiDebugWrite
);
7912 EXPORT_SYMBOL(ifx_pop_eoc
);
7914 MODULE_LICENSE("GPL");
7916 module_init(amazon_mei_init_module
);
7917 module_exit(amazon_mei_cleanup_module
);