Ejemplo n.º 1
0
/*
 * Configure the operational queue parameters.
 */
int pqisrc_configure_op_queues(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	
	/* Get the PQI capability, 
		REPORT PQI DEVICE CAPABILITY request */
	ret = pqisrc_report_pqi_capability(softs);
	if (ret) {
		DBG_ERR("Failed to send report pqi dev capability request : %d\n",
				ret);
		goto err_out;
	}

	/* Reserve required no of slots for internal requests */
	softs->max_io_for_scsi_ml = softs->max_outstanding_io - PQI_RESERVED_IO_SLOTS_CNT;

	/* Decide the Op queue configuration */
	pqisrc_decide_opq_config(softs);	
	
	DBG_FUNC("OUT\n");
	return ret;
		
err_out:
	DBG_FUNC("OUT failed\n");
	return ret;
}
Ejemplo n.º 2
0
/* Trigger a NMI as part of taking controller offline procedure */
void pqisrc_trigger_nmi_sis(pqisrc_softstate_t *softs)
{

	DBG_FUNC("IN\n");

	PCI_MEM_PUT32(softs,  &softs->ioa_reg->host_to_ioa_db, 
			LEGACY_SIS_IDBR, LE_32(TRIGGER_NMI_SIS));
	DBG_FUNC("OUT\n");
}
Ejemplo n.º 3
0
/*
 * Validate the PQI mode of adapter.
 */
int pqisrc_check_pqimode(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_FAILURE;
	int tmo = 0;
	uint64_t signature = 0;

	DBG_FUNC("IN\n");

	/* Check the PQI device signature */
	tmo = PQISRC_PQIMODE_READY_TIMEOUT;
	do {
		signature = LE_64(PCI_MEM_GET64(softs, &softs->pqi_reg->signature, PQI_SIGNATURE));
        
		if (memcmp(&signature, PQISRC_PQI_DEVICE_SIGNATURE,
				sizeof(uint64_t)) == 0) {
			ret = PQI_STATUS_SUCCESS;
			break;
		}
		OS_SLEEP(PQISRC_MODE_READY_POLL_INTERVAL);
	} while (tmo--);

	PRINT_PQI_SIGNATURE(signature);

	if (tmo <= 0) {
		DBG_ERR("PQI Signature is invalid\n");
		ret = PQI_STATUS_TIMEOUT;
		goto err_out;
	}

	tmo = PQISRC_PQIMODE_READY_TIMEOUT;
	/* Check function and status code for the device */
	COND_WAIT((PCI_MEM_GET64(softs, &softs->pqi_reg->admin_q_config,
		PQI_ADMINQ_CONFIG) == PQI_ADMIN_QUEUE_CONF_FUNC_STATUS_IDLE), tmo);
	if (!tmo) {
		DBG_ERR("PQI device is not in IDLE state\n");
		ret = PQI_STATUS_TIMEOUT;
		goto err_out;
	}


	tmo = PQISRC_PQIMODE_READY_TIMEOUT;
	/* Check the PQI device status register */
	COND_WAIT(LE_32(PCI_MEM_GET32(softs, &softs->pqi_reg->pqi_dev_status, PQI_DEV_STATUS)) &
				PQI_DEV_STATE_AT_INIT, tmo);
	if (!tmo) {
		DBG_ERR("PQI Registers are not ready\n");
		ret = PQI_STATUS_TIMEOUT;
		goto err_out;
	}

	DBG_FUNC("OUT\n");
	return ret;
err_out:
	DBG_FUNC("OUT failed\n");
	return ret;
}
Ejemplo n.º 4
0
/*
 * Uninitialize the resources used during PQI initialization.
 */
