Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/imcsmb/imcsmb_pci.c
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | static struct imcsmb_reg_set imcsmb_regs[] = { | ||||
}, | }, | ||||
{ | { | ||||
.smb_stat = IMCSMB_REG_STATUS1, | .smb_stat = IMCSMB_REG_STATUS1, | ||||
.smb_cmd = IMCSMB_REG_COMMAND1, | .smb_cmd = IMCSMB_REG_COMMAND1, | ||||
.smb_cntl = IMCSMB_REG_CONTROL1 | .smb_cntl = IMCSMB_REG_CONTROL1 | ||||
}, | }, | ||||
}; | }; | ||||
static struct imcsmb_pci_device { | struct pci_device_table imcsmb_pci_devs[] = { | ||||
uint16_t vendorid; | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_SBX), | ||||
uint16_t deviceid; | PCI_DESCR("Intel Sandybridge Xeon iMC 0 SMBus controllers")}, | ||||
char *name; | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_IBX), | ||||
} imcsmb_pci_devices[] = { | PCI_DESCR("Intel Ivybridge Xeon iMC 0 SMBus controllers")}, | ||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_SBX, | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_HSX), | ||||
"Intel Sandybridge Xeon iMC 0 SMBus controllers" }, | PCI_DESCR("Intel Haswell Xeon iMC 0 SMBus controllers")}, | ||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_IBX, | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC1_HSX), | ||||
"Intel Ivybridge Xeon iMC 0 SMBus controllers" }, | PCI_DESCR("Intel Haswell Xeon iMC 1 SMBus controllers")}, | ||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_HSX, | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_BDX), | ||||
"Intel Haswell Xeon iMC 0 SMBus controllers" }, | PCI_DESCR("Intel Broadwell Xeon iMC 0 SMBus controllers")}, | ||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC1_HSX, | {PCI_DEV(PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC1_BDX), | ||||
"Intel Haswell Xeon iMC 1 SMBus controllers" }, | PCI_DESCR("Intel Broadwell Xeon iMC 1 SMBus controllers")} | ||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC0_BDX, | |||||
"Intel Broadwell Xeon iMC 0 SMBus controllers" }, | |||||
{PCI_VENDOR_INTEL, IMCSMB_PCI_DEV_ID_IMC1_BDX, | |||||
"Intel Broadwell Xeon iMC 1 SMBus controllers" }, | |||||
{0, 0, NULL}, | |||||
}; | }; | ||||
/* Device methods. */ | /* Device methods. */ | ||||
static int imcsmb_pci_attach(device_t dev); | static int imcsmb_pci_attach(device_t dev); | ||||
static int imcsmb_pci_detach(device_t dev); | static int imcsmb_pci_detach(device_t dev); | ||||
static int imcsmb_pci_probe(device_t dev); | static int imcsmb_pci_probe(device_t dev); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
* @author Joe Kloss, rpokala | * @author Joe Kloss, rpokala | ||||
* | * | ||||
* @param[in,out] dev | * @param[in,out] dev | ||||
* Device being probed. | * Device being probed. | ||||
*/ | */ | ||||
static int | static int | ||||
imcsmb_pci_probe(device_t dev) | imcsmb_pci_probe(device_t dev) | ||||
{ | { | ||||
struct imcsmb_pci_device *pci_device; | const struct pci_device_table *imcsd; | ||||
int rc; | |||||
uint16_t pci_dev_id; | |||||
rc = ENXIO; | imcsd = PCI_MATCH(dev, imcsmb_pci_devs); | ||||
if (imcsd == NULL) | |||||
if (pci_get_vendor(dev) != PCI_VENDOR_INTEL) { | return (ENXIO); | ||||
goto out; | device_set_desc(dev, imcsd->descr); | ||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
pci_dev_id = pci_get_device(dev); | |||||
for (pci_device = imcsmb_pci_devices; | |||||
pci_device->name != NULL; | |||||
pci_device++) { | |||||
if (pci_dev_id == pci_device->deviceid) { | |||||
device_set_desc(dev, pci_device->name); | |||||
rc = BUS_PROBE_DEFAULT; | |||||
goto out; | |||||
} | |||||
} | |||||
out: | |||||
return (rc); | |||||
} | |||||
/** | /** | ||||
* Invoked via smbus_callback() -> imcsmb_callback(); clear the semaphore, and | * Invoked via smbus_callback() -> imcsmb_callback(); clear the semaphore, and | ||||
* re-enable motherboard-specific DIMM temperature monitoring if needed. This | * re-enable motherboard-specific DIMM temperature monitoring if needed. This | ||||
* gets called after the transaction completes. | * gets called after the transaction completes. | ||||
* | * | ||||
* @author Joe Kloss | * @author Joe Kloss | ||||
* | * | ||||
* @param[in,out] dev | * @param[in,out] dev | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
static driver_t imcsmb_pci_driver = { | static driver_t imcsmb_pci_driver = { | ||||
.name = "imcsmb_pci", | .name = "imcsmb_pci", | ||||
.methods = imcsmb_pci_methods, | .methods = imcsmb_pci_methods, | ||||
.size = sizeof(struct imcsmb_pci_softc), | .size = sizeof(struct imcsmb_pci_softc), | ||||
}; | }; | ||||
DRIVER_MODULE(imcsmb_pci, pci, imcsmb_pci_driver, imcsmb_pci_devclass, 0, 0); | DRIVER_MODULE(imcsmb_pci, pci, imcsmb_pci_driver, imcsmb_pci_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, imcsmb_pci, imcsmb_pci_devices, | PCI_PNP_INFO(imcsmb_pci_devs); | ||||
sizeof(imcsmb_pci_devices[0]), nitems(imcsmb_pci_devices) - 1); | |||||
MODULE_DEPEND(imcsmb_pci, pci, 1, 1, 1); | MODULE_DEPEND(imcsmb_pci, pci, 1, 1, 1); | ||||
MODULE_VERSION(imcsmb_pci, 1); | MODULE_VERSION(imcsmb_pci, 1); | ||||
/* vi: set ts=8 sw=4 sts=8 noet: */ | /* vi: set ts=8 sw=4 sts=8 noet: */ |