コード例 #1
0
ファイル: montmulf.c プロジェクト: AOSC-Dev/nss-purified
static void cleanup(double *dt, int from, int tlen)
{
 int i;
 double tmp,tmp1,x,x1;

 tmp=tmp1=Zero;
 /* original code **
 for(i=2*from;i<2*tlen-2;i++)
   {
     x=dt[i];
     dt[i]=lower32(x,Zero)+tmp1;
     tmp1=tmp;
     tmp=upper32(x);
   }
 dt[tlen-2]+=tmp1;
 dt[tlen-1]+=tmp;
 **end original code ***/
 /* new code ***/
 for(i=2*from;i<2*tlen;i+=2)
   {
     x=dt[i];
     x1=dt[i+1];
     dt[i]=lower32(x,Zero)+tmp;
     dt[i+1]=lower32(x1,Zero)+tmp1;
     tmp=upper32(x);
     tmp1=upper32(x1);
   }
  /** end new code **/
}
コード例 #2
0
ファイル: netxen_nic_ctx.c プロジェクト: 3sOx/asuswrt-merlin
static int
netxen_init_old_ctx(struct netxen_adapter *adapter)
{
	struct netxen_recv_context *recv_ctx;
	struct nx_host_rds_ring *rds_ring;
	struct nx_host_sds_ring *sds_ring;
	struct nx_host_tx_ring *tx_ring;
	int ring;
	int port = adapter->portnum;
	struct netxen_ring_ctx *hwctx;
	u32 signature;

	tx_ring = adapter->tx_ring;
	recv_ctx = &adapter->recv_ctx;
	hwctx = recv_ctx->hwctx;

	hwctx->cmd_ring_addr = cpu_to_le64(tx_ring->phys_addr);
	hwctx->cmd_ring_size = cpu_to_le32(tx_ring->num_desc);


	for (ring = 0; ring < adapter->max_rds_rings; ring++) {
		rds_ring = &recv_ctx->rds_rings[ring];

		hwctx->rcv_rings[ring].addr =
			cpu_to_le64(rds_ring->phys_addr);
		hwctx->rcv_rings[ring].size =
			cpu_to_le32(rds_ring->num_desc);
	}

	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
		sds_ring = &recv_ctx->sds_rings[ring];

		if (ring == 0) {
			hwctx->sts_ring_addr = cpu_to_le64(sds_ring->phys_addr);
			hwctx->sts_ring_size = cpu_to_le32(sds_ring->num_desc);
		}
		hwctx->sts_rings[ring].addr = cpu_to_le64(sds_ring->phys_addr);
		hwctx->sts_rings[ring].size = cpu_to_le32(sds_ring->num_desc);
		hwctx->sts_rings[ring].msi_index = cpu_to_le16(ring);
	}
	hwctx->sts_ring_count = cpu_to_le32(adapter->max_sds_rings);

	signature = (adapter->max_sds_rings > 1) ?
		NETXEN_CTX_SIGNATURE_V2 : NETXEN_CTX_SIGNATURE;

	NXWR32(adapter, CRB_CTX_ADDR_REG_LO(port),
			lower32(recv_ctx->phys_addr));
	NXWR32(adapter, CRB_CTX_ADDR_REG_HI(port),
			upper32(recv_ctx->phys_addr));
	NXWR32(adapter, CRB_CTX_SIGNATURE_REG(port),
			signature | port);
	return 0;
}
コード例 #3
0
static int
netxen_init_old_ctx(struct netxen_adapter *adapter)
{
	struct netxen_recv_context *recv_ctx;
	struct nx_host_rds_ring *rds_ring;
	int ctx, ring;
	int func_id = adapter->portnum;

	adapter->ctx_desc->cmd_ring_addr =
		cpu_to_le64(adapter->ahw.cmd_desc_phys_addr);
	adapter->ctx_desc->cmd_ring_size =
		cpu_to_le32(adapter->max_tx_desc_count);

	for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
		recv_ctx = &adapter->recv_ctx[ctx];

		for (ring = 0; ring < adapter->max_rds_rings; ring++) {
			rds_ring = &recv_ctx->rds_rings[ring];

			adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr =
				cpu_to_le64(rds_ring->phys_addr);
			adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size =
				cpu_to_le32(rds_ring->max_rx_desc_count);
		}
		adapter->ctx_desc->sts_ring_addr =
			cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr);
		adapter->ctx_desc->sts_ring_size =
			cpu_to_le32(adapter->max_rx_desc_count);
	}

	adapter->pci_write_normalize(adapter, CRB_CTX_ADDR_REG_LO(func_id),
			lower32(adapter->ctx_desc_phys_addr));
	adapter->pci_write_normalize(adapter, CRB_CTX_ADDR_REG_HI(func_id),
			upper32(adapter->ctx_desc_phys_addr));
	adapter->pci_write_normalize(adapter, CRB_CTX_SIGNATURE_REG(func_id),
			NETXEN_CTX_SIGNATURE | func_id);
	return 0;
}