void pqisrc_pqi_uninit(pqisrc_softstate_t *softs)
{
	int i;
	DBG_FUNC("IN\n");
    
    if(softs->devlist_lockcreated==true){    
        os_uninit_spinlock(&softs->devlist_lock);
        softs->devlist_lockcreated = false;
    }
    
	for (i = 0; i <  softs->num_op_raid_ibq; i++) {
        /* OP RAID IB Q */
        if(softs->op_raid_ib_q[i].lockcreated==true){
		OS_UNINIT_PQILOCK(&softs->op_raid_ib_q[i].lock);
		softs->op_raid_ib_q[i].lockcreated = false;
        }
        
        /* OP AIO IB Q */
        if(softs->op_aio_ib_q[i].lockcreated==true){
		OS_UNINIT_PQILOCK(&softs->op_aio_ib_q[i].lock);
		softs->op_aio_ib_q[i].lockcreated = false;
        }
	}

	/* Free Op queues */
	os_dma_mem_free(softs, &softs->op_ibq_dma_mem);
	os_dma_mem_free(softs, &softs->op_obq_dma_mem);
	os_dma_mem_free(softs, &softs->event_q_dma_mem);

	/* Complete all pending commands. */
	os_complete_outstanding_cmds_nodevice(softs);
	
	/* Free  rcb */
	pqisrc_free_rcb(softs, softs->max_outstanding_io + 1);

	/* Free request id lists */
	pqisrc_destroy_taglist(softs,&softs->taglist);

    if(softs->admin_ib_queue.lockcreated==true){
	OS_UNINIT_PQILOCK(&softs->admin_ib_queue.lock);	
        softs->admin_ib_queue.lockcreated = false;
    }

	/* Free Admin Queue */
	os_dma_mem_free(softs, &softs->admin_queue_dma_mem);

	/* Switch back to SIS mode */
	if (pqisrc_force_sis(softs)) {
		DBG_ERR("Failed to switch back the adapter to SIS mode!\n");
	}

	DBG_FUNC("OUT\n");
}
Ejemplo n.º 5
0
void sis_disable_intx(pqisrc_softstate_t *softs)
{
	uint32_t db_reg;

	DBG_FUNC("IN\n");

	db_reg = PCI_MEM_GET32(softs, &softs->ioa_reg->host_to_ioa_db,
			LEGACY_SIS_IDBR);
	db_reg &= ~SIS_ENABLE_INTX;
	PCI_MEM_PUT32(softs, &softs->ioa_reg->host_to_ioa_db,
			LEGACY_SIS_IDBR, db_reg);

	DBG_FUNC("OUT\n");
}
Ejemplo n.º 6
0
NDIS_STATUS
PGPnetPMFailedSA(PGPnetPMContext *pContext, 
				 void *data,
				 UINT dataLen,
				 ULONG *pSrcBufferLen)
{
    DBG_FUNC("PGPnetPMFailedSA")

	PGPikeMTSAFailed * pSAFailed = (PGPikeMTSAFailed*)data;

    DBG_ENTER();

	*pSrcBufferLen = sizeof(PGPikeMTSAFailed);

	if (dataLen != *pSrcBufferLen) {
		DBG_LEAVE(NDIS_STATUS_INVALID_LENGTH);
		return NDIS_STATUS_INVALID_LENGTH;
	}

	PMRemovePendingSA(pContext, pSAFailed->ipAddress,
		pSAFailed->u.ipsec.ipAddrStart,
		pSAFailed->u.ipsec.ipMaskEnd);

	*pSrcBufferLen = 0;
    DBG_LEAVE(NDIS_STATUS_SUCCESS);
	return NDIS_STATUS_SUCCESS;
}
Ejemplo n.º 7
0
/*
 * Uninitialize the adapter.
 */
void pqisrc_uninit(pqisrc_softstate_t *softs)
{
	DBG_FUNC("IN\n");
	
	pqisrc_pqi_uninit(softs);

	pqisrc_sis_uninit(softs);

	os_destroy_semaphore(&softs->scan_lock);
	
	os_destroy_intr(softs);

	pqisrc_cleanup_devices(softs);

	DBG_FUNC("OUT\n");
}
Ejemplo n.º 8
0
NDIS_STATUS PolicyManagerInitialize(
    IN PDRIVER_OBJECT	DriverObject,
    IN PUNICODE_STRING	RegistryPath,
    OUT PNDIS_HANDLE	PolicyManagerHandle
)
{
    DBG_FUNC("PolicyManagerInitialize")
    NDIS_STATUS         status;
    PGPnetPMContext *pContext = 0;
    PGPError err = kPGPError_NoErr;

    NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1);

