aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/silan
diff options
context:
space:
mode:
authorztong <ztong@cs.unc.edu>2020-12-22 14:09:38 -0500
committerztong <ztong@cs.unc.edu>2020-12-22 14:09:38 -0500
commitb00f787062c73c972df42f82e566554357652e92 (patch)
treeafd981428735edfd713fc23ebb11bd3e22cd73c8 /drivers/net/ethernet/silan
parentcc27759fe1f148dbe19be727e5c7cbe441500e50 (diff)
BUG FIXESHEADEXT-RES
Diffstat (limited to 'drivers/net/ethernet/silan')
0 files changed, 0 insertions, 0 deletions
ckso The LITMUS^RT kernel.Bjoern Brandenburg
aboutsummaryrefslogblamecommitdiffstats
path: root/drivers/net/bnx2x_main.c
blob: 20f0ed956df26b57c51dbe8631cfa62d6a55b19e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                 
  
                                               




                                                                       

                                                        

                                                
                                                      
                                                    


   






















                                               
                          


                         
                             

                            
                         

                           

                     
 

                       
                           
                       
 

                                            
                                        
 


                              

                                            
 

                                                               
 
                                     
                                                                

                                                                             
                               
                                                                         

                                   
 

                                 











                                                                       
 
                       
                                  
                                                                




                                                                     



                                                               
                
                           
                                                   




                                                                      
                 
                            


                                                          
 
                                         


                       

                      

  
                                  
               

                                


                                                 

  
 
                                                     


                                                                       











                                                                             
                                                          






                                                                   










                                                                   


















                                                                            

                                                                        



                                          

                                                                          
 
                                 
                                             










                                                                               
                                                      
 


                                                                
                   
                                                     
     
                                                   
      









                                                                          
 
                                                 


                                                             


                                                                  
                                                                 

                                                               
 

                                    

                     
                                                    

                  



                                                                
                           
                                                     

                              
                      




                                                     
         

                                      

 
                                                               
 
                                 
                                             












                                                                               
                                                      
 


                                                                
                   
                                                     
     
                                                   
      









                                                                          
 
                                                 


                                                             


                                                                  
 


                                                             

                     
                                                    

                  


                                           
                           
                                                     

                              
                      




                                                     
         
                                                                 

                                                               



                                      














                                                                      







                                                                          
 
 










                                                 

                                            
                      















































































































                                                                       

                 
 

                  
 


                                           
                       


                                                         
                                     
                                                                 
 
                             




                                                                             
                                                     





                                                                             
                                                     
         
                                                






                                              


                                                        

                                                          









                                                                             
                                                       
 
                                                                

                                                                  
                                                            

                                                                            
                                                                   




                                                                             
 


                                                       
 
                                                                  


                                                                                
                                                             
                                                                          
                                                                            
                                               
         
 



                                                       


                                                                 
                                                             


                                                                     

                                                                          

                 

                                                
                                                              


                                                                          

                                                                             

                 

                                                      
                                                              

                                                               

                                                                        


                 








                                                                     

                                                                     






                                                                 

                                                                                

                 
 
                          

                                                        

 
                                              
 
                               


                                                            
                                                       

                   

                                                          

                                                           




                                                           

                                                         
                                                           

                                                       
 

                                                                     


                                      


                                                          

                                                                       

                              




                                                                               



                                                
                                                                   
                                         

                                                                    





                                                                 


                                                                       

 
                                               
 
                               










                                                             


                                          




                                                                  
                                                                    
 
                                                         
                      
 
                                        
                                  

                                                                    


                                                            


                                         

                                                          
                                     
                                                                           



                                               

                                          

 
               

  
                            

   
                                                           

                                                                      

                                                            



                                           
                                                                            



                                                                          


                                                           



                                           


















                                                                       

                                          


                                                            
 

                                                            
 







                              




                                                                     

 






                                                                         

                                            
                                          
                                                       






                                                             


                                                                      
 
                                                
                          
                                              
                                        


                              
                                          
 

                                            
 







                                                                       





                                                                   


                                                                           




                                                            
                      
                               


                             
                        

 
                                                           
 


                 
 
                                                                    


                              


                                                       
 
                          


                                                              
      
 
                                                  

 
                                                   

                                  
                                 







                                                       
                                                                          









                                                              
                                                                              

                                               
                                                      






                                                                            




                                  
                                
                                                    
 







                                                                              
                                                    
                                                      
                                                              
                                                 


         
 






                                                                    
                        
                                                                      
                                              
                                           


                       
                        














                                                                           


                                                                           
                 
                                                                       

                       
 











                                                                             
                                                                          
                                                                               
                                                                 

                      
 
                                                            
                                                            
                                                           
                                        

                      
                                                                          
                                                                
                                                                 

                      
                
                                                                        
                                              
                      
         
                                                               

 











                                                                          
                                                                        


























                                                                               
                                                                              
                                                   
                                                                   












                                                        











                                                                          
                                                                      
                                                     
                                                                   




























                                                                            
                                                                           






                                                                 


























                                                                       
                                                                   
                                                                       
                                     



















































                                                                                

                                                                       
















                                                                         
                                                                      































                                                                            





                                                             
                                                            


                                                                  
                                                                   


                                                                               

                                                                              














                                                                             
                                                                              
                                                   





                                                                           
                                                              




                                                                             
                                                                               


























                                                                               
                                                              
 
                              

                                                          






                                                                           



                                                



















                                                                     





                                                                              






                                                                         

                                                                 











                                                                               




                                                  
                                                                         

                                                                      
                                                      









                                                                      
                                                      






                                         









                                                                            

                                                                      
                                                                            

                                              

                                                 
                               

                                                                       

 


                                                              
                                                         







                                                     

                                                                   





                                                                  
                             









                                                                  
                                                  

                                              
                                               

                                      

                                




                                                      






                                                                            
                                                        
                                                                   
 
                                                                        

                                                                           
                                                                   

                                                            

                                             
                                                       






                                                           


                                                                      




                                                                           
                                                                           



























                                                                               
                                                         







                                                                             







                                                                            
                                                                          
                                                    

                                                                     
                                                                     













                                                                      
                                                                   
                                                                         
                                                                              












                                                                              

                                                                               

                                                                        
                                                                 





                                                                     
                                                                   
                                                         
                                                                      







                                                                              
                                          

                                                                              
                                    
                                                                      
                         

                 
                                                    
 
               
                                                                           

                                                                       



                                                                          
                                               
 





                                               

                                                     


                                                          
 
                                     



                                 
                                    


                                        


                                                              










                                                              
 





                                                                             
                                                                      
                                 
                                                                      




                                   



                                                                             
 
                                                              
 













                                                                             
 




                                                               
                                                     
                                       
                 
              
 
                                                                    



                                                           
                                                                      
 
                                                  




                                                                             




                                   

                                                       
 






                                                                            
 
                                                                              
 


















                                                                            

         
 
                                     
                                                              





                                           


                                                                             
 
                           

 
                      
 
                                                                               
 




                            
 
                                                                


                                           

                                
                
 






                                                                         
 






                                                                           
                                                               
                                                      




                                                                         
 

                                          
                                             

                                                                  

                                               
 
                          
         


                                      
 
                                                                


                                           

                                
 







                                                                         






                                                                           
                                                             
                                                      



                                                                         

         
                                                      



                                       
                                                    
 
                                        
 

                                                                 
 
 
                                                    
 

                                                                 
 
                                          
 
 





























                                                                           
                                                                     


                                                                           
                                                                    



                                                                         
 



                                                         
 
                                                         

                                                                           
 







                                                                            
 






                                                                             
 
                                            




                                                                         
 

                      

         
                                            
                                                         
 
                 

 













































                                                                            
                                                                   
 

                                        
 



                                                         

         
                                                         

                                                                           
 
                       
                                            




                                                                            
 
                                             




                                                                             
 




                                                                         
 

                      

         
                                            
                                                         
 


                 
                                               
 

                                                           
                                                      
                                                                 

                                                            
 
                                                      
                                                                

                                                           
 
                                                            
                                                              
                      
 
                
                                                                 



                                                            
 

                                               





                                                                            



                                                                           
 
                                                             
 



                                                        
 

                                                                           
                                                     

                                                             






                                                              
 


                                                                            
         

 
                                                                 
 

                            
 
                                                                    

                                                                       
                                        
                                                                             
                    
                                                                               
 
                                           



                                                                         
                                                                      
 
                                           
 

                                      

                                                                    
                                              
                 
 

                          
                                                                     
                       

 
                                            
 
                            
                                           
                                                                 
                                           
 

                                      
                                                                      
 
 

                                               
                            
                                           
                                                                      
                                           
              
                                                                        
 
 


                                           
 
                                   
                                                               
                                   
 

                  
 
                                                    
 


                                                   
 


                                                                                
 

                                                                            
 



                                                                       

                                                                             



                                                             
 

                                                                              
 





                                                                             

 







































                                                                               
                                                            














                                                                      
                                                                            
                                                             
                                                             
                                                            




                                                                    


                                                                         










                                                                             
                                

                                                                          


                                                                           
                                           


                                                                           



                                                                    











                                                                            
 


                                                 


                                                                      
                                                            
 

                                    
                                           
                                                         






                                                                         
                                                                     


                                              












                                                                    

                                  

                           
                                       
                         
                       
 
                                                                              



                                                       
                                                  


                                                                             
 




                                                                     
 
                                                             








                                                                               
         
 
 

                                                       

                               

                                          
 
                                                                   
 




                                                            


                                                                         

                                  
 
 











                                                         

                                                

 
                 






                            

















































































































































                                                                              



                                                                              
                               
 

                                                                          








                                                                        
                                    


                                                   
                                              


                              
 























                                                                        


                                                                           
                                                                     

                                 

                 
                                      



                                            
                                              
 
                      
                   











                                                     
                                  
                                                                       





                            

                                               











                                                                  




























                                                                              
                               

                                                     

                                                             

                                                                     
                     
                         
 


                                         


                                                                          
                                                            


                                                    
 

                                                                          
 
                                                            
                                   
                                                           


                                                   
 

                                                   
                                                     
                                                                 
                                                         
 
                                            












































                                                                             


                                                                  

                                   
                                           
                                                        

                                           

 















                                                                                
 
                                                                         
 
                               
                       
                                         
 

                                                                
 
                                                






                                                   
                                           

                                                                            
                                                                    
                                                                 
                                                                             


                                                                             

                              










                                                                             


                              
                                      
         
 






                                                                 






                                                                 
                                                                  

                              





                                                                         
                                                                 






                                                             













                                                                        
                                                                  

                              






















                                                                         













                                                                        
                                                                  

                              



                                                                         

                

                                                  



                                                                             



                                                                               
                                                      
                                                                          


                                                         











                                                                    
                                          





                                                                            










                                                                          
                                                                 




                                                                       

                                     
                               
                  

                     
                     


                                                                    
                              




                                                                              

                                                               




                                                                 


                                                                            
 







                                                                         

                                                              




                                                                        
                                                                               


                 
                              
 
                                                                              

                          

                                                                  
                                  
 
                                         
                                         



                                                         






                                                                          
 

                                                                          








                                                            



                                                                               










                                                                     
                                                   










                                                          
                                                                          

                   
 

                                                        
                                                                             



                                          

                                                               
 
                                                                              
 

                           
                                   
 
                                                                               








                                                                          
 








                                                                 
                                                                             


                                   
                                                                      





                                   
                                                      











                                                                             



                                        
                                                         




                                                     

                                         
                                             
                                         
                                                       

                                                                      
                                  
                                                    


                                           

                                            
                                            


                                           
                                                    

                                                     



                           
                             
              





                                                                           

                   
                                 
              



                                                             








                                             
                               
              


                                                          

                   
                                   
              

                                                                               







                                                                               



                                   

                                                                               


















                                                                               





















                                         



                                                               
                          

                                                              
                                                                

                                                                            











                                                                       





                                                    

                                 














































                                                                          




                                                                          
                          
















































                                                                         



                                                                     










                                                                              

                                  
                               
                              
                   
                                        
                     






                                                      

                             




                                                           
                   
                                                
     
                                              
      

                                                              
 
                                


                                                              


                                                                             
                                      



                                                                    

         











                                                                             

         
                 







                                                           

                                                              
 
                                                      


























                                                                            
                                                                              
                                                                            
                                                                              





                                                                    
                                                             






















                                                                              
                                                                              
                                                                            
                                                                              











                                                                              
                                                                            
                                                                            
                                                                            







                                                                    

























                                                                        







                                                                 



                                                                        
                              









                                                                        

 
                                                   
 

                                                    
 




                                    
 

                                                     
 

















                                                                           
 

                        
 




























                                                                    
                                                        



                       






                                                                      
                                                                       
                                                               
                                                       



















                                                                              









                                                                          





                                                                    
                                                        































                                                                         

















                                                                             







                                                                  



                       
                          







                                                         
                                                                       

                          
 

                                                               

                                                                       
 


                                                                              
 
                                                   
 



                                                                            
 
                                                                      
 





                                                                          
                 

 
                                                     

                                                               
                                             
                                                                              

                                                                  

              

                                                                         






                                                               
 
                                  















                                                                               
                                                                            





                                                                              
                                                                            











                                                                              
 
                                                 
                                                                     
                                                 













                                                                        
                                                 
                                                                        
 
                                                 
                                                                         
                                                 
                                                                         
 

























                                                                          
                                                                            
                                                    










                                                                            
 






























































                                                                               



                                                               














                                                                       
                                                                         

                                                                      

                                                                      
 

                              


                 
                                                    
 
                                                        
                                                          
              










                                                                             
                                                                        
 
                                                                           
 
                                                 
                                


                                                                            


                               
                                                                         
 
                            
                                                                     

                                  








                                                                         





                                                              

                                                     
 
                                   



                                                                             




                                                       












                                                                               
                                  






                                                                           

 
                                                
 
                                                   
 



                                         
                                          
 



                                                                         

         


                                   
                                             

                                                                             


                                                                             
                                                                
                                                                  
                      



                                                                    

                                                                             

                                                                    


                                                                             




                                                                         
                                                                 
                                                                            


                                                                         
                                                                  



                                                                                
                                                               








                                                                     


                                   
 





                                                   
 
                             
 


                                                           
                   
                                                
     
                                              
      












                                                                             
                                      










                                                                            
 

                                        

         













                                                                              
         














                                                          
 




                                                  


         





























                                                                              


                                                    




                                                                              






































































































































































                                                                              







                                                 
                                   




                                                       
                                 


                                            

                                       






                                                              
                                                                    
 
                                                                       











                                                                              


                                                           
 
              










                                                              
                                                      
 

                               






                                                                             

 

                                                                         

                               
                               
                  
                    



                                                                     
                                                   
 



                                                                              
                                

                                                                         

                                                                  

                                                                               



                                                                     
                                                   

                                       
                                                                              
                                       
                                                                    
                                
                                                          
                                                                         


                                                                  
                                                                               






                                                                 
 
                                                  

                                                                        






                                                                          

                                                                        



                                                                   
                                                            
 

                               





                                                                         
                                                           
 

                           


                                                                
                                                                 









                                                                              








                                                                      
                     




                                                                         
                                                           
 



                                                                           
                                

                                                                      

                                                                      

                                                                            



                                                                         
                                                           

                                       
                                                                           
                                       
                                                                 
                                
                                                           
                                                                      


                                                                      
                                                                            



                                                                         
                                                           

                                       
                                                                         
                                       
                                                               
                                
                                                           
                                                                    


                                                                      
                                                                          



                                                                         
                                                           

                                       
                                                                         
                                       
                                                               
                                
                                                           
                                                                    


                                                                      
                                                                          
 
                              
                                
 
                                                                 



                                                   
                               


                               
                                            

                                               


                                                                            
                                         


                                                                             
                                                    


                                                

                                                                            
                                         
                                                 

                                                                             
                                                    


         
















                                                                              
                                                                              





                                   

                                                 
                               


                                                                             
                 
 
                                                                       

                                                                      
 
                                          
 
                                          
                                                               
 
                                                              


















                                                                              
                                  



                                                       

                                                         


                                      














                                                                               
 
                                





                                                                        
                                                                               

                                                                        
                                                                               

                 
                             






                                                                        
                                                                               

                                                                        
                                                                               

                 


                                                                    
 





                                                                              
                                                                            








                                                            
                                     
                                              


                                                                        

                                                                             


                                                           
                                                                    
                                                

                 



                                                                         

                                              





                                                                         



                                               
                                                                  

                                                    
                                                                      







                                                    
                                  


                                                       

                                                                               
 
                                             
                                                                        
                                                                               
                                             
                                                                        
                                                                               

                 



                                                                    






                                                   



                                            



                                                
                               




                                       



                                                            
                                                                            
                                        

                                                                            

                                        
                                                                       






                                                
                                  

                                                                           
                                     
 

                                                                      
                                                                   
                                                                              
                                                         



                                                                           
                                                                         
                                                                     
                                                                
                                                                
                                                                   
                                                                            
                                                                   
                                                                            

                                                                  
                                                                        
                                                                         

                                                                          



                                                                            






                                                                                

                 




                                                                        














                                                                         



                                                                            
                                                                         
                                                                         




                                                  
                               

              
                                                    

                       

                                                                              
                                                           
                                                
                                                                  
                                                                 

 

                                                     
                                                            

                               
 
                                         
                                    

                                                                             
               
                                                                        
                                             
                                                                         


                                                             

                               

                                                                      
                                               
                                                                          

                                                   
                                                                              


                                                   

                                                                   

 

                                                     
                                                                    


                                      
                               
              





                                                                                
 
                                                                  


                                            


                                                        
                      
 
                                  
                                                          
                      
 
                                    

                                                          
                      
 
                                   


                                                          

                                                                                
                      
 
                

                                                      

         



                                                                                

                                                                             
                                                                     

                                                       
                                                                        

                                                      
 

                                            

 














                                                          



                                                                             




                                                                               
 

                                                                     

                               

                   
                         

                           
                                                             

                                                           





                                                                     


                                                                               
 

                                                      
                                       
                                                          

                                         
                                                                      

                                    






















                                                                         


                                             
                                    
 
                                                                        
                                         
                                                                            

                                         
                                                                        
                                         
                                                                            

                                         




                                                                            
                                                                        
                                         
                                                                            

                                         












                                                            
 






                                                            









                                                                             

                                                                            

         




                                                                                
                                  
                                                       

                                               
                                                                    

                                                    
                                                                        

                                                    







                                                                        
                                                 
                                                                     

                                       
 































                                                                               





































                                                                              

 





















                                                                            





                                                       
                            
                                                  
                              

                                            


                                                                          
                                  

                                                                         
                                                                         
                                         
                                          

         



                                                   


                                                                             




                                  
                                           
                                 








                                                        
                             




                                                                                




































                                                                     
                                                   
















                                                                          
                                                                  



                               

                                                                                
                               
         


               
                                           



                                                      
                                                                






























                                                                             
                            




                                           
                        

                                                       

                                 
                                                 
                                                              

                             

                                 
                                                                 
                                                              











                                               
                                 
                             


                                      
                           






                                                      
                                               










                                                                 
 

                                                                














                                                            











                                                           
                                                                          
                   
                                                                        
                   

                                                       






                                                      
                                               











                                                              
 

                                                                







































                                                                          

                                                       








                                                     
                                               
















                                                     

                                                   


                                                

                                                   



                                                        





                                                               


                                                

                                                   

                                              

                                                                            

 
 







                                                                            

















                                                                       



























                                                                                

                                                                           























                                                                          
                                              
 
                   
 
                                                                          
 
                               

                                                                              
 
                                                       

                                                              
 


                                                     
 
                                                      




                                                                
 
                                                       
                           

                   




                                                

                                               





                                                    

      
                                              
                


                                              

      

                                                         
 












                                                   
 

                                                  
 
                                                       
 


                                                 
 



                                                      
 




                                                        
                                                     


                                         

                
                                                         
      
 
                                                     




                                                          
 

                                                       
                                           

                                        

                                                             
 



                                                       
 



                                                                            
 



                                                       
 




                                                                   
 


                                                      
 




                                                                     
                                                       
                                        
 



                                                                               
 
                                                      

                                                   
 
                                                      
                                            




                                                          
 

                                                           
 
                                                        


                                         
 
                                                        
                                                        
                                                      
                                                      
 
                                                      
























                                                                 
 










                                                                       
                                                                    


                                                   
                                                   


                                          


                      
 

                                              

                                                
 
                                    
 






                                                                             

                 
 


                                            
                                                          
                      
                
 


                                                                 
 
                                                    
                                                     



                                                    
























                                                                     
                                                    
 



                                                               
                                                       
      
                                                   
 
                                                     






















                                                                           
                                                    
 
                                                     
                                                     
                                                     
                                                     
 



                                                     
 
                                                    
                                                    
 
                                                    

                                                          
                                                        

                              
                                                             
                                
                                                                       

                           
                                                
                  
                                                












                                                                  
      
                                                    
                                                    




                                                               
                                                   
 
                                                         






                                                                        
                                                      
                                                      
                                                      
                                                    
                                                    
 
                                                    



                                                              



                                                                  




                                                                       

         
                                                    
                                                     
 
                                                                    






























                                                                       
                                                   
                                                   
                                           



                                                                          
                                                  

                                          





                      
                              
 
































                                                                      
                      



                                                                 





                                                          











                                                                         








                                                                     











                                                                          
                                                           
 
                                         

                                       
 





                                                         
 

                                                        
 

                                    


                                   
 



























                                                                            

                                         
                                                                           
                                                     

                                                                               
 








                                                     

 






















                                                                    
                    

                               
                                   

                                                                   
                                                                 


                                  
 
                                                               








                                                                     
 
                              
                                                          



                                                                 






                                                                
                                                                          
         


                                                                      
                                                             

                                                          
                                                      






                                                               
                                                                


























                                                              
                    


                                         
                                   

                                                                     
                                                                  


                                  
 
                                                               










                                                                      





                                                                        
         


                                  




                                                                     
                                                                           
         

























                                                                             
                                                                             

























                                                                             
                                  





                                                       










                                                                            
                                  

                                                       








                                                                         
                                                                              



                                           
                                     

                                                                           
                                                                            










                                                  
                          

                                                    
                                                      


                                     
                                                                        
                                                                      

                                           
                                                                        
         



                                            
                                          

                                           

                                              




                                                 





                                                 

                              
 

                                                                             
 
                               
                                                   


                                                               

         
                                                          
                                                            
                 

                                                                           
         
 


                                     

 

                                                
                              
 

                                                                        





                                                     

                                                       





                                                                        
                                                                   
                                                                     
                         
                                                                               



                                                 
                                               

         
                                 




                                                                      
 
                 

 













                                                              

                                          
                            
               
 





                                                               
                                                 



                                                            

 



                                               
                                






                                                    
                                




                                                     





                                                                    
                                             

                                              

                                                                  



                 
                                                              
 
                                               
                               

                                                                

 



                         
                                                            

                                                                        
                               




                                               
                               
                                           
                                              








                                                                              
                                                                    



                                                                     

                                                                              

                                                               

                                                       




                                                             


                                                                                
                                                                    

                                                                  
                                                                        

                                                        

                                                                              






                                                                   
                                                             



                                                                             



                                         
                               
                                         
                                              








                                                                              

                                                                      

                                                                  




                                                                        
 

                                                                          








                                                                         



                                                                  
                       
 

                                                                     

                      
                       

                                                 

                                                           
                                                      



                                                               
 
                                                                



                                                                           
                                 
                 
 
                          


                                    

         
                      

                                                            


                          
 
                      



                                                
               
 
                             
                                                                           



                                                                    

                                                                         
 
                  



                                                         

                                                   
                             
                                                                     
 
                          


                                                                   


                                                                
                                                  

 
                                                            
 
















































                                                                             
 
                   
 


                           


                                                                  



                           




                                                                            
                                                         
 



                                                                           

                                           
                                                    

                                                                          




                                                                                
                 
                      
         
                                                        
                  

 




                                                          

                  
                          





                                                   
                                    
 


                                
                                


                                                                             
                                


                                                               

                              



                                                   
                                         

                 

                                                                        

                                                                   


                                       
                                                                               

                                                          
                                         
                 




                                                                       

         



















                                                                        
                                                                            


                                                                
                                                                            














                                                                  
 
                           

                                          
                                                        
                                 

         
                                                       
                                      
 





                                                                        
                                           
                            

                                                                         
                                                                      
                                    
                                         




                                                   

                                     
                                                     
                           
                                 



                              
         
 

                                                                
                                                                         

                                                         
 
                                            


                                                      
                                                 
                 
 




                                                      

                         
                                                      

                             

                            



                                                               
                                                    



                                           
                                                   

                                                  
                                                    
                                           
                      
 
                       
                                                    
                                           




                                             

         


                                              


                                                              
 

                 






                                                                      

                                                            
                                
                                                                    
            

                           

                               
                                
                                                       

                           
                  



                                                        
                                                   

               
                                 

                                                                          
 
                                 
                                                                
                                                
                             




                                                                     

                                                                
                                                
                  

 
                                               
 
                               
                                                 
                                         

                      




                                                 
                                                                          
 



                                                            
                          
 
                                           
 
                                     

                                                                  
                                                                


                                                       
                                                     






                                                                            
                                    


                              
                          
                                                    


                                                     

                  

 









                                                       


























                                                                       
                                                                       



                                        



















                                                              
 





                                                                              
                                   
                                                              
 
                               
                           
                       


                                                   
                            

                                         
 
                                                
                                
 


                                                                     
                                                 
 


                           

                                                   

                                                       
                           
                                                      
 
                                         










                                                                            
                                  
                 
         

                                                     
 





                                                                           
                                                        

                                                                
                                       



                                                                             
                                                      






                                                                             

                                                             



                                                             

                                                   

         


                                                             
                                         
                                                             
 
                           

















                                                                      
 

                                                                        

                                            
                                          
 

                                    
                                                    
                          
                              

                                  
      


             
                          
                                                              
              
                                                                              

                                                                
                                       
                                                                              


                                                                   
                                                   



                                                                     
 


                                                            

                            
                                         

                                       
                          
                                                               
 
                         
 
                                                            
                            
                                
                                                                    
                                
                                                       


                                       
 




                                   






                                                                        
                                                          














                                            







                            

























































                                                                                









                                                                            
                                                                 


                                                                         
                                           
                                               

                                     
 


                                                              



                                                                         


                                                                               
                                                                      



                                                                          



                                                                               
                                             





                                                                               

                         


                                                                         
                                                         



















                                                                               


                                                                               
                                           


                                                                               














                                                                               


                                                                         





                                                               
                








                                                                
                                           




                                                     






                                                                            






                                                                     
                                                                   
                                                           

                                                                      














                                                                              
                                                                   




                                                                       








                                                                             








                                                                     


                                                            








                                                                              
                                                                











                                                                     
 
                               

                         



                                                                     

                                                                            




                                                                      










                                                                         





                                                                    









                                                                         




                                                                     
                                                                  


                               


                                                                              




                                                                      

                                                                          




                                                                      











                                                                          

                              

                                                                    
                                                     
 
                                                                          
                                                                         
                                                                
                                                                  

                                                                     

                              

                                                                    

                                                     
                                                                          
                                                                         

                                                                         










                                                                          

                                                                     

                              

                                                                    

                                                     


                                                                          

                                                                     

                              

                                                                    

                                                     
                                                                          
                                                                         
                                                                  
                                                                

                                                                     

                              











                                                                          



                                                                       




                                                                          

                              















                                                                          




                                                                     


                                                                   
                                                                  


                               


                                                                            
 



                                                              
                                                

                       
                                                     

                                                              

                                                                          
                                                              
 

                                                                          
                                                              
 

                                                                           
                                                               
 

                                                                           
                                                               
 

                                                                            

                                                                  
 

                                                                              
                                                                
 

                                                                             
                                                                 
 
                                                               

 
                                                                     
 
                                                 
 
                                                                      
                                          
                                                             
                                                                        
                                                                  
                        






                                                                              
                                                      
                                                                             
                                                      






                                                                             
                                                        




                                              
                                                                  
                                                                  

                                                                         



                                                            
                                                       
                                                                  




                                              
                                                                  

                                                                  

                                                                         



                                                            
                                                       
                                                                  




                                               
                                                                   
                                                                   

                                                                          



                                                            
                                                       
                                                                  




                                               
                                                                   

                                                                   

                                                                          



                                                            
                                                       
                                                                  




                                        
                                                                    
                                                                    

                                                                           



                                                            
                                                       
                                                                  




                                          
                                                                    
                                                                    

                                                                           



                                                            
                                                       
                                                                  






                                             
                                                                     
                                                                     

                                                                            



                                                            
                                                       
                                                                  






                                                              
                                                
                                                                
                                                          

                      
 

                                                                         
                                                                      
                                                      
                                                                     
 
                                                                             
                                              

                                                      
                                                                            

 
                                                             
 

                               
                   
              
                         
 
                                
                                    
 
                                     
                                                                        
                                        

                                                                            










                                                                
                                        


                                                                              
                              

                                                                             












                                                                               


                                                                           
                                                                         


                                                        

                                                                       

                                                      
                                                                             
 

                                                                           
                                                                      


                                          










                                                                             
                                                                          
 







                                                                     

                                                                      






                                                       
 
                                    
 




                                                                         
 
                                                                              
                                                   
                                                         
                                      












                                                                            



                                                                            





                                                                               

                 
 






















                                                                           
                 

                          

         

                                                               
                                                                    


                                                                        
 





                                                    
                           

               

                                                                
                                                                    
 
                                        
 
                                                       














                                                                      
                                  

                                                                          
                                   
                                                                                




                                                   








                                                  




                                              
                        
 



                                        



                          

                                                              






                                                           











                                                                              

                                                

                                    

                                                      
                

                                                            
         







                                                                           
 


                                                                          


                                                          
                                                           
                                                           


                                                           
                                                           



                                                           
                                                           


                                            




                                                                     

                                                                            

                                                           

                 
                                    
 
                                          

                                         
                                                             
                                              
            
                                               



















                                                                              


                         







                                                                            
                                             

                                                                      
                                       
                 

                                                                           
                                                       
 

                                                                

                                                             





                                                                           
                                                          


                                                                       
                                                       
                                 



                                                                        
                                                          


                                                                       
                                                       
                                 







                                                                        
                                                          


                                                                           
                                                       
                                 



                                                                         
                                                          


                                                                           
                                                       
                                 






                                                                         

                                                                              
                                               
                         
 
                                                                               
                                                                              
                                               
                         





                                                                  


                                                                
                                               
                         
 
                                                                               

                                                                
                                               
                         
 
                                                                  



                                                      

                                                                               
                                               
                         
 
                                                                                
                                                                               
                                               
                         





                                                                   
                                                                  


                                       

                                                            
                                                   

         
                                                
                                                          
                                                                      
                                 
 
                                 
                                                         

                                   



                 




                                                                           
                                            
                            

              

































































                                                                                































                                                                               




























                                                                              
              
                            
 





















                                                                 

                          
 
                                 
                                                         

                                   



                 
                                                 





                                            



                                                       
                                     



                                                     
                               




















                                                             
                                                                            







                                                     
                               




















                                                                
                                                                             





























                                                         
                                                                                

                                                
                         




























                                                                    


                                                                       
                                                    












                                                                      
                   

                                                                      
                                 
                                                                     



                                     

                                                                      
                                                                           
                                                            










































                                                                         


                                
                                                    













                                                                         
                         



































                                                                    
                                                             






                                                                         
                   
 

                                                                      
                                                                           
                                                            






















                                                                       


















                                                                        
                                             
                                                                          

                                                                      
                                 
                                                                     



                                     

                                                                      
                                                                           
                                                            





















                                                               




















                                                                         

                               
 


                                
                                                    





                                                                      







                                                                             
 













                                                                              
                                                   




                                                                  
                                                   






                                                                               
                                                                               



                                                                      
 










                                                                          
                                                                               












                                                            



                 
                                                                               





                                                            

                                                     

                                                     

                                                     
 
                               

























                                                                
                   








                                                     


                                                     

         
                  






                                                                   

                                                           

                                                                             



                                                                             










                                                                             


                         



                                                                             
                                                             
 
                             
                                                                    
 
                             
                                                                    
 

                                                                     
 
                              
                                                                
                                                                      

                                       
 
                                                                     
                                                                             
         
 

                                                                  

                                 
                                                         

                                   



                 



























                                                            









                                                              
                   

                           









                                                                    



                                                          
                   
                                                                 

                                              
                                                                  


                                               


                 
                     

                                          





                                      
                                 






                                                        



                                                 
                               






















                                                                       
                                                                       

                                                                       







                                                                       

                                                                       



























                                                                           












































                                                                              

                             
                        







                                                                          












                                                            

                                                                           











                                                                  













                                                                              

                                                                  

                                 
                              
                                

                                            






                                






                                                                      
                                                              
                                                                 

                      
                               
         
 


                                                                     






                                                         

                                                                   


                                                       
                                      
                     

                                                       
 


                                                      
                          
                          
 

                                                             

                                                                     













                                                                          
 

              


                                                                         



                   
                                                 



                                       
                                                 


                                              
                                                 


                                              
                                                                







                                                                          
                                                               








                                                                   
 



                                                                

                              

                                                                               








                                                            
                        



                                             
                                
                                   
 



                                                                              

         



                                                                              

         
                                   






















                                                        
                              

                             
                       


                                              
                                                                      















                                                                     
                                                                       


                                             

                                                            
                                           
                                                                         
















                                                                        
                               



                                                            
                                              


















                                                                        



                                                                 


                                                      
                                
                       
 
                                                        



                                                     

                                       

                           




                                                                       
















                                                           
 
                                                    



                                                                    





                                                       

                                                   








                                                           



                             

 


                     

























                                                                               
                  

                                         
                                                                             
                                   
                                      

                                                                  
                                                  
                                                                        
                                                            
                                                                          
                                                              
                                                                          
                                                              
                                                                          
                                                        
                                                                       
                                                              
                                                                         








































                                                                                
                                                                    
                                                                              
                                                                      
                                                                             
                                                                    
                                                                     
                                                                  
                                                                              
                                                             
                                                                            
                                                          
                                                                             
                                                            
                                                                            
                                                                       
                                                                           
                                                                        
                                                                            
                                                                        
                                                                            
                                                                         
                                                                             
                                                                  
                                                                              
                                                          
                                                                              

                                                                        

  




                                                                             
 

                                                                             
                                            
                    
 

                            

                                   
                                                  

















                                                                                
                 









                                                                              
                                            
                         
 
                           
                                                                  









                                                             
         
 
                         





                                                                          

                               
 

                           
                                          



































                                                                              
                 



















                                                                        
                            
                 





                                                          
                               

              





                                



                                          
                                 
                                                                          


                                                                  
                                                                


                                                                  




                                            
                                  
                                                      


                                                          



                 
                                                     


                                                     

                                                     

                                                


                                                     
                                                 











                                                         
                                                            



                                                       


                                                        

                                                    

                                                        
                                                          















                                                                             
                                                                         



                                                                          
                                                                           
                                   
                      
 


                                                 
 

                                                        
 

                                                                         
 








                                                               

 











                                                                



                               








                                                                             
                                

      




                                                                             
                                    
                                                     
 



                                                                  
 
                                                                      
                                                                   
                                                                          
                                                                              
                                                                





                                                                              
 
                                     
                          
           
      
                                    
 
                                                      
                                                                        
                                                      

                                                                           
 
           


                         

                                                  
                                                     





                                                             

                                                                            

                                                        
                                                 














                                                                 
                                                    






                                                                 



                                                                     



                                                                

                                                   
























                                                                           
                                                         



















                                                                  
                                       


                                                                     














                                                                              
                                                        









































                                                                               
















                                                                         
      

                            
                                                                    
                     
   
                                                                                

                                            
                                            
                                 
                                

                                                           

                                           
                          
                           
                                                 

                    
                            





                                      


                                                 

                                                   
 
                                                                             
                                                   
                                         



                                                                   




                                                                              
                                       


                                                                          






                                                                             
                                            

                 
      
 
          
                                                                          
                                                              
                                                      

                                                        
                                                               


                                     
                                        
 
                                       
                                                   
                                                          
 


                                                                          
                        
                                                                           
 


                                                 
                          


                                                          
                                                                    
 


                                                              

                                                                              
              
      
                                                          
 


                                                  
 
                                                       

                                    
                                                                 

                                                          


                                                                               
 



                                                             
 
                                                    
                              
 
                                                                             

                                             
                                                            

                                                                        

                                                                     






                                                                           
                                                                       
 
                                               

                                                                           








                                                                         


                                                     
                                                                     
 





                                                                         

                                                                    
                                              


                                                                              
 
                                   





                                                                             
                                                                            
 
                                                      

                                                                              


                                                                      




                                                             


                                                                              






                                                                              

                                                                          
                                                     
 

                                                              
 
                                                      


                                                                         
 

                                                                               
 



                                                                   
 
                                       


                                                                           

         
                                                             
 

                                              
                                                       




                                                 


                                                         





                                                                          
                                                                    
 
                                                                           
 








                                                                             


                                                                   


                 
                              

                                                               
                                         


                                                                       
                                                   
                                                            
                                                 
         
                          



                            
                           



                                             

                               

                                          
                                             

 
                           

                                              


                                             



                                                             



                 
                                                











































                                                                             


                                                                              











                                                                             
                                                 



                                                                              
                                                                         












                                                                         
                                               
                                                    
                                                              


















                                                                              

                                                                             


















                                                                               




                                                                 
                                                        


                                                            

                                   
                                                     
                    
                                                      
         



                 
                           

                                                                
 



                                                                         
 

                                                                            
 







                                                                             
 




                                                                        
 



                           
 














                                                                             

         

                                                                          
 





                                                                   
 




                                                                          
 

                                                                         
 



                                                    

 
                           


                                                                
                   





                                                         
                                           




                                       

                                                     
         

                  














                                                                              
                           





                                                            









                                                              
                               
                                            
 
 












                                                                        



                                                       
                                                    












                                                                        

                                                           






                                        

                        
                      
                                         




















                                                                            






                                                                          
 


                                     
















                                                                         
                                                            
                                            
                                                                               





                                                                         
                                                                   





                                                                  


                                                     


                             
                                               





                                                                             


                                                                          







                                                                             






                                                                
 
                                         
 
                                            
                                              



                                                 

                                                         

                                                                   
                                                         






                                                              
      
 







                                                                     






                                     





                                       

                                                








                                    

                                                                        


                                                                  
                                                                      
 

                                                                      
 
 

                                                           
                                                       

                                               
                                 
                         
              
                         












                                                                      

                                                                          










                                                                             

                                                                          

















                                                                 
                               




                 
                                                                       
 

                                                       
              








                                                                 
                                                                        
 

                                                         
                      
 
                                                  





                                                              

                                                                       
 

                                                       
              





                                                   


                                                         
                                 

                                                                            

                                   

                                                                            

                   


                                                                              
                                         
                       


                                   
                                                                  




                                                                   


                                                 




                                                                

                                                                    


















                                                                                

                                                                     

                             















                                                                        

                 
 










                                       


                                                                    

                                      
                                   
               
 
                                         
                                                          

                                                                    
                               
         
 


                              

                                   
                                       




                                 
                               


                                   






                                                                
                                  
                 
                                                                    


                                   
                                                                 
                                                                       
                                                                         
                                                                 
                                                                        
                                              
                                                           
 
                 
















                                                




                                                            


                         


                                                                            
                              
 

                               




                                       






                                       



                                                






                                                                  

                         




                                                                            
 
                    
 
                             
 



                                  

                                 
 
                                           
 
                                                                 
 

                      





                                                       
                         

               



                                                                            
                              
 

                    
                                





                                  


                                          
                                           
 


                      

 




















                                                                           
                                                        




                                                                
                                
                                                                    
                                
                                                       






































                                                                              

















                                                                          




                                                   
                               
                                         





















































                                                                       

                              
                               
                                                







                                                      

                                              

  
                                             






                                                     



                                  

                

                                        





                                                                 





                                                                




                                                 

                                    




                           
 
