2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / alpha / pr66140.c
bloba69f0222521f3b36c37fcd0839b092e093d7c237
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mcpu=ev4" } */
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;
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);
20 static inline void dma_map_sg_attrs(void *sg, int nents, int dir)
22 int i;
24 for (i = 0; i < nents; i++, sg = sg_next(sg))
27 if (!dir)
28 asm volatile( "call_pal %0" : : "i"(129));
31 static inline void lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
32 unsigned *pde5)
34 void *sgde;
35 int i;
37 *pde5 = (((0x85 & 0x000000ffu) << 24) | (*pde5 & ~(0x000000ffu << 24)));
38 for (i = 0, sgde = scsi_sglist(sc); i < 2; i++, sgde = sg_next(sgde))
42 void lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba,
43 struct lpfc_scsi_buf *lpfc_cmd)
45 struct scsi_cmnd *scsi_cmnd = lpfc_cmd->pCmd;
46 unsigned *bpl = lpfc_cmd->fcp_bpl;
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);