#ifdef PM_EMULATION
    PDummySA dummySA;
#endif

    DBG_ENTER();

    status = NdisAllocateMemory(PolicyManagerHandle,
                                sizeof(PGPnetPMContext),
                                0,
                                HighestAcceptableAddress
                               );

#ifndef PM_EMULATION

    if (status != NDIS_STATUS_SUCCESS)
    {
        DBG_PRINT(("!!!!! NdisAllocateMemory failed status=%Xh\n", status););
int wl_get_tallies(struct wl_private *lp,
		   CFG_HERMES_TALLIES_STRCT *tallies)
{
    int ret = 0;
    int status;
    CFG_HERMES_TALLIES_STRCT *pTallies;

    DBG_FUNC( "wl_get_tallies" );
    DBG_ENTER(DbgInfo);

    /* Get the current tallies from the adapter */
    lp->ltvRecord.len = 1 + HCF_TOT_TAL_CNT * sizeof(hcf_16);
    lp->ltvRecord.typ = CFG_TALLIES;

    status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord));

    if( status == HCF_SUCCESS ) {
	pTallies = (CFG_HERMES_TALLIES_STRCT *)&(lp->ltvRecord.u.u32);
	memcpy(tallies, pTallies, sizeof(*tallies));
	DBG_TRACE( DbgInfo, "Get tallies okay, dixe: %d\n", sizeof(*tallies) );
    } else {
	DBG_TRACE( DbgInfo, "Get tallies failed\n" );
	ret = -EFAULT;
    }

    DBG_LEAVE( DbgInfo );

    return ret;
}
Ejemplo n.º 10
0
/*
 * Function used to deallocate the used rcb.
 */
void pqisrc_free_rcb(pqisrc_softstate_t *softs, int req_count)
{
	
	uint32_t num_req;
	size_t size;
	int i;

	DBG_FUNC("IN\n");
	num_req = softs->max_outstanding_io + 1;
	size = num_req * sizeof(rcb_t);
	for (i = 1; i < req_count; i++)
		os_dma_mem_free(softs, &softs->sg_dma_desc[i]);
	os_mem_free(softs, (void *)softs->rcb, size);
	softs->rcb = NULL;
	DBG_FUNC("OUT\n");
}
Ejemplo n.º 11
0
/*******************************************************************************
 *	wl_adapter_attach()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Creates an instance of the driver, allocating local data structures for
 *  one device. The device is registered with Card Services.
 *
 *  PARAMETERS:
 *
 *      none
 *
 *  RETURNS:
 *
 *      pointer to an allocated dev_link_t structure
 *      NULL on failure
 *
 ******************************************************************************/
