OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [via_ide_dma.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/* Via Apollo timings display header file for triton.c.
2
   Copyright (c) 1998 Michel Aubry
3
*/
4
 
5
typedef char *PCHAR;
6
 
7
static int via_get_info(char *, char **, off_t, int, int);
8
static PCHAR print_apollo_drive_config(char *buf,byte bus, byte fn);
9
static PCHAR print_apollo_ide_config(char *buf, byte bus, byte fn);
10
static PCHAR print_apollo_chipset_control1(char *buf,byte bus, byte fn);
11
static PCHAR print_apollo_chipset_control2(char *p,byte bus, byte fn);
12
static PCHAR print_apollo_chipset_control3(char *p, byte bus, byte fn, unsigned short n);
13
 
14
static struct proc_dir_entry via_proc_entry = {
15
  0, 3, "via", S_IFREG | S_IRUGO, 1, 0, 0, 0, 0, via_get_info
16
};
17
 
18
/* we save bus, function of chipset here for further debug use */
19
static byte bmide_bus, bmide_fn;
20
 
21
static char *FIFO_str[] = {" 1 ", "3/4", "1/2", "1/4"};
22
static char *control3_str[] = {"No limitation", "64","128","192"};
23
 
24
static int via_get_info(char *buffer, char **addr, off_t offset, int count, int dummy)
25
{
26
   /* print what /proc/via displays, if required from DISPLAY_APOLLO_TIMINGS */
27
     char *p = buffer;
28
     /* Parameter of chipset : */
29
     /* Miscellaneous control 1 */
30
     p = print_apollo_chipset_control1(buffer,bmide_bus, bmide_fn);
31
     /* Miscellaneous control 2 */
32
     p = print_apollo_chipset_control2(p,bmide_bus, bmide_fn);
33
     /* Parameters of drives: */
34
     /* Header */
35
     p += sprintf(p,"------------------Primary IDE------------Secondary IDE-----\n");
36
     p = print_apollo_chipset_control3(p, bmide_bus, bmide_fn, 0);
37
     p = print_apollo_ide_config(p,bmide_bus, bmide_fn);
38
     p += sprintf(p,"--------------drive0------drive1-------drive0------drive1----\n");
39
     p = print_apollo_chipset_control3(p, bmide_bus, bmide_fn, 1);
40
     p = print_apollo_drive_config(p,bmide_bus, bmide_fn);
41
 
42
     return p-buffer; /* hoping it is less than 4K... */
43
}
44
 
45
static PCHAR print_apollo_drive_config(char *buf,byte bus, byte fn)
46
{
47
     int rc;
48
     unsigned int time;
49
     byte tm;
50
     char *p = buf;
51
 
52
     /*  printk("--------------drive0------drive1-------drive0------drive1----");*/
53
 
54
     /* Drive Timing Control */
55
 
56
     rc = pcibios_read_config_dword(bus, fn, 0x48, &time);
57
     p += sprintf(p,"Act Pls Width:  %02d          %02d           %02d          %02d\n",((time & 0xf0000000)>>28)+1,((time & 0xf00000)>>20)+1,((time & 0xf000)>>12)+1, ((time & 0xf0)>>4)+1);
58
     p += sprintf(p,"Recovery Time:  %02d          %02d           %02d          %02d\n",((time & 0x0f000000)>>24)+1, ((time & 0x0f0000)>>16)+1, ((time & 0x0f00)>>8)+1, (time & 0x0f)+1);
59
 
60
     /* Address Setup Time */
61
 
62
     rc = pcibios_read_config_byte(bus, fn, 0x4C, &tm);
63
     p += sprintf(p, "Add. Setup T.:  %01dT          %01dT           %01dT          %01dT\n",((tm & 0xc0)>>6) + 1,((tm & 0x30)>>4) + 1,((tm & 0x0c)>>2) + 1,(tm & 0x03) + 1);
64
 
65
     /* UltraDMA33 Extended Timing Control */
66
 
67
     rc = pcibios_read_config_dword(bus, fn, 0x50, &time);
68
     p += sprintf(p, "------------------UDMA-Timing-Control------------------------\n");
69
     p += sprintf(p, "Enable Meth.:    %01d           %01d            %01d           %01d\n",(time & 0x80000000)?1:0,(time & 0x800000)?1:0, (time & 0x8000)?1:0, (time & 0x80)?1:0);
70
     p += sprintf(p, "Enable:         %s         %s          %s         %s\n",(time & 0x40000000)?"yes":"no ", (time & 0x400000)?"yes":"no ",(time & 0x4000)?"yes":"no ",(time & 0x40)?"yes":"no ");
71
     p += sprintf(p, "Transfer Mode: %s         %s          %s         %s\n",(time & 0x20000000)?"PIO":"DMA",(time & 0x200000)?"PIO":"DMA",(time & 0x2000)?"PIO":"DMA",(time & 0x20)?"PIO":"DMA");
72
     p += sprintf(p, "Cycle Time:     %01dT          %01dT           %01dT          %01dT\n",((time & 0x03000000)>>24)+2,((time & 0x030000)>>16)+2,((time & 0x0300)>>8)+2,(time & 0x03)+2);
73
 
74
     return (PCHAR)p;
75
}
76
 
77
static PCHAR print_apollo_ide_config(char *buf, byte bus, byte fn)
78
{
79
     byte time, tmp;
80
     unsigned short size0,size1;
81
     int rc;
82
     char *p = buf;
83
 
84
     rc = pcibios_read_config_byte(bus, fn, 0x41, &time);
85
     p += sprintf(p,"Prefetch Buffer :      %s                     %s\n", (time & 128)?"on ":"off", (time & 32)?"on ":"off");
86
     p += sprintf(p,"Post Write Buffer:     %s                     %s\n", (time & 64)? "on ": "off",(time & 16)?"on ":"off");
87
 
88
     /* FIFO configuration */
89
     rc = pcibios_read_config_byte(bus, fn, 0x43, &time);
90
     tmp = ((time & 0x20)>>2) + ((time & 0x40)>>3);
91
     p += sprintf(p,"FIFO Conf/Chan. :      %02d                      %02d\n", 16 - tmp, tmp);
92
     tmp = (time & 0x0F)>>2;
93
     p += sprintf(p,"Threshold Prim. :      %s                     %s\n", FIFO_str[tmp],FIFO_str[time & 0x03]);
94
 
95
     /* chipset Control3 */
96
     rc = pcibios_read_config_byte(bus, fn, 0x46, &time);
97
     p += sprintf(p,"Read DMA FIFO flush:   %s                     %s\n",(time & 0x80)?"on ":"off", (time & 0x40)?"on ":"off");
98
     p += sprintf(p,"End Sect. FIFO flush:  %s                     %s\n",(time & 0x20)?"on ":"off", (time & 0x10)?"on ":"off");
99
     p += sprintf(p,"Max DRDY Pulse Width:  %s %s\n", control3_str[(time & 0x03)], (time & 0x03)? "PCI clocks":"");
100
 
101
     /* Primary and Secondary sector sizes */
102
     rc = pcibios_read_config_word(bus, fn, 0x60, &size0);
103
     rc = pcibios_read_config_word(bus, fn, 0x68, &size1);
104
     p += sprintf(p,"Bytes Per Sector:      %03d                     %03d\n",size0 & 0xfff,size1 & 0xfff);
105
     return (PCHAR)p;
106
}
107
 
108
static PCHAR print_apollo_chipset_control1(char *buf,byte bus, byte fn)
109
{
110
     byte t;
111
     int rc;
112
     char *p = buf;
113
     unsigned short c;
114
     byte l,l_max;
115
 
116
     rc = pcibios_read_config_word(bus, fn, 0x04, &c);
117
     rc = pcibios_read_config_byte(bus, fn, 0x44, &t);
118
     rc = pcibios_read_config_byte(bus, fn, 0x0d, &l);
119
     rc = pcibios_read_config_byte(bus, fn, 0x3f, &l_max);
120
     p += sprintf(p,"Command register = 0x%x\n",c);
121
     p += sprintf(p,"Master Read  Cycle IRDY %d Wait State\n", (t & 64)>>6);
122
     p += sprintf(p,"Master Write Cycle IRDY %d Wait State\n", (t & 32)>>5 );
123
     p += sprintf(p,"FIFO Output Data 1/2 Clock Advance: %s\n", (t & 16)? "on ":"off");
124
     p += sprintf(p,"Bus Master IDE Status Register Read Retry: %s\n", (t & 8)? "on " : "off");
125
     p += sprintf(p,"Latency timer = %d (max. = %d)\n",l,l_max);
126
     return (PCHAR)p;
127
}
128
 
129
static PCHAR print_apollo_chipset_control2(char *buf,byte bus, byte fn)
130
{
131
     byte t;
132
     int rc;
133
     char *p = buf;
134
     rc = pcibios_read_config_byte(bus, fn, 0x45, &t);
135
     p += sprintf(p,"Interrupt Steering Swap: %s\n", (t & 64)? "on ":"off");
136
     return (PCHAR)p;
137
}
138
 
139
static PCHAR print_apollo_chipset_control3(char *buf, byte bus, byte fn, unsigned short n)
140
{
141
     /* at that point we can be sure that register 0x20 of the chipset contains the right address... */
142
     unsigned int bibma;
143
     int rc;
144
     byte c0,c1;
145
     char *p = buf;
146
 
147
     rc = pcibios_read_config_dword(bus, fn, 0x20, &bibma);
148
     bibma = (bibma & 0xfff0) ;
149
 
150
     /* at that point bibma+0x2 et bibma+0xa are byte registers to investigate:*/
151
     c0 = inb((unsigned short)bibma + 0x02);
152
     c1 = inb((unsigned short)bibma + 0x0a);
153
 
154
     if(n==0)
155
        /*p = sprintf(p,"--------------------Primary IDE------------Secondary IDE-----");*/
156
        p += sprintf(p,"both channels togth:   %s                     %s\n",(c0&0x80)?"no":"yes",(c1&0x80)?"no":"yes");
157
     else
158
        /*p = sprintf(p,"--------------drive0------drive1-------drive0------drive1----");*/
159
        p += sprintf(p,"DMA enabled:    %s         %s          %s         %s\n",(c0&0x20)?"yes":"no ",(c0&0x40)?"yes":"no ",(c1&0x20)?"yes":"no ",(c1&0x40)?"yes":"no ");
160
 
161
     return (PCHAR)p;
162
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.