Example #1
0
File: MPolUnit.c Project: 8l/csolve
void mpolunit(MPOL *p, MINT *coef, MPOL *q)
{ 
  register i;
  MINT *resco,rem;
  MPOL res;


  if (p->nterms==0) {
	mpolfree(q);
	mset(0,coef);
	return;
  };
  
  MINIT(&rem);
  MFREE(coef);
  MCOPY(&(p->coefs[0]),coef);
  for (i=1;i<p->nterms;i++)
	mgcd(coef,&(p->coefs[i]),coef);

  MPOLINIT(&res);

  res.nterms = p->nterms;
  POL_ALLOC(&res,p->nterms); 
  resco = res.coefs;
  for (i=0;i<p->nterms;i++){
	MINIT(resco);
	mdiv(&(p->coefs[i]),coef,(resco++),&rem);
	expocopy(MEXPO(p,i),MEXPO(&res,i));
  }
  mpolfree(q);
  MPOLMOVEFREE(&res,q);
  MFREE(&rem);
}
Example #2
0
void
si_gpio_handler_unregister(si_t *sih, void *gpioh)
{
	si_info_t *sii;
	gpioh_item_t *p, *n;

	sii = SI_INFO(sih);
	if (sih->ccrev < 11)
		return;

	ASSERT(sii->gpioh_head != NULL);
	if ((void*)sii->gpioh_head == gpioh) {
		sii->gpioh_head = sii->gpioh_head->next;
		MFREE(sii->osh, gpioh, sizeof(gpioh_item_t));
		return;
	} else {
		p = sii->gpioh_head;
		n = p->next;
		while (n) {
			if ((void*)n == gpioh) {
				p->next = n->next;
				MFREE(sii->osh, gpioh, sizeof(gpioh_item_t));
				return;
			}
			p = n;
			n = n->next;
		}
	}

	ASSERT(0); /* Not found in list */
}
static void
osl_timer(ulong data)
{
	osl_timer_t *t;

	t = (osl_timer_t *)data;

	ASSERT(t->set);

	if (t->periodic) {
#if defined(BCMJTAG) || defined(BCMSLTGT)
		t->timer.expires = jiffies + t->ms*HZ/1000*htclkratio;
#else
		t->timer.expires = jiffies + t->ms*HZ/1000;
#endif /* defined(BCMJTAG) || defined(BCMSLTGT) */
		add_timer(&t->timer);
		t->set = TRUE;
		t->fn(t->arg);
	} else {
		t->set = FALSE;
		t->fn(t->arg);
#ifdef BCMDBG
		if (t->name) {
			MFREE(NULL, t->name, strlen(t->name) + 1);
		}
#endif
		MFREE(NULL, t, sizeof(osl_timer_t));
	}

	return;
}
Example #4
0
/*
 * bcm_mpm_deinit() - de-initialize the whole memory pool system. This should only
 *                    be called after all memory pooled have been deleted.
 *
 * Parameters:
 *    mgr:     INPUT  Pointer to pool manager handle.
 *
 * Returns:
 *    BCME_OK  Memory pool manager successfully de-initialized.
 *    other    Indicated error occured during de-initialization.
 */