static int wl_adapter_attach(struct pcmcia_device *link)
{
	struct net_device   *dev;
	struct wl_private   *lp;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_attach");
	DBG_ENTER(DbgInfo);

	dev = wl_device_alloc();
	if (dev == NULL) {
		DBG_ERROR(DbgInfo, "wl_device_alloc returned NULL\n");
		return -ENOMEM;
	}

	link->resource[0]->end  = HCF_NUM_IO_PORTS;
	link->resource[0]->flags= IO_DATA_PATH_WIDTH_16;
	link->config_flags     |= CONF_ENABLE_IRQ;
	link->config_index      = 5;
	link->config_regs       = PRESENT_OPTION;

	link->priv = dev;
	lp = wl_priv(dev);
	lp->link = link;

	wl_adapter_insert(link);

	DBG_LEAVE(DbgInfo);
	return 0;
} /* wl_adapter_attach */
Ejemplo n.º 12
0
void
PGPnetRASdisconnect(PVPN_ADAPTER adapter)
{
	/* fire event */
	DBG_FUNC("PGPnetRASdisconnect")

	PGPMESSAGE_CONTEXT	*	kernelMessageContext;
	PGPnetMessageHeader *	kernelMessageHeader;
	PGPUInt32				head = 0;

	DBG_ENTER();

	if ((adapter != NULL) && (adapter->pgpMessage != NULL)) {
		kernelMessageContext = (PGPMESSAGE_CONTEXT*)(adapter->pgpMessage);
		kernelMessageHeader = &kernelMessageContext->header;
		
		NdisAcquireSpinLock(&adapter->general_lock);

		head = kernelMessageHeader->head + 1;

		if (head > kernelMessageHeader->maxSlots)
			head = 1;

		kernelMessageContext = &kernelMessageContext[head];
		kernelMessageContext->messageType = PGPnetMessageRASdisconnect;

		kernelMessageHeader->head = head;

		NdisReleaseSpinLock(&adapter->general_lock);

		PgpEventSet(&adapter->pgpEvent);
	}

	DBG_LEAVE(0);
}
Ejemplo n.º 13
0
/*******************************************************************************
 *	wl_adapter_open()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Open the device.
 *
 *  PARAMETERS:
 *
 *      dev - a pointer to a net_device structure representing the network
 *            device to open.
 *
 *  RETURNS:
 *
 *      0 on success
 *      errno value otherwise
 *
 ******************************************************************************/
