------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-19 
19:54 -------
Reduced as far as I can (-O1 to reproduce):
typedef union { int ioport; volatile char *maddr; } bus_space_handle_t;
struct scb { unsigned short *hscb; };
struct ahd_softc
{
  int tags[2];
  bus_space_handle_t bshs[2];
  int dst_mode;
  int src_mode;
  int flags;
};
void outb(int, int);
static inline void ahd_outb (struct ahd_softc *ahd, long port, int val)
{
  if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
  outb (1, ahd->bshs[0].ioport );
  if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
  outb (1, ahd->bshs[0].ioport );
}
int ahd_build_mode_state1(void);
static inline void ahd_set_modes (struct ahd_softc *ahd, int dst)
{
  if (ahd->src_mode == 2 && ahd->dst_mode == dst)
    ahd_outb (ahd, 0x00, ahd_build_mode_state1 ());
  ahd->src_mode = 1;
  ahd->dst_mode = 2;
}
int ahd_build_mode_state (int, int);
static inline int ahd_save_modes (struct ahd_softc *ahd)
{
  if (ahd->src_mode == 1)
    { int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;}
  return (ahd_build_mode_state (ahd->src_mode, ahd->dst_mode));
}
static inline void ahd_restore_modes (struct ahd_softc *ahd)
{
  int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;
  ahd_set_modes (ahd, dst);
}
int ahd_inb(struct ahd_softc*);
static inline int ahd_inb_scbram (struct ahd_softc *ahd)
{
  if ((ahd->flags & 1) != 0)
    ahd_inb (ahd);
  return 1;
}
int ahd_scb_active_in_fifo (void);
void ahd_flush_qoutfifo (struct ahd_softc *ahd, struct scb *scb)
{
  ahd_save_modes (ahd);
  ahd_set_modes (ahd,  1);
  while ((ahd_inb (ahd) & 0x01) != 0)
  {
    ahd_set_modes (ahd, 1);
    if (ahd_scb_active_in_fifo () == 0)
      continue;
    ahd_set_modes (ahd,  1);
    ahd_outb(ahd,1,1);
    if ((ahd_inb_scbram (ahd) & 0x01) == 0
        && ((ahd_inb_scbram (ahd) & 0x02) != 0
            || (ahd_inb_scbram (ahd) & 0x01) != 0))
    {
      int bb;
      ahd_outb(ahd,1,1);
      ahd_outb (ahd, 0x1a4, ahd_inb_scbram (ahd) | 0x04);
      bb = (*(scb->hscb));
      ahd_outb(ahd,1,1);
      bb = (*(scb->hscb));
      ahd_outb(ahd,1,1);
    }
  }
  ahd_outb(ahd,1,1);
  ahd_set_modes (ahd,  1);
  ahd_restore_modes (ahd);
  ahd->flags |= 1;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19080

Reply via email to