int BCMATTACHFN(bcm_mpm_deinit)(bcm_mpm_mgr_h *mgrp)
{
	bcm_mpm_mgr_h mgr;
	osl_t         *osh;

	/* Check parameters */
	if ((mgrp == NULL) || (*mgrp == NULL)) {
		return (BCME_BADARG);
	}

	mgr = *mgrp;
	osh = mgr->osh;

	/* Verify that all memory pools have been deleted. */
	if (mgr->npools != 0) {
		MPOOL_ERROR(("ERROR: %s: memory leak - npools(%d)\n",
		             __FUNCTION__, mgr->npools));

		return (BCME_BUSY);
	}

	/* Free the pre-allocated pool meta-data (bcm_mp_pool structs). */
	MFREE(osh, mgr->pool_objs, mgr->max_pools * sizeof(bcm_mp_pool_t));


	/* Free memory pool manager object. */
	MFREE(osh, mgr, sizeof(*mgr));

	*mgrp = NULL;
	return (BCME_OK);
}
Example #5
0
/* may be called with core in reset */
void
si_detach(si_t *sih)
{
	si_info_t *sii;
	uint idx;

	sii = SI_INFO(sih);

	if (sii == NULL)
		return;

	if (BUSTYPE(sih->bustype) == SI_BUS)
		for (idx = 0; idx < SI_MAXCORES; idx++)
			if (sii->common_info->regs[idx]) {
				REG_UNMAP(sii->common_info->regs[idx]);
				sii->common_info->regs[idx] = NULL;
			}


	if (1 == sii->common_info->attach_count--) {
		MFREE(sii->osh, sii->common_info, sizeof(si_common_info_t));
		common_info_alloced = NULL;
	}

#if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS)
	if (sii != &ksii)
#endif	/* !BCMBUSTYPE || (BCMBUSTYPE == SI_BUS) */
		MFREE(sii->osh, sii, sizeof(si_info_t));
}
Example #6
0
void
BCMATTACHFN(bcm_rpc_tp_detach)(rpc_tp_info_t * rpc_th)
{
	ASSERT(rpc_th);
	if (rpc_th->tx_flowctlq)
		MFREE(rpc_th->osh, rpc_th->tx_flowctlq, sizeof(struct spktq));

	MFREE(rpc_th->osh, rpc_th, sizeof(rpc_tp_info_t));
}
Example #7
0
/*
 * Description: This function is called during module load time. It
 *              opens communication channel to configure and start EMF.
 */
static int32 __init
emf_module_init(void)
{
	EMF_DEBUG("Loading EMF\n");

	/* Allocate EMF global data object */
	emf = MALLOC(NULL, sizeof(emf_struct_t));
	if (emf == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_info\n");
		return (FAILURE);
	}

	memset(emf, 0, sizeof(emf_struct_t));

	/* Create a Netlink socket in kernel-space */
#define NETLINK_EMFC 17
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, 0, emf_netlink_sock_cb,
	                                   NULL, THIS_MODULE);
