Date: Mon, 29 Oct 2007 08:35:59 +0300 From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: =?KOI8-R?Q?S=F8ren_Schmidt?= <sos@FreeBSD.org> Cc: cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/ata ata-pci.c Message-ID: <4725713F.5010409@yandex.ru> In-Reply-To: <200710260857.l9Q8v8HI099233@repoman.freebsd.org> References: <200710260857.l9Q8v8HI099233@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------080402060406020200060409 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit Søren Schmidt wrote: > Modified files: > sys/dev/ata ata-pci.c > Log: > Fix treating some modern chips (mem mapped) as legacy devices. Hi, Søren. Seems that PCIP_STORAGE_IDE_MASTERDEV, PCIP_STORAGE_IDE_MODEPRIM and PCIP_STORAGE_IDE_MODESEC should be related to the PCIS_STORAGE_IDE subclass. My Marvell 88SE6141 chip have PCIS_STORAGE_SATA subclass and PCIP_STORAGE_SATA_AHCI_1_0|PCIS_STORAGE_OTHER programming interface. And this chip detected as a legacy controller. What you think about the attached patch? -- WBR, Andrey V. Elsukov --------------080402060406020200060409 Content-Type: text/plain; name="ata-pci.c.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ata-pci.c.diff.txt" --- /usr/src/sys/dev/ata/ata-pci.c 2007-10-29 08:01:06.000000000 +0300 +++ ata-pci.c 2007-10-29 08:11:20.000000000 +0300 @@ -59,15 +59,17 @@ int ata_legacy(device_t dev) { - return (((pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV)&& - ((pci_read_config(dev, PCIR_PROGIF, 1) & - (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) != + uint32_t pi, scc; + pi = pci_read_config(dev, PCIR_PROGIF, 1); + scc = pci_read_config(dev, PCIR_SUBCLASS, 1); + return ((scc == PCIS_STORAGE_IDE && (pi & PCIP_STORAGE_IDE_MASTERDEV) && + ((pi & (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) != (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC))) || - (!pci_read_config(dev, PCIR_BAR(0), 4) && - !pci_read_config(dev, PCIR_BAR(1), 4) && - !pci_read_config(dev, PCIR_BAR(2), 4) && - !pci_read_config(dev, PCIR_BAR(3), 4) && - !pci_read_config(dev, PCIR_BAR(5), 4))); + (pci_read_config(dev, PCIR_BAR(0), 4) == 0 && + pci_read_config(dev, PCIR_BAR(1), 4) == 0 && + pci_read_config(dev, PCIR_BAR(2), 4) == 0 && + pci_read_config(dev, PCIR_BAR(3), 4) == 0 && + pci_read_config(dev, PCIR_BAR(5), 4) == 0)); } int --------------080402060406020200060409--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4725713F.5010409>