1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2013 Nathan Whitehorn 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #include <sys/param.h> 30 #include <sys/systm.h> 31 #include <sys/module.h> 32 #include <sys/bus.h> 33 #include <sys/conf.h> 34 #include <sys/kernel.h> 35 #include <sys/rman.h> 36 37 #include <machine/bus.h> 38 39 #include <dev/ofw/openfirm.h> 40 #include <dev/ofw/ofw_bus.h> 41 #include <dev/ofw/ofw_bus_subr.h> 42 43 #include <dev/fdt/simplebus.h> 44 45 #include "pci_if.h" 46 #include "pcib_if.h" 47 48 /* 49 * Bus interface. 50 */ 51 static int simplebus_probe(device_t dev); 52 static struct resource *simplebus_alloc_resource(device_t, device_t, int, 53 int, rman_res_t, rman_res_t, rman_res_t, u_int); 54 static void simplebus_probe_nomatch(device_t bus, device_t child); 55 static int simplebus_print_child(device_t bus, device_t child); 56 static device_t simplebus_add_child(device_t dev, u_int order, 57 const char *name, int unit); 58 static struct resource_list *simplebus_get_resource_list(device_t bus, 59 device_t child); 60 61 static ssize_t simplebus_get_property(device_t bus, device_t child, 62 const char *propname, void *propvalue, size_t size, 63 device_property_type_t type); 64 /* 65 * ofw_bus interface 66 */ 67 static const struct ofw_bus_devinfo *simplebus_get_devinfo(device_t bus, 68 device_t child); 69 70 /* 71 * PCI interface for MSI interrupts 72 */ 73 static pci_get_id_t simplebus_get_id; 74 static pci_alloc_msi_t simplebus_alloc_msi; 75 76 /* 77 * PCIB interface 78 */ 79 static pcib_alloc_msi_t simplebus_pcib_alloc_msi; 80 static pcib_release_msi_t simplebus_pcib_release_msi; 81 static pcib_alloc_msix_t simplebus_pcib_alloc_msix; 82 static pcib_release_msix_t simplebus_pcib_release_msix; 83 static pcib_map_msi_t simplebus_pcib_map_msi; 84 85 /* 86 * Driver methods. 87 */ 88 static device_method_t simplebus_methods[] = { 89 /* Device interface */ 90 DEVMETHOD(device_probe, simplebus_probe), 91 DEVMETHOD(device_attach, simplebus_attach), 92 DEVMETHOD(device_detach, simplebus_detach), 93 DEVMETHOD(device_shutdown, bus_generic_shutdown), 94 DEVMETHOD(device_suspend, bus_generic_suspend), 95 DEVMETHOD(device_resume, bus_generic_resume), 96 97 /* Bus interface */ 98 DEVMETHOD(bus_add_child, simplebus_add_child), 99 DEVMETHOD(bus_print_child, simplebus_print_child), 100 DEVMETHOD(bus_probe_nomatch, simplebus_probe_nomatch), 101 DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), 102 DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), 103 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), 104 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), 105 DEVMETHOD(bus_alloc_resource, simplebus_alloc_resource), 106 DEVMETHOD(bus_release_resource, bus_generic_release_resource), 107 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 108 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), 109 DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), 110 DEVMETHOD(bus_map_resource, bus_generic_map_resource), 111 DEVMETHOD(bus_unmap_resource, bus_generic_unmap_resource), 112 DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), 113 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), 114 DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), 115 DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), 116 DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list), 117 DEVMETHOD(bus_get_property, simplebus_get_property), 118 DEVMETHOD(bus_get_device_path, ofw_bus_gen_get_device_path), 119 120 /* ofw_bus interface */ 121 DEVMETHOD(ofw_bus_get_devinfo, simplebus_get_devinfo), 122 DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), 123 DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), 124 DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), 125 DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), 126 DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), 127 128 /* PCI interface for MSI interrupts */ 129 DEVMETHOD(pci_get_id, simplebus_get_id), 130 DEVMETHOD(pci_alloc_msi, simplebus_alloc_msi), 131 132 /* PCIB interface */ 133 DEVMETHOD(pcib_alloc_msi, simplebus_pcib_alloc_msi), 134 DEVMETHOD(pcib_release_msi, simplebus_pcib_release_msi), 135 DEVMETHOD(pcib_alloc_msix, simplebus_pcib_alloc_msix), 136 DEVMETHOD(pcib_release_msix, simplebus_pcib_release_msix), 137 DEVMETHOD(pcib_map_msi, simplebus_pcib_map_msi), 138 139 DEVMETHOD_END 140 }; 141 142 DEFINE_CLASS_0(simplebus, simplebus_driver, simplebus_methods, 143 sizeof(struct simplebus_softc)); 144 145 EARLY_DRIVER_MODULE(simplebus, ofwbus, simplebus_driver, 0, 0, BUS_PASS_BUS); 146 EARLY_DRIVER_MODULE(simplebus, simplebus, simplebus_driver, 0, 0, 147 BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); 148 149 static int 150 simplebus_probe(device_t dev) 151 { 152 153 if (!ofw_bus_status_okay(dev)) 154 return (ENXIO); 155 /* 156 * XXX We should attach only to pure' compatible = "simple-bus"', 157 * without any other compatible string. 158 * For now, filter only know cases: 159 * "syscon", "simple-bus"; is handled by fdt/syscon driver 160 * "simple-mfd", "simple-bus"; is handled by fdt/simple-mfd driver 161 */ 162 if (ofw_bus_is_compatible(dev, "syscon") || 163 ofw_bus_is_compatible(dev, "simple-mfd")) 164 return (ENXIO); 165 166 /* 167 * FDT data puts a "simple-bus" compatible string on many things that 168 * have children but aren't really buses in our world. Without a 169 * ranges property we will fail to attach, so just fail to probe too. 170 */ 171 if (!(ofw_bus_is_compatible(dev, "simple-bus") && 172 ofw_bus_has_prop(dev, "ranges")) && 173 (ofw_bus_get_type(dev) == NULL || strcmp(ofw_bus_get_type(dev), 174 "soc") != 0)) 175 return (ENXIO); 176 177 device_set_desc(dev, "Flattened device tree simple bus"); 178 179 return (BUS_PROBE_GENERIC); 180 } 181 182 int 183 simplebus_attach_impl(device_t dev, int flags, phandle_t node) 184 { 185 struct simplebus_softc *sc; 186 187 if (node == 0) 188 node = ofw_bus_get_node(dev); 189 sc = device_get_softc_class(dev, &simplebus_driver); 190 sc->flags |=flags; 191 192 simplebus_init(dev, node); 193 if ((sc->flags & SB_FLAG_NO_RANGES) == 0 && 194 simplebus_fill_ranges(sc->node, sc) < 0) { 195 device_printf(dev, "could not get ranges\n"); 196 return (ENXIO); 197 } 198 199 /* 200 * In principle, simplebus could have an interrupt map, but ignore that 201 * for now 202 */ 203 204 for (node = OF_child(sc->node); node > 0; node = OF_peer(node)) 205 simplebus_add_device(dev, node, 0, NULL, -1, NULL); 206 207 return (0); 208 } 209 210 int 211 simplebus_attach(device_t dev) 212 { 213 int rv; 214 215 rv = simplebus_attach_impl(dev, 0, 0); 216 if (rv != 0) 217 return (rv); 218 219 bus_attach_children(dev); 220 return (0); 221 } 222 223 int 224 simplebus_detach(device_t dev) 225 { 226 struct simplebus_softc *sc; 227 int rv; 228 229 rv = bus_generic_detach(dev); 230 if (rv != 0) 231 return (rv); 232 233 sc = device_get_softc_class(dev, &simplebus_driver); 234 if (sc->ranges != NULL) 235 free(sc->ranges, M_DEVBUF); 236 237 return (0); 238 } 239 240 void 241 simplebus_init(device_t dev, phandle_t node) 242 { 243 struct simplebus_softc *sc; 244 sc = device_get_softc_class(dev, &simplebus_driver); 245 if (node == 0) 246 node = ofw_bus_get_node(dev); 247 sc->dev = dev; 248 sc->node = node; 249 250 /* 251 * Some important numbers 252 */ 253 sc->acells = 2; 254 OF_getencprop(node, "#address-cells", &sc->acells, sizeof(sc->acells)); 255 sc->scells = 1; 256 OF_getencprop(node, "#size-cells", &sc->scells, sizeof(sc->scells)); 257 258 } 259 260 int 261 simplebus_fill_ranges(phandle_t node, struct simplebus_softc *sc) 262 { 263 int host_address_cells; 264 cell_t *base_ranges; 265 ssize_t nbase_ranges; 266 int err; 267 int i, j, k; 268 269 err = OF_searchencprop(OF_parent(node), "#address-cells", 270 &host_address_cells, sizeof(host_address_cells)); 271 if (err <= 0) 272 return (-1); 273 274 nbase_ranges = OF_getproplen(node, "ranges"); 275 if (nbase_ranges < 0) 276 return (-1); 277 sc->nranges = nbase_ranges / sizeof(cell_t) / 278 (sc->acells + host_address_cells + sc->scells); 279 if (sc->nranges == 0) 280 return (0); 281 282 sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]), 283 M_DEVBUF, M_WAITOK); 284 base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK); 285 OF_getencprop(node, "ranges", base_ranges, nbase_ranges); 286 287 for (i = 0, j = 0; i < sc->nranges; i++) { 288 sc->ranges[i].bus = 0; 289 for (k = 0; k < sc->acells; k++) { 290 sc->ranges[i].bus <<= 32; 291 sc->ranges[i].bus |= base_ranges[j++]; 292 } 293 sc->ranges[i].host = 0; 294 for (k = 0; k < host_address_cells; k++) { 295 sc->ranges[i].host <<= 32; 296 sc->ranges[i].host |= base_ranges[j++]; 297 } 298 sc->ranges[i].size = 0; 299 for (k = 0; k < sc->scells; k++) { 300 sc->ranges[i].size <<= 32; 301 sc->ranges[i].size |= base_ranges[j++]; 302 } 303 } 304 305 free(base_ranges, M_DEVBUF); 306 return (sc->nranges); 307 } 308 309 struct simplebus_devinfo * 310 simplebus_setup_dinfo(device_t dev, phandle_t node, 311 struct simplebus_devinfo *di) 312 { 313 struct simplebus_softc *sc; 314 struct simplebus_devinfo *ndi; 315 316 sc = device_get_softc_class(dev, &simplebus_driver); 317 if (di == NULL) 318 ndi = malloc(sizeof(*ndi), M_DEVBUF, M_WAITOK | M_ZERO); 319 else 320 ndi = di; 321 if (ofw_bus_gen_setup_devinfo(&ndi->obdinfo, node) != 0) { 322 if (di == NULL) 323 free(ndi, M_DEVBUF); 324 return (NULL); 325 } 326 327 resource_list_init(&ndi->rl); 328 ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl); 329 ofw_bus_intr_to_rl(dev, node, &ndi->rl, NULL); 330 331 return (ndi); 332 } 333 334 device_t 335 simplebus_add_device(device_t dev, phandle_t node, u_int order, 336 const char *name, int unit, struct simplebus_devinfo *di) 337 { 338 struct simplebus_devinfo *ndi; 339 device_t cdev; 340 341 if ((ndi = simplebus_setup_dinfo(dev, node, di)) == NULL) 342 return (NULL); 343 cdev = device_add_child_ordered(dev, order, name, unit); 344 if (cdev == NULL) { 345 device_printf(dev, "<%s>: device_add_child failed\n", 346 ndi->obdinfo.obd_name); 347 resource_list_free(&ndi->rl); 348 ofw_bus_gen_destroy_devinfo(&ndi->obdinfo); 349 if (di == NULL) 350 free(ndi, M_DEVBUF); 351 return (NULL); 352 } 353 device_set_ivars(cdev, ndi); 354 355 return(cdev); 356 } 357 358 static device_t 359 simplebus_add_child(device_t dev, u_int order, const char *name, int unit) 360 { 361 device_t cdev; 362 struct simplebus_devinfo *ndi; 363 364 cdev = device_add_child_ordered(dev, order, name, unit); 365 if (cdev == NULL) 366 return (NULL); 367 368 ndi = malloc(sizeof(*ndi), M_DEVBUF, M_WAITOK | M_ZERO); 369 ndi->obdinfo.obd_node = -1; 370 resource_list_init(&ndi->rl); 371 device_set_ivars(cdev, ndi); 372 373 return (cdev); 374 } 375 376 static const struct ofw_bus_devinfo * 377 simplebus_get_devinfo(device_t bus __unused, device_t child) 378 { 379 struct simplebus_devinfo *ndi; 380 381 ndi = device_get_ivars(child); 382 if (ndi == NULL) 383 return (NULL); 384 return (&ndi->obdinfo); 385 } 386 387 static struct resource_list * 388 simplebus_get_resource_list(device_t bus __unused, device_t child) 389 { 390 struct simplebus_devinfo *ndi; 391 392 ndi = device_get_ivars(child); 393 if (ndi == NULL) 394 return (NULL); 395 return (&ndi->rl); 396 } 397 398 static ssize_t 399 simplebus_get_property(device_t bus, device_t child, const char *propname, 400 void *propvalue, size_t size, device_property_type_t type) 401 { 402 phandle_t node, xref; 403 ssize_t ret, i; 404 uint32_t *buffer; 405 uint64_t val; 406 407 switch (type) { 408 case DEVICE_PROP_ANY: 409 case DEVICE_PROP_BUFFER: 410 case DEVICE_PROP_UINT32: 411 case DEVICE_PROP_UINT64: 412 case DEVICE_PROP_HANDLE: 413 break; 414 default: 415 return (-1); 416 } 417 418 node = ofw_bus_get_node(child); 419 if (propvalue == NULL || size == 0) 420 return (OF_getproplen(node, propname)); 421 422 /* 423 * Integer values are stored in BE format. 424 * If caller declared that the underlying property type is uint32_t 425 * we need to do the conversion to match host endianness. 426 */ 427 if (type == DEVICE_PROP_UINT32) 428 return (OF_getencprop(node, propname, propvalue, size)); 429 430 /* 431 * uint64_t also requires endianness handling. 432 * In FDT every 8 byte value is stored using two uint32_t variables 433 * in BE format. Now, since the upper bits are stored as the first 434 * of the pair, both halves require swapping. 435 */ 436 if (type == DEVICE_PROP_UINT64) { 437 ret = OF_getencprop(node, propname, propvalue, size); 438 if (ret <= 0) { 439 return (ret); 440 } 441 442 buffer = (uint32_t *)propvalue; 443 444 for (i = 0; i < size / 4; i += 2) { 445 val = (uint64_t)buffer[i] << 32 | buffer[i + 1]; 446 ((uint64_t *)buffer)[i / 2] = val; 447 } 448 return (ret); 449 } 450 451 if (type == DEVICE_PROP_HANDLE) { 452 if (size < sizeof(node)) 453 return (-1); 454 ret = OF_getencprop(node, propname, &xref, sizeof(xref)); 455 if (ret <= 0) 456 return (ret); 457 458 node = OF_node_from_xref(xref); 459 if (propvalue != NULL) 460 *(uint32_t *)propvalue = node; 461 return (ret); 462 } 463 464 return (OF_getprop(node, propname, propvalue, size)); 465 } 466 467 static struct resource * 468 simplebus_alloc_resource(device_t bus, device_t child, int type, int rid, 469 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) 470 { 471 struct simplebus_softc *sc; 472 struct simplebus_devinfo *di; 473 struct resource_list_entry *rle; 474 int j; 475 476 sc = device_get_softc_class(bus, &simplebus_driver); 477 478 /* 479 * Request for the default allocation with a given rid: use resource 480 * list stored in the local device info. 481 */ 482 if (RMAN_IS_DEFAULT_RANGE(start, end)) { 483 if ((di = device_get_ivars(child)) == NULL) 484 return (NULL); 485 486 rle = resource_list_find(&di->rl, type, rid); 487 if (rle == NULL) { 488 if (bootverbose) 489 device_printf(bus, "no default resources for " 490 "rid = %d, type = %d\n", rid, type); 491 return (NULL); 492 } 493 start = rle->start; 494 end = rle->end; 495 count = rle->count; 496 } 497 498 if (type == SYS_RES_MEMORY) { 499 /* Remap through ranges property */ 500 for (j = 0; j < sc->nranges; j++) { 501 if (start >= sc->ranges[j].bus && end < 502 sc->ranges[j].bus + sc->ranges[j].size) { 503 start -= sc->ranges[j].bus; 504 start += sc->ranges[j].host; 505 end -= sc->ranges[j].bus; 506 end += sc->ranges[j].host; 507 break; 508 } 509 } 510 if (j == sc->nranges && sc->nranges != 0) { 511 if (bootverbose) 512 device_printf(bus, "Could not map resource " 513 "%#jx-%#jx\n", start, end); 514 515 return (NULL); 516 } 517 } 518 519 return (bus_generic_alloc_resource(bus, child, type, rid, start, end, 520 count, flags)); 521 } 522 523 static int 524 simplebus_print_res(struct simplebus_devinfo *di) 525 { 526 int rv; 527 528 if (di == NULL) 529 return (0); 530 rv = 0; 531 rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#jx"); 532 rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%jd"); 533 return (rv); 534 } 535 536 static void 537 simplebus_probe_nomatch(device_t bus, device_t child) 538 { 539 const char *name, *type, *compat; 540 541 if (!bootverbose) 542 return; 543 544 compat = ofw_bus_get_compat(child); 545 if (compat == NULL) 546 return; 547 name = ofw_bus_get_name(child); 548 type = ofw_bus_get_type(child); 549 550 device_printf(bus, "<%s>", name != NULL ? name : "unknown"); 551 simplebus_print_res(device_get_ivars(child)); 552 if (!ofw_bus_status_okay(child)) 553 printf(" disabled"); 554 if (type) 555 printf(" type %s", type); 556 printf(" compat %s (no driver attached)\n", compat); 557 } 558 559 static int 560 simplebus_print_child(device_t bus, device_t child) 561 { 562 int rv; 563 564 rv = bus_print_child_header(bus, child); 565 rv += simplebus_print_res(device_get_ivars(child)); 566 if (!ofw_bus_status_okay(child)) 567 rv += printf(" disabled"); 568 rv += bus_print_child_footer(bus, child); 569 return (rv); 570 } 571 572 static int 573 simplebus_get_id(device_t dev, device_t child, enum pci_id_type type, 574 uintptr_t *id) 575 { 576 phandle_t node, xref; 577 pcell_t *cells; 578 uintptr_t rid; 579 int error, ncells; 580 581 if (type != PCI_ID_MSI) 582 return (EINVAL); 583 584 node = ofw_bus_get_node(child); 585 error = ofw_bus_parse_xref_list_alloc(node, "msi-parent", "#msi-cells", 586 0, &xref, &ncells, &cells); 587 if (error != 0) 588 return (error); 589 590 rid = 0; 591 if (ncells > 0) 592 rid = cells[0]; 593 594 *id = rid; 595 return (0); 596 } 597 598 static int 599 simplebus_alloc_msi(device_t bus, device_t child, int *count) 600 { 601 struct simplebus_devinfo *ndi; 602 struct resource_list_entry *rle; 603 int error, i, irq_count, *irqs; 604 605 if (*count < 1) 606 return (EINVAL); 607 608 ndi = device_get_ivars(child); 609 if (ndi == NULL) 610 return (ENXIO); 611 612 /* Only MSI or non-MSI for now */ 613 rle = resource_list_find(&ndi->rl, SYS_RES_IRQ, 0); 614 if (rle != NULL && rle->res != NULL) 615 return (ENXIO); 616 617 irq_count = *count; 618 irqs = mallocarray(irq_count, sizeof(int), M_DEVBUF, M_WAITOK | M_ZERO); 619 620 error = PCIB_ALLOC_MSI(bus, child, irq_count, irq_count, irqs); 621 if (error != 0) 622 goto out; 623 624 for (i = 0; i < irq_count; i++) { 625 error = bus_generic_rl_set_resource(bus, child, SYS_RES_IRQ, 626 i + 1, irqs[i], 1); 627 if (error != 0) 628 break; 629 } 630 631 /* Clean up resources if something failed */ 632 if (error != 0) { 633 for (int j = 0; j < i; j++) { 634 bus_generic_rl_delete_resource(bus, child, SYS_RES_IRQ, 635 j + 1); 636 } 637 } 638 out: 639 free(irqs, M_DEVBUF); 640 return (error); 641 } 642 643 static int 644 simplebus_pcib_alloc_msi(device_t dev, device_t child, int count, int maxcount, 645 int *irqs) 646 { 647 return (PCIB_ALLOC_MSI(device_get_parent(dev), child, count, maxcount, 648 irqs)); 649 } 650 651 static int 652 simplebus_pcib_release_msi(device_t dev, device_t child, int count, int *irqs) 653 { 654 return (PCIB_RELEASE_MSI(device_get_parent(dev), child, count, irqs)); 655 } 656 657 static int 658 simplebus_pcib_alloc_msix(device_t dev, device_t child, int *irq) 659 { 660 return (PCIB_ALLOC_MSIX(device_get_parent(dev), child, irq)); 661 } 662 663 static int 664 simplebus_pcib_release_msix(device_t dev, device_t child, int irq) 665 { 666 return (PCIB_RELEASE_MSIX(device_get_parent(dev), child, irq)); 667 } 668 669 static int 670 simplebus_pcib_map_msi(device_t dev, device_t child, int irq, uint64_t *addr, 671 uint32_t *data) 672 { 673 return (PCIB_MAP_MSI(device_get_parent(dev), child, irq, addr, 674 data)); 675 } 676