(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
alpha/
pr66140.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -mcpu=ev4" } */
       3  
       4  struct scsi_cmnd {
       5  	int sc_data_direction;
       6  };
       7  struct lpfc_hba {
       8  	unsigned cfg_total_seg_cnt;
       9  };
      10  struct lpfc_scsi_buf {
      11  	struct scsi_cmnd *pCmd;
      12  	unsigned seg_cnt;
      13  	unsigned *fcp_bpl;
      14  };
      15  
      16  extern void *sg_next(void *sg);
      17  extern void *scsi_sglist(struct scsi_cmnd *cmd);
      18  extern unsigned scsi_sg_count(struct scsi_cmnd *cmd);
      19  
      20  static inline void dma_map_sg_attrs(void *sg, int nents, int dir)
      21  {
      22  	int i;
      23  
      24  	for (i = 0; i < nents; i++, sg = sg_next(sg))
      25  		;
      26  
      27  	if (!dir)
      28  		asm volatile( "call_pal %0" : : "i"(129));
      29  }
      30  
      31  static inline void lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
      32  				     unsigned *pde5)
      33  {
      34  	void *sgde;
      35  	int i;
      36  
      37  	*pde5 = (((0x85 & 0x000000ffu) << 24) | (*pde5 & ~(0x000000ffu << 24)));
      38  	for (i = 0, sgde = scsi_sglist(sc); i < 2; i++, sgde = sg_next(sgde))
      39  		;
      40  }
      41  
      42  void lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba,
      43  				  struct lpfc_scsi_buf *lpfc_cmd)
      44  {
      45  	struct scsi_cmnd *scsi_cmnd = lpfc_cmd->pCmd;
      46  	unsigned *bpl = lpfc_cmd->fcp_bpl;
      47  
      48  	dma_map_sg_attrs(scsi_sglist(scsi_cmnd),
      49  			 scsi_sg_count(scsi_cmnd),
      50  			 scsi_cmnd->sc_data_direction);
      51  	if (lpfc_cmd->seg_cnt > phba->cfg_total_seg_cnt)
      52  		lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl);
      53  }