/* bnx2x_main.c: Broadcom Everest network driver.
 *
 * Copyright (c) 2007-2009 Broadcom Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
 * Written by: Eliezer Tamir
 * Based on code from Michael Chan's bnx2 driver
 * UDP CSUM errata workaround by Arik Gendelman
 * Slowpath and fastpath rework by Vladislav Zolotarov
 * Statistics and Link management by Yitchak Gertner
 *
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/device.h>  /* for dev_info() */
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/dma-mapping.h>
#include <linux/bitops.h>
#include <linux/irq.h>
#include <linux/delay.h>
#include <asm/byteorder.h>
#include <linux/time.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
#include <net/ip.h>
#include <net/tcp.h>
#include <net/checksum.h>
#include <net/ip6_checksum.h>
#include <linux/workqueue.h>
#include <linux/crc32.h>
#include <linux/crc32c.h>
#include <linux/prefetch.h>
#include <linux/zlib.h>
#include <linux/io.h>


#include "bnx2x.h"
#include "bnx2x_init.h"
#include "bnx2x_init_ops.h"
#include "bnx2x_dump.h"

#define DRV_MODULE_VERSION	"1.52.1"
#define DRV_MODULE_RELDATE	"2009/08/12"
#define BNX2X_BC_VER		0x040200

#include <linux/firmware.h>
#include "bnx2x_fw_file_hdr.h"
/* FW files */
#define FW_FILE_PREFIX_E1	"bnx2x-e1-"
#define FW_FILE_PREFIX_E1H	"bnx2x-e1h-"

