@@ -323,7 +323,12 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
323323
324324static int be_POST_stage_get (struct be_adapter * adapter , u16 * stage )
325325{
326- u32 sem = ioread32 (adapter -> csr + MPU_EP_SEMAPHORE_OFFSET );
326+ u32 sem ;
327+
328+ if (lancer_chip (adapter ))
329+ sem = ioread32 (adapter -> db + MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET );
330+ else
331+ sem = ioread32 (adapter -> csr + MPU_EP_SEMAPHORE_OFFSET );
327332
328333 * stage = sem & EP_SEMAPHORE_POST_STAGE_MASK ;
329334 if ((sem >> EP_SEMAPHORE_POST_ERR_SHIFT ) & EP_SEMAPHORE_POST_ERR_MASK )
@@ -465,14 +470,25 @@ int be_cmd_fw_init(struct be_adapter *adapter)
465470 spin_lock (& adapter -> mbox_lock );
466471
467472 wrb = (u8 * )wrb_from_mbox (adapter );
468- * wrb ++ = 0xFF ;
469- * wrb ++ = 0x12 ;
470- * wrb ++ = 0x34 ;
471- * wrb ++ = 0xFF ;
472- * wrb ++ = 0xFF ;
473- * wrb ++ = 0x56 ;
474- * wrb ++ = 0x78 ;
475- * wrb = 0xFF ;
473+ if (lancer_chip (adapter )) {
474+ * wrb ++ = 0xFF ;
475+ * wrb ++ = 0x34 ;
476+ * wrb ++ = 0x12 ;
477+ * wrb ++ = 0xFF ;
478+ * wrb ++ = 0xFF ;
479+ * wrb ++ = 0x78 ;
480+ * wrb ++ = 0x56 ;
481+ * wrb = 0xFF ;
482+ } else {
483+ * wrb ++ = 0xFF ;
484+ * wrb ++ = 0x12 ;
485+ * wrb ++ = 0x34 ;
486+ * wrb ++ = 0xFF ;
487+ * wrb ++ = 0xFF ;
488+ * wrb ++ = 0x56 ;
489+ * wrb ++ = 0x78 ;
490+ * wrb = 0xFF ;
491+ }
476492
477493 status = be_mbox_notify_wait (adapter );
478494
@@ -680,16 +696,36 @@ int be_cmd_cq_create(struct be_adapter *adapter,
680696 OPCODE_COMMON_CQ_CREATE , sizeof (* req ));
681697
682698 req -> num_pages = cpu_to_le16 (PAGES_4K_SPANNED (q_mem -> va , q_mem -> size ));
699+ if (lancer_chip (adapter )) {
700+ req -> hdr .version = 1 ;
701+ req -> page_size = 1 ; /* 1 for 4K */
702+ AMAP_SET_BITS (struct amap_cq_context_lancer , coalescwm , ctxt ,
703+ coalesce_wm );
704+ AMAP_SET_BITS (struct amap_cq_context_lancer , nodelay , ctxt ,
705+ no_delay );
706+ AMAP_SET_BITS (struct amap_cq_context_lancer , count , ctxt ,
707+ __ilog2_u32 (cq -> len /256 ));
708+ AMAP_SET_BITS (struct amap_cq_context_lancer , valid , ctxt , 1 );
709+ AMAP_SET_BITS (struct amap_cq_context_lancer , eventable ,
710+ ctxt , 1 );
711+ AMAP_SET_BITS (struct amap_cq_context_lancer , eqid ,
712+ ctxt , eq -> id );
713+ AMAP_SET_BITS (struct amap_cq_context_lancer , armed , ctxt , 1 );
714+ } else {
715+ AMAP_SET_BITS (struct amap_cq_context_be , coalescwm , ctxt ,
716+ coalesce_wm );
717+ AMAP_SET_BITS (struct amap_cq_context_be , nodelay ,
718+ ctxt , no_delay );
719+ AMAP_SET_BITS (struct amap_cq_context_be , count , ctxt ,
720+ __ilog2_u32 (cq -> len /256 ));
721+ AMAP_SET_BITS (struct amap_cq_context_be , valid , ctxt , 1 );
722+ AMAP_SET_BITS (struct amap_cq_context_be , solevent ,
723+ ctxt , sol_evts );
724+ AMAP_SET_BITS (struct amap_cq_context_be , eventable , ctxt , 1 );
725+ AMAP_SET_BITS (struct amap_cq_context_be , eqid , ctxt , eq -> id );
726+ AMAP_SET_BITS (struct amap_cq_context_be , armed , ctxt , 1 );
727+ }
683728
684- AMAP_SET_BITS (struct amap_cq_context , coalescwm , ctxt , coalesce_wm );
685- AMAP_SET_BITS (struct amap_cq_context , nodelay , ctxt , no_delay );
686- AMAP_SET_BITS (struct amap_cq_context , count , ctxt ,
687- __ilog2_u32 (cq -> len /256 ));
688- AMAP_SET_BITS (struct amap_cq_context , valid , ctxt , 1 );
689- AMAP_SET_BITS (struct amap_cq_context , solevent , ctxt , sol_evts );
690- AMAP_SET_BITS (struct amap_cq_context , eventable , ctxt , 1 );
691- AMAP_SET_BITS (struct amap_cq_context , eqid , ctxt , eq -> id );
692- AMAP_SET_BITS (struct amap_cq_context , armed , ctxt , 1 );
693729 be_dws_cpu_to_le (ctxt , sizeof (req -> context ));
694730
695731 be_cmd_page_addrs_prepare (req -> pages , ARRAY_SIZE (req -> pages ), q_mem );
@@ -737,13 +773,27 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
737773 OPCODE_COMMON_MCC_CREATE_EXT , sizeof (* req ));
738774
739775 req -> num_pages = cpu_to_le16 (PAGES_4K_SPANNED (q_mem -> va , q_mem -> size ));
776+ if (lancer_chip (adapter )) {
777+ req -> hdr .version = 1 ;
778+ req -> cq_id = cpu_to_le16 (cq -> id );
779+
780+ AMAP_SET_BITS (struct amap_mcc_context_lancer , ring_size , ctxt ,
781+ be_encoded_q_len (mccq -> len ));
782+ AMAP_SET_BITS (struct amap_mcc_context_lancer , valid , ctxt , 1 );
783+ AMAP_SET_BITS (struct amap_mcc_context_lancer , async_cq_id ,
784+ ctxt , cq -> id );
785+ AMAP_SET_BITS (struct amap_mcc_context_lancer , async_cq_valid ,
786+ ctxt , 1 );
787+
788+ } else {
789+ AMAP_SET_BITS (struct amap_mcc_context_be , valid , ctxt , 1 );
790+ AMAP_SET_BITS (struct amap_mcc_context_be , ring_size , ctxt ,
791+ be_encoded_q_len (mccq -> len ));
792+ AMAP_SET_BITS (struct amap_mcc_context_be , cq_id , ctxt , cq -> id );
793+ }
740794
741- AMAP_SET_BITS (struct amap_mcc_context , valid , ctxt , 1 );
742- AMAP_SET_BITS (struct amap_mcc_context , ring_size , ctxt ,
743- be_encoded_q_len (mccq -> len ));
744- AMAP_SET_BITS (struct amap_mcc_context , cq_id , ctxt , cq -> id );
745795 /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */
746- req -> async_event_bitmap [0 ] |= 0x00000022 ;
796+ req -> async_event_bitmap [0 ] = cpu_to_le32 ( 0x00000022 ) ;
747797 be_dws_cpu_to_le (ctxt , sizeof (req -> context ));
748798
749799 be_cmd_page_addrs_prepare (req -> pages , ARRAY_SIZE (req -> pages ), q_mem );
0 commit comments