本文整理汇总了C++中pci_intr_establish函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_intr_establish函数的具体用法?C++ pci_intr_establish怎么用?C++ pci_intr_establish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pci_intr_establish函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ral_pci_attach
void
ral_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct ral_pci_softc *psc = (struct ral_pci_softc *)self;
struct rt2560_softc *sc = &psc->sc_sc;
struct pci_attach_args *pa = aux;
const char *intrstr;
pci_intr_handle_t ih;
pcireg_t memtype;
int error;
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RALINK) {
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_RALINK_RT2560:
psc->sc_opns = &ral_rt2560_opns;
break;
case PCI_PRODUCT_RALINK_RT2561:
case PCI_PRODUCT_RALINK_RT2561S:
case PCI_PRODUCT_RALINK_RT2661:
psc->sc_opns = &ral_rt2661_opns;
break;
default:
psc->sc_opns = &ral_rt2860_opns;
break;
}
} else {
/* all other vendors are RT2860 only */
psc->sc_opns = &ral_rt2860_opns;
}
sc->sc_dmat = pa->pa_dmat;
psc->sc_pc = pa->pa_pc;
/* map control/status registers */
memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, RAL_PCI_BAR0);
error = pci_mapreg_map(pa, RAL_PCI_BAR0, memtype, 0, &sc->sc_st,
&sc->sc_sh, NULL, &psc->sc_mapsize, 0);
if (error != 0) {
printf(": can't map mem space\n");
return;
}
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
return;
}
intrstr = pci_intr_string(psc->sc_pc, ih);
psc->sc_ih = pci_intr_establish(psc->sc_pc, ih, IPL_NET,
psc->sc_opns->intr, sc, sc->sc_dev.dv_xname);
if (psc->sc_ih == NULL) {
printf(": can't establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
return;
}
printf(": %s", intrstr);
(*psc->sc_opns->attach)(sc, PCI_PRODUCT(pa->pa_id));
}
示例2: pci_intr_establish_xname
void *
pci_intr_establish_xname(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
int (*func)(void *), void *arg, const char *__nouse)
{
return pci_intr_establish(pc, ih, level, func, arg);
}
示例3: lpt_puc_attach
static void
lpt_puc_attach(device_t parent, device_t self, void *aux)
{
struct lpt_softc *sc = device_private(self);
struct puc_attach_args *aa = aux;
const char *intrstr;
sc->sc_dev = self;
sc->sc_iot = aa->t;
sc->sc_ioh = aa->h;
intrstr = pci_intr_string(aa->pc, aa->intrhandle);
sc->sc_ih = pci_intr_establish(aa->pc, aa->intrhandle, IPL_TTY,
lptintr, sc);
if (sc->sc_ih == NULL) {
aprint_error(": couldn't establish interrupt");
if (intrstr != NULL)
aprint_error(" at %s", intrstr);
aprint_error("\n");
return;
}
aprint_normal(": interrupting at %s\n", intrstr);
lpt_attach_subr(sc);
}
示例4: amdiic_attach
void
amdiic_attach(struct device *parent, struct device *self, void *aux)
{
struct amdiic_softc *sc = (struct amdiic_softc *)self;
struct pci_attach_args *pa = aux;
struct i2cbus_attach_args iba;
pcireg_t conf;
bus_size_t iosize;
pci_intr_handle_t ih;
const char *intrstr = NULL;
/* Map I/O space */
if (pci_mapreg_map(pa, AMD8111_SMB_BASE, PCI_MAPREG_TYPE_IO, 0,
&sc->sc_iot, &sc->sc_ioh, NULL, &iosize, 0)) {
printf(": can't map i/o space\n");
return;
}
/* Read configuration */
conf = pci_conf_read(pa->pa_pc, pa->pa_tag, AMD8111_SMB_MISC);
DPRINTF((": conf 0x%08x", conf));
sc->sc_poll = 1;
if (conf & AMD8111_SMB_MISC_SCIEN) {
/* No PCI IRQ */
printf(": SCI");
} else if (conf & AMD8111_SMB_MISC_INTEN) {
/* Install interrupt handler */
if (pci_intr_map(pa, &ih) == 0) {
intrstr = pci_intr_string(pa->pa_pc, ih);
sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO,
amdiic_intr, sc, sc->sc_dev.dv_xname);
if (sc->sc_ih != NULL) {
printf(": %s", intrstr);
sc->sc_poll = 0;
}
}
if (sc->sc_poll)
printf(": polling");
}
printf("\n");
/* Attach I2C bus */
rw_init(&sc->sc_i2c_lock, "iiclk");
sc->sc_i2c_tag.ic_cookie = sc;
sc->sc_i2c_tag.ic_acquire_bus = amdiic_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = amdiic_i2c_release_bus;
sc->sc_i2c_tag.ic_exec = amdiic_i2c_exec;
bzero(&iba, sizeof(iba));
iba.iba_name = "iic";
iba.iba_tag = &sc->sc_i2c_tag;
config_found(self, &iba, iicbus_print);
return;
}
示例5: mfi_pci_attach
void
mfi_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct mfi_softc *sc = (struct mfi_softc *)self;
struct pci_attach_args *pa = aux;
const struct mfi_pci_device *mpd;
pci_intr_handle_t ih;
bus_size_t size;
pcireg_t reg;
int regbar;
mpd = mfi_pci_find_device(pa);
if (mpd == NULL) {
printf(": can't find matching pci device\n");
return;
}
if (mpd->mpd_iop == MFI_IOP_GEN2 || mpd->mpd_iop == MFI_IOP_SKINNY)
regbar = MFI_BAR_GEN2;
else
regbar = MFI_BAR;
reg = pci_mapreg_type(pa->pa_pc, pa->pa_tag, regbar);
if (pci_mapreg_map(pa, regbar, reg, 0,
&sc->sc_iot, &sc->sc_ioh, NULL, &size, MFI_PCI_MEMSIZE)) {
printf(": can't map controller pci space\n");
return;
}
sc->sc_dmat = pa->pa_dmat;
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
goto unmap;
}
printf(": %s\n", pci_intr_string(pa->pa_pc, ih));
sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, mfi_intr, sc,
sc->sc_dev.dv_xname);
if (!sc->sc_ih) {
printf("%s: can't establish interrupt\n", DEVNAME(sc));
goto unmap;
}
if (mfi_attach(sc, mpd->mpd_iop)) {
printf("%s: can't attach\n", DEVNAME(sc));
goto unintr;
}
return;
unintr:
pci_intr_disestablish(pa->pa_pc, sc->sc_ih);
sc->sc_ih = NULL;
unmap:
bus_space_unmap(sc->sc_iot, sc->sc_ioh, size);
}
示例6: ral_pci_attach
void
ral_pci_attach(device_t parent, device_t self, void *aux)
{
struct ral_pci_softc *psc = device_private(self);
struct rt2560_softc *sc = &psc->sc_sc;
const struct pci_attach_args *pa = aux;
const char *intrstr;
bus_addr_t base;
pci_intr_handle_t ih;
pcireg_t reg;
int error;
pci_aprint_devinfo(pa, NULL);
psc->sc_opns = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RALINK_RT2560) ?
&ral_rt2560_opns : &ral_rt2661_opns;
sc->sc_dev = self;
sc->sc_dmat = pa->pa_dmat;
psc->sc_pc = pa->pa_pc;
/* enable the appropriate bits in the PCI CSR */
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, reg);
/* map control/status registers */
error = pci_mapreg_map(pa, RAL_PCI_BAR0, PCI_MAPREG_TYPE_MEM |
PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_st, &sc->sc_sh, &base,
&psc->sc_mapsize);
if (error != 0) {
aprint_error(": could not map memory space\n");
return;
}
if (pci_intr_map(pa, &ih) != 0) {
aprint_error(": could not map interrupt\n");
return;
}
intrstr = pci_intr_string(psc->sc_pc, ih);
psc->sc_ih = pci_intr_establish(psc->sc_pc, ih, IPL_NET,
psc->sc_opns->intr, sc);
if (psc->sc_ih == NULL) {
aprint_error(": could not establish interrupt");
if (intrstr != NULL)
aprint_error(" at %s", intrstr);
aprint_error("\n");
return;
}
aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
(*psc->sc_opns->attach)(sc, PCI_PRODUCT(pa->pa_id));
}
示例7: pgt_pci_attach
void
pgt_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct pgt_pci_softc *psc = (struct pgt_pci_softc *)self;
struct pgt_softc *sc = &psc->sc_pgt;
struct pci_attach_args *pa = aux;
const char *intrstr = NULL;
pci_intr_handle_t ih;
int error;
sc->sc_dmat = pa->pa_dmat;
psc->sc_pc = pa->pa_pc;
/* remember chipset */
if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTERSIL_ISL3877)
sc->sc_flags |= SC_ISL3877;
/* map control / status registers */
error = pci_mapreg_map(pa, PGT_PCI_BAR0,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_iotag, &sc->sc_iohandle, NULL, &psc->sc_mapsize, 0);
if (error != 0) {
printf(": can't map mem space\n");
return;
}
/* map interrupt */
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
return;
}
/* disable all interrupts */
bus_space_write_4(sc->sc_iotag, sc->sc_iohandle, PGT_REG_INT_EN, 0);
(void)bus_space_read_4(sc->sc_iotag, sc->sc_iohandle, PGT_REG_INT_EN);
DELAY(PGT_WRITEIO_DELAY);
/* establish interrupt */
intrstr = pci_intr_string(psc->sc_pc, ih);
psc->sc_ih = pci_intr_establish(psc->sc_pc, ih, IPL_NET, pgt_intr, sc,
sc->sc_dev.dv_xname);
if (psc->sc_ih == NULL) {
printf(": can't establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
return;
}
printf(": %s\n", intrstr);
if (rootvp == NULL)
mountroothook_establish(pgt_attach, sc);
else
pgt_attach(sc);
}
示例8: rtsx_pci_attach
void
rtsx_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct rtsx_pci_softc *sc = (struct rtsx_pci_softc *)self;
struct pci_attach_args *pa = aux;
pci_intr_handle_t ih;
char const *intrstr;
bus_space_tag_t iot;
bus_space_handle_t ioh;
bus_size_t size;
int flags;
if ((pci_conf_read(pa->pa_pc, pa->pa_tag, RTSX_CFG_PCI)
& RTSX_CFG_ASIC) != 0) {
printf("%s: no asic\n", sc->sc.sc_dev.dv_xname);
return;
}
if (pci_intr_map_msi(pa, &ih) && pci_intr_map(pa, &ih)) {
printf(": can't map interrupt\n");
return;
}
intrstr = pci_intr_string(pa->pa_pc, ih);
sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_SDMMC,
rtsx_intr, sc, sc->sc.sc_dev.dv_xname);
if (sc->sc_ih == NULL) {
printf(": can't establish interrupt\n");
return;
}
printf(": %s\n", intrstr);
if (pci_mem_find(pa->pa_pc, pa->pa_tag, RTSX_PCI_BAR,
NULL, NULL, NULL) != 0) {
printf("%s: can't find registers\n", sc->sc.sc_dev.dv_xname);
return;
}
if (pci_mapreg_map(pa, RTSX_PCI_BAR, PCI_MAPREG_TYPE_MEM, 0,
&iot, &ioh, NULL, &size, 0)) {
printf("%s: can't map registers\n", sc->sc.sc_dev.dv_xname);
return;
}
pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RTS5209)
flags = RTSX_F_5209;
else
flags = RTSX_F_5229;
if (rtsx_attach(&sc->sc, iot, ioh, size, pa->pa_dmat, flags) != 0)
printf("%s: can't initialize chip\n", sc->sc.sc_dev.dv_xname);
}
示例9: bwi_pci_attach
void
bwi_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct bwi_pci_softc *psc = (struct bwi_pci_softc *)self;
struct pci_attach_args *pa = aux;
struct bwi_softc *sc = &psc->psc_bwi;
const char *intrstr = NULL;
pci_intr_handle_t ih;
pcireg_t memtype, reg;
sc->sc_dmat = pa->pa_dmat;
psc->psc_pc = pa->pa_pc;
psc->psc_pcitag = pa->pa_tag;
/* map control / status registers */
memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, BWI_PCI_BAR0);
if (pci_mapreg_map(pa, BWI_PCI_BAR0, memtype, 0, &sc->sc_mem_bt,
&sc->sc_mem_bh, NULL, &psc->psc_mapsize, 0)) {
printf(": can't map mem space\n");
return;
}
/* map interrupt */
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
return;
}
/* establish interrupt */
intrstr = pci_intr_string(psc->psc_pc, ih);
psc->psc_ih = pci_intr_establish(psc->psc_pc, ih, IPL_NET, bwi_intr, sc,
sc->sc_dev.dv_xname);
if (psc->psc_ih == NULL) {
printf(": can't establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
return;
}
printf(": %s", intrstr);
/* we need to access PCI config space from the driver */
sc->sc_conf_write = bwi_pci_conf_write;
sc->sc_conf_read = bwi_pci_conf_read;
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
sc->sc_pci_revid = PCI_REVISION(pa->pa_class);
sc->sc_pci_did = PCI_PRODUCT(pa->pa_id);
sc->sc_pci_subvid = PCI_VENDOR(reg);
sc->sc_pci_subdid = PCI_PRODUCT(reg);
bwi_attach(sc);
}
示例10: ahci_pci_attach
static void
ahci_pci_attach(device_t parent, device_t self, void *aux)
{
struct pci_attach_args *pa = aux;
struct ahci_pci_softc *psc = device_private(self);
struct ahci_softc *sc = &psc->ah_sc;
bus_size_t size;
char devinfo[256];
const char *intrstr;
pci_intr_handle_t intrhandle;
void *ih;
sc->sc_atac.atac_dev = self;
if (pci_mapreg_map(pa, AHCI_PCI_ABAR,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_ahcit, &sc->sc_ahcih, NULL, &size) != 0) {
aprint_error_dev(self, "can't map ahci registers\n");
return;
}
psc->sc_pc = pa->pa_pc;
psc->sc_pcitag = pa->pa_tag;
pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
aprint_naive(": AHCI disk controller\n");
aprint_normal(": %s\n", devinfo);
if (pci_intr_map(pa, &intrhandle) != 0) {
aprint_error("%s: couldn't map interrupt\n", AHCINAME(sc));
return;
}
intrstr = pci_intr_string(pa->pa_pc, intrhandle);
ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, ahci_intr, sc);
if (ih == NULL) {
aprint_error("%s: couldn't establish interrupt", AHCINAME(sc));
return;
}
aprint_normal("%s: interrupting at %s\n", AHCINAME(sc),
intrstr ? intrstr : "unknown interrupt");
sc->sc_dmat = pa->pa_dmat;
if (PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_RAID) {
AHCIDEBUG_PRINT(("%s: RAID mode\n", AHCINAME(sc)), DEBUG_PROBE);
sc->sc_atac_capflags = ATAC_CAP_RAID;
} else {
AHCIDEBUG_PRINT(("%s: SATA mode\n", AHCINAME(sc)), DEBUG_PROBE);
}
ahci_attach(sc);
if (!pmf_device_register(self, NULL, ahci_pci_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
}
示例11: puc_pci_intr_establish
void *
puc_pci_intr_establish(struct puc_attach_args *paa, int type,
int (*func)(void *), void *arg, char *name)
{
struct puc_pci_softc *sc = paa->puc;
struct puc_softc *psc = &sc->sc_psc;
psc->sc_ports[paa->port].intrhand =
pci_intr_establish(sc->pc, sc->ih, type, func, arg, name);
return (psc->sc_ports[paa->port].intrhand);
}
示例12: mtd_pci_attach
static void
mtd_pci_attach(device_t parent, device_t self, void *aux)
{
struct pci_attach_args * const pa = aux;
struct mtd_softc * const sc = device_private(self);
pci_intr_handle_t ih;
const char *intrstring = NULL;
bus_space_tag_t iot, memt;
bus_space_handle_t ioh, memh;
int io_valid, mem_valid;
sc->dev = self;
pci_aprint_devinfo(pa, NULL);
io_valid = (pci_mapreg_map(pa, PCI_IO_MAP_REG, PCI_MAPREG_TYPE_IO,
0, &iot, &ioh, NULL, NULL) == 0);
mem_valid = (pci_mapreg_map(pa, PCI_MEM_MAP_REG, PCI_MAPREG_TYPE_MEM
| PCI_MAPREG_MEM_TYPE_32BIT, 0, &memt, &memh,
NULL, NULL) == 0);
if (mem_valid) {
sc->bus_tag = memt;
sc->bus_handle = memh;
} else if (io_valid) {
sc->bus_tag = iot;
sc->bus_handle = ioh;
} else {
aprint_error_dev(sc->dev, "could not map memory or i/o space\n");
return;
}
sc->dma_tag = pa->pa_dmat;
/* Do generic attach. Seems this must be done before setting IRQ */
mtd_config(sc);
if (pci_intr_map(pa, &ih)) {
aprint_error_dev(sc->dev, "could not map interrupt\n");
return;
}
intrstring = pci_intr_string(pa->pa_pc, ih);
if (pci_intr_establish(pa->pa_pc, ih, IPL_NET, mtd_irq_h, sc) == NULL) {
aprint_error_dev(sc->dev, "could not establish interrupt");
if (intrstring != NULL)
aprint_error(" at %s", intrstring);
aprint_error("\n");
return;
} else {
aprint_normal_dev(sc->dev, "using %s for interrupt\n",
intrstring ? intrstring : "unknown interrupt");
}
}
示例13: ahci_map_intr
int
ahci_map_intr(struct ahci_pci_softc *psc, struct pci_attach_args *pa,
pci_intr_handle_t ih)
{
struct ahci_softc *sc = &psc->psc_ahci;
sc->sc_ih = pci_intr_establish(psc->psc_pc, ih, IPL_BIO,
ahci_intr, sc, DEVNAME(sc));
if (sc->sc_ih == NULL) {
printf("%s: unable to map interrupt\n", DEVNAME(sc));
return (1);
}
return (0);
}
示例14: fdc_sableio_attach
void
fdc_sableio_attach(device_t parent, device_t self, void *aux)
{
struct fdc_sableio_softc *sfdc = device_private(self);
struct fdc_softc *fdc = &sfdc->sc_fdc;
struct sableio_attach_args *sa = aux;
const char *intrstr;
char buf[PCI_INTRSTR_LEN];
aprint_normal("\n");
fdc->sc_dev = self;
fdc->sc_iot = sa->sa_iot;
fdc->sc_ic = sa->sa_ic;
fdc->sc_drq = sa->sa_drq;
if (bus_space_map(fdc->sc_iot, sa->sa_ioaddr, 6 /* FDC_NPORT */, 0,
&sfdc->sc_baseioh)) {
aprint_error_dev(self, "unable to map I/O space\n");
return;
}
if (bus_space_subregion(fdc->sc_iot, sfdc->sc_baseioh, 2, 4,
&fdc->sc_ioh)) {
aprint_error_dev(self, "unable to subregion I/O space\n");
return;
}
if (bus_space_map(fdc->sc_iot, sa->sa_ioaddr + fdctl + 2, 1, 0,
&fdc->sc_fdctlioh)) {
aprint_error_dev(self, "unable to map CTL I/O space\n");
return;
}
intrstr = pci_intr_string(sa->sa_pc, sa->sa_sableirq[0],
buf, sizeof(buf));
fdc->sc_ih = pci_intr_establish(sa->sa_pc, sa->sa_sableirq[0],
IPL_BIO, fdcintr, fdc);
if (fdc->sc_ih == NULL) {
aprint_error_dev(self, "unable to establish interrupt");
if (intrstr != NULL)
aprint_error(" at %s", intrstr);
aprint_error("\n");
return;
}
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
fdcattach(fdc);
}
示例15: atw_pci_resume
static bool
atw_pci_resume(device_t self, const pmf_qual_t *qual)
{
struct atw_pci_softc *psc = device_private(self);
struct atw_softc *sc = &psc->psc_atw;
/* Establish the interrupt. */
psc->psc_intrcookie = pci_intr_establish(psc->psc_pc, psc->psc_ih,
IPL_NET, atw_intr, sc);
if (psc->psc_intrcookie == NULL) {
aprint_error_dev(sc->sc_dev, "unable to establish interrupt\n");
return false;
}
return true;
}