/* Time in jiffies before concluding the transmitter is hung */
#define TX_TIMEOUT		(5*HZ)

static char version[] __devinitdata =
	"Broadcom NetXtreme II 5771x 10Gigabit Ethernet Driver "
	DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";

MODULE_AUTHOR("Eliezer Tamir");
MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710/57711/57711E Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_MODULE_VERSION);

static int multi_mode = 1;
module_param(multi_mode, int, 0);
MODULE_PARM_DESC(multi_mode, " Multi queue mode "
			     "(0 Disable; 1 Enable (default))");

static int num_rx_queues;
module_param(num_rx_queues, int, 0);
MODULE_PARM_DESC(num_rx_queues, " Number of Rx queues for multi_mode=1"
				" (default is half number of CPUs)");

static int num_tx_queues;
module_param(num_tx_queues, int, 0);
MODULE_PARM_DESC(num_tx_queues, " Number of Tx queues for multi_mode=1"
				" (default is half number of CPUs)");

static int disable_tpa;
module_param(disable_tpa, int, 0);
MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");

static int int_mode;
module_param(int_mode, int, 0);
MODULE_PARM_DESC(int_mode, " Force interrupt mode (1 INT#x; 2 MSI)");

static int dropless_fc;
module_param(dropless_fc, int, 0);
MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring");

