当前位置: 首页>>代码示例>>C++>>正文


C++ pmf_device_register函数代码示例

本文整理汇总了C++中pmf_device_register函数的典型用法代码示例。如果您正苦于以下问题:C++ pmf_device_register函数的具体用法?C++ pmf_device_register怎么用?C++ pmf_device_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pmf_device_register函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: md_attach

static void
md_attach(device_t parent, device_t self,
          void *aux)
{
    struct md_softc *sc = device_private(self);

    bufq_alloc(&sc->sc_buflist, "fcfs", 0);

    /* XXX - Could accept aux info here to set the config. */
#ifdef	MEMORY_DISK_HOOKS
    /*
     * This external function might setup a pre-loaded disk.
     * All it would need to do is setup the md_conf struct.
     * See sys/dev/md_root.c for an example.
     */
    md_attach_hook(device_unit(self), &sc->sc_md);
#endif

    /*
     * Initialize and attach the disk structure.
     */
    disk_init(&sc->sc_dkdev, device_xname(self), &mddkdriver);
    disk_attach(&sc->sc_dkdev);

    if (!pmf_device_register(self, NULL, NULL))
        aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:27,代码来源:md.c

示例2: uipad_attach

void
uipad_attach(device_t parent, device_t self, void *aux)
{
    struct uipad_softc *sc = device_private(self);
    struct usb_attach_arg *uaa = aux;
    struct usbd_device *	dev = uaa->uaa_device;
    char			*devinfop;

    DPRINTFN(10,("uipad_attach: sc=%p\n", sc));

    sc->sc_dev = self;
    sc->sc_udev = dev;

    aprint_naive("\n");
    aprint_normal("\n");

    devinfop = usbd_devinfo_alloc(dev, 0);
    aprint_normal_dev(self, "%s\n", devinfop);
    usbd_devinfo_free(devinfop);

    uipad_charge(sc);

    DPRINTFN(10, ("uipad_attach: %p\n", sc->sc_udev));

    if (!pmf_device_register(self, NULL, NULL))
        aprint_error_dev(self, "couldn't establish power handler\n");

    usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
    return;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:30,代码来源:uipad.c

示例3: fujitsu_hk_attach

static void
fujitsu_hk_attach(device_t parent, device_t self, void *aux)
{
    struct fujitsu_hk_softc *sc = device_private(self);
    struct acpi_attach_args *aa = aux;
    struct acpi_devnode *ad = aa->aa_node;
    int i;

    aprint_naive(": Fujitsu Hotkeys\n");
    aprint_normal(": Fujitsu Hotkeys\n");

    sc->sc_dev = self;
    sc->sc_node = ad;
    sc->sc_log = NULL;
    sc->sc_caps = fujitsu_hk_capabilities(ad);

    mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE);

    for (i = 0; i < FUJITSU_HK_PSW_COUNT; i++) {
        (void)snprintf(sc->sc_smpsw_name[i],
                       sizeof(sc->sc_smpsw_name[i]), "%s-%d",
                       device_xname(self), i);
        sc->sc_smpsw[i].smpsw_name = sc->sc_smpsw_name[i];
        sc->sc_smpsw[i].smpsw_type = PSWITCH_TYPE_HOTKEY;
        (void)sysmon_pswitch_register(&sc->sc_smpsw[i]);
    }

    fujitsu_hk_sysctl_setup(sc);

    (void)pmf_device_register(self, fujitsu_hk_suspend, fujitsu_hk_resume);
    (void)acpi_register_notify(sc->sc_node, fujitsu_hk_notify_handler);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:32,代码来源:fujhk_acpi.c

示例4: wzero3ssp_attach

static void
wzero3ssp_attach(device_t parent, device_t self, void *aux)
{
	struct wzero3ssp_softc *sc = device_private(self);

	sc->sc_dev = self;
	wzero3ssp_sc = sc;

	aprint_normal("\n");
	aprint_naive("\n");

	sc->sc_model = wzero3ssp_lookup();
	if (sc->sc_model == NULL) {
		aprint_error_dev(self, "unknown model\n");
		return;
	}

	mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_TTY);

	sc->sc_iot = &pxa2x0_bs_tag;
	if (bus_space_map(sc->sc_iot, sc->sc_model->sspaddr, PXA2X0_SSP_SIZE, 0,
	     &sc->sc_ioh)) {
		aprint_error_dev(sc->sc_dev, "can't map bus space\n");
		return;
	}

	if (!pmf_device_register(sc->sc_dev, NULL, wzero3ssp_resume))
		aprint_error_dev(sc->sc_dev,
		    "couldn't establish power handler\n");

	wzero3ssp_init(sc);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:32,代码来源:wzero3_ssp.c

示例5: nsphyattach

static void
nsphyattach(device_t parent, device_t self, void *aux)
{
	struct mii_softc *sc = device_private(self);
	struct mii_attach_args *ma = aux;
	struct mii_data *mii = ma->mii_data;
	const struct mii_phydesc *mpd;

	mpd = mii_phy_match(ma, nsphys);
	aprint_naive(": Media interface\n");
	aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));

	sc->mii_dev = self;
	sc->mii_inst = mii->mii_instance;
	sc->mii_phy = ma->mii_phyno;
	sc->mii_funcs = &nsphy_funcs;
	sc->mii_pdata = mii;
	sc->mii_flags = ma->mii_flags;
	sc->mii_anegticks = MII_ANEGTICKS;

	PHY_RESET(sc);

	sc->mii_capabilities =
	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
	aprint_normal_dev(self, "");
	if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
		aprint_error("no media present");
	else
		mii_phy_add_media(sc);
	aprint_normal("\n");

	if (!pmf_device_register(self, NULL, mii_phy_resume))
		aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:34,代码来源:nsphy.c

示例6: fdcattach

void
fdcattach(struct fdc_softc *fdc)
{
	mutex_init(&fdc->sc_mtx, MUTEX_DEFAULT, IPL_BIO);
	cv_init(&fdc->sc_cv, "fdcwakeup");
	callout_init(&fdc->sc_timo_ch, 0);
	callout_init(&fdc->sc_intr_ch, 0);

	fdc->sc_state = DEVIDLE;
	TAILQ_INIT(&fdc->sc_drives);

	fdc->sc_maxiosize = isa_dmamaxsize(fdc->sc_ic, fdc->sc_drq);

	if (isa_drq_alloc(fdc->sc_ic, fdc->sc_drq) != 0) {
		aprint_normal_dev(fdc->sc_dev, "can't reserve drq %d\n",
		    fdc->sc_drq);
		return;
	}

	if (isa_dmamap_create(fdc->sc_ic, fdc->sc_drq, fdc->sc_maxiosize,
	    BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) {
		aprint_normal_dev(fdc->sc_dev, "can't set up ISA DMA map\n");
		return;
	}

	config_interrupts(fdc->sc_dev, fdcfinishattach);

	if (!pmf_device_register(fdc->sc_dev, fdcsuspend, fdcresume)) {
		aprint_error_dev(fdc->sc_dev,
		    "cannot set power mgmt handler\n");
	}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:32,代码来源:fd.c

示例7: pwdog_attach

void
pwdog_attach(device_t parent, device_t self, void *aux)
{
	struct pwdog_softc *sc = device_private(self);
	struct pci_attach_args *const pa = (struct pci_attach_args *)aux;
	pcireg_t memtype;

	memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START);
	if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &sc->sc_iot,
	    &sc->sc_ioh, NULL, &sc->sc_iosize)) {
		aprint_error("\n");
		aprint_error_dev(self, "PCI %s region not found\n",
		    memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory");
		return;
	}
	printf("\n");

	sc->sc_dev = self;

	pmf_device_register(self, pwdog_suspend, pwdog_resume);
	bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0);

	sc->sc_smw.smw_name = device_xname(self);
	sc->sc_smw.smw_cookie = sc;
	sc->sc_smw.smw_setmode = pwdog_setmode;
	sc->sc_smw.smw_tickle = pwdog_tickle;
	sc->sc_smw.smw_period = PWDOG_MAX_PERIOD;

	if (sysmon_wdog_register(&sc->sc_smw))
		aprint_error_dev(self, "couldn't register with sysmon\n");
	else
		sc->sc_smw_valid = true;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:33,代码来源:pwdog.c

示例8: atabus_attach

/*
 * atabus_attach:
 *
 *	Autoconfiguration attach routine.
 */
static void
atabus_attach(device_t parent, device_t self, void *aux)
{
	struct atabus_softc *sc = device_private(self);
	struct ata_channel *chp = aux;
	struct atabus_initq *initq;
	int error;

	sc->sc_chan = chp;

	aprint_normal("\n");
	aprint_naive("\n");

	sc->sc_dev = self;

	if (ata_addref(chp))
		return;

	RUN_ONCE(&ata_init_ctrl, atabus_init);

	initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
	initq->atabus_sc = sc;
	TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq);
	config_pending_incr(sc->sc_dev);

	if ((error = kthread_create(PRI_NONE, 0, NULL, atabus_thread, sc,
	    &chp->ch_thread, "%s", device_xname(self))) != 0)
		aprint_error_dev(self,
		    "unable to create kernel thread: error %d\n", error);

	if (!pmf_device_register(self, atabus_suspend, atabus_resume))
		aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:goroutines,项目名称:rumprun,代码行数:38,代码来源:ata.c

示例9: asus_attach

static void
asus_attach(device_t parent, device_t self, void *opaque)
{
	asus_softc_t *sc = device_private(self);
	struct acpi_attach_args *aa = opaque;
	ACPI_STATUS rv;

	sc->sc_node = aa->aa_node;
	sc->sc_dev = self;

	aprint_naive("\n");
	aprint_normal("\n");

	asus_init(self);

	sc->sc_smpsw_valid = true;
	sc->sc_smpsw[ASUS_PSW_DISPLAY_CYCLE].smpsw_name =
	    PSWITCH_HK_DISPLAY_CYCLE;
	sc->sc_smpsw[ASUS_PSW_DISPLAY_CYCLE].smpsw_type =
	    PSWITCH_TYPE_HOTKEY;
	if (sysmon_pswitch_register(&sc->sc_smpsw[ASUS_PSW_DISPLAY_CYCLE])) {
		aprint_error_dev(self, "couldn't register with sysmon\n");
		sc->sc_smpsw_valid = false;
	}

	rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle, ACPI_ALL_NOTIFY,
	    asus_notify_handler, sc);
	if (ACPI_FAILURE(rv))
		aprint_error_dev(self, "couldn't install notify handler: %s\n",
		    AcpiFormatException(rv));

	if (!pmf_device_register(self, asus_suspend, asus_resume))
		aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:34,代码来源:asus_acpi.c

示例10: btkbd_attach

static void
btkbd_attach(device_t parent, device_t self, void *aux)
{
	struct btkbd_softc *sc = device_private(self);
	struct bthidev_attach_args *ba = aux;
	struct wskbddev_attach_args wska;
	const char *parserr;

	sc->sc_output = ba->ba_output;
	ba->ba_input = btkbd_input;

	parserr = btkbd_parse_desc(sc, ba->ba_id, ba->ba_desc, ba->ba_dlen);
	if (parserr != NULL) {
		aprint_error("%s\n", parserr);
		return;
	}

	aprint_normal("\n");

#ifdef WSDISPLAY_COMPAT_RAWKBD
#ifdef BTKBD_REPEAT
	callout_init(&sc->sc_repeat, 0);
	callout_setfunc(&sc->sc_repeat, btkbd_repeat, sc);
#endif
#endif

	wska.console = 0;
	wska.keymap = &btkbd_keymapdata;
	wska.accessops = &btkbd_accessops;
	wska.accesscookie = sc;

	sc->sc_wskbd = config_found(self, &wska, wskbddevprint);

	pmf_device_register(self, NULL, NULL);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:35,代码来源:btkbd.c

示例11: btnmgrattach

void
btnmgrattach(device_t parent,
	     device_t self, void *aux)
{
	int id;
	struct btnmgr_softc *sc = device_private(self);
	struct wskbddev_attach_args wa;

	printf("\n");

	/*
	 * install button event listener
	 */
	for (id = 0; id <= n_button_config; id++)
		if (button_config[id].name != NULL)
			sc->sc_hook_tag = config_hook(CONFIG_HOOK_BUTTONEVENT,
			    id, CONFIG_HOOK_SHARE,
			    btnmgr_hook, sc);

	/*
	 * attach wskbd
	 */
	wa.console = 0;
	wa.keymap = &btnmgr_keymapdata;
	wa.accessops = &btnmgr_wskbd_accessops;
	wa.accesscookie = sc;

	sc->sc_wskbddev = config_found(self, &wa, wskbddevprint);

	if (!pmf_device_register(self, NULL, NULL))
		aprint_error_dev(self, "unable to establish power handler\n");
}
开发者ID:goroutines,项目名称:rumprun,代码行数:32,代码来源:btnmgr.c

示例12: jmahci_attach

static void
jmahci_attach(device_t parent, device_t self, void *aux)
{
	struct jmahci_attach_args *jma = aux;
	const struct pci_attach_args *pa = jma->jma_pa;
	struct ahci_softc *sc = device_private(self);
	uint32_t ahci_cap;

	aprint_naive(": AHCI disk controller\n");
	aprint_normal("\n");

	sc->sc_atac.atac_dev = self;
	sc->sc_ahcit = jma->jma_ahcit;
	sc->sc_ahcih = jma->jma_ahcih;

	ahci_cap = AHCI_READ(sc, AHCI_CAP);

	if (pci_dma64_available(jma->jma_pa) && (ahci_cap & AHCI_CAP_64BIT))
		sc->sc_dmat = jma->jma_pa->pa_dmat64;
	else
		sc->sc_dmat = jma->jma_pa->pa_dmat;

	if (PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_RAID)
		sc->sc_atac_capflags = ATAC_CAP_RAID;

	ahci_attach(sc);

	if (!pmf_device_register(self, NULL, jmahci_resume))
	    aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:30,代码来源:jmide.c

示例13: ppbattach

static void
ppbattach(device_t parent, device_t self, void *aux)
{
	struct ppb_softc *sc = device_private(self);
	struct pci_attach_args *pa = aux;
	pci_chipset_tag_t pc = pa->pa_pc;
	struct pcibus_attach_args pba;
	pcireg_t busdata;

	pci_aprint_devinfo(pa, NULL);

	sc->sc_pc = pc;
	sc->sc_tag = pa->pa_tag;
	sc->sc_dev = self;

	busdata = pci_conf_read(pc, pa->pa_tag, PPB_REG_BUSINFO);

	if (PPB_BUSINFO_SECONDARY(busdata) == 0) {
		aprint_normal_dev(self, "not configured by system firmware\n");
		return;
	}

	ppb_fix_pcie(self);

#if 0
	/*
	 * XXX can't do this, because we're not given our bus number
	 * (we shouldn't need it), and because we've no way to
	 * decompose our tag.
	 */
	/* sanity check. */
	if (pa->pa_bus != PPB_BUSINFO_PRIMARY(busdata))
		panic("ppbattach: bus in tag (%d) != bus in reg (%d)",
		    pa->pa_bus, PPB_BUSINFO_PRIMARY(busdata));
#endif

	if (!pmf_device_register(self, ppb_suspend, ppb_resume))
		aprint_error_dev(self, "couldn't establish power handler\n");

	/*
	 * Attach the PCI bus than hangs off of it.
	 *
	 * XXX Don't pass-through Memory Read Multiple.  Should we?
	 * XXX Consult the spec...
	 */
	pba.pba_iot = pa->pa_iot;
	pba.pba_memt = pa->pa_memt;
	pba.pba_dmat = pa->pa_dmat;
	pba.pba_dmat64 = pa->pa_dmat64;
	pba.pba_pc = pc;
	pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
	pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
	pba.pba_sub = PPB_BUSINFO_SUBORDINATE(busdata);
	pba.pba_bridgetag = &sc->sc_tag;
	pba.pba_intrswiz = pa->pa_intrswiz;
	pba.pba_intrtag = pa->pa_intrtag;

	config_found_ia(self, "pcibus", &pba, pcibusprint);
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:59,代码来源:ppb.c

示例14: pckbdattach

void
pckbdattach(device_t parent, device_t self, void *aux)
{
	struct pckbd_softc *sc = device_private(self);
	struct pckbport_attach_args *pa = aux;
	struct wskbddev_attach_args a;
	int isconsole;
	u_char cmd[1];

	aprint_naive("\n");
	aprint_normal("\n");

	sc->sc_dev = self;
	isconsole = pckbd_is_console(pa->pa_tag, pa->pa_slot);

	if (isconsole) {
		sc->id = &pckbd_consdata;

		/*
		 * Some keyboards are not enabled after a reset,
		 * so make sure it is enabled now.
		 */
		cmd[0] = KBC_ENABLE;
		(void) pckbport_poll_cmd(sc->id->t_kbctag, sc->id->t_kbcslot,
				      cmd, 1, 0, 0, 0);
		sc->sc_enabled = 1;
	} else {
		sc->id = malloc(sizeof(struct pckbd_internal),
				M_DEVBUF, M_WAITOK);
		(void) pckbd_init(sc->id, pa->pa_tag, pa->pa_slot, 0);

		/* no interrupts until enabled */
		cmd[0] = KBC_DISABLE;
		(void) pckbport_poll_cmd(sc->id->t_kbctag, sc->id->t_kbcslot,
				      cmd, 1, 0, 0, 0);
		sc->sc_enabled = 0;
	}

	sc->id->t_sc = sc;

	pckbport_set_inputhandler(sc->id->t_kbctag, sc->id->t_kbcslot,
			       pckbd_input, sc, device_xname(sc->sc_dev));

	a.console = isconsole;

	a.keymap = &pckbd_keymapdata;

	a.accessops = &pckbd_accessops;
	a.accesscookie = sc;

	if (!pmf_device_register(self, pckbd_suspend, pckbd_resume))
		aprint_error_dev(self, "couldn't establish power handler\n");

	/*
	 * Attach the wskbd, saving a handle to it.
	 * XXX XXX XXX
	 */
	sc->sc_wskbddev = config_found_ia(self, "wskbddev", &a, wskbddevprint);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:59,代码来源:pckbd.c

示例15: tpm_isa_attach

static void
tpm_isa_attach(device_t parent, device_t self, void *aux)
{
	struct tpm_softc *sc = device_private(self);
	struct isa_attach_args *ia = aux;
	bus_addr_t iobase;
	bus_size_t size;
	int rv;

	sc->sc_dev = self;

	if (tpm_legacy_probe(ia->ia_iot, ia->ia_io[0].ir_addr)) {
		sc->sc_bt = ia->ia_iot;
		iobase = (unsigned int)ia->ia_io[0].ir_addr;
		size = ia->ia_io[0].ir_size;
		sc->sc_batm = ia->ia_iot;
		sc->sc_init = tpm_legacy_init;
		sc->sc_start = tpm_legacy_start;
		sc->sc_read = tpm_legacy_read;
		sc->sc_write = tpm_legacy_write;
		sc->sc_end = tpm_legacy_end;
	} else {
		sc->sc_bt = ia->ia_memt;
		iobase = (unsigned int)ia->ia_iomem[0].ir_addr;
		size = TPM_SIZE;
		sc->sc_init = tpm_tis12_init;
		sc->sc_start = tpm_tis12_start;
		sc->sc_read = tpm_tis12_read;
		sc->sc_write = tpm_tis12_write;
		sc->sc_end = tpm_tis12_end;
	}

	if (bus_space_map(sc->sc_bt, iobase, size, 0, &sc->sc_bh)) {
		aprint_error_dev(sc->sc_dev, "cannot map registers\n");
		return;
	}

	if ((rv = (*sc->sc_init)(sc, ia->ia_irq[0].ir_irq,
	    device_xname(sc->sc_dev))) != 0) {
		bus_space_unmap(sc->sc_bt, sc->sc_bh, size);
		return;
	}

	/*
	 * Only setup interrupt handler when we have a vector and the
	 * chip is TIS 1.2 compliant.
	 */
	if (sc->sc_init == tpm_tis12_init &&
	    ia->ia_irq[0].ir_irq != ISA_UNKNOWN_IRQ &&
	    (sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
	    IST_EDGE, IPL_TTY, tpm_intr, sc)) == NULL) {
		bus_space_unmap(sc->sc_bt, sc->sc_bh, TPM_SIZE);
		aprint_error_dev(sc->sc_dev, "cannot establish interrupt\n");
		return;
	}

	if (!pmf_device_register(sc->sc_dev, tpm_suspend, tpm_resume))
		aprint_error_dev(sc->sc_dev, "Cannot set power mgmt handler\n");
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:59,代码来源:tpm_isa.c


注:本文中的pmf_device_register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。