version 1.7, 2007/11/01 13:22:08 |
version 1.10, 2007/12/16 12:54:44 |
|
|
#include <sys/device.h> |
#include <sys/device.h> |
#include <sys/kern_devconfig.h> |
#include <sys/kern_devconfig.h> |
#include <sys/mem.h> |
#include <sys/mem.h> |
|
#include <sys/kern_irq.h> |
#include <libkern/string.h> |
#include <libkern/string.h> |
#include <libkern/printf.h> |
#include <libkern/printf.h> |
|
|
|
|
/* allocate space for device's devdata */ |
/* allocate space for device's devdata */ |
cdevp->dv_devdata = kmalloc(drp->dr_ddsize); |
cdevp->dv_devdata = kmalloc(drp->dr_ddsize); |
if (cdevp->dv_devdata == NULL) |
if (cdevp->dv_devdata == NULL) |
panic("failed to allocate space for %s devdata\n"); |
panic("failed to allocate space for %s devdata\n", aip->ai_cname); |
/* NOTREACHED */ |
/* NOTREACHED */ |
|
|
/* increment number of driver's instances */ |
/* increment number of driver's instances */ |
|
|
|
|
/* activate device */ |
/* activate device */ |
cdevp->dv_active = 1; |
cdevp->dv_active = 1; |
|
|
|
/* if device has interrupt handler, establish it */ |
|
if (drp->dr_interrupt != NULL) { |
|
DPRINTF("devconfig_attach_childs: establishing interrupt %d for %s/%d\n", |
|
aip->ai_intrno, cdevp->dv_name, cdevp->dv_minor); |
|
intr_establish(aip->ai_intrno, cdevp, drp->dr_interrupt); |
|
} |
|
|
/* recursive attach this child's children */ |
/* recursive attach this child's children */ |
devconfig_attach_childs(cdevp); |
devconfig_attach_childs(cdevp); |