/[linux-patches]/genpatches-2.6/historical/2.6.10/4330_via-vt6421-sata-1.patch
Gentoo

Contents of /genpatches-2.6/historical/2.6.10/4330_via-vt6421-sata-1.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download) (as text)
Sat Jun 11 23:16:54 2005 UTC (15 years, 1 month ago) by dsd
File MIME type: text/x-diff
File size: 5861 byte(s)
Import historical releases
1 # This is a BitKeeper generated diff -Nru style patch.
2 #
3 # ChangeSet
4 # 2004/11/16 01:31:58-05:00 jgarzik@pobox.com
5 # [libata sata_via] minor cleanups
6 #
7 # Preparation for addition of VT6421 support. Mostly moving bits
8 # of code into discrete functions.
9 #
10 # drivers/scsi/sata_via.c
11 # 2004/11/16 01:31:52-05:00 jgarzik@pobox.com +67 -47
12 # [libata sata_via] minor cleanups
13 #
14 # Preparation for addition of VT6421 support. Mostly moving bits
15 # of code into discrete functions.
16 #
17 diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
18 --- a/drivers/scsi/sata_via.c 2005-01-13 13:55:38 -08:00
19 +++ b/drivers/scsi/sata_via.c 2005-01-13 13:55:38 -08:00
20 @@ -40,9 +40,11 @@
21 #define DRV_NAME "sata_via"
22 #define DRV_VERSION "1.0"
23
24 -enum {
25 - via_sata = 0,
26 +enum board_ids_enum {
27 + vt6420,
28 +};
29
30 +enum {
31 SATA_CHAN_ENAB = 0x40, /* SATA channel enable */
32 SATA_INT_GATE = 0x41, /* SATA interrupt gating */
33 SATA_NATIVE_MODE = 0x42, /* Native mode enable */
34 @@ -50,10 +52,8 @@
35
36 PORT0 = (1 << 1),
37 PORT1 = (1 << 0),
38 -
39 - ENAB_ALL = PORT0 | PORT1,
40 -
41 - INT_GATE_ALL = PORT0 | PORT1,
42 + ALL_PORTS = PORT0 | PORT1,
43 + N_PORTS = 2,
44
45 NATIVE_MODE_ALL = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4),
46
47 @@ -66,7 +66,7 @@
48 static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
49
50 static struct pci_device_id svia_pci_tbl[] = {
51 - { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, via_sata },
52 + { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 },
53
54 { } /* terminate list */
55 };
56 @@ -163,13 +163,67 @@
57 return addr + (port * 128);
58 }
59
60 +static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
61 +{
62 + struct ata_probe_ent *probe_ent;
63 + struct ata_port_info *ppi = &svia_port_info;
64 +
65 + probe_ent = ata_pci_init_native_mode(pdev, &ppi);
66 + if (!probe_ent)
67 + return NULL;
68 +
69 + probe_ent->port[0].scr_addr =
70 + svia_scr_addr(pci_resource_start(pdev, 5), 0);
71 + probe_ent->port[1].scr_addr =
72 + svia_scr_addr(pci_resource_start(pdev, 5), 1);
73 +
74 + return probe_ent;
75 +}
76 +
77 +static void svia_configure(struct pci_dev *pdev)
78 +{
79 + u8 tmp8;
80 +
81 + pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8);
82 + printk(KERN_INFO DRV_NAME "(%s): routed to hard irq line %d\n",
83 + pci_name(pdev),
84 + (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f);
85 +
86 + /* make sure SATA channels are enabled */
87 + pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8);
88 + if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
89 + printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channels (0x%x)\n",
90 + pci_name(pdev), (int) tmp8);
91 + tmp8 |= ALL_PORTS;
92 + pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
93 + }
94 +
95 + /* make sure interrupts for each channel sent to us */
96 + pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8);
97 + if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
98 + printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel interrupts (0x%x)\n",
99 + pci_name(pdev), (int) tmp8);
100 + tmp8 |= ALL_PORTS;
101 + pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
102 + }
103 +
104 + /* make sure native mode is enabled */
105 + pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8);
106 + if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
107 + printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel native mode (0x%x)\n",
108 + pci_name(pdev), (int) tmp8);
109 + tmp8 |= NATIVE_MODE_ALL;
110 + pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
111 + }
112 +}
113 +
114 static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
115 {
116 static int printed_version;
117 unsigned int i;
118 int rc;
119 - struct ata_port_info *ppi;
120 struct ata_probe_ent *probe_ent;
121 + const int *bar_sizes;
122 u8 tmp8;
123
124 if (!printed_version++)
125 @@ -191,9 +245,11 @@
126 goto err_out_regions;
127 }
128
129 + bar_sizes = &svia_bar_sizes[0];
130 +
131 for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++)
132 if ((pci_resource_start(pdev, i) == 0) ||
133 - (pci_resource_len(pdev, i) < svia_bar_sizes[i])) {
134 + (pci_resource_len(pdev, i) < bar_sizes[i])) {
135 printk(KERN_ERR DRV_NAME "(%s): invalid PCI BAR %u (sz 0x%lx, val 0x%lx)\n",
136 pci_name(pdev), i,
137 pci_resource_start(pdev, i),
138 @@ -209,8 +265,7 @@
139 if (rc)
140 goto err_out_regions;
141
142 - ppi = &svia_port_info;
143 - probe_ent = ata_pci_init_native_mode(pdev, &ppi);
144 + probe_ent = vt6420_init_probe_ent(pdev);
145 if (!probe_ent) {
146 printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
147 pci_name(pdev));
148 @@ -218,42 +273,7 @@
149 goto err_out_regions;
150 }
151
152 - probe_ent->port[0].scr_addr =
153 - svia_scr_addr(pci_resource_start(pdev, 5), 0);
154 - probe_ent->port[1].scr_addr =
155 - svia_scr_addr(pci_resource_start(pdev, 5), 1);
156 -
157 - pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8);
158 - printk(KERN_INFO DRV_NAME "(%s): routed to hard irq line %d\n",
159 - pci_name(pdev),
160 - (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f);
161 -
162 - /* make sure SATA channels are enabled */
163 - pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8);
164 - if ((tmp8 & ENAB_ALL) != ENAB_ALL) {
165 - printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channels (0x%x)\n",
166 - pci_name(pdev), (int) tmp8);
167 - tmp8 |= ENAB_ALL;
168 - pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
169 - }
170 -
171 - /* make sure interrupts for each channel sent to us */
172 - pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8);
173 - if ((tmp8 & INT_GATE_ALL) != INT_GATE_ALL) {
174 - printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel interrupts (0x%x)\n",
175 - pci_name(pdev), (int) tmp8);
176 - tmp8 |= INT_GATE_ALL;
177 - pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
178 - }
179 -
180 - /* make sure native mode is enabled */
181 - pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8);
182 - if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
183 - printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel native mode (0x%x)\n",
184 - pci_name(pdev), (int) tmp8);
185 - tmp8 |= NATIVE_MODE_ALL;
186 - pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
187 - }
188 + svia_configure(pdev);
189
190 pci_set_master(pdev);
191

  ViewVC Help
Powered by ViewVC 1.1.20