apb.c revision 221257
1187517Sgonzo/*- 2187517Sgonzo * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org> 3187517Sgonzo * All rights reserved. 4187517Sgonzo * 5187517Sgonzo * Redistribution and use in source and binary forms, with or without 6187517Sgonzo * modification, are permitted provided that the following conditions 7187517Sgonzo * are met: 8187517Sgonzo * 1. Redistributions of source code must retain the above copyright 9187517Sgonzo * notice unmodified, this list of conditions, and the following 10187517Sgonzo * disclaimer. 11187517Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 12187517Sgonzo * notice, this list of conditions and the following disclaimer in the 13187517Sgonzo * documentation and/or other materials provided with the distribution. 14187517Sgonzo * 15187517Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16187517Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17187517Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18187517Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19187517Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20187517Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21187517Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22187517Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23187517Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24187517Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25187517Sgonzo * SUCH DAMAGE. 26187517Sgonzo */ 27187517Sgonzo 28187517Sgonzo#include <sys/cdefs.h> 29187517Sgonzo__FBSDID("$FreeBSD: head/sys/mips/atheros/apb.c 221257 2011-04-30 12:07:15Z adrian $"); 30187517Sgonzo 31187517Sgonzo#include <sys/param.h> 32187517Sgonzo#include <sys/systm.h> 33187517Sgonzo#include <sys/bus.h> 34187517Sgonzo#include <sys/interrupt.h> 35187517Sgonzo#include <sys/kernel.h> 36187517Sgonzo#include <sys/module.h> 37187517Sgonzo#include <sys/rman.h> 38187517Sgonzo#include <sys/malloc.h> 39187517Sgonzo 40187517Sgonzo#include <machine/bus.h> 41199497Sgonzo#include <machine/intr_machdep.h> 42187517Sgonzo 43187517Sgonzo#include <mips/atheros/apbvar.h> 44187517Sgonzo#include <mips/atheros/ar71xxreg.h> 45221257Sadrian#include <mips/atheros/ar71xx_setup.h> 46187517Sgonzo 47188883Sgonzo#undef APB_DEBUG 48188883Sgonzo#ifdef APB_DEBUG 49188883Sgonzo#define dprintf printf 50188883Sgonzo#else 51188883Sgonzo#define dprintf(x, arg...) 52188883Sgonzo#endif /* APB_DEBUG */ 53188883Sgonzo 54187517Sgonzostatic int apb_activate_resource(device_t, device_t, int, int, 55187517Sgonzo struct resource *); 56212413Savgstatic device_t apb_add_child(device_t, u_int, const char *, int); 57187517Sgonzostatic struct resource * 58187517Sgonzo apb_alloc_resource(device_t, device_t, int, int *, u_long, 59187517Sgonzo u_long, u_long, u_int); 60187517Sgonzostatic int apb_attach(device_t); 61187517Sgonzostatic int apb_deactivate_resource(device_t, device_t, int, int, 62187517Sgonzo struct resource *); 63187517Sgonzostatic struct resource_list * 64187517Sgonzo apb_get_resource_list(device_t, device_t); 65187517Sgonzostatic void apb_hinted_child(device_t, const char *, int); 66187517Sgonzostatic int apb_intr(void *); 67187517Sgonzostatic int apb_probe(device_t); 68187517Sgonzostatic int apb_release_resource(device_t, device_t, int, int, 69187517Sgonzo struct resource *); 70187517Sgonzostatic int apb_setup_intr(device_t, device_t, struct resource *, int, 71187517Sgonzo driver_filter_t *, driver_intr_t *, void *, void **); 72187517Sgonzostatic int apb_teardown_intr(device_t, device_t, struct resource *, 73187517Sgonzo void *); 74187517Sgonzo 75192822Sgonzostatic void 76192822Sgonzoapb_mask_irq(void *source) 77187517Sgonzo{ 78192822Sgonzo unsigned int irq = (unsigned int)source; 79187517Sgonzo uint32_t reg; 80187517Sgonzo 81187517Sgonzo reg = ATH_READ_REG(AR71XX_MISC_INTR_MASK); 82187517Sgonzo ATH_WRITE_REG(AR71XX_MISC_INTR_MASK, reg & ~(1 << irq)); 83187517Sgonzo 84187517Sgonzo} 85187517Sgonzo 86192822Sgonzostatic void 87192822Sgonzoapb_unmask_irq(void *source) 88187517Sgonzo{ 89187517Sgonzo uint32_t reg; 90192822Sgonzo unsigned int irq = (unsigned int)source; 91187517Sgonzo 92187517Sgonzo reg = ATH_READ_REG(AR71XX_MISC_INTR_MASK); 93187517Sgonzo ATH_WRITE_REG(AR71XX_MISC_INTR_MASK, reg | (1 << irq)); 94187517Sgonzo} 95187517Sgonzo 96187517Sgonzostatic int 97187517Sgonzoapb_probe(device_t dev) 98187517Sgonzo{ 99187517Sgonzo 100187517Sgonzo return (0); 101187517Sgonzo} 102187517Sgonzo 103187517Sgonzostatic int 104187517Sgonzoapb_attach(device_t dev) 105187517Sgonzo{ 106187517Sgonzo struct apb_softc *sc = device_get_softc(dev); 107187517Sgonzo int rid = 0; 108187517Sgonzo 109187517Sgonzo device_set_desc(dev, "APB Bus bridge"); 110191837Sgonzo 111191837Sgonzo sc->apb_mem_rman.rm_type = RMAN_ARRAY; 112191837Sgonzo sc->apb_mem_rman.rm_descr = "APB memory window"; 113191837Sgonzo 114191837Sgonzo if (rman_init(&sc->apb_mem_rman) != 0 || 115191837Sgonzo rman_manage_region(&sc->apb_mem_rman, 116191837Sgonzo AR71XX_APB_BASE, 117191837Sgonzo AR71XX_APB_BASE + AR71XX_APB_SIZE - 1) != 0) 118191837Sgonzo panic("apb_attach: failed to set up memory rman"); 119191837Sgonzo 120187517Sgonzo sc->apb_irq_rman.rm_type = RMAN_ARRAY; 121187517Sgonzo sc->apb_irq_rman.rm_descr = "APB IRQ"; 122187517Sgonzo 123187517Sgonzo if (rman_init(&sc->apb_irq_rman) != 0 || 124187517Sgonzo rman_manage_region(&sc->apb_irq_rman, 125187517Sgonzo APB_IRQ_BASE, APB_IRQ_END) != 0) 126187517Sgonzo panic("apb_attach: failed to set up IRQ rman"); 127187517Sgonzo 128187517Sgonzo if ((sc->sc_misc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, 129187517Sgonzo RF_SHAREABLE | RF_ACTIVE)) == NULL) { 130187517Sgonzo device_printf(dev, "unable to allocate IRQ resource\n"); 131187517Sgonzo return (ENXIO); 132187517Sgonzo } 133187517Sgonzo 134187517Sgonzo if ((bus_setup_intr(dev, sc->sc_misc_irq, INTR_TYPE_MISC, 135187517Sgonzo apb_intr, NULL, sc, &sc->sc_misc_ih))) { 136187517Sgonzo device_printf(dev, 137187517Sgonzo "WARNING: unable to register interrupt handler\n"); 138187517Sgonzo return (ENXIO); 139187517Sgonzo } 140187517Sgonzo 141187517Sgonzo bus_generic_probe(dev); 142187517Sgonzo bus_enumerate_hinted_children(dev); 143187517Sgonzo bus_generic_attach(dev); 144187517Sgonzo 145187517Sgonzo return (0); 146187517Sgonzo} 147187517Sgonzo 148187517Sgonzostatic struct resource * 149187517Sgonzoapb_alloc_resource(device_t bus, device_t child, int type, int *rid, 150187517Sgonzo u_long start, u_long end, u_long count, u_int flags) 151187517Sgonzo{ 152187517Sgonzo struct apb_softc *sc = device_get_softc(bus); 153187517Sgonzo struct apb_ivar *ivar = device_get_ivars(child); 154187517Sgonzo struct resource *rv; 155187517Sgonzo struct resource_list_entry *rle; 156187517Sgonzo struct rman *rm; 157187517Sgonzo int isdefault, needactivate, passthrough; 158187517Sgonzo 159187517Sgonzo isdefault = (start == 0UL && end == ~0UL); 160187517Sgonzo needactivate = flags & RF_ACTIVE; 161188883Sgonzo /* 162188883Sgonzo * Pass memory requests to nexus device 163188883Sgonzo */ 164191837Sgonzo passthrough = (device_get_parent(child) != bus); 165187517Sgonzo rle = NULL; 166187517Sgonzo 167191837Sgonzo dprintf("%s: entry (%p, %p, %d, %d, %p, %p, %ld, %d)\n", 168191837Sgonzo __func__, bus, child, type, *rid, (void *)(intptr_t)start, 169188883Sgonzo (void *)(intptr_t)end, count, flags); 170188883Sgonzo 171187517Sgonzo if (passthrough) 172187517Sgonzo return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, 173187517Sgonzo rid, start, end, count, flags)); 174187517Sgonzo 175187517Sgonzo /* 176187517Sgonzo * If this is an allocation of the "default" range for a given RID, 177187517Sgonzo * and we know what the resources for this device are (ie. they aren't 178187517Sgonzo * maintained by a child bus), then work out the start/end values. 179187517Sgonzo */ 180187517Sgonzo 181187517Sgonzo if (isdefault) { 182187517Sgonzo rle = resource_list_find(&ivar->resources, type, *rid); 183187517Sgonzo if (rle == NULL) { 184187517Sgonzo return (NULL); 185187517Sgonzo } 186187517Sgonzo 187187517Sgonzo if (rle->res != NULL) { 188187517Sgonzo panic("%s: resource entry is busy", __func__); 189187517Sgonzo } 190187517Sgonzo start = rle->start; 191187517Sgonzo end = rle->end; 192187517Sgonzo count = rle->count; 193188883Sgonzo 194188883Sgonzo dprintf("%s: default resource (%p, %p, %ld)\n", 195188883Sgonzo __func__, (void *)(intptr_t)start, 196188883Sgonzo (void *)(intptr_t)end, count); 197187517Sgonzo } 198187517Sgonzo 199187517Sgonzo switch (type) { 200187517Sgonzo case SYS_RES_IRQ: 201187517Sgonzo rm = &sc->apb_irq_rman; 202187517Sgonzo break; 203191837Sgonzo case SYS_RES_MEMORY: 204191837Sgonzo rm = &sc->apb_mem_rman; 205191837Sgonzo break; 206187517Sgonzo default: 207187517Sgonzo printf("%s: unknown resource type %d\n", __func__, type); 208187517Sgonzo return (0); 209187517Sgonzo } 210187517Sgonzo 211187517Sgonzo rv = rman_reserve_resource(rm, start, end, count, flags, child); 212187517Sgonzo if (rv == 0) { 213187517Sgonzo printf("%s: could not reserve resource\n", __func__); 214187517Sgonzo return (0); 215187517Sgonzo } 216187517Sgonzo 217187517Sgonzo rman_set_rid(rv, *rid); 218187517Sgonzo 219187517Sgonzo if (needactivate) { 220187517Sgonzo if (bus_activate_resource(child, type, *rid, rv)) { 221187517Sgonzo printf("%s: could not activate resource\n", __func__); 222187517Sgonzo rman_release_resource(rv); 223187517Sgonzo return (0); 224187517Sgonzo } 225187517Sgonzo } 226187517Sgonzo 227187517Sgonzo return (rv); 228187517Sgonzo} 229187517Sgonzo 230187517Sgonzostatic int 231187517Sgonzoapb_activate_resource(device_t bus, device_t child, int type, int rid, 232187517Sgonzo struct resource *r) 233187517Sgonzo{ 234187517Sgonzo 235187517Sgonzo /* XXX: should we mask/unmask IRQ here? */ 236187517Sgonzo return (BUS_ACTIVATE_RESOURCE(device_get_parent(bus), child, 237187517Sgonzo type, rid, r)); 238187517Sgonzo} 239187517Sgonzo 240187517Sgonzostatic int 241187517Sgonzoapb_deactivate_resource(device_t bus, device_t child, int type, int rid, 242187517Sgonzo struct resource *r) 243187517Sgonzo{ 244187517Sgonzo 245187517Sgonzo /* XXX: should we mask/unmask IRQ here? */ 246187517Sgonzo return (BUS_DEACTIVATE_RESOURCE(device_get_parent(bus), child, 247187517Sgonzo type, rid, r)); 248187517Sgonzo} 249187517Sgonzo 250187517Sgonzostatic int 251187517Sgonzoapb_release_resource(device_t dev, device_t child, int type, 252187517Sgonzo int rid, struct resource *r) 253187517Sgonzo{ 254187517Sgonzo struct resource_list *rl; 255187517Sgonzo struct resource_list_entry *rle; 256187517Sgonzo 257187517Sgonzo rl = apb_get_resource_list(dev, child); 258187517Sgonzo if (rl == NULL) 259187517Sgonzo return (EINVAL); 260187517Sgonzo rle = resource_list_find(rl, type, rid); 261187517Sgonzo if (rle == NULL) 262187517Sgonzo return (EINVAL); 263187517Sgonzo rman_release_resource(r); 264187517Sgonzo rle->res = NULL; 265187517Sgonzo 266187517Sgonzo return (0); 267187517Sgonzo} 268187517Sgonzo 269187517Sgonzostatic int 270187517Sgonzoapb_setup_intr(device_t bus, device_t child, struct resource *ires, 271187517Sgonzo int flags, driver_filter_t *filt, driver_intr_t *handler, 272187517Sgonzo void *arg, void **cookiep) 273187517Sgonzo{ 274187517Sgonzo struct apb_softc *sc = device_get_softc(bus); 275187517Sgonzo struct intr_event *event; 276187517Sgonzo int irq, error; 277187517Sgonzo 278187517Sgonzo irq = rman_get_start(ires); 279187517Sgonzo 280187517Sgonzo if (irq > APB_IRQ_END) 281187517Sgonzo panic("%s: bad irq %d", __func__, irq); 282187517Sgonzo 283187517Sgonzo event = sc->sc_eventstab[irq]; 284187517Sgonzo if (event == NULL) { 285187517Sgonzo error = intr_event_create(&event, (void *)irq, 0, irq, 286192822Sgonzo apb_mask_irq, apb_unmask_irq, 287187517Sgonzo NULL, NULL, 288187517Sgonzo "apb intr%d:", irq); 289187517Sgonzo 290199497Sgonzo if (error == 0) { 291199497Sgonzo sc->sc_eventstab[irq] = event; 292199497Sgonzo sc->sc_intr_counter[irq] = 293199497Sgonzo mips_intrcnt_create(event->ie_name); 294199497Sgonzo } 295199497Sgonzo else 296199497Sgonzo return (error); 297187517Sgonzo } 298187517Sgonzo 299187517Sgonzo intr_event_add_handler(event, device_get_nameunit(child), filt, 300187517Sgonzo handler, arg, intr_priority(flags), flags, cookiep); 301199497Sgonzo mips_intrcnt_setname(sc->sc_intr_counter[irq], event->ie_fullname); 302187517Sgonzo 303192822Sgonzo apb_unmask_irq((void*)irq); 304191837Sgonzo 305187517Sgonzo return (0); 306187517Sgonzo} 307187517Sgonzo 308187517Sgonzostatic int 309187517Sgonzoapb_teardown_intr(device_t dev, device_t child, struct resource *ires, 310187517Sgonzo void *cookie) 311187517Sgonzo{ 312187517Sgonzo struct apb_softc *sc = device_get_softc(dev); 313187517Sgonzo int irq, result; 314187517Sgonzo 315187517Sgonzo irq = rman_get_start(ires); 316187517Sgonzo if (irq > APB_IRQ_END) 317187517Sgonzo panic("%s: bad irq %d", __func__, irq); 318187517Sgonzo 319187517Sgonzo if (sc->sc_eventstab[irq] == NULL) 320187517Sgonzo panic("Trying to teardown unoccupied IRQ"); 321187517Sgonzo 322192822Sgonzo apb_mask_irq((void*)irq); 323187517Sgonzo 324187517Sgonzo result = intr_event_remove_handler(cookie); 325187517Sgonzo if (!result) 326187517Sgonzo sc->sc_eventstab[irq] = NULL; 327187517Sgonzo 328187517Sgonzo return (result); 329187517Sgonzo} 330187517Sgonzo 331187517Sgonzostatic int 332187517Sgonzoapb_intr(void *arg) 333187517Sgonzo{ 334187517Sgonzo struct apb_softc *sc = arg; 335187517Sgonzo struct intr_event *event; 336187517Sgonzo uint32_t reg, irq; 337187517Sgonzo 338187517Sgonzo reg = ATH_READ_REG(AR71XX_MISC_INTR_STATUS); 339187517Sgonzo for (irq = 0; irq < APB_NIRQS; irq++) { 340187517Sgonzo if (reg & (1 << irq)) { 341221257Sadrian 342221257Sadrian switch (ar71xx_soc) { 343221257Sadrian case AR71XX_SOC_AR7240: 344221257Sadrian case AR71XX_SOC_AR7241: 345221257Sadrian case AR71XX_SOC_AR7242: 346221257Sadrian /* Ack/clear the irq on status register for AR724x */ 347221257Sadrian ATH_WRITE_REG(AR71XX_MISC_INTR_STATUS, 348221257Sadrian reg & ~(1 << irq)); 349221257Sadrian break; 350221257Sadrian default: 351221257Sadrian /* fallthrough */ 352221257Sadrian break; 353221257Sadrian } 354221257Sadrian 355187517Sgonzo event = sc->sc_eventstab[irq]; 356187517Sgonzo if (!event || TAILQ_EMPTY(&event->ie_handlers)) { 357191837Sgonzo /* Ignore timer interrupts */ 358191837Sgonzo if (irq != 0) 359199497Sgonzo printf("Stray APB IRQ %d\n", irq); 360187517Sgonzo continue; 361187517Sgonzo } 362187517Sgonzo 363187517Sgonzo /* TODO: frame instead of NULL? */ 364187517Sgonzo intr_event_handle(event, NULL); 365199497Sgonzo mips_intrcnt_inc(sc->sc_intr_counter[irq]); 366187517Sgonzo } 367187517Sgonzo } 368187517Sgonzo 369187517Sgonzo return (FILTER_HANDLED); 370187517Sgonzo} 371187517Sgonzo 372187517Sgonzostatic void 373187517Sgonzoapb_hinted_child(device_t bus, const char *dname, int dunit) 374187517Sgonzo{ 375187517Sgonzo device_t child; 376187517Sgonzo long maddr; 377187517Sgonzo int msize; 378187517Sgonzo int irq; 379187517Sgonzo int result; 380187517Sgonzo int mem_hints_count; 381187517Sgonzo 382187517Sgonzo child = BUS_ADD_CHILD(bus, 0, dname, dunit); 383187517Sgonzo 384187517Sgonzo /* 385187517Sgonzo * Set hard-wired resources for hinted child using 386187517Sgonzo * specific RIDs. 387187517Sgonzo */ 388187517Sgonzo mem_hints_count = 0; 389187517Sgonzo if (resource_long_value(dname, dunit, "maddr", &maddr) == 0) 390187517Sgonzo mem_hints_count++; 391187517Sgonzo if (resource_int_value(dname, dunit, "msize", &msize) == 0) 392187517Sgonzo mem_hints_count++; 393187517Sgonzo 394187517Sgonzo /* check if all info for mem resource has been provided */ 395187517Sgonzo if ((mem_hints_count > 0) && (mem_hints_count < 2)) { 396187517Sgonzo printf("Either maddr or msize hint is missing for %s%d\n", 397187517Sgonzo dname, dunit); 398187517Sgonzo } else if (mem_hints_count) { 399187517Sgonzo result = bus_set_resource(child, SYS_RES_MEMORY, 0, 400187517Sgonzo maddr, msize); 401187517Sgonzo if (result != 0) 402187517Sgonzo device_printf(bus, 403187517Sgonzo "warning: bus_set_resource() failed\n"); 404187517Sgonzo } 405187517Sgonzo 406187517Sgonzo if (resource_int_value(dname, dunit, "irq", &irq) == 0) { 407187517Sgonzo result = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); 408187517Sgonzo if (result != 0) 409187517Sgonzo device_printf(bus, 410187517Sgonzo "warning: bus_set_resource() failed\n"); 411187517Sgonzo } 412187517Sgonzo} 413187517Sgonzo 414187517Sgonzostatic device_t 415212413Savgapb_add_child(device_t bus, u_int order, const char *name, int unit) 416187517Sgonzo{ 417187517Sgonzo device_t child; 418187517Sgonzo struct apb_ivar *ivar; 419187517Sgonzo 420187517Sgonzo ivar = malloc(sizeof(struct apb_ivar), M_DEVBUF, M_WAITOK | M_ZERO); 421187517Sgonzo if (ivar == NULL) { 422187517Sgonzo printf("Failed to allocate ivar\n"); 423187517Sgonzo return (0); 424187517Sgonzo } 425187517Sgonzo resource_list_init(&ivar->resources); 426187517Sgonzo 427187517Sgonzo child = device_add_child_ordered(bus, order, name, unit); 428187517Sgonzo if (child == NULL) { 429187517Sgonzo printf("Can't add child %s%d ordered\n", name, unit); 430187517Sgonzo return (0); 431187517Sgonzo } 432187517Sgonzo 433187517Sgonzo device_set_ivars(child, ivar); 434187517Sgonzo 435187517Sgonzo return (child); 436187517Sgonzo} 437187517Sgonzo 438187517Sgonzo/* 439187517Sgonzo * Helper routine for bus_generic_rl_get_resource/bus_generic_rl_set_resource 440187517Sgonzo * Provides pointer to resource_list for these routines 441187517Sgonzo */ 442187517Sgonzostatic struct resource_list * 443187517Sgonzoapb_get_resource_list(device_t dev, device_t child) 444187517Sgonzo{ 445187517Sgonzo struct apb_ivar *ivar; 446187517Sgonzo 447187517Sgonzo ivar = device_get_ivars(child); 448187517Sgonzo return (&(ivar->resources)); 449187517Sgonzo} 450187517Sgonzo 451187517Sgonzostatic device_method_t apb_methods[] = { 452187517Sgonzo DEVMETHOD(bus_activate_resource, apb_activate_resource), 453187517Sgonzo DEVMETHOD(bus_add_child, apb_add_child), 454187517Sgonzo DEVMETHOD(bus_alloc_resource, apb_alloc_resource), 455187517Sgonzo DEVMETHOD(bus_deactivate_resource, apb_deactivate_resource), 456187517Sgonzo DEVMETHOD(bus_get_resource_list, apb_get_resource_list), 457187517Sgonzo DEVMETHOD(bus_hinted_child, apb_hinted_child), 458187517Sgonzo DEVMETHOD(bus_print_child, bus_generic_print_child), 459187517Sgonzo DEVMETHOD(bus_release_resource, apb_release_resource), 460187517Sgonzo DEVMETHOD(bus_setup_intr, apb_setup_intr), 461187517Sgonzo DEVMETHOD(bus_teardown_intr, apb_teardown_intr), 462187517Sgonzo DEVMETHOD(device_attach, apb_attach), 463187517Sgonzo DEVMETHOD(device_probe, apb_probe), 464187517Sgonzo DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), 465187517Sgonzo DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), 466187517Sgonzo 467187517Sgonzo {0, 0}, 468187517Sgonzo}; 469187517Sgonzo 470187517Sgonzostatic driver_t apb_driver = { 471187517Sgonzo "apb", 472187517Sgonzo apb_methods, 473187517Sgonzo sizeof(struct apb_softc), 474187517Sgonzo}; 475187517Sgonzostatic devclass_t apb_devclass; 476187517Sgonzo 477187517SgonzoDRIVER_MODULE(apb, nexus, apb_driver, apb_devclass, 0, 0); 478