Date: Tue, 10 Nov 2009 09:46:53 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r199132 - head/sys/dev/siis Message-ID: <200911100946.nAA9krUT053517@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911100946.nAA9krUT053517>