s = SOCKET(handle); 
int pcmcia_request_configuration(client_handle_t handle,				 config_req_t *req){	int i;	u_int base;	struct pcmcia_socket *s;	config_t *c;	pccard_io_map iomap;	s = SOCKET(handle);	if (!(s->state & SOCKET_PRESENT))		return CS_NO_CARD;#ifdef CONFIG_CARDBUS	if (handle->state & CLIENT_CARDBUS)		return CS_UNSUPPORTED_MODE;#endif	if (req->IntType & INT_CARDBUS)		return CS_UNSUPPORTED_MODE;	c = CONFIG(handle);	if (c->state & CONFIG_LOCKED)		return CS_CONFIGURATION_LOCKED;	/* Do power control.  We don't allow changes in Vcc. */	if (s->socket.Vcc != req->Vcc)		return CS_BAD_VCC;	if (req->Vpp1 != req->Vpp2)		return CS_BAD_VPP;	s->socket.Vpp = req->Vpp1;	if (s->ops->set_socket(s, &s->socket))		return CS_BAD_VPP;	c->Vcc = req->Vcc; c->Vpp1 = c->Vpp2 = req->Vpp1;	/* Pick memory or I/O card, DMA mode, interrupt */	c->IntType = req->IntType;	c->Attributes = req->Attributes;	if (req->IntType & INT_MEMORY_AND_IO)		s->socket.flags |= SS_IOCARD;	if (req->IntType & INT_ZOOMED_VIDEO)		s->socket.flags |= SS_ZVCARD | SS_IOCARD;	if (req->Attributes & CONF_ENABLE_DMA)		s->socket.flags |= SS_DMA_MODE;	if (req->Attributes & CONF_ENABLE_SPKR)		s->socket.flags |= SS_SPKR_ENA;	if (req->Attributes & CONF_ENABLE_IRQ)		s->socket.io_irq = s->irq.AssignedIRQ;	else		s->socket.io_irq = 0;	s->ops->set_socket(s, &s->socket);	s->lock_count++;	/* Set up CIS configuration registers */	base = c->ConfigBase = req->ConfigBase;	c->Present = c->CardValues = req->Present;	if (req->Present & PRESENT_COPY) {		c->Copy = req->Copy;		pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &c->Copy);	}	if (req->Present & PRESENT_OPTION) {		if (s->functions == 1) {			c->Option = req->ConfigIndex & COR_CONFIG_MASK;		} else {			c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK;			c->Option |= COR_FUNC_ENA|COR_IREQ_ENA;			if (req->Present & PRESENT_IOBASE_0)				c->Option |= COR_ADDR_DECODE;		}		if (c->state & CONFIG_IRQ_REQ)			if (!(c->irq.Attributes & IRQ_FORCED_PULSE))				c->Option |= COR_LEVEL_REQ;		pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option);		mdelay(40);	}	if (req->Present & PRESENT_STATUS) {		c->Status = req->Status;		pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status);	}	if (req->Present & PRESENT_PIN_REPLACE) {		c->Pin = req->Pin;		pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &c->Pin);	}	if (req->Present & PRESENT_EXT_STATUS) {		c->ExtStatus = req->ExtStatus;		pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus);	}	if (req->Present & PRESENT_IOBASE_0) {		u_char b = c->io.BasePort1 & 0xff;		pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);		b = (c->io.BasePort1 >> 8) & 0xff;		pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b);	}	if (req->Present & PRESENT_IOSIZE) {		u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1;		pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b);	}	/* Configure I/O windows */	if (c->state & CONFIG_IO_REQ) {		iomap.speed = io_speed;		for (i = 0; i < MAX_IO_WIN; i++)			if (s->io[i].NumPorts != 0) {				iomap.map = i;				iomap.flags = MAP_ACTIVE;				switch (s->io[i].Attributes & IO_DATA_PATH_WIDTH) {				case IO_DATA_PATH_WIDTH_16:					iomap.flags |= MAP_16BIT; break;				case IO_DATA_PATH_WIDTH_AUTO:					iomap.flags |= MAP_AUTOSZ; break;				default:					break;				}				iomap.start = s->io[i].BasePort;				iomap.stop = iomap.start + s->io[i].NumPorts - 1;				s->ops->set_io_map(s, &iomap);				s->io[i].Config++;			}	}	c->state |= CONFIG_LOCKED;	handle->state |= CLIENT_CONFIG_LOCKED;	return CS_SUCCESS;} /* pcmcia_request_configuration */
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/2bc5a9bdc56fac6f7cbf95b89443e3809141c247/pcmcia_resource.c/buggy/drivers/pcmcia/pcmcia_resource.c