View | Details | Raw Unified | Return to bug 18744
Collapse All | Expand All

(-)bktr_os.c (-9 / +11 lines)
Lines 274-280 Link Here
274
	unsigned int	rev;
274
	unsigned int	rev;
275
	unsigned int	unit;
275
	unsigned int	unit;
276
	int		error = 0;
276
	int		error = 0;
277
	int		rid;
278
#ifdef BROOKTREE_IRQ
277
#ifdef BROOKTREE_IRQ
279
	u_long		old_irq, new_irq;
278
	u_long		old_irq, new_irq;
280
#endif 
279
#endif 
Lines 293-300 Link Here
293
	/*
292
	/*
294
	 * Map control/status registers.
293
	 * Map control/status registers.
295
	 */
294
	 */
296
	rid = PCI_MAP_REG_START;
295
	bktr->mem_rid = PCI_MAP_REG_START;
297
	bktr->res_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
296
	bktr->res_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &bktr->mem_rid,
298
                                  0, ~0, 1, RF_ACTIVE);
297
                                  0, ~0, 1, RF_ACTIVE);
299
298
300
	if (!bktr->res_mem) {
299
	if (!bktr->res_mem) {
Lines 324-332 Link Here
324
	/*
323
	/*
325
	 * Allocate our interrupt.
324
	 * Allocate our interrupt.
326
	 */
325
	 */
327
	rid = 0;
326
	bktr->irq_rid = 0;
328
	bktr->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
327
	bktr->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &bktr->irq_rid,
329
                                 RF_SHAREABLE | RF_ACTIVE);
328
                                 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE);
330
	if (bktr->res_irq == NULL) {
329
	if (bktr->res_irq == NULL) {
331
		device_printf(dev, "could not map interrupt\n");
330
		device_printf(dev, "could not map interrupt\n");
332
		error = ENXIO;
331
		error = ENXIO;
Lines 405-412 Link Here
405
	return 0;
404
	return 0;
406
405
407
fail:
406
fail:
407
    if (bktr->res_irq)
408
        bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq);
409
    if (bktr->res_mem)
410
        bus_release_resource(dev, SYS_RES_IRQ, bktr->mem_rid, bktr->res_mem);
408
	return error;
411
	return error;
409
410
}
412
}
411
413
412
/*
414
/*
Lines 423-434 Link Here
423
425
424
	/* FIXME - Free memory for RISC programs, grab buffer, vbi buffers */
426
	/* FIXME - Free memory for RISC programs, grab buffer, vbi buffers */
425
427
426
	/*
428
	/*
427
	 * Deallocate resources.
429
	 * Deallocate resources.
428
	 */
430
	 */
429
	bus_teardown_intr(dev, bktr->res_irq, bktr->res_ih);
431
	bus_teardown_intr(dev, bktr->res_irq, bktr->res_ih);
430
	bus_release_resource(dev, SYS_RES_IRQ, 0, bktr->res_irq);
432
	bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq);
431
	bus_release_resource(dev, SYS_RES_MEMORY, PCI_MAP_REG_START, bktr->res_mem);
433
	bus_release_resource(dev, SYS_RES_MEMORY, bktr->mem_rid, bktr->res_mem);
432
434
433
	return 0;
435
	return 0;
434
}
436
}
(-)bktr_reg.h (+2 lines)
Lines 498-504 Link Here
498
    pcici_t         tag;	/* 2.x PCI tag, for doing PCI commands */
498
    pcici_t         tag;	/* 2.x PCI tag, for doing PCI commands */
499
    #endif
499
    #endif
500
    #if (__FreeBSD_version >= 400000)
500
    #if (__FreeBSD_version >= 400000)
501
    int             mem_rid;	/* 4.x resource id */
501
    struct resource *res_mem;	/* 4.x resource descriptor for registers */
502
    struct resource *res_mem;	/* 4.x resource descriptor for registers */
503
    int             irq_rid;	/* 4.x resource id */
502
    struct resource *res_irq;	/* 4.x resource descriptor for interrupt */
504
    struct resource *res_irq;	/* 4.x resource descriptor for interrupt */
503
    void            *res_ih;	/* 4.x newbus interrupt handler cookie */
505
    void            *res_ih;	/* 4.x newbus interrupt handler cookie */
504
    #endif
506
    #endif

Return to bug 18744