static int poll;
module_param(poll, int, 0);
MODULE_PARM_DESC(poll, " Use polling (for debug)");

static int mrrs = -1;
module_param(mrrs, int, 0);
MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)");

static int debug;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, " Default debug msglevel");

static int load_count[3]; /* 0-common, 1-port0, 2-port1 */

static struct workqueue_struct *bnx2x_wq;

enum bnx2x_board_type {
	BCM57710 = 0,
	BCM57711 = 1,
	BCM57711E = 2,
};

/* indexed by board_type, above */
static struct {
	char *name;
} board_info[] __devinitdata = {
	{ "Broadcom NetXtreme II BCM57710 XGb" },
	{ "Broadcom NetXtreme II BCM57711 XGb" },
	{ "Broadcom NetXtreme II BCM57711E XGb" }
};


static const struct pci_device_id bnx2x_pci_tbl[] = {
	{ PCI_VDEVICE(BROADCOM, PCI_DEVICE_ID_NX2_57710), BCM57710 },
	{ PCI_VDEVICE(BROADCOM, PCI_DEVICE_ID_NX2_57711), BCM57711 },
	{ PCI_VDEVICE(BROADCOM, PCI_DEVICE_ID_NX2_57711E), BCM57711E },
	{ 0 }
};

MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl);

