From owner-svn-src-head@FreeBSD.ORG Mon Feb 16 19:10:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91F7B106566C; Mon, 16 Feb 2009 19:10:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65A148FC12; Mon, 16 Feb 2009 19:10:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1GJA7gI084646; Mon, 16 Feb 2009 19:10:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1GJA7su084643; Mon, 16 Feb 2009 19:10:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200902161910.n1GJA7su084643@svn.freebsd.org> From: Alexander Motin Date: Mon, 16 Feb 2009 19:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188694 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 19:10:08 -0000 Author: mav Date: Mon Feb 16 19:10:07 2009 New Revision: 188694 URL: http://svn.freebsd.org/changeset/base/188694 Log: Give atapci knowledge about set of implemented AHCI ports. It is possible to not allocate them after the recent ata channels enumeration changes. It allows to save some resources, not bother user with unexisting hardware and not check unimplemented ports status on every interrupt. Modified: head/sys/dev/ata/ata-pci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Feb 16 18:59:18 2009 (r188693) +++ head/sys/dev/ata/ata-pci.c Mon Feb 16 19:10:07 2009 (r188694) @@ -98,6 +98,7 @@ ata_pci_attach(device_t dev) ctlr->channels = 2; else ctlr->channels = 1; + ctlr->ichannels = -1; ctlr->allocate = ata_pci_allocate; ctlr->dmainit = ata_pci_dmainit; ctlr->dev = dev; @@ -122,6 +123,8 @@ ata_pci_attach(device_t dev) /* attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { + if ((ctlr->ichannels & (1 << unit)) == 0) + continue; child = device_add_child(dev, "ata", ((unit == 0 || unit == 1) && ctlr->legacy) ? unit : devclass_find_free_unit(ata_devclass, 2)); Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Feb 16 18:59:18 2009 (r188693) +++ head/sys/dev/ata/ata-pci.h Mon Feb 16 19:10:07 2009 (r188694) @@ -51,6 +51,7 @@ struct ata_pci_controller { struct ata_chip_id *chip; int legacy; int channels; + int ichannels; int (*chipinit)(device_t); int (*suspend)(device_t); int (*resume)(device_t); Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Feb 16 18:59:18 2009 (r188693) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Feb 16 19:10:07 2009 (r188694) @@ -122,8 +122,9 @@ ata_ahci_chipinit(device_t dev) }; /* get the number of HW channels */ + ctlr->ichannels = ATA_INL(ctlr->r_res2, ATA_AHCI_PI); ctlr->channels = - MAX(flsl(ATA_INL(ctlr->r_res2, ATA_AHCI_PI)), + MAX(flsl(ctlr->ichannels), (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1); ctlr->reset = ata_ahci_reset; @@ -667,11 +668,6 @@ ata_ahci_reset(device_t dev) u_int32_t signature; int offset = ch->unit << 7; - if (!(ATA_INL(ctlr->r_res2, ATA_AHCI_PI) & (1 << ch->unit))) { - device_printf(dev, "port not implemented\n"); - return; - } - /* setup work areas */ work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET; ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff);