Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/uart/uart_bus_pci.c
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | struct pci_id { | ||||
uint16_t subven; | uint16_t subven; | ||||
uint16_t subdev; | uint16_t subdev; | ||||
const char *desc; | const char *desc; | ||||
int rid; | int rid; | ||||
int rclk; | int rclk; | ||||
int regshft; | int regshft; | ||||
}; | }; | ||||
#define PCI_NO_MSI 0x40000000 | |||||
#define PCI_RID_MASK 0x0000ffff | |||||
static const struct pci_id pci_ns8250_ids[] = { | static const struct pci_id pci_ns8250_ids[] = { | ||||
{ 0x1028, 0x0008, 0xffff, 0, "Dell Remote Access Card III", 0x14, | { 0x1028, 0x0008, 0xffff, 0, "Dell Remote Access Card III", 0x14, | ||||
128 * DEFAULT_RCLK }, | 128 * DEFAULT_RCLK }, | ||||
{ 0x1028, 0x0012, 0xffff, 0, "Dell RAC 4 Daughter Card Virtual UART", 0x14, | { 0x1028, 0x0012, 0xffff, 0, "Dell RAC 4 Daughter Card Virtual UART", 0x14, | ||||
128 * DEFAULT_RCLK }, | 128 * DEFAULT_RCLK }, | ||||
{ 0x1033, 0x0074, 0x1033, 0x8014, "NEC RCV56ACF 56k Voice Modem", 0x10 }, | { 0x1033, 0x0074, 0x1033, 0x8014, "NEC RCV56ACF 56k Voice Modem", 0x10 }, | ||||
{ 0x1033, 0x007d, 0x1033, 0x8012, "NEC RS232C", 0x10 }, | { 0x1033, 0x007d, 0x1033, 0x8012, "NEC RS232C", 0x10 }, | ||||
{ 0x103c, 0x1048, 0x103c, 0x1227, "HP Diva Serial [GSP] UART - Powerbar SP2", | { 0x103c, 0x1048, 0x103c, 0x1227, "HP Diva Serial [GSP] UART - Powerbar SP2", | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
{ 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, | { 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, | ||||
{ 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, | { 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, | ||||
{ 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, | { 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, | ||||
{ 0x8086, 0x8814, 0xffff, 0, "Intel EG20T Serial Port 3", 0x10 }, | { 0x8086, 0x8814, 0xffff, 0, "Intel EG20T Serial Port 3", 0x10 }, | ||||
{ 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, | { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, | ||||
{ 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, | { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, | ||||
{ 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, | { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, | ||||
{ 0x8086, 0xa13d, 0xffff, 0, | { 0x8086, 0xa13d, 0xffff, 0, | ||||
"100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, | "100 Series/C230 Series Chipset Family KT Redirection", | ||||
0x10 | PCI_NO_MSI }, | |||||
{ 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, | { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, | ||||
{ 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, | { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, | ||||
{ 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, | { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, | ||||
{ 0x9710, 0x9900, 0xa000, 0x1000, | { 0x9710, 0x9900, 0xa000, 0x1000, | ||||
"MosChip MCS9900 PCIe to Peripheral Controller", 0x10 }, | "MosChip MCS9900 PCIe to Peripheral Controller", 0x10 }, | ||||
{ 0x9710, 0x9901, 0xa000, 0x1000, | { 0x9710, 0x9901, 0xa000, 0x1000, | ||||
"MosChip MCS9901 PCIe to Peripheral Controller", 0x10 }, | "MosChip MCS9901 PCIe to Peripheral Controller", 0x10 }, | ||||
{ 0x9710, 0x9904, 0xa000, 0x1000, | { 0x9710, 0x9904, 0xa000, 0x1000, | ||||
Show All 39 Lines | uart_pci_probe(device_t dev) | ||||
if (id != NULL) { | if (id != NULL) { | ||||
sc->sc_class = &uart_ns8250_class; | sc->sc_class = &uart_ns8250_class; | ||||
goto match; | goto match; | ||||
} | } | ||||
/* Add checks for non-ns8250 IDs here. */ | /* Add checks for non-ns8250 IDs here. */ | ||||
return (ENXIO); | return (ENXIO); | ||||
match: | match: | ||||
result = uart_bus_probe(dev, id->regshft, 0, id->rclk, id->rid, 0, 0); | result = uart_bus_probe(dev, id->regshft, 0, id->rclk, | ||||
id->rid & PCI_RID_MASK, 0, 0); | |||||
/* Bail out on error. */ | /* Bail out on error. */ | ||||
if (result > 0) | if (result > 0) | ||||
return (result); | return (result); | ||||
/* Set/override the device description. */ | /* Set/override the device description. */ | ||||
if (id->desc) | if (id->desc) | ||||
device_set_desc(dev, id->desc); | device_set_desc(dev, id->desc); | ||||
return (result); | return (result); | ||||
} | } | ||||
static int | static int | ||||
uart_pci_attach(device_t dev) | uart_pci_attach(device_t dev) | ||||
{ | { | ||||
struct uart_softc *sc; | struct uart_softc *sc; | ||||
const struct pci_id *id; | |||||
int count; | int count; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
/* | /* | ||||
* Use MSI in preference to legacy IRQ if available. However, experience | * Use MSI in preference to legacy IRQ if available. However, experience | ||||
* suggests this is only reliable when one MSI vector is advertised. | * suggests this is only reliable when one MSI vector is advertised. | ||||
*/ | */ | ||||
if (pci_msi_count(dev) == 1) { | id = uart_pci_match(dev, pci_ns8250_ids); | ||||
if ((id == NULL || (id->rid & PCI_NO_MSI) == 0) && | |||||
pci_msi_count(dev) == 1) { | |||||
count = 1; | count = 1; | ||||
if (pci_alloc_msi(dev, &count) == 0) { | if (pci_alloc_msi(dev, &count) == 0) { | ||||
sc->sc_irid = 1; | sc->sc_irid = 1; | ||||
device_printf(dev, "Using %d MSI message\n", count); | device_printf(dev, "Using %d MSI message\n", count); | ||||
} | } | ||||
} | } | ||||
return (uart_bus_attach(dev)); | return (uart_bus_attach(dev)); | ||||
Show All 16 Lines |