1 typedef union { int ioport; volatile char *maddr; } bus_space_handle_t;
2 struct scb { unsigned short *hscb; };
3 struct ahd_softc
4 {
5   int tags[2];
6   bus_space_handle_t bshs[2];
7   int dst_mode;
8   int src_mode;
9   int flags;
10 };
11 void outb(int, int);
12 
13 int foo_inb(struct ahd_softc*);
14 int foo_int_int (int, int);
15 int ahd_inb(struct ahd_softc*);
16 int ahd_scb_active_in_fifo (void);
17 
ahd_flush_qoutfifo(struct ahd_softc * ahd,struct scb * scb)18 void ahd_flush_qoutfifo (struct ahd_softc *ahd, struct scb *scb)
19 {
20   int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;
21   int bb, p;
22 
23   if (ahd->src_mode == 1)
24     { int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;}
25   foo_int_int (ahd->src_mode, ahd->dst_mode);
26   p = 1;
27   if (ahd->src_mode == 2 && ahd->dst_mode == p)
28     {
29       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
30         outb (1, ahd->bshs[0].ioport );
31       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
32         outb (1, ahd->bshs[0].ioport );
33     }
34   ahd->src_mode = 1;
35   ahd->dst_mode = 2;
36   while ((ahd_inb (ahd) & 0x01) != 0)
37   {
38     p = 1;
39     if (ahd->src_mode == 2 && ahd->dst_mode == p)
40       {
41         if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
42           outb (1, ahd->bshs[0].ioport );
43         if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
44           outb (1, ahd->bshs[0].ioport );
45       }
46     ahd->src_mode = 1;
47     ahd->dst_mode = 2;
48     if (ahd_scb_active_in_fifo () == 0)
49       continue;
50     p = 1;
51     if (ahd->src_mode == 2 && ahd->dst_mode == p)
52       {
53         if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
54           outb (1, ahd->bshs[0].ioport );
55         if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
56           outb (1, ahd->bshs[0].ioport );
57       }
58     ahd->src_mode = 1;
59     ahd->dst_mode = 2;
60     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
61       outb (1, ahd->bshs[0].ioport );
62     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
63       outb (1, ahd->bshs[0].ioport );
64     if ((ahd->flags & 1) != 0)
65       foo_inb (ahd);
66     if ((ahd->flags & 1) != 0)
67       foo_inb (ahd);
68     if ((ahd->flags & 1) != 0)
69       foo_inb (ahd);
70     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
71       outb (1, ahd->bshs[0].ioport );
72     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
73       outb (1, ahd->bshs[0].ioport );
74     if ((ahd->flags & 1) != 0)
75       foo_inb (ahd);
76     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
77       outb (1, ahd->bshs[0].ioport );
78     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
79       outb (1, ahd->bshs[0].ioport );
80     bb = (*(scb->hscb));
81     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
82       outb (1, ahd->bshs[0].ioport );
83     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
84       outb (1, ahd->bshs[0].ioport );
85     bb = (*(scb->hscb));
86     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
87       outb (1, ahd->bshs[0].ioport );
88     if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
89       outb (1, ahd->bshs[0].ioport );
90   }
91   if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
92     outb (1, ahd->bshs[0].ioport );
93   if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
94     outb (1, ahd->bshs[0].ioport );
95   p = 1;
96   if (ahd->src_mode == 2 && ahd->dst_mode == p)
97     {
98       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
99         outb (1, ahd->bshs[0].ioport );
100       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
101         outb (1, ahd->bshs[0].ioport );
102     }
103   ahd->src_mode = 1;
104   ahd->dst_mode = 2;
105   if (ahd->src_mode == 2 && ahd->dst_mode == dst)
106     {
107       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
108         outb (1, ahd->bshs[0].ioport );
109       if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr);
110         outb (1, ahd->bshs[0].ioport );
111     }
112   ahd->src_mode = 1;
113   ahd->dst_mode = 2;
114   ahd->flags |= 1;
115 }
116