/****************************************************************************
* General service functions
****************************************************************************/

/* used only at init
 * locking is done by mcp
 */
void bnx2x_reg_wr_ind(struct bnx2x *bp, u32 addr, u32 val)
{
	pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, addr);
	pci_write_config_dword(bp->pdev, PCICFG_GRC_DATA, val);
	pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS,
			       PCICFG_VENDOR_ID_OFFSET);
}

static u32 bnx2x_reg_rd_ind(struct bnx2x *bp, u32 addr)
{
	u32 val;

	pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, addr);
	pci_read_config_dword(bp->pdev, PCICFG_GRC_DATA, &val);
	pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS,
			       PCICFG_VENDOR_ID_OFFSET);

	return val;
}

static const u32 dmae_reg_go_c[] = {
	DMAE_REG_GO_C0, DMAE_REG_GO_C1, DMAE_REG_GO_C2, DMAE_REG_GO_C3,
	DMAE_REG_GO_C4, DMAE_REG_GO_C5, DMAE_REG_GO_C6, DMAE_REG_GO_C7,
	DMAE_REG_GO_C8, DMAE_REG_GO_C9, DMAE_REG_GO_C10, DMAE_REG_GO_C11,
	DMAE_REG_GO_C12, DMAE_REG_GO_C13, DMAE_REG_GO_C14, DMAE_REG_GO_C15
};

