* Attach an interface that successfully probed. */
| 321 | * Attach an interface that successfully probed. |
| 322 | */ |
| 323 | static int |
| 324 | xlp_sec_attach(device_t dev) |
| 325 | { |
| 326 | struct xlp_sec_softc *sc = device_get_softc(dev); |
| 327 | uint64_t base; |
| 328 | int qstart, qnum; |
| 329 | int freq, node; |
| 330 | |
| 331 | sc->sc_dev = dev; |
| 332 | |
| 333 | node = nlm_get_device_node(pci_get_slot(dev)); |
| 334 | freq = nlm_set_device_frequency(node, DFS_DEVICE_SAE, 250); |
| 335 | if (bootverbose) |
| 336 | device_printf(dev, "SAE Freq: %dMHz\n", freq); |
| 337 | if(pci_get_device(dev) == PCI_DEVICE_ID_NLM_SAE) { |
| 338 | device_set_desc(dev, "XLP Security Accelerator"); |
| 339 | sc->sc_cid = crypto_get_driverid(dev, |
| 340 | sizeof(struct xlp_sec_session), CRYPTOCAP_F_HARDWARE); |
| 341 | if (sc->sc_cid < 0) { |
| 342 | printf("xlp_sec - error : could not get the driver" |
| 343 | " id\n"); |
| 344 | goto error_exit; |
| 345 | } |
| 346 | |
| 347 | base = nlm_get_sec_pcibase(node); |
| 348 | qstart = nlm_qidstart(base); |
| 349 | qnum = nlm_qnum(base); |
| 350 | sc->sec_vc_start = qstart; |
| 351 | sc->sec_vc_end = qstart + qnum - 1; |
| 352 | } |
| 353 | |
| 354 | if (xlp_sec_init(sc) != 0) |
| 355 | goto error_exit; |
| 356 | if (bootverbose) |
| 357 | device_printf(dev, "SEC Initialization complete!\n"); |
| 358 | return (0); |
| 359 | |
| 360 | error_exit: |
| 361 | return (ENXIO); |
| 362 | |
| 363 | } |
| 364 | |
| 365 | /* |
| 366 | * Detach an interface that successfully probed. |
nothing calls this directly
no test coverage detected