Пример #1
0
static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
{
	struct ehci_qh		*qh;
	dma_addr_t		dma;

	qh = kzalloc(sizeof *qh, GFP_ATOMIC);
	if (!qh)
		goto done;
	qh->hw = (struct ehci_qh_hw *)
		dma_pool_alloc(ehci->qh_pool, flags, &dma);
	if (!qh->hw)
		goto fail;
	memset(qh->hw, 0, sizeof *qh->hw);
	qh->refcount = 1;
	qh->ehci = ehci;
	qh->qh_dma = dma;
	// INIT_LIST_HEAD (&qh->qh_list);
	INIT_LIST_HEAD (&qh->qtd_list);

	/* dummy td enables safe urb queuing */
	qh->dummy = ehci_qtd_alloc (ehci, flags);
	if (qh->dummy == NULL) {
		ehci_dbg (ehci, "no dummy td\n");
		goto fail1;
	}
done:
	return qh;
fail1:
	dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
fail:
	kfree(qh);
	return NULL;
}
static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
{
	struct ehci_qh		*qh;
	dma_addr_t		dma;

	qh = (struct ehci_qh *)
		dma_pool_alloc (ehci->qh_pool, flags, &dma);
	if (!qh)
		return qh;

	memset (qh, 0, sizeof *qh);
	kref_init(&qh->kref, qh_destroy);
	qh->ehci = ehci;
	qh->qh_dma = dma;
	// INIT_LIST_HEAD (&qh->qh_list);
	INIT_LIST_HEAD (&qh->qtd_list);

	/* dummy td enables safe urb queuing */
	qh->dummy = ehci_qtd_alloc (ehci, flags);
	if (qh->dummy == 0) {
		ehci_dbg (ehci, "no dummy td\n");
		dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
		qh = NULL;
	}
	return qh;
}
Пример #3
0
static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
{
    struct ehci_qh		*qh;
    //dma_addr_t		dma;

    void*		real;

    real = kmalloc( sizeof( struct ehci_qh ) + 32, MEMF_KERNEL | MEMF_CLEAR );
    qh = ( struct ehci_qh* )( ( (uint32)real + 32 ) & ~31 );

#if 0
    qh = (struct ehci_qh *)
         pci_pool_alloc (ehci->qh_pool, flags, &dma);
#endif
    if (!real)
        return real;

    memset (qh, 0, sizeof *qh);

    atomic_set(&qh->refcount, 1);
    qh->qh_real = real;
    // INIT_LIST_HEAD (&qh->qh_list);
    INIT_LIST_HEAD (&qh->qtd_list);

    /* dummy td enables safe urb queuing */
    qh->dummy = ehci_qtd_alloc (ehci, flags);
    if (qh->dummy == 0) {
        ehci_dbg (ehci, "no dummy td\n");
        kfree( qh->qh_real );
//		pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
        qh = 0;
    }
    return qh;
}
Пример #4
0
static struct ehci_qh *ehci_qh_alloc(struct ehci_hcd *ehci, gfp_t flags)
{
	struct ehci_qh *qh;
	dma_addr_t dma;

	dma = usb_malloc(sizeof(struct ehci_qh), flags);
	if (dma != 0)
		qh = (struct ehci_qh *)IO_ADDRESS(dma);
	else
		qh = (struct ehci_qh *)
		    dma_pool_alloc(ehci->qh_pool, flags, &dma);
	++g_debug_qH_allocated;
	if (qh == NULL) {
		panic("run out of i-ram for qH allocation\n");
		return qh;
	}

	memset(qh, 0, sizeof *qh);
	qh->refcount = 1;
	qh->ehci = ehci;
	qh->qh_dma = dma;
	INIT_LIST_HEAD(&qh->qtd_list);

	/* dummy td enables safe urb queuing */
	qh->dummy = ehci_qtd_alloc(ehci, flags);
	if (qh->dummy == NULL) {
		ehci_dbg(ehci, "no dummy td\n");
		dma_pool_free(ehci->qh_pool, qh, qh->qh_dma);
		qh = NULL;
	}
	return qh;
}
Пример #5
0
static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
{
	struct ehci_qh		*qh;
	dma_addr_t		dma;

	qh = (struct ehci_qh *)
		pci_pool_alloc (ehci->qh_pool, flags, &dma);
	if (!qh)
		return qh;

	memset (qh, 0, sizeof *qh);
	atomic_set (&qh->refcount, 1);
	qh->qh_dma = dma;
	// INIT_LIST_HEAD (&qh->qh_list);
	INIT_LIST_HEAD (&qh->qtd_list);

	/* dummy td enables safe urb queuing */
	qh->dummy = ehci_qtd_alloc (ehci, flags);
	if (qh->dummy == 0) {
		ehci_dbg (ehci, "no dummy td\n");
		pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
		qh = 0;
	}
	return qh;
}
Пример #6
0
static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
{
	struct ehci_qh		*qh;
	dma_addr_t		dma;

	qh = kzalloc(sizeof *qh, GFP_ATOMIC);
	if (!qh)
		goto done;
	qh->hw = (struct ehci_qh_hw *)
		dma_pool_alloc(ehci->qh_pool, flags, &dma);
/* tony.yu map between PHY addr & BUS addr */
#if defined(CONFIG_ARM) && (MP_USB_MSTAR==1)
	dma = BUS2PA(dma);
#endif
	if (!qh->hw)
		goto fail;
	memset(qh->hw, 0, sizeof *qh->hw);
	qh->refcount = 1;
	qh->ehci = ehci;
	qh->qh_dma = dma;
	// INIT_LIST_HEAD (&qh->qh_list);
	INIT_LIST_HEAD (&qh->qtd_list);

	/* dummy td enables safe urb queuing */
	qh->dummy = ehci_qtd_alloc (ehci, flags);
	if (qh->dummy == NULL) {
		ehci_dbg (ehci, "no dummy td\n");
		goto fail1;
	}
done:
	return qh;
fail1:
/* tony.yu map between PHY addr & BUS addr */
#if defined(CONFIG_ARM) && (MP_USB_MSTAR==1)
	qh->qh_dma = PA2BUS(qh->qh_dma);
#endif
	dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
fail:
	kfree(qh);
	return NULL;
}