/* copy command into DMAE command memory and set DMAE command go */
static void bnx2x_post_dmae(struct bnx2x *bp, struct dmae_command *dmae,
			    int idx)
{
	u32 cmd_offset;
	int i;

	cmd_offset = (DMAE_REG_CMD_MEM + sizeof(struct dmae_command) * idx);
	for (i = 0; i < (sizeof(struct dmae_command)/4); i++) {
		REG_WR(bp, cmd_offset + i*4, *(((u32 *)dmae) + i));

		DP(BNX2X_MSG_OFF, "DMAE cmd[%d].%d (0x%08x) : 0x%08x\n",
		   idx, i, cmd_offset + i*4, *(((u32 *)dmae) + i));
	}
	REG_WR(bp, dmae_reg_go_c[idx], 1);
}

void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
		      u32 len32)
{
	struct dmae_command dmae;
	u32 *wb_comp = bnx2x_sp(bp, wb_comp);
	int cnt = 200;

	if (!bp->dmae_ready) {
		u32 *data = bnx2x_sp(bp, wb_data[0]);

		DP(BNX2X_MSG_OFF, "DMAE is not ready (dst_addr %08x  len32 %d)"
		   "  using indirect\n", dst_addr, len32);
		bnx2x_init_ind_wr(bp, dst_addr, data, len32);
		return;
	}

	memset(&dmae, 0, sizeof(struct dmae_command));

	dmae.opcode = (DMAE_CMD_SRC_PCI | DMAE_CMD_DST_GRC |
		       DMAE_CMD_C_DST_PCI | DMAE_CMD_C_ENABLE |
		       DMAE_CMD_SRC_RESET | DMAE_CMD_DST_RESET |
#ifdef __BIG_ENDIAN
		       DMAE_CMD_ENDIANITY_B_DW_SWAP |
#else
		       DMAE_CMD_ENDIANITY_DW_SWAP |
#endif
		       (BP_PORT(bp) ? DMAE_CMD_PORT_1 : DMAE_CMD_PORT_0) |
		       (BP_E1HVN(bp) << DMAE_CMD_E1HVN_SHIFT));
	dmae.src_addr_lo = U64_LO(dma_addr);
	dmae.src_addr_hi = U64_HI(dma_addr);
	dmae.dst_addr_lo = dst_addr >> 2;
	dmae.dst_addr_hi = 0;
	dmae.len = len32;
	dmae.comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, wb_comp));
	dmae.comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, wb_comp));
	dmae.comp_val = DMAE_COMP_VAL;

	DP(BNX2X_MSG_OFF, "DMAE: opcode 0x%08x\n"
	   DP_LEVEL "src_addr  [%x:%08x]  len [%d *4]  "
		    "dst_addr [%x:%08x (%08x)]\n"
	   DP_LEVEL "comp_addr [%x:%08x]  comp_val 0x%08x\n",
	   dmae.opcode, dmae.src_addr_hi, dmae.src_addr_lo,
	   dmae.len, dmae.dst_addr_hi, dmae.dst_addr_lo, dst_addr,
	   dmae.comp_addr_hi, dmae.comp_addr_lo, dmae.comp_val);
	DP(BNX2X_MSG_OFF, "data [0x%08x 0x%08x 0x%08x 0x%08x]\n",
	   bp->slowpath->wb_data[0], bp->slowpath->wb_data[1],
	   bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]);

	mutex_lock(&bp->dmae_mutex);

	*wb_comp = 0;

	bnx2x_post_dmae(bp, &dmae, INIT_DMAE_C(bp));

	udelay(5);

	while (*wb_comp != DMAE_COMP_VAL) {
		DP(BNX2X_MSG_OFF, "wb_comp 0x%08x\n", *wb_comp);

		if (!cnt) {
			BNX2X_ERR("DMAE timeout!\n");
			break;
		}
		cnt--;
		/* adjust delay for emulation/FPGA */
		if (CHIP_REV_IS_SLOW(bp))
			msleep(100);
		else
			udelay(5);
	}

	mutex_unlock(&bp->dmae_mutex);
}

void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
{
	struct dmae_command dmae;
	u32 *wb_comp = bnx2x_sp(bp, wb_comp);
	int cnt = 200;

	if (!bp->dmae_ready) {
		u32 *data = bnx2x_sp(bp, wb_data[0]);
		int i;

		DP(BNX2X_MSG_OFF, "DMAE is not ready (src_addr %08x  len32 %d)"
		   "  using indirect\n", src_addr, len32);
		for (i = 0; i < len32; i++)
			data[i] = bnx2x_reg_rd_ind(bp, src_addr + i*4);
		return;
	}

	memset(&dmae, 0, sizeof(struct dmae_command));

	dmae.opcode = (DMAE_CMD_SRC_GRC | DMAE_CMD_DST_PCI |
		       DMAE_CMD_C_DST_PCI | DMAE_CMD_C_ENABLE |
		       DMAE_CMD_SRC_RESET | DMAE_CMD_DST_RESET |
#ifdef __BIG_ENDIAN
		       DMAE_CMD_ENDIANITY_B_DW_SWAP |
#else
		       DMAE_CMD_ENDIANITY_DW_SWAP |
#endif
		       (BP_PORT(bp) ? DMAE_CMD_PORT_1 : DMAE_CMD_PORT_0) |
		       (BP_E1HVN(bp) << DMAE_CMD_E1HVN_SHIFT));
	dmae.src_addr_lo = src_addr >> 2;
	dmae.src_addr_hi = 0;
	dmae.dst_addr_lo = U64_LO(bnx2x_sp_mapping(bp, wb_data));
	dmae.dst_addr_hi = U64_HI(bnx2x_sp_mapping(bp, wb_data));
	dmae.len = len32;
	dmae.comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, wb_comp));
	dmae.comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, wb_comp));
	dmae.comp_val = DMAE_COMP_VAL;

	DP(BNX2X_MSG_OFF, "DMAE: opcode 0x%08x\n"
	   DP_LEVEL "src_addr  [%x:%08x]  len [%d *4]  "
		    "dst_addr [%x:%08x (%08x)]\n"
	   DP_LEVEL "comp_addr [%x:%08x]  comp_val 0x%08x\n",
	   dmae.opcode, dmae.src_addr_hi, dmae.src_addr_lo,
	   dmae.len, dmae.dst_addr_hi, dmae.dst_addr_lo, src_addr,
	   dmae.comp_addr_hi, dmae.comp_addr_lo, dmae.comp_val);

	mutex_lock(&bp->dmae_mutex);

	memset(bnx2x_sp(bp, wb_data[0]), 0, sizeof(u32) * 4);
	*wb_comp = 0;

	bnx2x_post_dmae(bp, &dmae, INIT_DMAE_C(bp));

	udelay(5);

	while (*wb_comp != DMAE_COMP_VAL) {

		if (!cnt) {
			BNX2X_ERR("DMAE timeout!\n");
			break;
		}
		cnt--;
		/* adjust delay for emulation/FPGA */
		if (CHIP_REV_IS_SLOW(bp))
			msleep(100);
		else
			udelay(5);
	}
	DP(BNX2X_MSG_OFF, "data [0x%08x 0x%08x 0x%08x 0x%08x]\n",
	   bp->slowpath->wb_data[0], bp->slowpath->wb_data[1],
	   bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]);

	mutex_unlock(&bp->dmae_mutex);
}

