memset (s, 0, sizeof(struct socal)); 
static inline void socal_init(struct sbus_dev *sdev, int no){	unsigned char tmp[60];	int propl;	struct socal *s;	static unsigned version_printed = 0;	socal_hw_cq cq[8];	int size, i;	int irq, node;		s = kmalloc (sizeof (struct socal), GFP_KERNEL);	if (!s) return;	memset (s, 0, sizeof(struct socal));	spin_lock_init(&s->lock);	s->socal_no = no;	SOD(("socals %08lx socal_intr %08lx socal_hw_enque %08lx\n",	     (long)socals, (long)socal_intr, (long)socal_hw_enque))	if (version_printed++ == 0)		printk (version);	s->port[0].fc.module = THIS_MODULE;	s->port[1].fc.module = THIS_MODULE;                                		s->next = socals;	socals = s;	s->port[0].fc.dev = sdev;	s->port[1].fc.dev = sdev;	s->port[0].s = s;	s->port[1].s = s;	s->port[0].fc.next = &s->port[1].fc;	/* World Wide Name of SOCAL */	propl = prom_getproperty (sdev->prom_node, "wwn", tmp, sizeof(tmp));	if (propl != sizeof (fc_wwn)) {		s->wwn.naaid = NAAID_IEEE_REG;		s->wwn.nportid = 0x123;		s->wwn.hi = 0x1234;		s->wwn.lo = 0x12345678;	} else		memcpy (&s->wwn, tmp, sizeof (fc_wwn));		memcpy (&s->port[0].fc.wwn_nport, &s->wwn, sizeof (fc_wwn));	s->port[0].fc.wwn_nport.lo++;	memcpy (&s->port[1].fc.wwn_nport, &s->wwn, sizeof (fc_wwn));	s->port[1].fc.wwn_nport.lo+=2;		node = prom_getchild (sdev->prom_node);	while (node && (node = prom_searchsiblings (node, "sf"))) {		int port;				port = prom_getintdefault(node, "port#", -1);		switch (port) {		case 0:		case 1:			if (prom_getproplen(node, "port-wwn") == sizeof (fc_wwn))				prom_getproperty (node, "port-wwn", 						  (char *)&s->port[port].fc.wwn_nport,						  sizeof (fc_wwn));			break;		default:			break;		};		node = prom_getsibling(node);	}	memcpy (&s->port[0].fc.wwn_node, &s->wwn, sizeof (fc_wwn));	memcpy (&s->port[1].fc.wwn_node, &s->wwn, sizeof (fc_wwn));	SOD(("Got wwns %08x%08x ports %08x%08x and %08x%08x\n", 	     *(u32 *)&s->port[0].fc.wwn_node, s->port[0].fc.wwn_node.lo,	     *(u32 *)&s->port[0].fc.wwn_nport, s->port[0].fc.wwn_nport.lo,	     *(u32 *)&s->port[1].fc.wwn_nport, s->port[1].fc.wwn_nport.lo))			s->port[0].fc.sid = 1;	s->port[1].fc.sid = 17;	s->port[0].fc.did = 2;	s->port[1].fc.did = 18;		s->port[0].fc.reset = socal_reset;	s->port[1].fc.reset = socal_reset;		if (sdev->num_registers == 1) {		s->eeprom = sbus_ioremap(&sdev->resource[0], 0,					 sdev->reg_addrs[0].reg_size, "socal xram");		if (sdev->reg_addrs[0].reg_size > 0x20000)			s->xram = s->eeprom + 0x10000UL;		else			s->xram = s->eeprom;		s->regs = (s->xram + 0x10000UL);	} else {		/* E.g. starfire presents 3 registers for SOCAL */		s->xram = sbus_ioremap(&sdev->resource[1], 0,				       sdev->reg_addrs[1].reg_size, "socal xram");		s->regs = sbus_ioremap(&sdev->resource[2], 0,				       sdev->reg_addrs[2].reg_size, "socal regs");	}		socal_init_bursts(s, sdev);		SOD(("Disabling SOCAL\n"))		socal_disable (s);		irq = sdev->irqs[0];	if (request_irq (irq, socal_intr, SA_SHIRQ, "SOCAL", (void *)s)) {		socal_printk ("Cannot order irq %d to go\n", irq);		socals = s->next;		return;	}	SOD(("SOCAL uses IRQ %s\n", __irq_itoa(irq)))		s->port[0].fc.irq = irq;	s->port[1].fc.irq = irq;		sprintf (s->port[0].fc.name, "socal%d port A", no);	sprintf (s->port[1].fc.name, "socal%d port B", no);	s->port[0].flags = SOCAL_FC_HDR | SOCAL_PORT_A;	s->port[1].flags = SOCAL_FC_HDR | SOCAL_PORT_B;	s->port[1].mask = (1 << 11);		s->port[0].fc.hw_enque = socal_hw_enque;	s->port[1].fc.hw_enque = socal_hw_enque;		socal_download_fw (s);		SOD(("Downloaded firmware\n"))	/* Now setup xram circular queues */	memset (cq, 0, sizeof(cq));	size = (SOCAL_CQ_REQ0_SIZE + SOCAL_CQ_REQ1_SIZE +		SOCAL_CQ_RSP0_SIZE + SOCAL_CQ_RSP1_SIZE +		SOCAL_CQ_RSP2_SIZE) * sizeof(socal_req);	s->req_cpu = sbus_alloc_consistent(sdev, size, &s->req_dvma);	s->req[0].pool = s->req_cpu;	cq[0].address = s->req_dvma;	s->req[1].pool = s->req[0].pool + SOCAL_CQ_REQ0_SIZE;	s->rsp[0].pool = s->req[1].pool + SOCAL_CQ_REQ1_SIZE;	s->rsp[1].pool = s->rsp[0].pool + SOCAL_CQ_RSP0_SIZE;	s->rsp[2].pool = s->rsp[1].pool + SOCAL_CQ_RSP1_SIZE;		s->req[0].hw_cq = (socal_hw_cq __iomem *)(s->xram + SOCAL_CQ_REQ_OFFSET);	s->req[1].hw_cq = (socal_hw_cq __iomem *)(s->xram + SOCAL_CQ_REQ_OFFSET + sizeof(socal_hw_cq));	s->rsp[0].hw_cq = (socal_hw_cq __iomem *)(s->xram + SOCAL_CQ_RSP_OFFSET);	s->rsp[1].hw_cq = (socal_hw_cq __iomem *)(s->xram + SOCAL_CQ_RSP_OFFSET + sizeof(socal_hw_cq));	s->rsp[2].hw_cq = (socal_hw_cq __iomem *)(s->xram + SOCAL_CQ_RSP_OFFSET + 2 * sizeof(socal_hw_cq));		cq[1].address = cq[0].address + (SOCAL_CQ_REQ0_SIZE * sizeof(socal_req));	cq[4].address = cq[1].address + (SOCAL_CQ_REQ1_SIZE * sizeof(socal_req));	cq[5].address = cq[4].address + (SOCAL_CQ_RSP0_SIZE * sizeof(socal_req));	cq[6].address = cq[5].address + (SOCAL_CQ_RSP1_SIZE * sizeof(socal_req));	cq[0].last = SOCAL_CQ_REQ0_SIZE - 1;	cq[1].last = SOCAL_CQ_REQ1_SIZE - 1;	cq[4].last = SOCAL_CQ_RSP0_SIZE - 1;	cq[5].last = SOCAL_CQ_RSP1_SIZE - 1;	cq[6].last = SOCAL_CQ_RSP2_SIZE - 1;	for (i = 0; i < 8; i++)		cq[i].seqno = 1;		s->req[0].last = SOCAL_CQ_REQ0_SIZE - 1;	s->req[1].last = SOCAL_CQ_REQ1_SIZE - 1;	s->rsp[0].last = SOCAL_CQ_RSP0_SIZE - 1;	s->rsp[1].last = SOCAL_CQ_RSP1_SIZE - 1;	s->rsp[2].last = SOCAL_CQ_RSP2_SIZE - 1;		s->req[0].seqno = 1;	s->req[1].seqno = 1;	s->rsp[0].seqno = 1;	s->rsp[1].seqno = 1;	s->rsp[2].seqno = 1;		socal_copy_to_xram(s->xram + SOCAL_CQ_REQ_OFFSET, cq, sizeof(cq));		SOD(("Setting up params\n"))		/* Make our sw copy of SOCAL service parameters */	socal_copy_from_xram(s->serv_params, s->xram + 0x280, sizeof (s->serv_params));		s->port[0].fc.common_svc = (common_svc_parm *)s->serv_params;	s->port[0].fc.class_svcs = (svc_parm *)(s->serv_params + 0x20);	s->port[1].fc.common_svc = (common_svc_parm *)&s->serv_params;	s->port[1].fc.class_svcs = (svc_parm *)(s->serv_params + 0x20);		socal_enable (s);		SOD(("Enabled SOCAL\n"))}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/49d0c6039dd36791cad36624e68bce5fe011bf12/socal.c/clean/drivers/fc4/socal.c