int wl_adapter_open(struct net_device *dev)
{
	struct wl_private *lp = wl_priv(dev);
	struct pcmcia_device *link = lp->link;
	int result = 0;
	int hcf_status = HCF_SUCCESS;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_open");
	DBG_ENTER(DbgInfo);
	DBG_PRINT("%s\n", VERSION_INFO);
	DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);

	if (!pcmcia_dev_present(link)) {
		DBG_LEAVE(DbgInfo);
		return -ENODEV;
	}

	link->open++;

	hcf_status = wl_open(dev);

	if (hcf_status != HCF_SUCCESS) {
		link->open--;
		result = -ENODEV;
	}

	DBG_LEAVE(DbgInfo);
	return result;
} /* wl_adapter_open */
/*******************************************************************************
 *	wl_process_updated_record()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Process the updated information record message signaled by the device.
 *
 *  PARAMETERS:
 *
 *      lp - a pointer to the device's private structure
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void wl_process_updated_record( struct wl_private *lp )
{
    DBG_FUNC( "wl_process_updated_record" );
    DBG_ENTER( DbgInfo );


    if( lp != NULL ) {
        lp->updatedRecord.u.u16[0] = CNV_LITTLE_TO_INT( lp->updatedRecord.u.u16[0] );

        switch( lp->updatedRecord.u.u16[0] ) {
        case CFG_CUR_COUNTRY_INFO:
            DBG_TRACE( DbgInfo, "Updated Record: CFG_CUR_COUNTRY_INFO\n" );
            wl_connect( lp );
            break;

        case CFG_PORT_STAT:
            DBG_TRACE( DbgInfo, "Updated Record: WAIT_FOR_CONNECT (0xFD40)\n" );
            //wl_connect( lp );
            break;

        default:
            DBG_TRACE( DbgInfo, "UNKNOWN: 0x%04x\n",
                       lp->updatedRecord.u.u16[0] );
        }
    }

    DBG_LEAVE( DbgInfo );
    return;
} // wl_process_updated_record
Ejemplo n.º 15
0
static int wl_adapter_attach(struct pcmcia_device *link)
{
    struct net_device   *dev;
    struct wl_private	*lp;
    /*------------------------------------------------------------------------*/

    DBG_FUNC( "wl_adapter_attach" );
    DBG_ENTER( DbgInfo );

    dev = wl_device_alloc();
    if(dev == NULL) {
        DBG_ERROR( DbgInfo, "wl_device_alloc returned NULL\n");
	return -ENOMEM;
    }

    link->io.NumPorts1      = HCF_NUM_IO_PORTS;
    link->io.Attributes1    = IO_DATA_PATH_WIDTH_16;
    link->io.IOAddrLines    = 6;
    link->conf.Attributes   = CONF_ENABLE_IRQ;
    link->conf.IntType      = INT_MEMORY_AND_IO;
    link->conf.ConfigIndex  = 5;
    link->conf.Present      = PRESENT_OPTION;

    link->priv = dev;
    lp = wl_priv(dev);
    lp->link = link;

    wl_adapter_insert(link);

    DBG_LEAVE( DbgInfo );
    return 0;
} // wl_adapter_attach
Ejemplo n.º 16
0
PGPError pgpIPsecCompress(PGPIPsecContextRef ipsec,
			PGPIPsecBuffer *ipPacketIn, PGPBoolean tunnelMode, 
			PGPUInt32 gatewayIP, PGPCompressionAlgorithm alg, 
			PGPIPsecBuffer *ipPacketOut, PGPBoolean *usedIPCOMP)
{
	PGPError err = kPGPError_NoErr;
	PGPUInt32 compIndex;
	PGPUInt32 inDataIndex;
	PGPUInt32 outDataIndex;
	PGPSize bytesIn;
	PGPSize bytesOut;
	PGPUInt32 total;
	PGPUInt32 originalSize;
	PGPUInt32 compressedSize;
	PGPUInt16 packetSize;
	PGPUInt16 cpi;
	PGPByte nextHeader;
	PGPBoolean moreOutput = FALSE;
	PGPIPsecBuffer *inPtr = NULL;
	PGPIPsecBuffer *outPtr = NULL;
	PGPIPsecBuffer *endPtr = NULL;
	PGPMemoryMgrRef memoryMgr = NULL;
	PGPCompContextRef compRef = NULL;

	DBG_FUNC("pgpIPsecCompress")

	DBG_ENTER();

	if (NULL==(int)(ipsec)) {
		DBG_PRINT(("!!!!! pgpIPsecCompress error: %d !!!!!!!!!!!\n", kPGPError_BadParams););
Ejemplo n.º 17
0
NDIS_STATUS
PGPnetPMNewSA(PGPnetPMContext *pContext, 
			  void *data, 
			  UINT dataLen, 
			  ULONG *pSrcBufferLen)
{
    DBG_FUNC("PGPnetPMNewSA")

    DBG_ENTER();

	*pSrcBufferLen = sizeof(PGPikeSA);

	if (dataLen != *pSrcBufferLen) {
		DBG_LEAVE(NDIS_STATUS_INVALID_LENGTH);
		return NDIS_STATUS_INVALID_LENGTH;
	}

	if (!PMAddSA(pContext, (PGPikeSA*) data)) {
		DBG_LEAVE(NDIS_STATUS_FAILURE);
		return NDIS_STATUS_FAILURE;
	}

	*pSrcBufferLen = 0;
    DBG_LEAVE(NDIS_STATUS_SUCCESS);
	return NDIS_STATUS_SUCCESS;
}
Ejemplo n.º 18
0
NDIS_STATUS
PGPnetPMNewHost(PGPnetPMContext *context, 
				void *data,
				UINT dataLen,
				ULONG *pSrcBufferLen)
{
    DBG_FUNC("PGPnetPMNewHost")

    DBG_ENTER();

	*pSrcBufferLen = sizeof(PGPNetHostEntry) - 8; /* minus 8 bytes for eth_dstAddress */

	if (dataLen != *pSrcBufferLen) {
		DBG_LEAVE(NDIS_STATUS_INVALID_LENGTH);
		return NDIS_STATUS_INVALID_LENGTH;
	}

	if (!PMAddHost(context, (PGPNetHostEntry*) data)) {
		DBG_LEAVE(NDIS_STATUS_FAILURE);
		return NDIS_STATUS_FAILURE;
	}

	*pSrcBufferLen = 0;
	DBG_LEAVE(NDIS_STATUS_SUCCESS);
	return NDIS_STATUS_SUCCESS;
}
Ejemplo n.º 19
0
void sis_enable_intx(pqisrc_softstate_t *softs)
{
	uint32_t db_reg;

	DBG_FUNC("IN\n");

	db_reg = PCI_MEM_GET32(softs, &softs->ioa_reg->host_to_ioa_db,
			LEGACY_SIS_IDBR);
	db_reg |= SIS_ENABLE_INTX;
	PCI_MEM_PUT32(softs, &softs->ioa_reg->host_to_ioa_db,
			LEGACY_SIS_IDBR, db_reg);
	if (pqisrc_sis_wait_for_db_bit_to_clear(softs,SIS_ENABLE_INTX) 
			!= PQI_STATUS_SUCCESS) {
		DBG_ERR("Failed to wait for enable intx db bit to clear\n");
	}
	DBG_FUNC("OUT\n");
}
Ejemplo n.º 20
0
void
PGPnetRASconnect(PVPN_ADAPTER adaptor, ULONG ipAddress)
{
	DBG_FUNC("PGPnetRASconnect")

	DBG_ENTER();

	DBG_PRINT(("New IP address Report, ipAddress: %xh\n", ipAddress););
Ejemplo n.º 21
0
/* Validate the FW status PQI_CTRL_KERNEL_UP_AND_RUNNING */
int pqisrc_check_fw_status(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t timeout = SIS_STATUS_OK_TIMEOUT;

	DBG_FUNC("IN\n");

	OS_SLEEP(1000000);
	COND_WAIT((GET_FW_STATUS(softs) &
		PQI_CTRL_KERNEL_UP_AND_RUNNING), timeout);
	if (!timeout) {
		DBG_ERR("FW check status timedout\n");
		ret = PQI_STATUS_TIMEOUT;
	}

	DBG_FUNC("OUT\n");
	return ret;
}
Ejemplo n.º 22
0
/* Switch the adapter back to SIS mode during uninitialization */
int pqisrc_reenable_sis(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t timeout = SIS_ENABLE_TIMEOUT;

	DBG_FUNC("IN\n");

	PCI_MEM_PUT32(softs, &softs->ioa_reg->host_to_ioa_db, 
        LEGACY_SIS_IDBR, LE_32(REENABLE_SIS));

	COND_WAIT(((PCI_MEM_GET32(softs, &softs->ioa_reg->ioa_to_host_db, LEGACY_SIS_ODBR_R) &
				REENABLE_SIS) == 0), timeout)
	if (!timeout) {
		DBG_WARN(" [ %s ] failed to re enable sis\n",__func__);
		ret = PQI_STATUS_TIMEOUT;
	}
		
	DBG_FUNC("OUT\n");
	return ret;
}
Ejemplo n.º 23
0
/* First SIS command for the adapter to check PQI support */
int pqisrc_get_adapter_properties(pqisrc_softstate_t *softs,
				uint32_t *prop, uint32_t *ext_prop)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t mb[6] = {0};

	DBG_FUNC("IN\n");

	mb[0] = SIS_CMD_GET_ADAPTER_PROPERTIES;
	ret = pqisrc_send_sis_cmd(softs, mb);
	if (!ret) {
		DBG_INIT("GET_PROPERTIES prop = %x, ext_prop = %x\n",
					mb[1], mb[4]);
		*prop = mb[1];
		*ext_prop = mb[4];
	}

	DBG_FUNC("OUT\n");
	return ret;
}
Ejemplo n.º 24
0
void wl_adapter_insert(struct pcmcia_device *link)
{
	struct net_device *dev;
	int i;
	int ret;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_insert");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "link", "0x%p", link);

	dev     = link->priv;

	/* Do we need to allocate an interrupt? */
	link->config_flags |= CONF_ENABLE_IRQ;
	link->io_lines = 6;

	ret = pcmcia_request_io(link);
	if (ret != 0)
		goto failed;

	ret = pcmcia_request_irq(link, (void *) wl_isr);
	if (ret != 0)
		goto failed;

	ret = pcmcia_enable_device(link);
	if (ret != 0)
		goto failed;

	dev->irq        = link->irq;
	dev->base_addr  = link->resource[0]->start;

	SET_NETDEV_DEV(dev, &link->dev);
	if (register_netdev(dev) != 0) {
;
		goto failed;
	}

	register_wlags_sysfs(dev);

//	printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
;
	for (i = 0; i < ETH_ALEN; i++)
;

	DBG_LEAVE(DbgInfo);
	return;

failed:
	wl_adapter_release(link);

	DBG_LEAVE(DbgInfo);
	return;
} /* wl_adapter_insert */
Ejemplo n.º 25
0
void sis_disable_interrupt(pqisrc_softstate_t *softs)
{
	DBG_FUNC("IN");
	
	switch(softs->intr_type) {
		case INTR_TYPE_FIXED:
			pqisrc_configure_legacy_intx(softs,false);
			sis_disable_intx(softs);
			break;
		case INTR_TYPE_MSI:
		case INTR_TYPE_MSIX:
			sis_disable_msix(softs);
			break;
		default:
			DBG_ERR("Inerrupt mode none!\n");
			break;
	}
	
	DBG_FUNC("OUT");
}
Ejemplo n.º 26
0
void wl_adapter_insert( struct pcmcia_device *link )
{
    struct net_device       *dev;
    int i;
    int                     ret;
    /*------------------------------------------------------------------------*/

    DBG_FUNC( "wl_adapter_insert" );
    DBG_ENTER( DbgInfo );
    DBG_PARAM( DbgInfo, "link", "0x%p", link );

    dev     = link->priv;

    /* Do we need to allocate an interrupt? */
    link->conf.Attributes |= CONF_ENABLE_IRQ;

    ret = pcmcia_request_io(link, &link->io);
    if (ret != 0)
        goto failed;

    ret = pcmcia_request_irq(link, (void *) wl_isr);
    if (ret != 0)
        goto failed;

    ret = pcmcia_request_configuration(link, &link->conf);
    if (ret != 0)
        goto failed;

    dev->irq        = link->irq;
    dev->base_addr  = link->io.BasePort1;

    SET_NETDEV_DEV(dev, &link->dev);
    if (register_netdev(dev) != 0) {
	printk("%s: register_netdev() failed\n", MODULE_NAME);
	goto failed;
    }

    register_wlags_sysfs(dev);

    printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
               dev->name, dev->base_addr, dev->irq);
    for( i = 0; i < ETH_ALEN; i++ ) {
        printk("%02X%c", dev->dev_addr[i], ((i < (ETH_ALEN-1)) ? ':' : '\n'));
    }

    DBG_LEAVE( DbgInfo );
    return;

failed:
    wl_adapter_release( link );

    DBG_LEAVE(DbgInfo);
    return;
} // wl_adapter_insert
Ejemplo n.º 27
0
/*******************************************************************************
 *	wl_adapter_cleanup_module()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Called by cleanup_module() to perform driver uninitialization.
 *
 *  PARAMETERS:
 *
 *      N/A
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void wl_adapter_cleanup_module(void)
{
	DBG_FUNC("wl_adapter_cleanup_module");
	DBG_ENTER(DbgInfo);
	DBG_TRACE(DbgInfo, "wl_adapter_cleanup_module() -- PCMCIA\n");


	pcmcia_unregister_driver(&wlags49_driver);

	DBG_LEAVE(DbgInfo);
	return;
} /* wl_adapter_cleanup_module */
Ejemplo n.º 28
0
/*
 * Function used to perform PQI hard reset.
 */
int pqi_reset(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t val = 0;
	pqi_reset_reg_t pqi_reset_reg;

	DBG_FUNC("IN\n");

	if (true == softs->ctrl_in_pqi_mode) { 
	
		if (softs->pqi_reset_quiesce_allowed) {
			val = PCI_MEM_GET32(softs, &softs->ioa_reg->host_to_ioa_db,
					LEGACY_SIS_IDBR);
			val |= SIS_PQI_RESET_QUIESCE;
			PCI_MEM_PUT32(softs, &softs->ioa_reg->host_to_ioa_db,
					LEGACY_SIS_IDBR, LE_32(val));
			ret = pqisrc_sis_wait_for_db_bit_to_clear(softs, SIS_PQI_RESET_QUIESCE);
			if (ret) {
				DBG_ERR("failed with error %d during quiesce\n", ret);
				return ret;
			}
		}

		pqi_reset_reg.all_bits = 0;
		pqi_reset_reg.bits.reset_type = PQI_RESET_TYPE_HARD_RESET;
		pqi_reset_reg.bits.reset_action = PQI_RESET_ACTION_RESET;

		PCI_MEM_PUT32(softs, &softs->pqi_reg->dev_reset, PQI_DEV_RESET,
			LE_32(pqi_reset_reg.all_bits));

		ret = pqisrc_wait_for_pqi_reset_completion(softs);
		if (ret) {
			DBG_ERR("PQI reset timed out: ret = %d!\n", ret);
			return ret;
		}
	}
	softs->ctrl_in_pqi_mode = false;
	DBG_FUNC("OUT\n");
	return ret;
}
Ejemplo n.º 29
0
/*******************************************************************************
 *	ParseConfigLine()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Parses a line from the configuration file into an L-val and an R-val,
 *  representing a key/value pair.
 *
 *  PARAMETERS:
 *
 *      pszLine     - the line from the config file to parse
 *      ppszLVal    - the resulting L-val (Key)
 *      ppszRVal    - the resulting R-val (Value)
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void ParseConfigLine(char *pszLine, char **ppszLVal, char **ppszRVal)
{
	int i;
	int size;
	/*------------------------------------------------------------------------*/

	DBG_FUNC("ParseConfigLine");
	DBG_ENTER(DbgInfo);

	/* get a snapshot of our string size */
	size      = strlen(pszLine);
	*ppszLVal = NULL;
	*ppszRVal = NULL;

	if (pszLine[0] != '#' &&							/* skip the line if it is a comment */
		 pszLine[0] != '\n' &&							/* if it's an empty UNIX line, do nothing */
		 !(pszLine[0] == '\r' && pszLine[1] == '\n')	/* if it's an empty MS-DOS line, do nothing */
	   ) {
		/* advance past any whitespace, and assign the L-value */
		for (i = 0; i < size; i++) {
			if (pszLine[i] != ' ') {
				*ppszLVal = &pszLine[i];
				break;
			}
		}
		/* advance to the end of the l-value*/
		for (i++; i < size; i++) {
			if (pszLine[i] == ' ' || pszLine[i] == '=') {
				pszLine[i] = '\0';
				break;
			}
		}
		/* make any whitespace and the equal sign a NULL character, and
		   advance to the R-Value */
		for (i++; i < size; i++) {
			if (pszLine[i] == ' ' || pszLine[i] == '=') {
				pszLine[i] = '\0';
				continue;
			}
			*ppszRVal = &pszLine[i];
			break;
		}
		/* make the line ending character(s) a NULL */
		for (i++; i < size; i++) {
			if (pszLine[i] == '\n')
				pszLine[i] = '\0';
			if ((pszLine[i] == '\r') && (pszLine[i+1] == '\n'))
				pszLine[i] = '\0';
		}
	}
	DBG_LEAVE(DbgInfo);
} /* ParseConfigLine */
Ejemplo n.º 30
0
void wl_adapter_release(struct pcmcia_device *link)
{
	DBG_FUNC("wl_adapter_release");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "link", "0x%p", link);

	/* Stop hardware */
	wl_remove(link->priv);

	pcmcia_disable_device(link);

	DBG_LEAVE(DbgInfo);
} /* wl_adapter_release */