From owner-svn-src-head@FreeBSD.ORG Wed Mar 21 16:59:40 2012 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 81680106566B; Wed, 21 Mar 2012 16:59:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69EF68FC1B; Wed, 21 Mar 2012 16:59:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LGxeaO085607; Wed, 21 Mar 2012 16:59:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LGxdPb085573; Wed, 21 Mar 2012 16:59:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201203211659.q2LGxdPb085573@svn.freebsd.org> From: Marius Strobl Date: Wed, 21 Mar 2012 16:59:39 +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: r233282 - 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: Wed, 21 Mar 2012 16:59:40 -0000 Author: marius Date: Wed Mar 21 16:59:39 2012 New Revision: 233282 URL: http://svn.freebsd.org/changeset/base/233282 Log: - First pass at const'ifying ata(4) as appropriate. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week Modified: head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-card.c head/sys/dev/ata/ata-cbus.c head/sys/dev/ata/ata-disk.c head/sys/dev/ata/ata-pci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/ata-queue.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/atapi-cam.c head/sys/dev/ata/atapi-cd.c head/sys/dev/ata/atapi-fd.c head/sys/dev/ata/atapi-tape.c head/sys/dev/ata/chipsets/ata-acard.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-adaptec.c head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-amd.c head/sys/dev/ata/chipsets/ata-ati.c head/sys/dev/ata/chipsets/ata-cyrix.c head/sys/dev/ata/chipsets/ata-highpoint.c head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/ata/chipsets/ata-ite.c head/sys/dev/ata/chipsets/ata-jmicron.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ata/chipsets/ata-national.c head/sys/dev/ata/chipsets/ata-nvidia.c head/sys/dev/ata/chipsets/ata-promise.c head/sys/dev/ata/chipsets/ata-serverworks.c head/sys/dev/ata/chipsets/ata-siliconimage.c head/sys/dev/ata/chipsets/ata-sis.c head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-all.c Wed Mar 21 16:59:39 2012 (r233282) @@ -1209,7 +1209,7 @@ ata_udelay(int interval) } #ifndef ATA_CAM -char * +const char * ata_unit2str(struct ata_device *atadev) { struct ata_channel *ch = device_get_softc(device_get_parent(atadev->dev)); Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-all.h Wed Mar 21 16:59:39 2012 (r233282) @@ -622,7 +622,7 @@ int ata_identify(device_t dev); void ata_default_registers(device_t dev); void ata_modify_if_48bit(struct ata_request *request); void ata_udelay(int interval); -char *ata_unit2str(struct ata_device *atadev); +const char *ata_unit2str(struct ata_device *atadev); const char *ata_mode2str(int mode); int ata_str2mode(const char *str); const char *ata_satarev2str(int rev); @@ -649,7 +649,7 @@ void ata_timeout(struct ata_request *); void ata_catch_inflight(device_t dev); void ata_fail_requests(device_t dev); void ata_drop_requests(device_t dev); -char *ata_cmd2str(struct ata_request *request); +const char *ata_cmd2str(struct ata_request *request); /* ata-lowlevel.c: */ void ata_generic_hw(device_t dev); Modified: head/sys/dev/ata/ata-card.c ============================================================================== --- head/sys/dev/ata/ata-card.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-card.c Wed Mar 21 16:59:39 2012 (r233282) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "pccarddevs.h" -static const struct pccard_product ata_pccard_products[] = { +static const struct pccard_product const ata_pccard_products[] = { PCMCIA_CARD(FREECOM, PCCARDIDE), PCMCIA_CARD(EXP, EXPMULTIMEDIA), PCMCIA_CARD(IODATA3, CBIDE2), @@ -172,7 +172,7 @@ static device_method_t ata_pccard_method DEVMETHOD(device_attach, ata_pccard_attach), DEVMETHOD(device_detach, ata_pccard_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_pccard_driver = { @@ -181,5 +181,5 @@ static driver_t ata_pccard_driver = { sizeof(struct ata_channel), }; -DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); Modified: head/sys/dev/ata/ata-cbus.c ============================================================================== --- head/sys/dev/ata/ata-cbus.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-cbus.c Wed Mar 21 16:59:39 2012 (r233282) @@ -248,7 +248,7 @@ static device_method_t ata_cbus_methods[ DEVMETHOD(bus_setup_intr, ata_cbus_setup_intr), DEVMETHOD(bus_print_child, ata_cbus_print_child), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_cbus_driver = { @@ -393,7 +393,7 @@ static device_method_t ata_cbuschannel_m /* ATA methods */ DEVMETHOD(ata_locking, ata_cbuschannel_banking), #endif - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_cbuschannel_driver = { @@ -402,5 +402,5 @@ static driver_t ata_cbuschannel_driver = sizeof(struct ata_channel), }; -DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); Modified: head/sys/dev/ata/ata-disk.c ============================================================================== --- head/sys/dev/ata/ata-disk.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-disk.c Wed Mar 21 16:59:39 2012 (r233282) @@ -591,7 +591,7 @@ static device_method_t ad_methods[] = { /* ATA methods */ DEVMETHOD(ata_reinit, ad_reinit), - { 0, 0 } + DEVMETHOD_END }; static driver_t ad_driver = { Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-pci.c Wed Mar 21 16:59:39 2012 (r233282) @@ -595,7 +595,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), - { 0, 0 } + DEVMETHOD_END }; devclass_t ata_pci_devclass; @@ -606,7 +606,7 @@ static driver_t ata_pci_driver = { sizeof(struct ata_pci_controller), }; -DRIVER_MODULE(atapci, pci, ata_pci_driver, ata_pci_devclass, 0, 0); +DRIVER_MODULE(atapci, pci, ata_pci_driver, ata_pci_devclass, NULL, NULL); MODULE_VERSION(atapci, 1); MODULE_DEPEND(atapci, ata, 1, 1, 1); @@ -773,7 +773,7 @@ static device_method_t ata_pcichannel_me #endif DEVMETHOD(ata_reset, ata_pcichannel_reset), - { 0, 0 } + DEVMETHOD_END }; driver_t ata_pcichannel_driver = { @@ -782,7 +782,7 @@ driver_t ata_pcichannel_driver = { sizeof(struct ata_channel), }; -DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, NULL, NULL); /* * misc support fucntions @@ -863,8 +863,8 @@ ata_set_desc(device_t dev) device_set_desc_copy(dev, buffer); } -struct ata_chip_id * -ata_match_chip(device_t dev, struct ata_chip_id *index) +const struct ata_chip_id * +ata_match_chip(device_t dev, const struct ata_chip_id *index) { uint32_t devid; uint8_t revid; @@ -879,10 +879,10 @@ ata_match_chip(device_t dev, struct ata_ return (NULL); } -struct ata_chip_id * -ata_find_chip(device_t dev, struct ata_chip_id *index, int slot) +const struct ata_chip_id * +ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot) { - struct ata_chip_id *idx; + const struct ata_chip_id *idx; device_t *children; int nchildren, i; uint8_t s; @@ -904,7 +904,7 @@ ata_find_chip(device_t dev, struct ata_c return (NULL); } -char * +const char * ata_pcivendor2str(device_t dev) { switch (pci_get_vendor(dev)) { Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-pci.h Wed Mar 21 16:59:39 2012 (r233282) @@ -33,7 +33,7 @@ struct ata_chip_id { int cfg1; int cfg2; u_int8_t max_dma; - char *text; + const char *text; }; #define ATA_PCI_MAX_CH 8 @@ -50,7 +50,7 @@ struct ata_pci_controller { int r_irq_rid; struct resource *r_irq; void *handle; - struct ata_chip_id *chip; + const struct ata_chip_id *chip; int legacy; int channels; int ichannels; @@ -569,15 +569,15 @@ int ata_pci_status(device_t dev); void ata_pci_hw(device_t dev); void ata_pci_dmainit(device_t dev); void ata_pci_dmafini(device_t dev); -char *ata_pcivendor2str(device_t dev); +const char *ata_pcivendor2str(device_t dev); int ata_legacy(device_t); void ata_generic_intr(void *data); int ata_generic_chipinit(device_t dev); int ata_generic_setmode(device_t dev, int target, int mode); int ata_setup_interrupt(device_t dev, void *intr_func); void ata_set_desc(device_t dev); -struct ata_chip_id *ata_match_chip(device_t dev, struct ata_chip_id *index); -struct ata_chip_id *ata_find_chip(device_t dev, struct ata_chip_id *index, int slot); +const struct ata_chip_id *ata_match_chip(device_t dev, const struct ata_chip_id *index); +const struct ata_chip_id *ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot); int ata_mode2idx(int mode); /* global prototypes from chipsets/ata-*.c */ @@ -611,15 +611,14 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(pci_write_config, ata_pci_write_config), \ DEVMETHOD(bus_print_child, ata_pci_print_child), \ DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ - { 0, 0 } \ + DEVMETHOD_END \ }; \ static driver_t __CONCAT(dname,_driver) = { \ "atapci", \ __CONCAT(dname,_methods), \ sizeof(struct ata_pci_controller) \ }; \ -DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, 0, 0); \ +DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, NULL, NULL); \ MODULE_VERSION(dname, 1); \ MODULE_DEPEND(dname, ata, 1, 1, 1); \ MODULE_DEPEND(dname, atapci, 1, 1, 1); - Modified: head/sys/dev/ata/ata-queue.c ============================================================================== --- head/sys/dev/ata/ata-queue.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-queue.c Wed Mar 21 16:59:39 2012 (r233282) @@ -684,7 +684,7 @@ ata_sort_queue(struct ata_channel *ch, s } #endif -char * +const char * ata_cmd2str(struct ata_request *request) { static char buffer[20]; Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/ata-raid.c Wed Mar 21 16:59:39 2012 (r233282) @@ -4546,7 +4546,7 @@ static device_method_t ata_raid_sub_meth DEVMETHOD(device_probe, ata_raid_subdisk_probe), DEVMETHOD(device_attach, ata_raid_subdisk_attach), DEVMETHOD(device_detach, ata_raid_subdisk_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_raid_sub_driver = { Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/atapi-cam.c Wed Mar 21 16:59:39 2012 (r233282) @@ -122,7 +122,7 @@ static device_method_t atapi_cam_methods DEVMETHOD(device_attach, atapi_cam_attach), DEVMETHOD(device_detach, atapi_cam_detach), DEVMETHOD(ata_reinit, atapi_cam_reinit), - {0, 0} + DEVMETHOD_END }; static driver_t atapi_cam_driver = { Modified: head/sys/dev/ata/atapi-cd.c ============================================================================== --- head/sys/dev/ata/atapi-cd.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/atapi-cd.c Wed Mar 21 16:59:39 2012 (r233282) @@ -1899,7 +1899,7 @@ static device_method_t acd_methods[] = { /* ATA methods */ DEVMETHOD(ata_reinit, acd_reinit), - { 0, 0 } + DEVMETHOD_END }; static driver_t acd_driver = { Modified: head/sys/dev/ata/atapi-fd.c ============================================================================== --- head/sys/dev/ata/atapi-fd.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/atapi-fd.c Wed Mar 21 16:59:39 2012 (r233282) @@ -423,7 +423,7 @@ static device_method_t afd_methods[] = { /* ATA methods */ DEVMETHOD(ata_reinit, afd_reinit), - { 0, 0 } + DEVMETHOD_END }; static driver_t afd_driver = { Modified: head/sys/dev/ata/atapi-tape.c ============================================================================== --- head/sys/dev/ata/atapi-tape.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/atapi-tape.c Wed Mar 21 16:59:39 2012 (r233282) @@ -723,7 +723,7 @@ static device_method_t ast_methods[] = { /* ATA methods */ DEVMETHOD(ata_reinit, ast_reinit), - { 0, 0 } + DEVMETHOD_END }; static driver_t ast_driver = { Modified: head/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acard.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-acard.c Wed Mar 21 16:59:39 2012 (r233282) @@ -81,7 +81,7 @@ static int ata_acard_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_ATP850R, 0, ATP_OLD, 0x00, ATA_UDMA2, "ATP850" }, { ATA_ATP860A, 0, 0, 0x00, ATA_UDMA4, "ATP860A" }, { ATA_ATP860R, 0, 0, 0x00, ATA_UDMA4, "ATP860R" }, Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 21 16:59:39 2012 (r233282) @@ -75,7 +75,7 @@ static int ata_ali_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_ALI_5289, 0x00, 2, ALI_SATA, ATA_SA150, "M5289" }, { ATA_ALI_5288, 0x00, 4, ALI_SATA, ATA_SA300, "M5288" }, { ATA_ALI_5287, 0x00, 4, ALI_SATA, ATA_SA150, "M5287" }, @@ -304,11 +304,12 @@ ata_ali_setmode(device_t dev, int target struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; - u_int32_t piotimings[] = + static const uint32_t piotimings[] = { 0x006d0003, 0x00580002, 0x00440001, 0x00330001, 0x00310001, 0x006d0003, 0x00330001, 0x00310001 }; - u_int8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0d}; - u_int32_t word54; + static const uint8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, + 0x0d}; + uint32_t word54; mode = min(mode, ctlr->chip->max_dma); Modified: head/sys/dev/ata/chipsets/ata-adaptec.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-adaptec.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-adaptec.c Wed Mar 21 16:59:39 2012 (r233282) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #define MV_60XX 60 //must match ata_marvell.c's definition #define MV_7042 72 //must match ata_marvell.c's definition - /* * Adaptec chipset support functions */ @@ -63,7 +62,7 @@ static int ata_adaptec_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_ADAPTEC_1420, 0, 4, MV_60XX, ATA_SA300, "1420SA" }, { ATA_ADAPTEC_1430, 0, 4, MV_7042, ATA_SA300, "1430SA" }, { 0, 0, 0, 0, 0, 0}}; Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 21 16:59:39 2012 (r233282) @@ -1056,11 +1056,12 @@ static device_method_t ata_ahci_ata_meth DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_ahci_ata_driver = { "atapci", ata_ahci_ata_methods, sizeof(struct ata_pci_controller) }; -DRIVER_MODULE(ata_ahci_ata, atapci, ata_ahci_ata_driver, ata_pci_devclass, 0, 0); +DRIVER_MODULE(ata_ahci_ata, atapci, ata_ahci_ata_driver, ata_pci_devclass, + NULL, NULL); Modified: head/sys/dev/ata/chipsets/ata-amd.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-amd.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-amd.c Wed Mar 21 16:59:39 2012 (r233282) @@ -67,7 +67,7 @@ static int ata_amd_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_AMD756, 0x00, 0x00, 0, ATA_UDMA4, "756" }, { ATA_AMD766, 0x00, AMD_CABLE|AMD_BUG, 0, ATA_UDMA5, "766" }, { ATA_AMD768, 0x00, AMD_CABLE, 0, ATA_UDMA5, "768" }, @@ -113,8 +113,10 @@ ata_amd_setmode(device_t dev, int target struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; - u_int8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; - int modes[7] = { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 }; + static const uint8_t timings[] = + { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; + static const uint8_t modes[] = + { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 }; int reg = 0x53 - devno; mode = min(mode, ctlr->chip->max_dma); Modified: head/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ati.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-ati.c Wed Mar 21 16:59:39 2012 (r233282) @@ -58,11 +58,12 @@ static int ata_ati_ixp700_ch_attach(devi static int ata_ati_setmode(device_t dev, int target, int mode); /* misc defines */ -#define ATI_PATA 0x01 -#define ATI_SATA 0x02 +#define SII_MEMIO 1 /* must match ata_siliconimage.c's definition */ +#define SII_BUG 0x04 /* must match ata_siliconimage.c's definition */ + +#define ATI_SATA SII_MEMIO +#define ATI_PATA 0x02 #define ATI_AHCI 0x04 -#define SII_MEMIO 1 -#define SII_BUG 0x04 static int force_ahci = 1; TUNABLE_INT("hw.ahci.force", &force_ahci); @@ -74,13 +75,13 @@ static int ata_ati_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_ATI_IXP200, 0x00, ATI_PATA, 0, ATA_UDMA5, "IXP200" }, { ATA_ATI_IXP300, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP300" }, - { ATA_ATI_IXP300_S1, 0x00, ATI_SATA, 0, ATA_SA150, "IXP300" }, + { ATA_ATI_IXP300_S1, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP300" }, { ATA_ATI_IXP400, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP400" }, - { ATA_ATI_IXP400_S1, 0x00, ATI_SATA, 0, ATA_SA150, "IXP400" }, - { ATA_ATI_IXP400_S2, 0x00, ATI_SATA, 0, ATA_SA150, "IXP400" }, + { ATA_ATI_IXP400_S1, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP400" }, + { ATA_ATI_IXP400_S2, 0x00, ATI_SATA, SII_BUG, ATA_SA150, "IXP400" }, { ATA_ATI_IXP600, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP600" }, { ATA_ATI_IXP600_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP600" }, { ATA_ATI_IXP700, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP700/800" }, @@ -107,10 +108,7 @@ ata_ati_probe(device_t dev) case ATI_SATA: /* * the ATI SATA controller is actually a SiI 3112 controller - * cfg values below much match those in ata-siliconimage.c */ - ctlr->chip->cfg1 = SII_MEMIO; - ctlr->chip->cfg2 = SII_BUG; ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: @@ -212,8 +210,8 @@ ata_ati_setmode(device_t dev, int target int devno = (ch->unit << 1) + target; int offset = (devno ^ 0x01) << 3; int piomode; - u_int8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; - u_int8_t dmatimings[] = { 0x77, 0x21, 0x20 }; + static const uint8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; + static const uint8_t dmatimings[] = { 0x77, 0x21, 0x20 }; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { Modified: head/sys/dev/ata/chipsets/ata-cyrix.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-cyrix.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-cyrix.c Wed Mar 21 16:59:39 2012 (r233282) @@ -101,10 +101,12 @@ ata_cyrix_setmode(device_t dev, int targ struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; - u_int32_t piotiming[] = + static const uint32_t piotiming[] = { 0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010 }; - u_int32_t dmatiming[] = { 0x00077771, 0x00012121, 0x00002020 }; - u_int32_t udmatiming[] = { 0x00921250, 0x00911140, 0x00911030 }; + static const uint32_t dmatiming[] = + { 0x00077771, 0x00012121, 0x00002020 }; + static const uint32_t udmatiming[] = + { 0x00921250, 0x00911140, 0x00911030 }; mode = min(mode, ATA_UDMA2); /* dont try to set the mode if we dont have the resource */ Modified: head/sys/dev/ata/chipsets/ata-highpoint.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-highpoint.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-highpoint.c Wed Mar 21 16:59:39 2012 (r233282) @@ -72,8 +72,8 @@ static int ata_highpoint_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - struct ata_chip_id *idx; - static struct ata_chip_id ids[] = + const struct ata_chip_id *idx; + static const struct ata_chip_id const ids[] = {{ ATA_HPT374, 0x07, HPT_374, 0, ATA_UDMA6, "HPT374" }, { ATA_HPT372, 0x02, HPT_372, 0, ATA_UDMA6, "HPT372N" }, { ATA_HPT372, 0x01, HPT_372, 0, ATA_UDMA6, "HPT372" }, @@ -163,8 +163,8 @@ ata_highpoint_setmode(device_t dev, int struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; - u_int32_t timings33[][4] = { - /* HPT366 HPT370 HPT372 HPT374 mode */ + static const uint32_t timings33[][4] = { + /* HPT366 HPT370 HPT372 HPT374 mode */ { 0x40d0a7aa, 0x06914e57, 0x0d029d5e, 0x0ac1f48a }, /* PIO 0 */ { 0x40d0a7a3, 0x06914e43, 0x0d029d26, 0x0ac1f465 }, /* PIO 1 */ { 0x40d0a753, 0x06514e33, 0x0c829ca6, 0x0a81f454 }, /* PIO 2 */ Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 21 16:59:39 2012 (r233282) @@ -105,7 +105,7 @@ static int ata_intel_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_I82371FB, 0, 0, 2, ATA_WDMA2, "PIIX" }, { ATA_I82371SB, 0, 0, 2, ATA_WDMA2, "PIIX3" }, { ATA_I82371AB, 0, 0, 2, ATA_UDMA2, "PIIX4" }, @@ -519,8 +519,10 @@ ata_intel_new_setmode(device_t dev, int u_int16_t reg54 = pci_read_config(parent, 0x54, 2); u_int32_t mask40 = 0, new40 = 0; u_int8_t mask44 = 0, new44 = 0; - u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; - u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; + static const uint8_t timings[] = + { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; + static const uint8_t utimings[] = + { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; /* In combined mode, skip PATA stuff for SATA channel. */ if (ch->flags & ATA_SATA) Modified: head/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-ite.c Wed Mar 21 16:59:39 2012 (r233282) @@ -57,7 +57,6 @@ static int ata_ite_ch_attach(device_t de static int ata_ite_821x_setmode(device_t dev, int target, int mode); static int ata_ite_8213_setmode(device_t dev, int target, int mode); - /* * Integrated Technology Express Inc. (ITE) chipset support functions */ @@ -65,7 +64,7 @@ static int ata_ite_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_IT8213F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8213F" }, { ATA_IT8212F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8212F" }, { ATA_IT8211F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8211F" }, @@ -132,9 +131,9 @@ ata_ite_821x_setmode(device_t dev, int t int devno = (ch->unit << 1) + target; int piomode; uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); - u_int8_t udmatiming[] = + static const uint8_t udmatiming[] = { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; - u_int8_t chtiming[] = + static const uint8_t chtiming[] = { 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 }; mode = min(mode, ctlr->chip->max_dma); @@ -182,8 +181,10 @@ ata_ite_8213_setmode(device_t dev, int t u_int16_t reg54 = pci_read_config(parent, 0x54, 2); u_int16_t mask40 = 0, new40 = 0; u_int8_t mask44 = 0, new44 = 0; - u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; - u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; + static const uint8_t timings[] = + { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; + static const uint8_t utimings[] = + { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; mode = min(mode, ctlr->chip->max_dma); Modified: head/sys/dev/ata/chipsets/ata-jmicron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-jmicron.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-jmicron.c Wed Mar 21 16:59:39 2012 (r233282) @@ -63,8 +63,8 @@ static int ata_jmicron_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - struct ata_chip_id *idx; - static struct ata_chip_id ids[] = + const struct ata_chip_id *idx; + static const struct ata_chip_id const ids[] = {{ ATA_JMB360, 0, 1, 0, ATA_SA300, "JMB360" }, { ATA_JMB361, 0, 1, 1, ATA_UDMA6, "JMB361" }, { ATA_JMB363, 0, 2, 1, ATA_UDMA6, "JMB363" }, Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 21 16:59:39 2012 (r233282) @@ -99,7 +99,7 @@ static int ata_marvell_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_M88SX5040, 0, 4, MV_50XX, ATA_SA150, "88SX5040" }, { ATA_M88SX5041, 0, 4, MV_50XX, ATA_SA150, "88SX5041" }, { ATA_M88SX5080, 0, 8, MV_50XX, ATA_SA150, "88SX5080" }, Modified: head/sys/dev/ata/chipsets/ata-national.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-national.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-national.c Wed Mar 21 16:59:39 2012 (r233282) @@ -103,11 +103,13 @@ ata_national_setmode(device_t dev, int t struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; - u_int32_t piotiming[] = + static const uint32_t piotiming[] = { 0x9172d132, 0x21717121, 0x00803020, 0x20102010, 0x00100010, 0x9172d132, 0x20102010, 0x00100010 }; - u_int32_t dmatiming[] = { 0x80077771, 0x80012121, 0x80002020 }; - u_int32_t udmatiming[] = { 0x80921250, 0x80911140, 0x80911030 }; + static const uint32_t dmatiming[] = + { 0x80077771, 0x80012121, 0x80002020 }; + static const uint32_t udmatiming[] = + { 0x80921250, 0x80911140, 0x80911030 }; mode = min(mode, ATA_UDMA2); Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 21 16:59:39 2012 (r233282) @@ -75,7 +75,7 @@ static int ata_nvidia_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_NFORCE1, 0, 0, 0, ATA_UDMA5, "nForce" }, { ATA_NFORCE2, 0, 0, 0, ATA_UDMA6, "nForce2" }, { ATA_NFORCE2_PRO, 0, 0, 0, ATA_UDMA6, "nForce2 Pro" }, @@ -332,8 +332,10 @@ ata_nvidia_setmode(device_t dev, int tar struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; - u_int8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; - int modes[7] = { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 }; + static const uint8_t timings[] = + { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; + static const uint8_t modes[] = + { 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, 0xc7 }; int reg = 0x63 - devno; mode = min(mode, ctlr->chip->max_dma); Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-promise.c Wed Mar 21 16:59:39 2012 (r233282) @@ -129,8 +129,8 @@ static int ata_promise_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - struct ata_chip_id *idx; - static struct ata_chip_id ids[] = + const struct ata_chip_id *idx; + static const struct ata_chip_id const ids[] = {{ ATA_PDC20246, 0, PR_OLD, 0x00, ATA_UDMA2, "PDC20246" }, { ATA_PDC20262, 0, PR_NEW, 0x00, ATA_UDMA4, "PDC20262" }, { ATA_PDC20263, 0, PR_NEW, 0x00, ATA_UDMA4, "PDC20263" }, @@ -454,7 +454,7 @@ ata_promise_setmode(device_t dev, int ta struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; - u_int32_t timings[][2] = { + static const uint32_t timings[][2] = { /* PR_OLD PR_NEW mode */ { 0x004ff329, 0x004fff2f }, /* PIO 0 */ { 0x004fec25, 0x004ff82a }, /* PIO 1 */ Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Wed Mar 21 16:59:39 2012 (r233282) @@ -75,7 +75,7 @@ static int ata_serverworks_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_ROSB4, 0x00, SWKS_33, 0, ATA_WDMA2, "ROSB4" }, { ATA_CSB5, 0x92, SWKS_100, 0, ATA_UDMA5, "CSB5" }, { ATA_CSB5, 0x00, SWKS_66, 0, ATA_UDMA4, "CSB5" }, @@ -350,8 +350,8 @@ ata_serverworks_setmode(device_t dev, in int devno = (ch->unit << 1) + target; int offset = (devno ^ 0x01) << 3; int piomode; - u_int8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; - u_int8_t dmatimings[] = { 0x77, 0x21, 0x20 }; + static const uint8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; + static const uint8_t dmatimings[] = { 0x77, 0x21, 0x20 }; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 21 16:59:39 2012 (r233282) @@ -87,7 +87,7 @@ static int ata_sii_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_SII3114, 0x00, SII_MEMIO, SII_4CH, ATA_SA150, "3114" }, { ATA_SII3512, 0x02, SII_MEMIO, 0, ATA_SA150, "3512" }, { ATA_SII3112, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, @@ -272,10 +272,11 @@ ata_cmd_setmode(device_t dev, int target int treg = 0x54 + ((devno < 3) ? (devno << 1) : 7); int ureg = ch->unit ? 0x7b : 0x73; int piomode; - uint8_t piotimings[] = { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f }; - uint8_t udmatimings[][2] = { { 0x31, 0xc2 }, { 0x21, 0x82 }, - { 0x11, 0x42 }, { 0x25, 0x8a }, - { 0x15, 0x4a }, { 0x05, 0x0a } }; + static const uint8_t piotimings[] = + { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f }; + static const uint8_t udmatimings[][2] = + { { 0x31, 0xc2 }, { 0x21, 0x82 }, { 0x11, 0x42 }, + { 0x25, 0x8a }, { 0x15, 0x4a }, { 0x05, 0x0a } }; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { @@ -410,9 +411,11 @@ ata_sii_setmode(device_t dev, int target u_int8_t preg = 0xa4 + rego; u_int8_t dreg = 0xa8 + rego; u_int8_t ureg = 0xac + rego; - u_int16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; - u_int16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 }; - u_int8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 }; + static const uint16_t piotimings[] = + { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; + static const uint16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 }; + static const uint8_t udmatimings[] = + { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 }; mode = min(mode, ctlr->chip->max_dma); Modified: head/sys/dev/ata/chipsets/ata-sis.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 21 16:59:39 2012 (r233282) @@ -66,7 +66,6 @@ static int ata_sis_setmode(device_t dev, #define SIS_133OLD 6 #define SIS_SATA 7 - /* * Silicon Integrated Systems Corp. (SiS) chipset support functions */ @@ -74,8 +73,8 @@ static int ata_sis_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - struct ata_chip_id *idx; - static struct ata_chip_id ids[] = + const struct ata_chip_id *idx; + static const struct ata_chip_id const ids[] = {{ ATA_SIS182, 0x00, SIS_SATA, 0, ATA_SA150, "182" }, /* south */ { ATA_SIS181, 0x00, SIS_SATA, 0, ATA_SA150, "181" }, /* south */ { ATA_SIS180, 0x00, SIS_SATA, 0, ATA_SA150, "180" }, /* south */ @@ -102,6 +101,8 @@ ata_sis_probe(device_t dev) { ATA_SIS5513, 0xc2, SIS_33, 1, ATA_UDMA2, "5513" }, { ATA_SIS5513, 0x00, SIS_33, 1, ATA_WDMA2, "5513" }, { 0, 0, 0, 0, 0, 0 }}; + static struct ata_chip_id id[] = + {{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }}; char buffer[64]; int found = 0; @@ -114,14 +115,15 @@ ata_sis_probe(device_t dev) if (!(idx = ata_find_chip(dev, ids, -pci_get_slot(dev)))) return ENXIO; - if (idx->cfg2 && !found) { + if (idx->cfg2) { u_int8_t reg57 = pci_read_config(dev, 0x57, 1); pci_write_config(dev, 0x57, (reg57 & 0x7f), 1); if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5518) { found = 1; - idx->cfg1 = SIS_133NEW; - idx->max_dma = ATA_UDMA6; + memcpy(&id[0], idx, sizeof(id[0])); + id[0].cfg1 = SIS_133NEW; + id[0].max_dma = ATA_UDMA6; sprintf(buffer, "SiS 962/963 %s controller", ata_mode2str(idx->max_dma)); } @@ -132,17 +134,13 @@ ata_sis_probe(device_t dev) pci_write_config(dev, 0x4a, (reg4a | 0x10), 1); if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5517) { - struct ata_chip_id id[] = - {{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }}; - found = 1; if (ata_find_chip(dev, id, pci_get_slot(dev))) { - idx->cfg1 = SIS_133OLD; - idx->max_dma = ATA_UDMA6; - } - else { - idx->cfg1 = SIS_100NEW; - idx->max_dma = ATA_UDMA5; + id[0].cfg1 = SIS_133OLD; + id[0].max_dma = ATA_UDMA6; + } else { + id[0].cfg1 = SIS_100NEW; + id[0].max_dma = ATA_UDMA5; } sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma)); } @@ -151,6 +149,8 @@ ata_sis_probe(device_t dev) if (!found) sprintf(buffer,"SiS %s %s controller", idx->text, ata_mode2str(idx->max_dma)); + else + idx = &id[0]; device_set_desc_copy(dev, buffer); ctlr->chip = idx; @@ -262,7 +262,7 @@ ata_sis_setmode(device_t dev, int target switch (ctlr->chip->cfg1) { case SIS_133NEW: { - u_int32_t timings[] = + static const uint32_t timings[] = { 0x28269008, 0x0c266008, 0x04263008, 0x0c0a3008, 0x05093008, 0x22196008, 0x0c0a3008, 0x05093008, 0x050939fc, 0x050936ac, 0x0509347c, 0x0509325c, 0x0509323c, 0x0509322c, 0x0509321c}; @@ -273,7 +273,7 @@ ata_sis_setmode(device_t dev, int target break; } case SIS_133OLD: { - u_int16_t timings[] = + static const uint16_t timings[] = { 0x00cb, 0x0067, 0x0044, 0x0033, 0x0031, 0x0044, 0x0033, 0x0031, 0x8f31, 0x8a31, 0x8731, 0x8531, 0x8331, 0x8231, 0x8131 }; @@ -283,7 +283,7 @@ ata_sis_setmode(device_t dev, int target break; } case SIS_100NEW: { - u_int16_t timings[] = + static const uint16_t timings[] = { 0x00cb, 0x0067, 0x0044, 0x0033, 0x0031, 0x0044, 0x0033, 0x0031, 0x8b31, 0x8731, 0x8531, 0x8431, 0x8231, 0x8131 }; u_int16_t reg = 0x40 + (devno << 1); @@ -294,7 +294,7 @@ ata_sis_setmode(device_t dev, int target case SIS_100OLD: case SIS_66: case SIS_33: { - u_int16_t timings[] = + static const uint16_t timings[] = { 0x0c0b, 0x0607, 0x0404, 0x0303, 0x0301, 0x0404, 0x0303, 0x0301, 0xf301, 0xd301, 0xb301, 0xa301, 0x9301, 0x8301 }; u_int16_t reg = 0x40 + (devno << 1); Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Wed Mar 21 16:16:59 2012 (r233281) +++ head/sys/dev/ata/chipsets/ata-via.c Wed Mar 21 16:59:39 2012 (r233282) @@ -82,7 +82,6 @@ static int ata_via_sata_status(device_t #define VIAAHCI 0x08 #define VIASATA 0x10 - /* * VIA Technologies Inc. chipset support functions */ @@ -90,7 +89,7 @@ static int ata_via_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - static struct ata_chip_id ids[] = + static const struct ata_chip_id const ids[] = {{ ATA_VIA82C586, 0x02, VIA33, 0x00, ATA_UDMA2, "82C586B" }, { ATA_VIA82C586, 0x00, VIA33, 0x00, ATA_WDMA2, "82C586" }, { ATA_VIA82C596, 0x12, VIA66, VIACLK, ATA_UDMA4, "82C596B" }, @@ -114,7 +113,7 @@ ata_via_probe(device_t dev) { ATA_VIAVX855, 0x00, VIA133, 0x00, ATA_UDMA6, "VX855" }, { ATA_VIAVX900, 0x00, VIA133, VIASATA, ATA_SA300, "VX900" }, { 0, 0, 0, 0, 0, 0 }}; - static struct ata_chip_id new_ids[] = + static const struct ata_chip_id const new_ids[] = {{ ATA_VIA6410, 0x00, 0, 0x00, ATA_UDMA6, "6410" }, { ATA_VIA6420, 0x00, 7, 0x00, ATA_SA150, "6420" }, { ATA_VIA6421, 0x00, 6, VIABAR, ATA_SA150, "6421" }, @@ -328,8 +327,10 @@ ata_via_new_setmode(device_t dev, int ta if ((ctlr->chip->cfg2 & VIABAR) && (ch->unit > 1)) { int piomode; - u_int8_t pio_timings[] = { 0xa8, 0x65, 0x65, 0x32, 0x20 }; - u_int8_t dma_timings[] = { 0xee, 0xe8, 0xe6, 0xe4, 0xe2, 0xe1, 0xe0 }; + static const uint8_t pio_timings[] = + { 0xa8, 0x65, 0x65, 0x32, 0x20 }; + static const uint8_t dma_timings[] = + { 0xee, 0xe8, 0xe6, 0xe4, 0xe2, 0xe1, 0xe0 }; /* This chip can't do WDMA. */ if (mode >= ATA_WDMA0 && mode < ATA_UDMA0) @@ -355,8 +356,9 @@ ata_via_old_setmode(device_t dev, int ta int devno = (ch->unit << 1) + target; int reg = 0x53 - devno; int piomode; - uint8_t timings[] = { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; - uint8_t modes[][7] = { + static const uint8_t timings[] = + { 0xa8, 0x65, 0x42, 0x22, 0x20, 0xa8, 0x22, 0x20 }; + static const uint8_t modes[][7] = { { 0xc2, 0xc1, 0xc0, 0x00, 0x00, 0x00, 0x00 }, /* VIA ATA33 */ { 0xee, 0xec, 0xea, 0xe9, 0xe8, 0x00, 0x00 }, /* VIA ATA66 */ { 0xf7, 0xf6, 0xf4, 0xf2, 0xf1, 0xf0, 0x00 }, /* VIA ATA100 */