#else
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, emf_netlink_sock_cb);
#endif

	if (emf->nl_sk == NULL)
	{
		EMF_ERROR("Netlink kernel socket create failed\n");
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	emf->lock = OSL_LOCK_CREATE("EMF Instance List");

	if (emf->lock == NULL)
	{
		EMF_ERROR("EMF instance list lock create failed\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
		sock_release(emf->nl_sk->sk_socket);
#else
		sock_release(emf->nl_sk->socket);
#endif
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	/* Call the common code global init function */
	if (emfc_module_init() != SUCCESS)
	{
		OSL_LOCK_DESTROY(emf->lock);
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	EMF_DEBUG("EMF Init done\n");

	return (SUCCESS);
}
Example #8
0
/*
 * EMFL Packet Counters/Statistics
 */
static int32
emf_stats_get(char *buf, char **start, off_t offset, int32 size,
              int32 *eof, void *data)
{
	emf_info_t *emfi = (emf_info_t *)data;
	emf_cfg_request_t *cfg;
	emf_stats_t *emfs;
	struct bcmstrbuf b;

	ASSERT(emfi);

	cfg = MALLOC(emfi->osh, sizeof(emf_cfg_request_t));
	if (cfg == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_cfg_request\n");
		return (FAILURE);
	}

	cfg->command_id = EMFCFG_CMD_EMF_STATS;
	cfg->oper_type = EMFCFG_OPER_TYPE_GET;
	cfg->size = sizeof(emf_stats_t);
	emfs = (emf_stats_t *)cfg->arg;

	emfc_cfg_request_process(emfi->emfci, cfg);
	if (cfg->status != EMFCFG_STATUS_SUCCESS)
	{
		EMF_ERROR("Unable to get the EMF stats\n");
		MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "McastDataPkts   McastDataFwd    McastFlooded    "
		    "McastDataSentUp McastDataDropped\n");
	bcm_bprintf(&b, "%-15d %-15d %-15d %-15d %d\n",
	            emfs->mcast_data_frames, emfs->mcast_data_fwd,
	            emfs->mcast_data_flooded, emfs->mcast_data_sentup,
	            emfs->mcast_data_dropped);
	bcm_bprintf(&b, "IgmpPkts        IgmpPktsFwd     "
		    "IgmpPktsSentUp  MFDBCacheHits   MFDBCacheMisses\n");
	bcm_bprintf(&b, "%-15d %-15d %-15d %-15d %d\n",
	            emfs->igmp_frames, emfs->igmp_frames_fwd,
	            emfs->igmp_frames_sentup, emfs->mfdb_cache_hits,
	            emfs->mfdb_cache_misses);
	MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));

	if (b.size == 0)
	{
		EMF_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
Example #9
0
static int32
igs_sdb_list(char *buf, char **start, off_t offset, int32 size,
             int32 *eof, void *data)
{
	igs_info_t *igs_info = (igs_info_t *)data;
	igs_cfg_request_t *cfg;
	igs_cfg_sdb_list_t *list;
	int32 i;
	struct bcmstrbuf b;

	ASSERT(igs_info);

	cfg = MALLOC(igs_info->osh, sizeof(igs_cfg_request_t));
	if (cfg == NULL)
	{
		IGS_ERROR("Out of memory allocating igs_cfg_request\n");
		return (FAILURE);
	}

	strcpy(cfg->inst_id, igs_info->inst_id);
	cfg->command_id = IGSCFG_CMD_IGSDB_LIST;
	cfg->oper_type = IGSCFG_OPER_TYPE_GET;
	cfg->size = sizeof(cfg->arg);
	list = (igs_cfg_sdb_list_t *)cfg->arg;

	igsc_cfg_request_process(igs_info->igsc_info, cfg);
	if (cfg->status != IGSCFG_STATUS_SUCCESS)
	{
		IGS_ERROR("Unable to get the IGSDB list\n");
		MFREE(igs_info->osh, cfg, sizeof(igs_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "Group           Members         Interface\n");

	for (i = 0; i < list->num_entries; i++)
	{
		bcm_bprintf(&b, "%08x        ", list->sdb_entry[i].mgrp_ip);
		bcm_bprintf(&b, "%08x        ", list->sdb_entry[i].mh_ip);
		bcm_bprintf(&b, "%s\n", list->sdb_entry[i].if_name);
	}
	MFREE(igs_info->osh, cfg, sizeof(igs_cfg_request_t));

	if (b.size == 0)
	{
		IGS_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
Example #10
0
static int32
emf_mfdb_list(char *buf, char **start, off_t offset, int32 size,
              int32 *eof, void *data)
{
	emf_info_t *emfi = (emf_info_t *)data;
	emf_cfg_request_t *cfg;
	struct bcmstrbuf b;
	emf_cfg_mfdb_list_t *list;
	int32 i;

	ASSERT(emfi);

	cfg = MALLOC(emfi->osh, sizeof(emf_cfg_request_t));
	if (cfg == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_cfg_request\n");
		return (FAILURE);
	}

	cfg->command_id = EMFCFG_CMD_MFDB_LIST;
	cfg->oper_type = EMFCFG_OPER_TYPE_GET;
	cfg->size = sizeof(cfg->arg);
	list = (emf_cfg_mfdb_list_t *)cfg->arg;

	emfc_cfg_request_process(emfi->emfci, cfg);
	if (cfg->status != EMFCFG_STATUS_SUCCESS)
	{
		EMF_ERROR("Unable to get the MFDB list\n");
		MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "Group           Interface      Pkts\n");

	for (i = 0; i < list->num_entries; i++)
	{
		bcm_bprintf(&b, "%08x        ", list->mfdb_entry[i].mgrp_ip);
		bcm_bprintf(&b, "%-15s", list->mfdb_entry[i].if_name);
		bcm_bprintf(&b, "%d\n", list->mfdb_entry[i].pkts_fwd);
	}
	MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));

	if (b.size == 0)
	{
		EMF_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
Example #11
0
void free_read_info(struct read_info** ri, int numseq)
{
	int i;
	
	for(i = 0; i < numseq;i++){
		if(ri[i]->cigar){
			MFREE(ri[i]->cigar);
		}
		
		if(ri[i]->md){
			MFREE(ri[i]->md);
		}
		
		if(ri[i]->labels){
			MFREE(ri[i]->labels);
		}
		if(ri[i]->name){
			MFREE(ri[i]->name);
		}
		
		if(ri[i]->seq){
			MFREE(ri[i]->seq);
		}
		if(ri[i]->qual){
			MFREE(ri[i]->qual );
		}
		
		MFREE(ri[i]);
	}
	MFREE(ri);
}
Example #12
0
/* Destroy all the objs in a cache, and release the mem back to the system.
 */
void
bcmcache_destroy(bcmcache_t *cachep)
{
	struct buffer *nextp;
	struct buffer *head;

	head = cachep->head;
	while (head) {
		nextp = head;
		head = head->next;
		MFREE(cachep->osh, nextp, sizeof(struct buffer) + cachep->obj_size);
	}

	MFREE(cachep->osh, cachep, sizeof(bcmcache_t));
}
void* bcmsdh_probe(osl_t *osh, void *dev, void *sdioh, void *adapter_info, uint bus_type,
	uint bus_num, uint slot_num)
{
	uint32 regs;
	bcmsdh_info_t *bcmsdh;
	uint32 vendevid;
	bcmsdh_os_info_t *bcmsdh_osinfo = NULL;

	bcmsdh = bcmsdh_attach(osh, sdioh, &regs);
	if (bcmsdh == NULL) {
		SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
		goto err;
	}
	bcmsdh_osinfo = MALLOC(osh, sizeof(bcmsdh_os_info_t));
	if (bcmsdh_osinfo == NULL) {
		SDLX_MSG(("%s: failed to allocate bcmsdh_os_info_t\n", __FUNCTION__));
		goto err;
	}
	bzero((char *)bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
	bcmsdh->os_cxt = bcmsdh_osinfo;
	bcmsdh_osinfo->sdioh = sdioh;
	bcmsdh_osinfo->dev = dev;
	osl_set_bus_handle(osh, bcmsdh);

#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
	if (dev && device_init_wakeup(dev, true) == 0)
		bcmsdh_osinfo->dev_wake_enabled = TRUE;
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */

#if defined(OOB_INTR_ONLY)
	spin_lock_init(&bcmsdh_osinfo->oob_irq_spinlock);
	/* Get customer specific OOB IRQ parametres: IRQ number as IRQ type */
	bcmsdh_osinfo->oob_irq_num = wifi_platform_get_irq_number(adapter_info,
		&bcmsdh_osinfo->oob_irq_flags);
	if  (bcmsdh_osinfo->oob_irq_num < 0) {
		SDLX_MSG(("%s: Host OOB irq is not defined\n", __FUNCTION__));
		goto err;
	}
#endif /* defined(BCMLXSDMMC) */

	/* Read the vendor/device ID from the CIS */
	vendevid = bcmsdh_query_device(bcmsdh);
	/* try to attach to the target device */
	bcmsdh_osinfo->context = drvinfo.probe((vendevid >> 16), (vendevid & 0xFFFF), bus_num,
		slot_num, 0, bus_type, (void *)regs, osh, bcmsdh);
	if (bcmsdh_osinfo->context == NULL) {
		SDLX_MSG(("%s: device attach failed\n", __FUNCTION__));
		goto err;
	}

	return bcmsdh;

	/* error handling */
err:
	if (bcmsdh != NULL)
		bcmsdh_detach(osh, bcmsdh);
	if (bcmsdh_osinfo != NULL)
		MFREE(osh, bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
	return NULL;
}
Example #14
0
/*
 * Initialize nonvolatile variable table from flash.
 * Return 0 on success, nonzero on error.
 */
static int
initvars_flash_sb(void *sbh, char **vars, uint *count)
{
	osl_t *osh = sb_osh(sbh);
	char devpath[SB_DEVPATH_BUFSZ];
	char *vp, *base;
	int err;

	ASSERT(vars);
	ASSERT(count);

	if ((err = sb_devpath(sbh, devpath, sizeof(devpath))))
		return err;

	base = vp = MALLOC(osh, VARS_MAX);
	ASSERT(vp);
	if (!vp)
		return BCME_NOMEM;

	if ((err = initvars_flash(osh, &vp, VARS_MAX, devpath)))
		goto err;

	err = initvars_table(osh, base, vp, vars, count);

err:	MFREE(osh, base, VARS_MAX);
	return err;
}
Example #15
0
void
rpc_osl_detach(rpc_osl_t *rpc_osh)
{
	if (rpc_osh) {
		MFREE(rpc_osh->osh, rpc_osh, sizeof(rpc_osl_t));
	}
}
Example #16
0
bool
spi_hw_detach(sdioh_info_t *sd)
{
	spih_info_t *si = (spih_info_t *)sd->controller;
	osl_t *osh = si->osh;
	spih_regs_t *regs = si->regs;
	spih_pciregs_t *pciregs = si->pciregs;

	sd_trace(("%s: enter\n", __FUNCTION__));

	SPIPCI_WREG(osh, &regs->spih_ctrl, 0x00000010);
	SPIPCI_WREG(osh, &regs->spih_gpio_ctrl, 0x00000000);	
	SPIPCI_WREG(osh, &regs->spih_int_mask, 0x00000000);	
	SPIPCI_WREG(osh, &regs->spih_hex_disp, 0x0000DEAF);
	SPIPCI_WREG(osh, &regs->spih_int_edge, 0x00000000);
	SPIPCI_WREG(osh, &regs->spih_int_pol, 0x00000000);
	SPIPCI_WREG(osh, &regs->spih_hex_disp, 0x0000DEAD);

	
	if (si->pciregs) {
		SPIPCI_WREG(osh, &pciregs->ICR, 0x00000000);
		spi_reg_unmap(osh, (uintptr)pciregs, sizeof(spih_pciregs_t));
	}
	spi_reg_unmap(osh, (uintptr)regs, sizeof(spih_regs_t));

	MFREE(osh, si, sizeof(spih_info_t));

	sd->controller = NULL;

	sd_trace(("%s: exit\n", __FUNCTION__));
	return TRUE;
}
Example #17
0
void testcrc32(void)
{
	uint j,k,l;
	uint8 *buf;
	uint len[CNBUFS];
	uint32 crcr;
	uint32 crc32tv[CNBUFS] =
		{0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};

	ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL);

	/* step through all possible alignments */
	for (l=0;l<=4;l++) {
		for (j=0; j<CNBUFS; j++) {
			len[j] = CLEN;
			for (k=0; k<len[j]; k++)
				*(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff;
		}

		for (j=0; j<CNBUFS; j++) {
			crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE);
			ASSERT(crcr == crc32tv[j]);
		}
	}

	MFREE(buf, CBUFSIZ*CNBUFS);
	return;
}
Example #18
0
/* Initialize hash table. Should be locked. */
int
BCMINITFN(_nvram_init)(void *sih)
{
	struct nvram_header *header;
	int ret;


	if (!(header = (struct nvram_header *) MALLOC(si_osh(sih), NVRAM_SPACE))) {
		printf("nvram_init: out of memory\n");
		return -12; /* -ENOMEM */
	}

#if 0
    if ((ret = _nvram_read(header)) == 0 &&
	    header->magic == NVRAM_MAGIC)
		nvram_rehash(header);
#else
// nvram_rehash - may corrupt correct header
	_nvram_read(header);
	if (header->magic != NVRAM_MAGIC)
		nvram_rehash(header);
#endif

	MFREE(si_osh(sih), header, NVRAM_SPACE);
	return ret;
}
Example #19
0
static void dwmac_desc_enh_release_tx_bufs( dwmac_common_context *self )
{
  volatile dwmac_desc_ext *p_enh     = (volatile dwmac_desc_ext *) self->dma_tx;
  const size_t             NUM_DESCS = (size_t) self->bsd_config->xbuf_count;
  unsigned int             i;


  assert( p_enh != NULL );

  for ( i = 0; i < NUM_DESCS; ++i ) {
    if ( p_enh[i].etx.des0_3.des1 != 0 ) {
      struct mbuf *dummy;

      assert( self->mbuf_addr_tx[i] != NULL );

      MFREE( self->mbuf_addr_tx[i], dummy );
      (void) dummy;
      memset( __DEVOLATILE( void *,
                            &p_enh[i].etx ), 0, sizeof( dwmac_desc_ext ) );
    }
  }

  self->dma_tx = (volatile dwmac_desc *) p_enh;
  DWMAC_COMMON_DSB();
}
Example #20
0
main(void)
{
	MINT io;
	int b, blk;
	int cplen;
	char *cp;

	while (1) {
		MINIT(&io);
		printf("base: ");
		scanf("%d",&b);
		printf("blanks: ");
		scanf("%d",&blk);
		m_in_b(&io,b,stdin,blk);
		printf("\nOutbase: ");
		scanf("%d",&b);
		printf("Outblanks: ");
		scanf("%d",&blk);
		printf("\nOut: "); m_out_b(&io,b,stdout,blk);
		putchar('\n');
		cp = htonm(&io);
		cplen = msize(&io);
		MFREE(&io);
		printf("cplen = %d\n",cplen);
		MINIT(&io);
		ntohm(&io,cp);
		free(cp);
		printf("To-Network-To-Host: "); m_out_b(&io,b,stdout,blk);
		putchar('\n');
		if (feof(stdin)) break;
	}
}
int
dhd_conf_attach(dhd_pub_t *dhd)
{
    dhd_conf_t *conf;

    CONFIG_TRACE(("%s: Enter\n", __FUNCTION__));

    if (dhd->conf != NULL) {
        printf("%s: config is attached before!\n", __FUNCTION__);
        return 0;
    }
    /* Allocate private bus interface state */
    if (!(conf = MALLOC(dhd->osh, sizeof(dhd_conf_t)))) {
        CONFIG_ERROR(("%s: MALLOC failed\n", __FUNCTION__));
        goto fail;
    }
    memset(conf, 0, sizeof(dhd_conf_t));

    dhd->conf = conf;

    return 0;

fail:
    if (conf != NULL)
        MFREE(dhd->osh, conf, sizeof(dhd_conf_t));
    return BCME_NOMEM;
}
Example #22
0
/* generic kernel variant of si_attach() */
si_t *
si_kattach(osl_t *osh)
{
	static bool ksii_attached = FALSE;

	if (!ksii_attached) {
		void *regs = REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE);

		if (si_doattach(&ksii, BCM4710_DEVICE_ID, osh, regs,
		                SI_BUS, NULL,
		                osh != SI_OSH ? &ksii.vars : NULL,
		                osh != SI_OSH ? &ksii.varsz : NULL) == NULL) {
			if (NULL != ksii.common_info)
				MFREE(osh, ksii.common_info, sizeof(si_common_info_t));
			SI_ERROR(("si_kattach: si_doattach failed\n"));
			REG_UNMAP(regs);
			return NULL;
		}
		REG_UNMAP(regs);

		/* save ticks normalized to ms for si_watchdog_ms() */
		if (PMUCTL_ENAB(&ksii.pub)) {
			/* based on 32KHz ILP clock */
			wd_msticks = 32;
		} else {
			wd_msticks = ALP_CLOCK / 1000;
		}

		ksii_attached = TRUE;
		SI_MSG(("si_kattach done. ccrev = %d, wd_msticks = %d\n",
		        ksii.pub.ccrev, wd_msticks));
	}

	return &ksii.pub;
}
Example #23
0
void
BCMINITFN(_nvram_free)(struct nvram_tuple *t)
{
	if (t)
		MFREE(NULL, t, sizeof(struct nvram_tuple) + strlen(t->name) + 1 +
		      strlen(t->value) + 1);
}
Example #24
0
static int32
emf_iflist_del(emf_struct_t *emf, emf_info_t *emfi, struct net_device *if_ptr)
{
	emf_iflist_t *ptr, *prev;

	OSL_LOCK(emf->lock);

	if ((ptr = emf_iflist_find(emf, emfi, if_ptr, &prev)) != NULL)
	{
		/* Delete the entry from iflist */
		if (prev != NULL)
			prev->next = ptr->next;
		else
			emfi->iflist_head = ptr->next;

		MFREE(emfi->osh, ptr, sizeof(emf_iflist_t));

		OSL_UNLOCK(emf->lock);
		return (SUCCESS);
	}

	OSL_UNLOCK(emf->lock);

	return (FAILURE);
}
Example #25
0
struct vmm_mbuf *m_free(struct vmm_mbuf *m)
{
	struct vmm_mbuf *n;

	MFREE(m, n);
	return (n);
}
void
bcm_xtlv_buf_free(void *osh, struct bcm_tlvbuf *tbuf)
{
	if (tbuf == NULL)
		return;
	MFREE(osh, tbuf, (tbuf->size + sizeof(struct bcm_tlvbuf)));
}
Example #27
0
void
dhd_conf_detach(dhd_pub_t *dhd)
{
	if (dhd->conf)
		MFREE(dhd->osh, dhd->conf, sizeof(dhd_conf_t));
	dhd->conf = NULL;
}
Example #28
0
/* !! may be called with core in reset */
static void
_dma_detach(dma_info_t *di)
{
	if (di == NULL)
		return;

	DMA_TRACE(("%s: dma_detach\n", di->name));

	/* shouldn't be here if descriptors are unreclaimed */
	ASSERT(di->txin == di->txout);
	ASSERT(di->rxin == di->rxout);

	/* free dma descriptor rings */
	if (DMA64_ENAB(di)) {
		if (di->txd64)
			DMA_FREE_CONSISTENT(di->osh, ((int8*)(uintptr)di->txd64 - di->txdalign),
			                    di->txdalloc, (di->txdpa - di->txdalign), &di->tx_dmah);
		if (di->rxd64)
			DMA_FREE_CONSISTENT(di->osh, ((int8*)(uintptr)di->rxd64 - di->rxdalign),
			                    di->rxdalloc, (di->rxdpa - di->rxdalign), &di->rx_dmah);
	} else {
		if (di->txd32)
			DMA_FREE_CONSISTENT(di->osh, ((int8*)(uintptr)di->txd32 - di->txdalign),
			                    di->txdalloc, (di->txdpa - di->txdalign), &di->tx_dmah);
		if (di->rxd32)
			DMA_FREE_CONSISTENT(di->osh, ((int8*)(uintptr)di->rxd32 - di->rxdalign),
			                    di->rxdalloc, (di->rxdpa - di->rxdalign), &di->rx_dmah);
	}

	/* free packet pointer vectors */
	if (di->txp)
		MFREE(di->osh, (void *)di->txp, (di->ntxd * sizeof(void *)));
	if (di->rxp)
		MFREE(di->osh, (void *)di->rxp, (di->nrxd * sizeof(void *)));

	/* free tx packet DMA handles */
	if (di->txp_dmah)
		MFREE(di->osh, (void *)di->txp_dmah, di->ntxd * sizeof(osldma_t **));

	/* free rx packet DMA handles */
	if (di->rxp_dmah)
		MFREE(di->osh, (void *)di->rxp_dmah, di->nrxd * sizeof(osldma_t **));

	/* free our private info structure */
	MFREE(di->osh, (void *)di, sizeof(dma_info_t));

}
Example #29
0
/* ~NOTE~ What if another thread is waiting on the semaphore?  Holding it? */
void
dhd_prot_detach(dhd_pub_t *dhd)
{
#ifndef DHD_USE_STATIC_BUF
		MFREE(dhd->osh, dhd->prot, sizeof(dhd_prot_t));
#endif
	dhd->prot = NULL;
}
Example #30
0
void
rpc_osl_detach(rpc_osl_t *rpc_osh)
{
	if (!rpc_osh)
		return;

	MFREE(rpc_osh->osh, rpc_osh, sizeof(rpc_osl_t));
}