void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr,
			       u32 addr, u32 len)
{
	int offset = 0;

	while (len > DMAE_LEN32_WR_MAX) {
		bnx2x_write_dmae(bp, phys_addr + offset,
				 addr + offset, DMAE_LEN32_WR_MAX);
		offset += DMAE_LEN32_WR_MAX * 4;
		len -= DMAE_LEN32_WR_MAX;
	}

	bnx2x_write_dmae(bp, phys_addr + offset, addr + offset, len);
}

/* used only for slowpath so not inlined */
static void bnx2x_wb_wr(struct bnx2x *bp, int reg, u32 val_hi, u32 val_lo)
{
	u32 wb_write[2];

	wb_write[0] = val_hi;
	wb_write[1] = val_lo;
	REG_WR_DMAE(bp, reg, wb_write, 2);
}

#ifdef USE_WB_RD
static u64 bnx2x_wb_rd(struct bnx2x *bp, int reg)
{
	u32 wb_data[2];

	REG_RD_DMAE(bp, reg, wb_data, 2);

	return HILO_U64(wb_data[0], wb_data[1]);
}
#endif

static int bnx2x_mc_assert(struct bnx2x *bp)
{
	char last_idx;
	int i, rc = 0;
	u32 row0, row1, row2, row3;

	/* XSTORM */
	last_idx = REG_RD8(bp, BAR_XSTRORM_INTMEM +
			   XSTORM_ASSERT_LIST_INDEX_OFFSET);
	if (last_idx)
		BNX2X_ERR("XSTORM_ASSERT_LIST_INDEX 0x%x\n", last_idx);

	/* print the asserts */
	for (i = 0; i < STROM_ASSERT_ARRAY_SIZE; i++) {

		row0 = REG_RD(bp, BAR_XSTRORM_INTMEM +
			      XSTORM_ASSERT_LIST_OFFSET(i));
		row1 = REG_RD(bp, BAR_XSTRORM_INTMEM +
			      XSTORM_ASSERT_LIST_OFFSET(i) + 4);
		row2 = REG_RD(bp, BAR_XSTRORM_INTMEM +
			      XSTORM_ASSERT_LIST_OFFSET(i) + 8);
		row3 = REG_RD(bp, BAR_XSTRORM_INTMEM +
			      XSTORM_ASSERT_LIST_OFFSET(i) + 12);

		if (row0 != COMMON_ASM_INVALID_ASSERT_OPCODE) {
			BNX2X_ERR("XSTORM_ASSERT_INDEX 0x%x = 0x%08x"
				  " 0x%08x 0x%08x 0x%08x\n",
				  i, row3, row2, row1, row0);
			rc++;
		} else {
			break;
		}
	}

	/* TSTORM */
	last_idx = REG_RD8(bp, BAR_TSTRORM_INTMEM +
			   TSTORM_ASSERT_LIST_INDEX_OFFSET);
	if (last_idx)
		BNX2X_ERR("TSTORM_ASSERT_LIST_INDEX 0x%x\n", last_idx);

	/* print the asserts */
	for (i = 0; i < STROM_ASSERT_ARRAY_SIZE; i++) {

		row0 = REG_RD(bp, BAR_TSTRORM_INTMEM +
			      TSTORM_ASSERT_LIST_OFFSET(i));
		row1 = REG_RD(bp, BAR_TSTRORM_INTMEM +
			      TSTORM_ASSERT_LIST_OFFSET(i) + 4);
		row2 = REG_RD(bp, BAR_TSTRORM_INTMEM +
			      TSTORM_ASSERT_LIST_OFFSET(i) + 8);
		row3 = REG_RD(bp, BAR_TSTRORM_INTMEM +
			      TSTORM_ASSERT_LIST_OFFSET(i) + 12);

		if (row0 != COMMON_ASM_INVALID_ASSERT_OPCODE) {
			BNX2X_ERR("TSTORM_ASSERT_INDEX 0x%x = 0x%08x"
				  " 0x%08x 0x%08x 0x%08x\n",
				  i, row3, row2, row1, row0);
			rc++;
		} else {
			break;
		}
	}

	/* CSTORM */
	last_idx = REG_RD8(bp, BAR_CSTRORM_INTMEM +
			   CSTORM_ASSERT_LIST_INDEX_OFFSET);
	if (last_idx)
		BNX2X_ERR("CSTORM_ASSERT_LIST_INDEX 0x%x\n", last_idx);

	/* print the asserts */
	for (i = 0; i < STROM_ASSERT_ARRAY_SIZE; i++) {

		row0 = REG_RD(bp, BAR_CSTRORM_INTMEM +
			      CSTORM_ASSERT_LIST_OFFSET(i));
		row1 = REG_RD(bp, BAR_CSTRORM_INTMEM +
			      CSTORM_ASSERT_LIST_OFFSET(i) + 4);
		row2 = REG_RD(bp, BAR_CSTRORM_INTMEM +
			      CSTORM_ASSERT_LIST_OFFSET(i) + 8);
		row3 = REG_RD(bp, BAR_CSTRORM_INTMEM +
			      CSTORM_ASSERT_LIST_OFFSET(i) + 12);

		if (row0 != COMMON_ASM_INVALID_ASSERT_OPCODE) {
			BNX2X_ERR("CSTORM_ASSERT_INDEX 0x%x = 0x%08x"
				  " 0x%08x 0x%08x 0x%08x\n",
				  i, row3, row2, row1, row0);
			rc++;
		} else {
			break;
		}
	}

	/* USTORM */
	last_idx = REG_RD8(bp, BAR_USTRORM_INTMEM +
			   USTORM_ASSERT_LIST_INDEX_OFFSET);
	if (last_idx)
		BNX2X_ERR("USTORM_ASSERT_LIST_INDEX 0x%x\n", last_idx);

	/* print the asserts */
	for (i = 0; i < STROM_ASSERT_ARRAY_SIZE; i++) {

		row0 = REG_RD(bp, BAR_USTRORM_INTMEM +
			      USTORM_ASSERT_LIST_OFFSET(i));
		row1 = REG_RD(bp, BAR_USTRORM_INTMEM +
			      USTORM_ASSERT_LIST_OFFSET(i) + 4);
		row2 = REG_RD(bp, BAR_USTRORM_INTMEM +
			      USTORM_ASSERT_LIST_OFFSET(i) + 8);
		row3 = REG_RD(bp, BAR_USTRORM_INTMEM +
			      USTORM_ASSERT_LIST_OFFSET(i) + 12);

		if (row0 != COMMON_ASM_INVALID_ASSERT_OPCODE) {
			BNX2X_ERR("USTORM_ASSERT_INDEX 0x%x = 0x%08x"
				  " 0x%08x 0x%08x 0x%08x\n",
				  i, row3, row2, row1, row0);
			rc++;
		} else {
			break;
		}
	}

	return rc;
}

static void bnx2x_fw_dump(struct bnx2x *bp)
{
	u32 mark, offset;
	__be32 data[9];
	int word;

	mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
	mark = ((mark + 0x3) & ~0x3);
	printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark);

	printk(KERN_ERR PFX);
	for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) {
		for (word = 0; word < 8; word++)
			data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
						  offset + 4*word));
		data[8] = 0x0;
		printk(KERN_CONT "%s", (char *)data);
	}
	for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) {
		for (word = 0; word < 8; word++)
			data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
						  offset + 4*word));
		data[8] = 0x0;
		printk(KERN_CONT "%s", (char *)data);
	}
	printk(KERN_ERR PFX "end of fw dump\n");
}

