Deleted Added
full compact
ata-all.c (54544) ata-all.c (54594)
1/*-
2 * Copyright (c) 1998,1999 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1998,1999 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/ata/ata-all.c 54544 1999-12-13 10:19:39Z sos $
28 * $FreeBSD: head/sys/dev/ata/ata-all.c 54594 1999-12-14 10:25:28Z sos $
29 */
30
31#include "ata.h"
32#include "apm.h"
33#include "isa.h"
34#include "pci.h"
35#include "atadisk.h"
36#include "atapicd.h"

--- 154 unchanged lines hidden (view full) ---

191 return "Intel PIIX ATA controller";
192 case 0x70108086:
193 return "Intel PIIX3 ATA controller";
194 case 0x71118086:
195 return "Intel PIIX4 ATA controller";
196 case 0x522910b9:
197 return "AcerLabs Aladdin ATA controller";
198 case 0x05711106: /* 82c586 & 82c686 */
29 */
30
31#include "ata.h"
32#include "apm.h"
33#include "isa.h"
34#include "pci.h"
35#include "atadisk.h"
36#include "atapicd.h"

--- 154 unchanged lines hidden (view full) ---

191 return "Intel PIIX ATA controller";
192 case 0x70108086:
193 return "Intel PIIX3 ATA controller";
194 case 0x71118086:
195 return "Intel PIIX4 ATA controller";
196 case 0x522910b9:
197 return "AcerLabs Aladdin ATA controller";
198 case 0x05711106: /* 82c586 & 82c686 */
199 switch (pci_read_config(dev, 0x08, 1)) {
200 case 1:
199 if (ata_find_dev(dev, 0x05861106))
201 return "VIA 82C586 ATA controller";
200 return "VIA 82C586 ATA controller";
202 case 6:
201 if (ata_find_dev(dev, 0x06861106))
203 return "VIA 82C686 ATA controller";
202 return "VIA 82C686 ATA controller";
204 }
205 return "VIA Apollo ATA controller";
206 case 0x55131039:
207 return "SiS 5591 ATA controller";
208 case 0x4d33105a:
209 return "Promise Ultra/33 ATA controller";
210 case 0x4d38105a:
211 return "Promise Ultra/66 ATA controller";
212 case 0x00041103:

--- 58 unchanged lines hidden (view full) ---

