mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
ata: Use device_set_descf()
No functional change intended. MFC after: 1 week
This commit is contained in:
parent
a74b496507
commit
25b839dfd2
|
@ -60,7 +60,6 @@ int
|
||||||
ata_pci_probe(device_t dev)
|
ata_pci_probe(device_t dev)
|
||||||
{
|
{
|
||||||
struct ata_pci_controller *ctlr = device_get_softc(dev);
|
struct ata_pci_controller *ctlr = device_get_softc(dev);
|
||||||
char buffer[64];
|
|
||||||
|
|
||||||
/* is this a storage class device ? */
|
/* is this a storage class device ? */
|
||||||
if (pci_get_class(dev) != PCIC_STORAGE)
|
if (pci_get_class(dev) != PCIC_STORAGE)
|
||||||
|
@ -70,8 +69,7 @@ ata_pci_probe(device_t dev)
|
||||||
if (pci_get_subclass(dev) != PCIS_STORAGE_IDE)
|
if (pci_get_subclass(dev) != PCIS_STORAGE_IDE)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
|
|
||||||
sprintf(buffer, "%s ATA controller", ata_pcivendor2str(dev));
|
device_set_descf(dev, "%s ATA controller", ata_pcivendor2str(dev));
|
||||||
device_set_desc_copy(dev, buffer);
|
|
||||||
ctlr->chipinit = ata_generic_chipinit;
|
ctlr->chipinit = ata_generic_chipinit;
|
||||||
|
|
||||||
/* we are a low priority handler */
|
/* we are a low priority handler */
|
||||||
|
@ -831,12 +829,10 @@ void
|
||||||
ata_set_desc(device_t dev)
|
ata_set_desc(device_t dev)
|
||||||
{
|
{
|
||||||
struct ata_pci_controller *ctlr = device_get_softc(dev);
|
struct ata_pci_controller *ctlr = device_get_softc(dev);
|
||||||
char buffer[128];
|
|
||||||
|
|
||||||
sprintf(buffer, "%s %s %s controller",
|
device_set_descf(dev, "%s %s %s controller",
|
||||||
ata_pcivendor2str(dev), ctlr->chip->text,
|
ata_pcivendor2str(dev), ctlr->chip->text,
|
||||||
ata_mode2str(ctlr->chip->max_dma));
|
ata_mode2str(ctlr->chip->max_dma));
|
||||||
device_set_desc_copy(dev, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct ata_chip_id *
|
const struct ata_chip_id *
|
||||||
|
|
|
@ -81,7 +81,7 @@ ata_highpoint_probe(device_t dev)
|
||||||
{ ATA_HPT366, 0x00, HPT_366, HPT_OLD, ATA_UDMA4, "HPT366" },
|
{ ATA_HPT366, 0x00, HPT_366, HPT_OLD, ATA_UDMA4, "HPT366" },
|
||||||
{ ATA_HPT302, 0x01, HPT_372, 0, ATA_UDMA6, "HPT302" },
|
{ ATA_HPT302, 0x01, HPT_372, 0, ATA_UDMA6, "HPT302" },
|
||||||
{ 0, 0, 0, 0, 0, 0}};
|
{ 0, 0, 0, 0, 0, 0}};
|
||||||
char buffer[64];
|
const char *channel;
|
||||||
|
|
||||||
if (pci_get_vendor(dev) != ATA_HIGHPOINT_ID)
|
if (pci_get_vendor(dev) != ATA_HIGHPOINT_ID)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
@ -89,16 +89,15 @@ ata_highpoint_probe(device_t dev)
|
||||||
if (!(idx = ata_match_chip(dev, ids)))
|
if (!(idx = ata_match_chip(dev, ids)))
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
strcpy(buffer, "HighPoint ");
|
channel = "";
|
||||||
strcat(buffer, idx->text);
|
|
||||||
if (idx->cfg1 == HPT_374) {
|
if (idx->cfg1 == HPT_374) {
|
||||||
if (pci_get_function(dev) == 0)
|
if (pci_get_function(dev) == 0)
|
||||||
strcat(buffer, " (channel 0+1)");
|
channel = " (channel 0+1)";
|
||||||
if (pci_get_function(dev) == 1)
|
else if (pci_get_function(dev) == 1)
|
||||||
strcat(buffer, " (channel 2+3)");
|
channel = " (channel 2+3)";
|
||||||
}
|
}
|
||||||
sprintf(buffer, "%s %s controller", buffer, ata_mode2str(idx->max_dma));
|
device_set_descf(dev, "Highpoint %s%s %s controller",
|
||||||
device_set_desc_copy(dev, buffer);
|
idx->text, channel, ata_mode2str(idx->max_dma));
|
||||||
ctlr->chip = idx;
|
ctlr->chip = idx;
|
||||||
ctlr->chipinit = ata_highpoint_chipinit;
|
ctlr->chipinit = ata_highpoint_chipinit;
|
||||||
return (BUS_PROBE_LOW_PRIORITY);
|
return (BUS_PROBE_LOW_PRIORITY);
|
||||||
|
|
|
@ -72,7 +72,6 @@ ata_jmicron_probe(device_t dev)
|
||||||
{ ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" },
|
{ ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" },
|
||||||
{ ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, "JMB368" },
|
{ ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, "JMB368" },
|
||||||
{ 0, 0, 0, 0, 0, 0}};
|
{ 0, 0, 0, 0, 0, 0}};
|
||||||
char buffer[64];
|
|
||||||
|
|
||||||
if (pci_get_vendor(dev) != ATA_JMICRON_ID)
|
if (pci_get_vendor(dev) != ATA_JMICRON_ID)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
@ -80,9 +79,8 @@ ata_jmicron_probe(device_t dev)
|
||||||
if (!(idx = ata_match_chip(dev, ids)))
|
if (!(idx = ata_match_chip(dev, ids)))
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
sprintf(buffer, "JMicron %s %s controller",
|
device_set_descf(dev, "JMicron %s %s controller",
|
||||||
idx->text, ata_mode2str(idx->max_dma));
|
idx->text, ata_mode2str(idx->max_dma));
|
||||||
device_set_desc_copy(dev, buffer);
|
|
||||||
ctlr->chip = idx;
|
ctlr->chip = idx;
|
||||||
ctlr->chipinit = ata_jmicron_chipinit;
|
ctlr->chipinit = ata_jmicron_chipinit;
|
||||||
return (BUS_PROBE_LOW_PRIORITY);
|
return (BUS_PROBE_LOW_PRIORITY);
|
||||||
|
|
|
@ -166,7 +166,7 @@ ata_promise_probe(device_t dev)
|
||||||
{ ATA_PDC40719, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40719" },
|
{ ATA_PDC40719, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40719" },
|
||||||
{ ATA_PDC40779, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40779" },
|
{ ATA_PDC40779, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40779" },
|
||||||
{ 0, 0, 0, 0, 0, 0}};
|
{ 0, 0, 0, 0, 0, 0}};
|
||||||
char buffer[64];
|
const char *channel;
|
||||||
uintptr_t devid = 0;
|
uintptr_t devid = 0;
|
||||||
|
|
||||||
if (pci_get_vendor(dev) != ATA_PROMISE_ID)
|
if (pci_get_vendor(dev) != ATA_PROMISE_ID)
|
||||||
|
@ -182,10 +182,8 @@ ata_promise_probe(device_t dev)
|
||||||
devid == ATA_I960RM)
|
devid == ATA_I960RM)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
strcpy(buffer, "Promise ");
|
|
||||||
strcat(buffer, idx->text);
|
|
||||||
|
|
||||||
/* if we are on a FastTrak TX4, adjust the interrupt resource */
|
/* if we are on a FastTrak TX4, adjust the interrupt resource */
|
||||||
|
channel = NULL;
|
||||||
if ((idx->cfg2 & PR_TX4) && pci_get_class(GRANDPARENT(dev))==PCIC_BRIDGE &&
|
if ((idx->cfg2 & PR_TX4) && pci_get_class(GRANDPARENT(dev))==PCIC_BRIDGE &&
|
||||||
!BUS_READ_IVAR(device_get_parent(GRANDPARENT(dev)),
|
!BUS_READ_IVAR(device_get_parent(GRANDPARENT(dev)),
|
||||||
GRANDPARENT(dev), PCI_IVAR_DEVID, &devid) &&
|
GRANDPARENT(dev), PCI_IVAR_DEVID, &devid) &&
|
||||||
|
@ -194,18 +192,18 @@ ata_promise_probe(device_t dev)
|
||||||
|
|
||||||
if (pci_get_slot(dev) == 1) {
|
if (pci_get_slot(dev) == 1) {
|
||||||
bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end);
|
bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end);
|
||||||
strcat(buffer, " (channel 0+1)");
|
channel = " (channel 0+1)";
|
||||||
}
|
}
|
||||||
else if (pci_get_slot(dev) == 2 && start && end) {
|
else if (pci_get_slot(dev) == 2 && start && end) {
|
||||||
bus_set_resource(dev, SYS_RES_IRQ, 0, start, end);
|
bus_set_resource(dev, SYS_RES_IRQ, 0, start, end);
|
||||||
strcat(buffer, " (channel 2+3)");
|
channel = " (channel 2+3)";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(buffer, "%s %s controller", buffer, ata_mode2str(idx->max_dma));
|
device_set_descf(dev, "Promise %s%s %s controller", idx->text,
|
||||||
device_set_desc_copy(dev, buffer);
|
channel == NULL ? "" : channel, ata_mode2str(idx->max_dma));
|
||||||
ctlr->chip = idx;
|
ctlr->chip = idx;
|
||||||
ctlr->chipinit = ata_promise_chipinit;
|
ctlr->chipinit = ata_promise_chipinit;
|
||||||
return (BUS_PROBE_LOW_PRIORITY);
|
return (BUS_PROBE_LOW_PRIORITY);
|
||||||
|
|
|
@ -101,7 +101,6 @@ ata_sis_probe(device_t dev)
|
||||||
{ 0, 0, 0, 0, 0, 0 }};
|
{ 0, 0, 0, 0, 0, 0 }};
|
||||||
static struct ata_chip_id id[] =
|
static struct ata_chip_id id[] =
|
||||||
{{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
|
{{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
|
||||||
char buffer[64];
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
if (pci_get_class(dev) != PCIC_STORAGE)
|
if (pci_get_class(dev) != PCIC_STORAGE)
|
||||||
|
@ -122,8 +121,8 @@ ata_sis_probe(device_t dev)
|
||||||
memcpy(&id[0], idx, sizeof(id[0]));
|
memcpy(&id[0], idx, sizeof(id[0]));
|
||||||
id[0].cfg1 = SIS_133NEW;
|
id[0].cfg1 = SIS_133NEW;
|
||||||
id[0].max_dma = ATA_UDMA6;
|
id[0].max_dma = ATA_UDMA6;
|
||||||
sprintf(buffer, "SiS 962/963 %s controller",
|
device_set_descf(dev, "SiS 962/963 %s controller",
|
||||||
ata_mode2str(idx->max_dma));
|
ata_mode2str(idx->max_dma));
|
||||||
}
|
}
|
||||||
pci_write_config(dev, 0x57, reg57, 1);
|
pci_write_config(dev, 0x57, reg57, 1);
|
||||||
}
|
}
|
||||||
|
@ -140,17 +139,17 @@ ata_sis_probe(device_t dev)
|
||||||
id[0].cfg1 = SIS_100NEW;
|
id[0].cfg1 = SIS_100NEW;
|
||||||
id[0].max_dma = ATA_UDMA5;
|
id[0].max_dma = ATA_UDMA5;
|
||||||
}
|
}
|
||||||
sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma));
|
device_set_descf(dev, "SiS 961 %s controller",
|
||||||
|
ata_mode2str(idx->max_dma));
|
||||||
}
|
}
|
||||||
pci_write_config(dev, 0x4a, reg4a, 1);
|
pci_write_config(dev, 0x4a, reg4a, 1);
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
sprintf(buffer,"SiS %s %s controller",
|
device_set_descf(dev, "SiS %s %s controller",
|
||||||
idx->text, ata_mode2str(idx->max_dma));
|
idx->text, ata_mode2str(idx->max_dma));
|
||||||
else
|
else
|
||||||
idx = &id[0];
|
idx = &id[0];
|
||||||
|
|
||||||
device_set_desc_copy(dev, buffer);
|
|
||||||
ctlr->chip = idx;
|
ctlr->chip = idx;
|
||||||
ctlr->chipinit = ata_sis_chipinit;
|
ctlr->chipinit = ata_sis_chipinit;
|
||||||
return (BUS_PROBE_LOW_PRIORITY);
|
return (BUS_PROBE_LOW_PRIORITY);
|
||||||
|
|
Loading…
Reference in a new issue