From 45f13b849c8500a2369ea4504dd079eb82f53489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Tue, 28 Oct 2003 19:01:48 +0000 Subject: [PATCH] This should allow us to boot with DMA enabled on unknown PCI ATA chipsets, well at least newer ones... --- sys/dev/ata/ata-chipset.c | 3 +- sys/dev/ata/ata-pci.c | 70 +++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 83aedeacf934..07582221ed46 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -160,6 +160,7 @@ ata_generic_intr(void *data) static void ata_generic_setmode(struct ata_device *atadev, int mode) { + mode = ata_limit_mode(atadev, mode, ATA_UDMA2); mode = ata_check_80pin(atadev, mode); if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode)) atadev->mode = mode; @@ -2050,7 +2051,7 @@ ata_via_ident(device_t dev) { 0, 0, 0, 0, 0, 0 }}; char buffer[64]; - if (!(idx = ata_find_chip(dev, ids, pci_get_slot(dev)))) + if (!(idx = ata_find_chip(dev, ids, pci_get_slot(dev)))) return ENXIO; sprintf(buffer, "%s %s controller", idx->text, ata_mode2str(idx->max_dma)); diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 01ca793b6153..325ed2745159 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -68,42 +68,64 @@ ata_pci_probe(device_t dev) switch (pci_get_vendor(dev)) { case ATA_ACARD_ID: - return ata_acard_ident(dev); + if (!ata_acard_ident(dev)) + return 0; + break; case ATA_ACER_LABS_ID: - return ata_ali_ident(dev); + if (!ata_ali_ident(dev)) + return 0; + break; case ATA_AMD_ID: - return ata_amd_ident(dev); + if (!ata_amd_ident(dev)) + return 0; + break; case ATA_CYRIX_ID: - return ata_cyrix_ident(dev); + if (!ata_cyrix_ident(dev)) + return 0; + break; case ATA_CYPRESS_ID: - return ata_cypress_ident(dev); + if (!ata_cypress_ident(dev)) + return 0; + break; case ATA_HIGHPOINT_ID: - return ata_highpoint_ident(dev); + if (!ata_highpoint_ident(dev)) + return 0; + break; case ATA_INTEL_ID: - return ata_intel_ident(dev); - case ATA_NATIONAL_ID: - return ata_national_ident(dev); + if (!ata_intel_ident(dev)) + return 0; + break; case ATA_NVIDIA_ID: - return ata_nvidia_ident(dev); + if (!ata_nvidia_ident(dev)) + return 0; + break; case ATA_PROMISE_ID: - return ata_promise_ident(dev); + if (!ata_promise_ident(dev)) + return 0; + break; case ATA_SERVERWORKS_ID: - return ata_serverworks_ident(dev); + if (!ata_serverworks_ident(dev)) + return 0; + break; case ATA_SILICON_IMAGE_ID: - return ata_sii_ident(dev); + if (!ata_sii_ident(dev)) + return 0; + break; case ATA_SIS_ID: - return ata_sis_ident(dev); + if (!ata_sis_ident(dev)) + return 0; + break; case ATA_VIA_ID: - return ata_via_ident(dev); - + if (!ata_via_ident(dev)) + return 0; + break; case 0x16ca: if (pci_get_devid(dev) == 0x000116ca) { ata_generic_ident(dev); device_set_desc(dev, "Cenatek Rocket Drive controller"); return 0; } - return ENXIO; - + break; case 0x1042: if (pci_get_devid(dev)==0x10001042 || pci_get_devid(dev)==0x10011042) { ata_generic_ident(dev); @@ -111,14 +133,14 @@ ata_pci_probe(device_t dev) "RZ 100? ATA controller !WARNING! buggy HW data loss possible"); return 0; } - return ENXIO; + break; + } /* unknown chipset, try generic DMA if it seems possible */ - default: - if (pci_get_class(dev) == PCIC_STORAGE && - (pci_get_subclass(dev) == PCIS_STORAGE_IDE)) - return ata_generic_ident(dev); - } + if ((pci_get_class(dev) == PCIC_STORAGE) && + (pci_get_subclass(dev) == PCIS_STORAGE_IDE)) + return ata_generic_ident(dev); + return ENXIO; }