static void bnx2x_panic_dump(struct bnx2x *bp)
{
	int i;
	u16 j, start, end;

	bp->stats_state = STATS_STATE_DISABLED;
	DP(BNX2X_MSG_STATS, "stats_state - DISABLED\n");

	BNX2X_ERR("begin crash dump -----------------\n");

	/* Indices */
	/* Common */
	BNX2X_ERR("def_c_idx(%u)  def_u_idx(%u)  def_x_idx(%u)"
		  "  def_t_idx(%u)  def_att_idx(%u)  attn_state(%u)"
		  "  spq_prod_idx(%u)\n",
		  bp->def_c_idx, bp->def_u_idx, bp->def_x_idx, bp->def_t_idx,
		  bp->def_att_idx, bp->attn_state, bp->spq_prod_idx);

	/* Rx */
	for_each_rx_queue(bp, i) {
		struct bnx2x_fastpath *fp = &bp->fp[i];

		BNX2X_ERR("fp%d: rx_bd_prod(%x)  rx_bd_cons(%x)"
			  "  *rx_bd_cons_sb(%x)  rx_comp_prod(%x)"
			  "  rx_comp_cons(%x)  *rx_cons_sb(%x)\n",
			  i, fp->rx_bd_prod, fp->rx_bd_cons,
			  le16_to_cpu(*fp->rx_bd_cons_sb), fp->rx_comp_prod,
			  fp->rx_comp_cons, le16_to_cpu(*fp->rx_cons_sb));
		BNX2X_ERR("      rx_sge_prod(%x)  last_max_sge(%x)"
			  "  fp_u_idx(%x) *sb_u_idx(%x)\n",
			  fp->rx_sge_prod, fp->last_max_sge,
			  le16_to_cpu(fp->fp_u_idx),
			  fp->status_blk->u_status_block.status_block_index);
	}

	/* Tx */
	for_each_tx_queue(bp, i) {
		struct bnx2x_fastpath *fp = &bp->fp[i];

		BNX2X_ERR("fp%d: tx_pkt_prod(%x)  tx_pkt_cons(%x)"
			  "  tx_bd_prod(%x)  tx_bd_cons(%x)  *tx_cons_sb(%x)\n",
			  i, fp->tx_pkt_prod, fp->tx_pkt_cons, fp->tx_bd_prod,
			  fp->tx_bd_cons, le16_to_cpu(*fp->tx_cons_sb));
		BNX2X_ERR("      fp_c_idx(%x)  *sb_c_idx(%x)"
			  "  tx_db_prod(%x)\n", le16_to_cpu(fp->fp_c_idx),
			  fp->status_blk->c_status_block.status_block_index,
			  fp->tx_db.data.prod);
	}

	/* Rings */
	/* Rx */
	for_each_rx_queue(bp, i) {
		struct bnx2x_fastpath *fp = &bp->fp[i];

		start = RX_BD(le16_to_cpu(*fp->rx_cons_sb) - 10);
		end = RX_BD(le16_to_cpu(*fp->rx_cons_sb) + 503);
		for (j = start; j != end; j = RX_BD(j + 1)) {
			u32 *rx_bd = (u32 *)&fp->rx_desc_ring[j];
			struct sw_rx_bd *sw_bd = &fp->rx_buf_ring[j];

			BNX2X_ERR("fp%d: rx_bd[%x]=[%x:%x]  sw_bd=[%p]\n",
				  i, j, rx_bd[1], rx_bd[0], sw_bd->skb);
		}

		start = RX_SGE(fp->rx_sge_prod);
		end = RX_SGE(fp->last_max_sge);
		for (j = start; j != end; j = RX_SGE(j + 1)) {
			u32 *rx_sge = (u32 *)&fp->rx_sge_ring[j];
			struct sw_rx_page *sw_page = &fp->rx_page_ring[j];

			BNX2X_ERR("fp%d: rx_sge[%x]=[%x:%x]  sw_page=[%p]\n",
				  i, j, rx_sge[1], rx_sge[0], sw_page->page);
		}

		start = RCQ_BD(fp->rx_comp_cons - 10);
		end = RCQ_BD(fp->rx_comp_cons + 503);
		for (j = start; j != end; j = RCQ_BD(j + 1)) {
			u32 *cqe = (u32 *)&fp->rx_comp_ring[j];

			BNX2X_ERR("fp%d: cqe[%x]=[%x:%x:%x:%x]\n",
				  i, j, cqe[0], cqe[1], cqe[2], cqe[3]);
		}
	}

	/* Tx */
	for_each_tx_queue(bp, i) {
		struct bnx2x_fastpath *fp = &bp->fp[i];

		start = TX_BD(le16_to_cpu(*fp->tx_cons_sb) - 10);
		end = TX_BD(le16_to_cpu(*fp->tx_cons_sb) + 245);
		for (j = start; j != end; j = TX_BD(j + 1)) {
			struct sw_tx_bd *sw_bd = &fp->tx_buf_ring[j];

			BNX2X_ERR("fp%d: packet[%x]=[%p,%x]\n",
				  i, j, sw_bd->skb, sw_bd->first_bd);
		}

		start = TX_BD(fp->tx_bd_cons - 10);
		end = TX_BD(fp->tx_bd_cons + 254);
		for (j = start; j != end; j = TX_BD(j + 1)) {
			u32 *tx_bd = (u32 *)&fp->tx_desc_ring[j];

			BNX2X_ERR("fp%d: tx_bd[%x]=[%x:%x:%x:%x]\n",
				  i, j, tx_bd[0], tx_bd[1], tx_bd[2], tx_bd[3]);
		}
	}

	bnx2x_fw_dump(bp);
	bnx2x_mc_assert(bp);
	BNX2X_ERR("end crash dump -----------------\n");
}

static void bnx2x_int_enable(struct bnx2x *bp)
{
	int port = BP_PORT(bp);
	u32 addr = port ? HC_REG_CONFIG_1 : HC_REG_CONFIG_0;
	u32 val = REG_RD(bp, addr);
	int msix = (bp->flags & USING_MSIX_FLAG) ? 1 : 0;
	int msi = (bp->flags & USING_MSI_FLAG) ? 1 : 0;

	if (msix) {
		val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
			 HC_CONFIG_0_REG_INT_LINE_EN_0);
		val |= (HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
			HC_CONFIG_0_REG_ATTN_BIT_EN_0);
	} else if (msi) {
		val &= ~HC_CONFIG_0_REG_INT_LINE_EN_0;
		val |= (HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
			HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
			HC_CONFIG_0_REG_ATTN_BIT_EN_0);
	} else {
		val |= (HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
			HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
			HC_CONFIG_0_REG_INT_LINE_EN_0 |
			HC_CONFIG_0_REG_ATTN_BIT_EN_0);

		DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
		   val, port, addr);

		REG_WR(bp, addr, val);

		val &= ~HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0;
	}

	DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)  mode %s\n",
	   val, port, addr, (msix ? "MSI-X" : (msi ? "MSI" : "INTx")));

	REG_WR(bp, addr, val);
	/*
	 * Ensure that HC_CONFIG is written before leading/trailing edge config
	 */
	mmiowb();
	barrier();

	if (CHIP_IS_E1H(bp)) {
		/* init leading/trailing edge */
		if (IS_E1HMF(bp)) {
			val = (0xee0f | (1 << (BP_E1HVN(bp) + 4)));
			if (bp->port.pmf)
				/* enable nig and gpio3 attention */
				val |= 0x1100;
		} else
			val = 0xffff;

		REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, val);
		REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, val);
	}

	/* Make sure that interrupts are indeed enabled from here on */
	mmiowb();
}

static void bnx2x_int_disable(struct bnx2x *bp)
{
	int port = BP_PORT(bp);
	u32 addr = port ? HC_REG_CONFIG_1 : HC_REG_CONFIG_0;
	u32 val = REG_RD(bp, addr);

	val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
		 HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
		 HC_CONFIG_0_REG_INT_LINE_EN_0 |
		 HC_CONFIG_0_REG_ATTN_BIT_EN_0);

	DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
	   val, port, addr);

	/* flush all outstanding writes */
	mmiowb();

	REG_WR(bp, addr, val);
	if (REG_RD(bp, addr) != val)
		BNX2X_ERR("BUG! proper val not read from IGU!\n");
}

static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
{
	int msix = (bp->flags & USING_MSIX_FLAG) ? 1 : 0;
	int i, offset;

	/* disable interrupt handling */
	atomic_inc(&bp->intr_sem);
	smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */

	if (disable_hw)
		/* prevent the HW from sending interrupts */
		bnx2x_int_disable(bp);

	/* make sure all ISRs are done */
	if (msix) {
		synchronize_irq(bp->msix_table[0].vector);
		offset = 1;
		for_each_queue(bp, i)
			synchronize_irq(bp->msix_table[i + offset].vector);
	} else
		synchronize_irq(bp->pdev->irq);

	/* make sure sp_task is not running */
	cancel_delayed_work(&bp->sp_task);
	flush_workqueue(bnx2x_wq);
}

/* fast path */

/*
 * General service functions
 */

static inline void bnx2x_ack_sb(struct bnx2x *bp, u8 sb_id,
				u8 storm, u16 index, u8 op, u8 update)
{
	u32 hc_addr = (HC_REG_COMMAND_REG + BP_PORT(bp)*32 +
		       COMMAND_REG_INT_ACK);
	struct igu_ack_register igu_ack;