From owner-svn-src-all@FreeBSD.ORG Tue Nov 10 09:46:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E4461065696; Tue, 10 Nov 2009 09:46:53 +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 244748FC23; Tue, 10 Nov 2009 09:46:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAA9krMh053520; Tue, 10 Nov 2009 09:46:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAA9krUT053517; Tue, 10 Nov 2009 09:46:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911100946.nAA9krUT053517@svn.freebsd.org> From: Alexander Motin Date: Tue, 10 Nov 2009 09:46:53 +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: r199132 - head/sys/dev/siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 09:46:53 -0000 Author: mav Date: Tue Nov 10 09:46:52 2009 New Revision: 199132 URL: http://svn.freebsd.org/changeset/base/199132 Log: MFp4: Organize device IDs and add some more of them. Modified: head/sys/dev/siis/siis.c head/sys/dev/siis/siis.h Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Tue Nov 10 09:45:43 2009 (r199131) +++ head/sys/dev/siis/siis.c Tue Nov 10 09:46:52 2009 (r199132) @@ -89,24 +89,37 @@ static void siispoll(struct cam_sim *sim MALLOC_DEFINE(M_SIIS, "SIIS driver", "SIIS driver data buffers"); +static struct { + uint32_t id; + const char *name; + int ports; +} siis_ids[] = { + {0x31241095, "SiI3124", 4}, + {0x31248086, "SiI3124", 4}, + {0x31321095, "SiI3132", 2}, + {0x02421095, "SiI3132", 2}, + {0x02441095, "SiI3132", 2}, + {0x31311095, "SiI3131", 1}, + {0x35311095, "SiI3531", 1}, + {0, NULL, 0} +}; + static int siis_probe(device_t dev) { + char buf[64]; + int i; uint32_t devid = pci_get_devid(dev); - if (devid == SIIS_SII3124) { - device_set_desc_copy(dev, "SiI3124 SATA2 controller"); - } else if (devid == SIIS_SII3132 || - devid == SIIS_SII3132_1 || - devid == SIIS_SII3132_2) { - device_set_desc_copy(dev, "SiI3132 SATA2 controller"); - } else if (devid == SIIS_SII3531) { - device_set_desc_copy(dev, "SiI3531 SATA2 controller"); - } else { - return (ENXIO); + for (i = 0; siis_ids[i].id != 0; i++) { + if (siis_ids[i].id == devid) { + snprintf(buf, sizeof(buf), "%s SATA2 controller", + siis_ids[i].name); + device_set_desc_copy(dev, buf); + return (BUS_PROBE_VENDOR); + } } - - return (BUS_PROBE_VENDOR); + return (ENXIO); } static int @@ -115,8 +128,12 @@ siis_attach(device_t dev) struct siis_controller *ctlr = device_get_softc(dev); uint32_t devid = pci_get_devid(dev); device_t child; - int error, unit; + int error, i, unit; + for (i = 0; siis_ids[i].id != 0; i++) { + if (siis_ids[i].id == devid) + break; + } ctlr->dev = dev; /* Global memory */ ctlr->r_grid = PCIR_BAR(0); @@ -146,8 +163,7 @@ siis_attach(device_t dev) /* Reset controller */ siis_resume(dev); /* Number of HW channels */ - ctlr->channels = (devid == SIIS_SII3124) ? 4 : - (devid == SIIS_SII3531 ? 1 : 2); + ctlr->channels = siis_ids[i].ports; /* Setup interrupts. */ if (siis_setup_interrupt(dev)) { bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); Modified: head/sys/dev/siis/siis.h ============================================================================== --- head/sys/dev/siis/siis.h Tue Nov 10 09:45:43 2009 (r199131) +++ head/sys/dev/siis/siis.h Tue Nov 10 09:46:52 2009 (r199132) @@ -137,12 +137,6 @@ #define ATA_SACTIVE 16 -#define SIIS_SII3124 0x31241095 -#define SIIS_SII3132 0x31321095 -#define SIIS_SII3132_1 0x02421095 -#define SIIS_SII3132_2 0x02441095 -#define SIIS_SII3531 0x35311095 - /* * Global registers */