/** Unregister with DMA device core driver */ static void dma_setup_uninit(void) { struct dma_device_info* dma_dev=g_dma_device; if( dma_dev ) { dma_device_unregister(dma_dev); dma_device_release(dma_dev); } }
static int ifxmips_mii_remove(struct platform_device *dev) { struct ifxmips_mii_priv *priv = (struct ifxmips_mii_priv *)netdev_priv(ifxmips_mii0_dev); printk(KERN_INFO "ifxmips_mii0: ifxmips_mii0 cleanup\n"); dma_device_unregister(priv->dma_device); dma_device_release(priv->dma_device); kfree(priv->dma_device); unregister_netdev(ifxmips_mii0_dev); return 0; }
static void md5_final(void *ctx, u8 *out) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ struct md5_ctx *mctx = ctx; const unsigned int offset = mctx->byte_count & 0x3f; char *p = (char *) mctx->block + offset; int padding = 56 - (offset + 1); unsigned long flag; #ifndef ONLY_IN_MEM volatile struct deu_hash_t *hashs = (struct hash_t *) HASH_START; #else unsigned char *prin = NULL; struct deu_hash_t *hashs = NULL; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ hashs = (struct deu_hash_t *) kmalloc(sizeof(*hashs), GFP_KERNEL); memset(hashs, 0, sizeof(*hashs)); prin = (unsigned char *) hashs; #endif #ifdef DEBUG_MD5 printk("md5_final running\n"); //hexdump(mctx,sizeof(*mctx)); printk("block before and after transform\n"); hexdump(mctx->block, sizeof(mctx->block)); #endif //DEBUG_MD5 *p++ = 0x80; if(padding < 0) { memset(p, 0x00, padding + sizeof(u64)); md5_transform_helper(mctx); p = (char *) mctx->block; padding = 56; } memset(p, 0, padding); #ifdef DEBUG_MD5 hexdump(&mctx->byte_count, sizeof(mctx->byte_count)); #endif //DEBUG_MD5 mctx->block[14] = cpu_to_le32(mctx->byte_count << 3); mctx->block[15] = cpu_to_le32(mctx->byte_count >> 29); #ifdef DEBUG_MD5 hexdump(mctx->block, sizeof(mctx->block)); #endif //DEBUG_MD5 //le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - // sizeof(u64)) / sizeof(u32)); md5_transform(mctx->hash, mctx->block); local_irq_save(flag); #ifdef CONFIG_CRYPTO_DEV_DANUBE_DMA //wait for processing while(hashs->controlr.BSY) { // this will not take long } #endif *((u32 *) out + 0) = le32_to_cpu(hashs->D1R); *((u32 *) out + 1) = le32_to_cpu(hashs->D2R); *((u32 *) out + 2) = le32_to_cpu(hashs->D3R); *((u32 *) out + 3) = le32_to_cpu(hashs->D4R); hashs->controlr.SM = 0; // switch off again for next dma transfer /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifdef CONFIG_CRYPTO_DEV_DANUBE_DMA struct dma_device_info *dma_device; _ifx_deu_device *pDev = ifx_deu; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ dma_device = pDev->dma_device; //if(dma_device) dma_device_release(dma_device); if(dma_device) { dma_device_unregister(pDev->dma_device); dma_device_release(pDev->dma_device); } #endif //cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(u32)); //memcpy(out, mctx->hash, sizeof(mctx->hash)); local_irq_restore(flag); // Wipe context memset(mctx, 0, sizeof(*mctx)); }