static int ntb_initialize_hw(struct ntb_softc *ntb) { if (ntb->type == NTB_SOC) return (ntb_setup_soc(ntb)); else return (ntb_setup_xeon(ntb)); }
static int ntb_attach(device_t device) { struct ntb_softc *ntb; struct ntb_hw_info *p; int error; ntb = DEVICE2SOFTC(device); p = ntb_get_device_info(pci_get_devid(device)); ntb->device = device; ntb->type = p->type; ntb->features = p->features; /* Heartbeat timer for NTB_SOC since there is no link interrupt */ callout_init(&ntb->heartbeat_timer, 1); callout_init(&ntb->lr_timer, 1); if (ntb->type == NTB_SOC) error = ntb_detect_soc(ntb); else error = ntb_detect_xeon(ntb); if (error) goto out; ntb_detect_max_mw(ntb); error = ntb_map_pci_bars(ntb); if (error) goto out; if (ntb->type == NTB_SOC) error = ntb_setup_soc(ntb); else error = ntb_setup_xeon(ntb); if (error) goto out; error = ntb_setup_interrupts(ntb); if (error) goto out; pci_enable_busmaster(ntb->device); out: if (error != 0) ntb_detach(device); return (error); }