271 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
272 iobase_1 = IO_WD1;
273 altiobase_1 = iobase_1 + ATA_ALTPORT;
274 irq1 = 14;
275 }
276 else {
277 iobase_1 = pci_read_config(dev, 0x10, 4) & IOMASK;
278 altiobase_1 = pci_read_config(dev, 0x14, 4) & IOMASK;
203 return "VIA Apollo ATA controller";
204 case 0x55131039:
205 return "SiS 5591 ATA controller";
206 case 0x4d33105a:
207 return "Promise Ultra/33 ATA controller";
208 case 0x4d38105a:
209 return "Promise Ultra/66 ATA controller";
210 case 0x00041103:

--- 58 unchanged lines hidden (view full) ---

269 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
270 iobase_1 = IO_WD1;
271 altiobase_1 = iobase_1 + ATA_ALTPORT;
272 irq1 = 14;
273 }
274 else {
275 iobase_1 = pci_read_config(dev, 0x10, 4) & IOMASK;
276 altiobase_1 = pci_read_config(dev, 0x14, 4) & IOMASK;
279 bmaddr_1 = pci_read_config(dev, 0x20, 4) & IOMASK;
280 irq1 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
281 }
282
283 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
284 iobase_2 = IO_WD2;
285 altiobase_2 = iobase_2 + ATA_ALTPORT;
286 irq2 = 15;
287 }
288 else {
289 iobase_2 = pci_read_config(dev, 0x18, 4) & IOMASK;
290 altiobase_2 = pci_read_config(dev, 0x1c, 4) & IOMASK;
277 irq1 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
278 }
279
280 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
281 iobase_2 = IO_WD2;
282 altiobase_2 = iobase_2 + ATA_ALTPORT;
283 irq2 = 15;
284 }
285 else {
286 iobase_2 = pci_read_config(dev, 0x18, 4) & IOMASK;
287 altiobase_2 = pci_read_config(dev, 0x1c, 4) & IOMASK;
291 bmaddr_2 = (pci_read_config(dev, 0x20, 4) & IOMASK) + ATA_BM_OFFSET1;
292 irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
293 }
294
295 /* is this controller busmaster DMA capable ? */
296 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
297 /* is busmastering support turned on ? */
298 if ((pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4) & 5) == 5) {
299 /* is there a valid port range to connect to ? */

--- 5 unchanged lines hidden (view full) ---

305 printf("ata-pci%d: Busmastering DMA not configured\n", unit);
306 }
307 else
308 printf("ata-pci%d: Busmastering DMA not enabled\n", unit);
309 }
310 else {
311 if (type == 0x4d33105a || type == 0x4d38105a || type == 0x00041103) {
312 /* Promise and HPT366 controllers support busmastering DMA */
288 irq2 = pci_read_config(dev, PCI_INTERRUPT_REG, 4) & 0xff;
289 }
290
291 /* is this controller busmaster DMA capable ? */
292 if (pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) {
293 /* is busmastering support turned on ? */
294 if ((pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4) & 5) == 5) {
295 /* is there a valid port range to connect to ? */

--- 5 unchanged lines hidden (view full) ---

301 printf("ata-pci%d: Busmastering DMA not configured\n", unit);
302 }
303 else
304 printf("ata-pci%d: Busmastering DMA not enabled\n", unit);
305 }
306 else {
307 if (type == 0x4d33105a || type == 0x4d38105a || type == 0x00041103) {
308 /* Promise and HPT366 controllers support busmastering DMA */
309 bmaddr_1 = pci_read_config(dev, 0x20, 4) & IOMASK;
310 bmaddr_2 = (pci_read_config(dev, 0x20, 4) & IOMASK)+ATA_BM_OFFSET1;
313 printf("ata-pci%d: Busmastering DMA supported\n", unit);
314 }
315 else {
311 printf("ata-pci%d: Busmastering DMA supported\n", unit);
312 }
313 else {
316 /* we dont know this controller, disable busmastering DMA */
317 bmaddr_1 = bmaddr_2 = 0;
314 /* we dont know this controller, no busmastering DMA */
318 printf("ata-pci%d: Busmastering DMA not supported\n", unit);
319 }
320 }
321
322 /* do extra chipset specific setups */
323 switch (type) {
324 case 0x522910b9:
325 /* on the Aladdin activate the ATAPI FIFO */

--- 617 unchanged lines hidden (view full) ---

943 blank = 1;
944 if (i == 0)
945 continue;
946 }
947 dst[j++] = src[i];
948 }
949 dst[j] = 0x00;
950}
315 printf("ata-pci%d: Busmastering DMA not supported\n", unit);
316 }
317 }
318
319 /* do extra chipset specific setups */
320 switch (type) {
321 case 0x522910b9:
322 /* on the Aladdin activate the ATAPI FIFO */

--- 617 unchanged lines hidden (view full) ---

940 blank = 1;
941 if (i == 0)
942 continue;
943 }
944 dst[j++] = src[i];
945 }
946 dst[j] = 0x00;
947}
948
949int32_t
950ata_find_dev(device_t dev, int32_t type)
951{
952 device_t *children, child;
953 int nchildren, i;
954
955 if (device_get_children(device_get_parent(dev), &children, &nchildren))
956 return 0;
957
958 for (i = 0; i < nchildren; i++) {
959 child = children[i];
960
961 /* check that it's on the same silicon and the device we want */
962 if (pci_get_slot(dev) == pci_get_slot(child) &&
963 pci_get_vendor(child) == (type & 0xffff) &&
964 pci_get_device(child) == ((type & 0xffff0000)>>16)) {
965 free(children, M_TEMP);
966 return 1;
967 }
968 }
969 free(children, M_TEMP);
970 return 0;
971}