Commit fbb3bc6f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] CardServices() removal from pcmcia net drivers

From: Andres Salomon <dilinger@voxel.net>

Replace the various CardServices() calls w/ their pcmcia_* function.  The
pcmcia functions fit better with kernel conventions, and don't have the
nasty var args stuff.  These patches also fix a few places where the args
supplied to CardServices were either not supplied, or dealt with in
non-obvious ways.
parent d5d4042d
......@@ -330,7 +330,7 @@ static dev_link_t *tc574_attach(void)
client_reg.event_handler = &tc574_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
tc574_detach(link);
......@@ -369,7 +369,7 @@ static void tc574_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -387,8 +387,8 @@ static void tc574_detach(dev_link_t *link)
ethernet device available to the system.
*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void tc574_config(dev_link_t *link)
{
......@@ -409,12 +409,12 @@ static void tc574_config(dev_link_t *link)
tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
......@@ -424,15 +424,15 @@ static void tc574_config(dev_link_t *link)
link->io.IOAddrLines = 16;
for (i = j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break;
}
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i);
goto failed;
}
CS_CHECK(RequestIRQ, link->handle, &link->irq);
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
......@@ -451,8 +451,8 @@ static void tc574_config(dev_link_t *link)
the hardware address. The future products may include a modem chip
and put the address in the CIS. */
tuple.DesiredTuple = 0x88;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) {
CardServices(GetTupleData, handle, &tuple);
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(handle, &tuple);
for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]);
} else {
......@@ -466,9 +466,9 @@ static void tc574_config(dev_link_t *link)
}
}
tuple.DesiredTuple = CISTPL_VERS_1;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS &&
CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS &&
CardServices(ParseTuple, handle, &tuple, &parse) == CS_SUCCESS) {
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS &&
pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS &&
pcmcia_parse_tuple(handle, &tuple, &parse) == CS_SUCCESS) {
cardname = parse.version_1.str + parse.version_1.ofs[1];
} else
cardname = "3Com 3c574";
......@@ -564,9 +564,9 @@ static void tc574_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -608,7 +608,7 @@ static int tc574_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -616,7 +616,7 @@ static int tc574_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
tc574_reset(dev);
netif_device_attach(dev);
......
......@@ -244,7 +244,7 @@ static dev_link_t *tc589_attach(void)
client_reg.event_handler = &tc589_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
tc589_detach(link);
......@@ -283,7 +283,7 @@ static void tc589_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -303,8 +303,8 @@ static void tc589_detach(dev_link_t *link)
======================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void tc589_config(dev_link_t *link)
{
......@@ -323,20 +323,20 @@ static void tc589_config(dev_link_t *link)
phys_addr = (u16 *)dev->dev_addr;
tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
/* Is this a 3c562? */
tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON;
if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) &&
(CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS)) {
if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) {
if (le16_to_cpu(buf[0]) != MANFID_3COM)
printk(KERN_INFO "3c589_cs: hmmm, is this really a "
"3Com card??\n");
......@@ -351,15 +351,15 @@ static void tc589_config(dev_link_t *link)
for (i = j = 0; j < 0x400; j += 0x10) {
if (multi && (j & 0x80)) continue;
link->io.BasePort1 = j ^ 0x300;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break;
}
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i);
goto failed;
}
CS_CHECK(RequestIRQ, link->handle, &link->irq);
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
......@@ -374,8 +374,8 @@ static void tc589_config(dev_link_t *link)
/* The 3c589 has an extra EEPROM for configuration info, including
the hardware address. The 3c562 puts the address in the CIS. */
tuple.DesiredTuple = 0x88;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) {
CardServices(GetTupleData, handle, &tuple);
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(handle, &tuple);
for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]);
} else {
......@@ -440,9 +440,9 @@ static void tc589_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -486,7 +486,7 @@ static int tc589_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -494,7 +494,7 @@ static int tc589_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
tc589_reset(dev);
netif_device_attach(dev);
......
......@@ -205,7 +205,7 @@ static dev_link_t *axnet_attach(void)
client_reg.event_handler = &axnet_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
axnet_detach(link);
......@@ -244,7 +244,7 @@ static void axnet_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -313,11 +313,8 @@ static int get_prom(dev_link_t *link)
======================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CFG_CHECK(fn, args...) \
if (CardServices(fn, args) != 0) goto next_entry
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int try_io_port(dev_link_t *link)
{
......@@ -340,12 +337,12 @@ static int try_io_port(dev_link_t *link)
for (j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300;
link->io.BasePort2 = (j ^ 0x300) + 0x10;
ret = CardServices(RequestIO, link->handle, &link->io);
ret = pcmcia_request_io(link->handle, &link->io);
if (ret == CS_SUCCESS) return ret;
}
return ret;
} else {
return CardServices(RequestIO, link->handle, &link->io);
return pcmcia_request_io(link->handle, &link->io);
}
}
......@@ -367,9 +364,9 @@ static void axnet_config(dev_link_t *link)
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* don't trust the CIS on this; Linksys got it wrong */
link->conf.Present = 0x63;
......@@ -378,19 +375,19 @@ static void axnet_config(dev_link_t *link)
link->state |= DEV_CONFIG;
/* Look up current Vcc */
CS_CHECK(GetConfigurationInfo, handle, &conf);
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf));
link->conf.Vcc = conf.Vcc;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (last_ret == CS_SUCCESS) {
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
cistpl_io_t *io = &(parse.cftable_entry.io);
CFG_CHECK(GetTupleData, handle, &tuple);
CFG_CHECK(ParseTuple, handle, &tuple, &parse);
if ((cfg->index == 0) || (cfg->io.nwin == 0))
if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0 ||
cfg->index == 0 || cfg->io.nwin == 0)
goto next_entry;
link->conf.ConfigIndex = 0x05;
......@@ -411,21 +408,21 @@ static void axnet_config(dev_link_t *link)
if (last_ret == CS_SUCCESS) break;
}
next_entry:
last_ret = CardServices(GetNextTuple, handle, &tuple);
last_ret = pcmcia_get_next_tuple(handle, &tuple);
}
if (last_ret != CS_SUCCESS) {
cs_error(handle, RequestIO, last_ret);
goto failed;
}
CS_CHECK(RequestIRQ, handle, &link->irq);
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
if (link->io.NumPorts2 == 8) {
link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
}
CS_CHECK(RequestConfiguration, handle, &link->conf);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
if (register_netdev(dev) != 0) {
......@@ -476,7 +473,7 @@ static void axnet_config(dev_link_t *link)
Bit 2 of CCSR is active low. */
if (i == 32) {
conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 };
CardServices(AccessConfigurationRegister, link->handle, &reg);
pcmcia_access_configuration_register(link->handle, &reg);
for (i = 0; i < 32; i++) {
j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
if ((j != 0) && (j != 0xffff)) break;
......@@ -520,9 +517,9 @@ static void axnet_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -574,7 +571,7 @@ static int axnet_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
axnet_reset_8390(&info->dev);
AX88190_init(&info->dev, 1);
......
......@@ -227,7 +227,7 @@ static dev_link_t *com20020_attach(void)
client_reg.event_handler = &com20020_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
com20020_detach(link);
......@@ -277,7 +277,7 @@ static void com20020_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
DEBUG(1,"unlinking...\n");
......@@ -325,8 +325,8 @@ static void com20020_detach(dev_link_t *link)
======================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void com20020_config(dev_link_t *link)
{
......@@ -353,9 +353,9 @@ static void com20020_config(dev_link_t *link)
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
......@@ -368,13 +368,13 @@ static void com20020_config(dev_link_t *link)
for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
{
link->io.BasePort1 = ioaddr;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS)
break;
}
}
else
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i != CS_SUCCESS)
{
......@@ -388,7 +388,7 @@ static void com20020_config(dev_link_t *link)
DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
link->irq.AssignedIRQ,
link->irq.IRQInfo1, link->irq.IRQInfo2);
i = CardServices(RequestIRQ, link->handle, &link->irq);
i = pcmcia_request_irq(link->handle, &link->irq);
if (i != CS_SUCCESS)
{
DEBUG(1,"arcnet: requestIRQ failed totally!\n");
......@@ -397,7 +397,7 @@ static void com20020_config(dev_link_t *link)
dev->irq = link->irq.AssignedIRQ;
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
if (com20020_check(dev))
{
......@@ -454,9 +454,9 @@ static void com20020_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
......@@ -502,7 +502,7 @@ static int com20020_event(event_t event, int priority,
if (link->open) {
netif_device_detach(dev);
}
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -510,7 +510,7 @@ static int com20020_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
int ioaddr = dev->base_addr;
struct arcnet_local *lp = (struct arcnet_local *)dev->priv;
......
......@@ -307,7 +307,7 @@ static dev_link_t *fmvj18x_attach(void)
client_reg.event_handler = &fmvj18x_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
fmvj18x_detach(link);
......@@ -340,7 +340,7 @@ static void fmvj18x_detach(dev_link_t *link)
/* Break the link with Card Services */
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free pieces */
*linkp = link->next;
......@@ -354,8 +354,8 @@ static void fmvj18x_detach(dev_link_t *link)
/*====================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int mfc_try_io_port(dev_link_t *link)
{
......@@ -369,7 +369,7 @@ static int mfc_try_io_port(dev_link_t *link)
link->io.NumPorts2 = 0;
printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n");
}
ret = CardServices(RequestIO, link->handle, &link->io);
ret = pcmcia_request_io(link->handle, &link->io);
if (ret == CS_SUCCESS) return ret;
}
return ret;
......@@ -385,7 +385,7 @@ static int ungermann_try_io_port(dev_link_t *link)
*/
for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) {
link->io.BasePort1 = ioaddr;
ret = CardServices(RequestIO, link->handle, &link->io);
ret = pcmcia_request_io(link->handle, &link->io);
if (ret == CS_SUCCESS) {
/* calculate ConfigIndex value */
link->conf.ConfigIndex =
......@@ -417,12 +417,12 @@ static void fmvj18x_config(dev_link_t *link)
registers.
*/
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleData = (u_char *)buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
/* Configure card */
link->state |= DEV_CONFIG;
......@@ -432,16 +432,16 @@ static void fmvj18x_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_FUNCE;
tuple.TupleOffset = 0;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) {
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
/* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigIndex = parse.cftable_entry.index;
tuple.DesiredTuple = CISTPL_MANFID;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, handle, &tuple);
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
else
buf[0] = 0xffff;
switch (le16_to_cpu(buf[0])) {
......@@ -449,7 +449,7 @@ static void fmvj18x_config(dev_link_t *link)
cardtype = TDK;
if (le16_to_cpu(buf[1]) == PRODID_TDK_CF010) {
cs_status_t status;
CardServices(GetStatus, handle, &status);
pcmcia_get_status(handle, &status);
if (status.CardState & CS_EVENT_3VCARD)
link->conf.Vcc = 33; /* inserted in 3.3V slot */
} else if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410) {
......@@ -478,8 +478,8 @@ static void fmvj18x_config(dev_link_t *link)
} else {
/* old type card */
tuple.DesiredTuple = CISTPL_MANFID;
if (CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, handle, &tuple);
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
else
buf[0] = 0xffff;
switch (le16_to_cpu(buf[0])) {
......@@ -510,10 +510,10 @@ static void fmvj18x_config(dev_link_t *link)
ret = ungermann_try_io_port(link);
if (ret != CS_SUCCESS) goto cs_failed;
} else {
CS_CHECK(RequestIO, link->handle, &link->io);
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io));
}
CS_CHECK(RequestIRQ, link->handle, &link->irq);
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
if (register_netdev(dev) != 0) {
......@@ -546,17 +546,17 @@ static void fmvj18x_config(dev_link_t *link)
case CONTEC:
tuple.DesiredTuple = CISTPL_FUNCE;
tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
if (cardtype == MBH10304) {
/* MBH10304's CIS_FUNCE is corrupted */
node_id = &(tuple.TupleData[5]);
card_name = "FMV-J182";
} else {
while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) {
CS_CHECK(GetNextTuple, handle, &tuple) ;
CS_CHECK(GetTupleData, handle, &tuple) ;
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
}
node_id = &(tuple.TupleData[2]);
if( cardtype == TDK ) {
......@@ -633,8 +633,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0;
req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle;
i = CardServices(RequestWindow, &link->win, &req);
i = pcmcia_request_window(&link->handle, &req, &link->win);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestWindow, i);
return -1;
......@@ -643,7 +642,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
base = ioremap(req.Base, req.Size);
mem.Page = 0;
mem.CardOffset = 0;
CardServices(MapMemPage, link->win, &mem);
pcmcia_map_mem_page(link->win, &mem);
/*
* MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
......@@ -668,7 +667,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
}
iounmap(base);
j = CardServices(ReleaseWindow, link->win);
j = pcmcia_release_window(link->win);
if (j != CS_SUCCESS)
cs_error(link->handle, ReleaseWindow, j);
return (i != 0x200) ? 0 : -1;
......@@ -689,8 +688,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0;
req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle;
i = CardServices(RequestWindow, &link->win, &req);
i = pcmcia_request_window(&link->handle, &req, &link->win);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestWindow, i);
return -1;
......@@ -699,7 +697,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
base = ioremap(req.Base, req.Size);
mem.Page = 0;
mem.CardOffset = 0;
CardServices(MapMemPage, link->win, &mem);
pcmcia_map_mem_page(link->win, &mem);
ioaddr = dev->base_addr;
writeb(0x47, base+0x800); /* Config Option Register of LAN */
......@@ -712,7 +710,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
writeb(0x8, base+0x822); /* Config and Status Register */
iounmap(base);
j = CardServices(ReleaseWindow, link->win);
j = pcmcia_release_window(link->win);
if (j != CS_SUCCESS)
cs_error(link->handle, ReleaseWindow, j);
return 0;
......@@ -737,10 +735,10 @@ static void fmvj18x_release(dev_link_t *link)
}
/* Don't bother checking to see if these succeed or not */
CardServices(ReleaseWindow, link->win);
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_window(link->win);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -777,7 +775,7 @@ static int fmvj18x_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -785,7 +783,7 @@ static int fmvj18x_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
fjn_reset(dev);
netif_device_attach(dev);
......
......@@ -214,7 +214,7 @@ static dev_link_t *ibmtr_attach(void)
client_reg.event_handler = &ibmtr_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
goto out_detach;
......@@ -264,7 +264,7 @@ static void ibmtr_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -281,8 +281,8 @@ static void ibmtr_detach(dev_link_t *link)
======================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void ibmtr_config(dev_link_t *link)
{
......@@ -304,9 +304,9 @@ static void ibmtr_config(dev_link_t *link)
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
......@@ -318,18 +318,18 @@ static void ibmtr_config(dev_link_t *link)
/* Try PRIMARY card at 0xA20-0xA23 */
link->io.BasePort1 = 0xA20;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) {
memcpy(info->node.dev_name, "tr0\0", 4);
} else {
/* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
link->io.BasePort1 = 0xA24;
CS_CHECK(RequestIO, link->handle, &link->io);
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io));
memcpy(info->node.dev_name, "tr1\0", 4);
}
dev->base_addr = link->io.BasePort1;
CS_CHECK(RequestIRQ, link->handle, &link->irq);
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
dev->irq = link->irq.AssignedIRQ;
ti->irq = link->irq.AssignedIRQ;
ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
......@@ -340,12 +340,11 @@ static void ibmtr_config(dev_link_t *link)
req.Base = 0;
req.Size = 0x2000;
req.AccessSpeed = 250;
link->win = (window_handle_t)link->handle;
CS_CHECK(RequestWindow, &link->win, &req);
CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win));
mem.CardOffset = mmiobase;
mem.Page = 0;
CS_CHECK(MapMemPage, link->win, &mem);
CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
ti->mmio = ioremap(req.Base, req.Size);
/* Allocate the SRAM memory window */
......@@ -354,17 +353,16 @@ static void ibmtr_config(dev_link_t *link)
req.Base = 0;
req.Size = sramsize * 1024;
req.AccessSpeed = 250;
info->sram_win_handle = (window_handle_t)link->handle;
CS_CHECK(RequestWindow, &info->sram_win_handle, &req);
CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &info->sram_win_handle));
mem.CardOffset = srambase;
mem.Page = 0;
CS_CHECK(MapMemPage, info->sram_win_handle, &mem);
CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem));
ti->sram_base = mem.CardOffset >> 12;
ti->sram_virt = (u_long)ioremap(req.Base, req.Size);
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
/* Set up the Token-Ring Controller Configuration Register and
turn on the card. Check the "Local Area Network Credit Card
......@@ -419,14 +417,14 @@ static void ibmtr_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
if (link->win) {
struct tok_info *ti = dev->priv;
iounmap((void *)ti->mmio);
CardServices(ReleaseWindow, link->win);
CardServices(ReleaseWindow, info->sram_win_handle);
pcmcia_release_window(link->win);
pcmcia_release_window(info->sram_win_handle);
}
link->state &= ~DEV_CONFIG;
......@@ -474,7 +472,7 @@ static int ibmtr_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -482,7 +480,7 @@ static int ibmtr_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
(dev->init)(dev);
netif_device_attach(dev);
......
......@@ -520,7 +520,7 @@ static dev_link_t *nmclan_attach(void)
client_reg.event_handler = &nmclan_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
nmclan_detach(link);
......@@ -558,7 +558,7 @@ static void nmclan_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -706,8 +706,8 @@ nmclan_config
ethernet device available to the system.
---------------------------------------------------------------------------- */
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void nmclan_config(dev_link_t *link)
{
......@@ -727,17 +727,17 @@ static void nmclan_config(dev_link_t *link)
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
link->state |= DEV_CONFIG;
CS_CHECK(RequestIO, handle, &link->io);
CS_CHECK(RequestIRQ, handle, &link->irq);
CS_CHECK(RequestConfiguration, handle, &link->conf);
CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
i = register_netdev(dev);
......@@ -753,8 +753,8 @@ static void nmclan_config(dev_link_t *link)
tuple.TupleData = buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
/* Verify configuration by reading the MACE ID. */
......@@ -819,9 +819,9 @@ static void nmclan_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -863,7 +863,7 @@ static int nmclan_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -871,7 +871,7 @@ static int nmclan_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
nmclan_reset(dev);
netif_device_attach(dev);
......@@ -903,7 +903,7 @@ static void nmclan_reset(struct net_device *dev)
reg.Action = CS_READ;
reg.Offset = CISREG_COR;
reg.Value = 0;
CardServices(AccessConfigurationRegister, link->handle, &reg);
pcmcia_access_configuration_register(link->handle, &reg);
OrigCorValue = reg.Value;
/* Reset Xilinx */
......@@ -912,12 +912,12 @@ static void nmclan_reset(struct net_device *dev)
DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n",
OrigCorValue);
reg.Value = COR_SOFT_RESET;
CardServices(AccessConfigurationRegister, link->handle, &reg);
pcmcia_access_configuration_register(link->handle, &reg);
/* Need to wait for 20 ms for PCMCIA to finish reset. */
/* Restore original COR configuration index */
reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK);
CardServices(AccessConfigurationRegister, link->handle, &reg);
pcmcia_access_configuration_register(link->handle, &reg);
/* Xilinx is now completely reset along with the MACE chip. */
lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
......@@ -1046,7 +1046,7 @@ static void mace_tx_timeout(struct net_device *dev)
printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name);
#if RESET_ON_TIMEOUT
printk("resetting card\n");
CardServices(ResetCard, link->handle);
pcmcia_reset_card(link->handle, NULL);
#else /* #if RESET_ON_TIMEOUT */
printk("NOT resetting card\n");
#endif /* #if RESET_ON_TIMEOUT */
......
......@@ -303,7 +303,7 @@ static dev_link_t *pcnet_attach(void)
client_reg.event_handler = &pcnet_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
pcnet_detach(link);
......@@ -342,7 +342,7 @@ static void pcnet_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -373,8 +373,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0;
req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle;
i = CardServices(RequestWindow, &link->win, &req);
i = pcmcia_request_window(&link->handle, &req, &link->win);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestWindow, i);
return NULL;
......@@ -384,7 +383,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
mem.Page = 0;
for (i = 0; i < NR_INFO; i++) {
mem.CardOffset = hw_info[i].offset & ~(req.Size-1);
CardServices(MapMemPage, link->win, &mem);
pcmcia_map_mem_page(link->win, &mem);
base = &virt[hw_info[i].offset & (req.Size-1)];
if ((readb(base+0) == hw_info[i].a0) &&
(readb(base+2) == hw_info[i].a1) &&
......@@ -397,7 +396,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
}
iounmap(virt);
j = CardServices(ReleaseWindow, link->win);
j = pcmcia_release_window(link->win);
if (j != CS_SUCCESS)
cs_error(link->handle, ReleaseWindow, j);
return (i < NR_INFO) ? hw_info+i : NULL;
......@@ -544,11 +543,8 @@ static hw_info_t *get_hwired(dev_link_t *link)
======================================================================*/
#define CS_CHECK(fn, args...) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
#define CFG_CHECK(fn, args...) \
if (CardServices(fn, args) != 0) goto next_entry
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int try_io_port(dev_link_t *link)
{
......@@ -571,12 +567,12 @@ static int try_io_port(dev_link_t *link)
for (j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300;
link->io.BasePort2 = (j ^ 0x300) + 0x10;
ret = CardServices(RequestIO, link->handle, &link->io);
ret = pcmcia_request_io(link->handle, &link->io);
if (ret == CS_SUCCESS) return ret;
}
return ret;
} else {
return CardServices(RequestIO, link->handle, &link->io);
return pcmcia_request_io(link->handle, &link->io);
}
}
......@@ -600,9 +596,9 @@ static void pcnet_config(dev_link_t *link)
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
......@@ -610,28 +606,28 @@ static void pcnet_config(dev_link_t *link)
link->state |= DEV_CONFIG;
/* Look up current Vcc */
CS_CHECK(GetConfigurationInfo, handle, &conf);
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf));
link->conf.Vcc = conf.Vcc;
tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON;
if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) &&
(CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS)) {
if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) {
manfid = le16_to_cpu(buf[0]);
prodid = le16_to_cpu(buf[1]);
}
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, handle, &tuple);
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (last_ret == CS_SUCCESS) {
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
cistpl_io_t *io = &(parse.cftable_entry.io);
CFG_CHECK(GetTupleData, handle, &tuple);
CFG_CHECK(ParseTuple, handle, &tuple, &parse);
if ((cfg->index == 0) || (cfg->io.nwin == 0))
goto next_entry;
if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0 ||
cfg->index == 0 || cfg->io.nwin == 0)
goto next_entry;
link->conf.ConfigIndex = cfg->index;
/* For multifunction cards, by convention, we configure the
......@@ -653,14 +649,14 @@ static void pcnet_config(dev_link_t *link)
if (last_ret == CS_SUCCESS) break;
}
next_entry:
last_ret = CardServices(GetNextTuple, handle, &tuple);
last_ret = pcmcia_get_next_tuple(handle, &tuple);
}
if (last_ret != CS_SUCCESS) {
cs_error(handle, RequestIO, last_ret);
goto failed;
}
CS_CHECK(RequestIRQ, handle, &link->irq);
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
if (link->io.NumPorts2 == 8) {
link->conf.Attributes |= CONF_ENABLE_SPKR;
......@@ -670,7 +666,7 @@ static void pcnet_config(dev_link_t *link)
(prodid == PRODID_IBM_HOME_AND_AWAY))
link->conf.ConfigIndex |= 0x10;
CS_CHECK(RequestConfiguration, handle, &link->conf);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
if (info->flags & HAS_MISC_REG) {
......@@ -799,11 +795,11 @@ static void pcnet_release(dev_link_t *link)
if (info->flags & USE_SHMEM) {
iounmap(info->base);
CardServices(ReleaseWindow, link->win);
pcmcia_release_window(link->win);
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
......@@ -847,7 +843,7 @@ static int pcnet_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(&info->dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -855,7 +851,7 @@ static int pcnet_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
pcnet_reset_8390(&info->dev);
NS8390_init(&info->dev, 1);
......@@ -1620,14 +1616,13 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
req.Attributes |= WIN_USE_WAIT;
req.Base = 0; req.Size = window_size;
req.AccessSpeed = mem_speed;
link->win = (window_handle_t)link->handle;
CS_CHECK(RequestWindow, &link->win, &req);
CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win));
mem.CardOffset = (start_pg << 8) + cm_offset;
offset = mem.CardOffset % window_size;
mem.CardOffset -= offset;
mem.Page = 0;
CS_CHECK(MapMemPage, link->win, &mem);
CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
/* Try scribbling on the buffer */
info->base = ioremap(req.Base, window_size);
......@@ -1639,7 +1634,7 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
pcnet_reset_8390(dev);
if (i != (TX_PAGES<<8)) {
iounmap(info->base);
CardServices(ReleaseWindow, link->win);
pcmcia_release_window(link->win);
info->base = NULL; link->win = NULL;
goto failed;
}
......
......@@ -379,7 +379,7 @@ static dev_link_t *smc91c92_attach(void)
client_reg.event_handler = &smc91c92_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
smc91c92_detach(link);
......@@ -418,7 +418,7 @@ static void smc91c92_detach(dev_link_t *link)
}
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -453,19 +453,27 @@ static int cvt_ascii_address(struct net_device *dev, char *s)
/*====================================================================*/
static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple,
cisparse_t *parse)
static int first_tuple(client_handle_t handle, tuple_t *tuple,
cisparse_t *parse)
{
int i;
i = CardServices(fn, handle, tuple);
if (i != CS_SUCCESS) return i;
i = CardServices(GetTupleData, handle, tuple);
if (i != CS_SUCCESS) return i;
return CardServices(ParseTuple, handle, tuple, parse);
int i;
if ((i = pcmcia_get_first_tuple(handle, tuple)) != CS_SUCCESS ||
(i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS)
return i;
return pcmcia_parse_tuple(handle, tuple, parse);
}
#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
static int next_tuple(client_handle_t handle, tuple_t *tuple,
cisparse_t *parse)
{
int i;
if ((i = pcmcia_get_next_tuple(handle, tuple)) != CS_SUCCESS ||
(i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS)
return i;
return pcmcia_parse_tuple(handle, tuple, parse);
}
/*======================================================================
......@@ -534,7 +542,7 @@ static int mhz_mfc_config(dev_link_t *link)
for (k = 0; k < 0x400; k += 0x10) {
if (k & 0x80) continue;
link->io.BasePort1 = k ^ 0x300;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break;
}
if (i == CS_SUCCESS) break;
......@@ -548,15 +556,14 @@ static int mhz_mfc_config(dev_link_t *link)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = req.Size = 0;
req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle;
i = CardServices(RequestWindow, &link->win, &req);
i = pcmcia_request_window(&link->handle, &req, &link->win);
if (i != CS_SUCCESS)
return i;
smc->base = ioremap(req.Base, req.Size);
mem.CardOffset = mem.Page = 0;
if (smc->manfid == MANFID_MOTOROLA)
mem.CardOffset = link->conf.ConfigBase;
i = CardServices(MapMemPage, link->win, &mem);
i = pcmcia_map_mem_page(link->win, &mem);
if ((i == CS_SUCCESS)
&& (smc->manfid == MANFID_MEGAHERTZ)
......@@ -594,9 +601,9 @@ static int mhz_setup(dev_link_t *link)
/* Another possibility: for the EM3288, in a special tuple */
tuple.DesiredTuple = 0x81;
if (CardServices(GetFirstTuple, handle, &tuple) != CS_SUCCESS)
if (pcmcia_get_first_tuple(handle, &tuple) != CS_SUCCESS)
return -1;
if (CardServices(GetTupleData, handle, &tuple) != CS_SUCCESS)
if (pcmcia_get_tuple_data(handle, &tuple) != CS_SUCCESS)
return -1;
buf[12] = '\0';
if (cvt_ascii_address(dev, buf) == 0)
......@@ -690,7 +697,7 @@ static int smc_config(dev_link_t *link)
link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base;
link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break;
}
i = next_tuple(link->handle, &tuple, &parse);
......@@ -763,14 +770,14 @@ static int osi_config(dev_link_t *link)
for (i = j = 0; j < 4; j++) {
link->io.BasePort2 = com[j];
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break;
}
if (i != CS_SUCCESS) {
/* Fallback: turn off hard decode */
link->conf.ConfigIndex = 0x03;
link->io.NumPorts2 = 0;
i = CardServices(RequestIO, link->handle, &link->io);
i = pcmcia_request_io(link->handle, &link->io);
}
dev->base_addr = link->io.BasePort1 + 0x10;
return i;
......@@ -791,12 +798,12 @@ static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid)
/* Read the station address from tuple 0x90, subtuple 0x04 */
tuple.DesiredTuple = 0x90;
i = CardServices(GetFirstTuple, handle, &tuple);
i = pcmcia_get_first_tuple(handle, &tuple);
while (i == CS_SUCCESS) {
i = CardServices(GetTupleData, handle, &tuple);
i = pcmcia_get_tuple_data(handle, &tuple);
if ((i != CS_SUCCESS) || (buf[0] == 0x04))
break;
i = CardServices(GetNextTuple, handle, &tuple);
i = pcmcia_get_next_tuple(handle, &tuple);
}
if (i != CS_SUCCESS)
return -1;
......@@ -869,9 +876,9 @@ static int check_sig(dev_link_t *link)
printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n");
args.client_data = link;
smc91c92_event(CS_EVENT_RESET_PHYSICAL, 0, &args);
CardServices(ReleaseIO, link->handle, &link->io);
pcmcia_release_io(link->handle, &link->io);
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
CardServices(RequestIO, link->handle, &link->io);
pcmcia_request_io(link->handle, &link->io);
smc91c92_event(CS_EVENT_CARD_RESET, 0, &args);
return check_sig(link);
}
......@@ -936,9 +943,9 @@ static void smc91c92_config(dev_link_t *link)
}
CS_EXIT_TEST(i, RequestIO, config_failed);
i = CardServices(RequestIRQ, link->handle, &link->irq);
i = pcmcia_request_irq(link->handle, &link->irq);
CS_EXIT_TEST(i, RequestIRQ, config_failed);
i = CardServices(RequestConfiguration, link->handle, &link->conf);
i = pcmcia_request_configuration(link->handle, &link->conf);
CS_EXIT_TEST(i, RequestConfiguration, config_failed);
if (smc->manfid == MANFID_MOTOROLA)
......@@ -1070,14 +1077,14 @@ static void smc91c92_release(dev_link_t *link)
return;
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
if (link->win) {
struct net_device *dev = link->priv;
struct smc_private *smc = dev->priv;
iounmap(smc->base);
CardServices(ReleaseWindow, link->win);
pcmcia_release_window(link->win);
}
link->state &= ~DEV_CONFIG;
......@@ -1124,7 +1131,7 @@ static int smc91c92_event(event_t event, int priority,
if (link->state & DEV_CONFIG) {
if (link->open)
netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -1135,7 +1142,7 @@ static int smc91c92_event(event_t event, int priority,
if ((smc->manfid == MANFID_MEGAHERTZ) &&
(smc->cardid == PRODID_MEGAHERTZ_EM3288))
mhz_3288_power(link);
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (smc->manfid == MANFID_MOTOROLA)
mot_config(link);
if ((smc->manfid == MANFID_OSITECH) &&
......
......@@ -391,28 +391,27 @@ static int do_stop(struct net_device *dev);
/*=============== Helper functions =========================*/
static int
get_tuple_data(int fn, client_handle_t handle, tuple_t *tuple)
first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
{
int err;
int err;
if ((err=CardServices(fn, handle, tuple)))
if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 &&
(err = pcmcia_get_tuple_data(handle, tuple)) == 0)
err = pcmcia_parse_tuple(handle, tuple, parse);
return err;
return CardServices(GetTupleData, handle, tuple);
}
static int
get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
{
int err;
int err;
if ((err=get_tuple_data(fn, handle, tuple)))
if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 &&
(err = pcmcia_get_tuple_data(handle, tuple)) == 0)
err = pcmcia_parse_tuple(handle, tuple, parse);
return err;
return CardServices(ParseTuple, handle, tuple, parse);
}
#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
#define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR)
#define GetByte(reg) ((unsigned)inb(ioaddr + (reg)))
#define GetWord(reg) ((unsigned)inw(ioaddr + (reg)))
......@@ -636,7 +635,7 @@ xirc2ps_attach(void)
client_reg.event_handler = &xirc2ps_event;
client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link;
if ((err = CardServices(RegisterClient, &link->handle, &client_reg))) {
if ((err = pcmcia_register_client(&link->handle, &client_reg))) {
cs_error(link->handle, RegisterClient, err);
xirc2ps_detach(link);
return NULL;
......@@ -680,7 +679,7 @@ xirc2ps_detach(dev_link_t * link)
/* Break the link with Card Services */
if (link->handle)
CardServices(DeregisterClient, link->handle);
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free it */
*linkp = link->next;
......@@ -887,7 +886,8 @@ xirc2ps_config(dev_link_t * link)
}
if (err) { /* not found: try to get the node-id from tuple 0x89 */
tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */
if (!(err = get_tuple_data(GetFirstTuple, handle, &tuple))) {
if ((err = pcmcia_get_first_tuple(handle, &tuple)) == 0 &&
(err = pcmcia_get_tuple_data(handle, &tuple)) == 0) {
if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID)
memcpy(&parse, buf, 8);
else
......@@ -953,8 +953,7 @@ xirc2ps_config(dev_link_t * link)
link->conf.ConfigIndex = cf->index ;
link->io.BasePort2 = cf->io.win[0].base;
link->io.BasePort1 = ioaddr;
if (!(err=CardServices(RequestIO, link->handle,
&link->io)))
if (!(err=pcmcia_request_io(link->handle, &link->io)))
goto port_found;
}
}
......@@ -976,8 +975,7 @@ xirc2ps_config(dev_link_t * link)
link->io.BasePort1 = link->io.BasePort2
+ (pass ? (cf->index & 0x20 ? -24:8)
: (cf->index & 0x20 ? 8:-24));
if (!(err=CardServices(RequestIO, link->handle,
&link->io)))
if (!(err=pcmcia_request_io(link->handle, &link->io)))
goto port_found;
}
}
......@@ -992,11 +990,11 @@ xirc2ps_config(dev_link_t * link)
link->io.NumPorts1 = 16;
for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
link->io.BasePort1 = ioaddr;
if (!(err=CardServices(RequestIO, link->handle, &link->io)))
if (!(err=pcmcia_request_io(link->handle, &link->io)))
goto port_found;
}
link->io.BasePort1 = 0; /* let CS decide */
if ((err=CardServices(RequestIO, link->handle, &link->io))) {
if ((err=pcmcia_request_io(link->handle, &link->io))) {
cs_error(link->handle, RequestIO, err);
goto config_error;
}
......@@ -1009,7 +1007,7 @@ xirc2ps_config(dev_link_t * link)
* Now allocate an interrupt line. Note that this does not
* actually assign a handler to the interrupt.
*/
if ((err=CardServices(RequestIRQ, link->handle, &link->irq))) {
if ((err=pcmcia_request_irq(link->handle, &link->irq))) {
cs_error(link->handle, RequestIRQ, err);
goto config_error;
}
......@@ -1018,8 +1016,7 @@ xirc2ps_config(dev_link_t * link)
* This actually configures the PCMCIA socket -- setting up
* the I/O windows and the interrupt mapping.
*/
if ((err=CardServices(RequestConfiguration,
link->handle, &link->conf))) {
if ((err=pcmcia_request_configuration(link->handle, &link->conf))) {
cs_error(link->handle, RequestConfiguration, err);
goto config_error;
}
......@@ -1037,16 +1034,14 @@ xirc2ps_config(dev_link_t * link)
reg.Action = CS_WRITE;
reg.Offset = CISREG_IOBASE_0;
reg.Value = link->io.BasePort2 & 0xff;
if ((err = CardServices(AccessConfigurationRegister, link->handle,
&reg))) {
if ((err = pcmcia_access_configuration_register(link->handle, &reg))) {
cs_error(link->handle, AccessConfigurationRegister, err);
goto config_error;
}
reg.Action = CS_WRITE;
reg.Offset = CISREG_IOBASE_1;
reg.Value = (link->io.BasePort2 >> 8) & 0xff;
if ((err = CardServices(AccessConfigurationRegister, link->handle,
&reg))) {
if ((err = pcmcia_access_configuration_register(link->handle, &reg))) {
cs_error(link->handle, AccessConfigurationRegister, err);
goto config_error;
}
......@@ -1058,15 +1053,14 @@ xirc2ps_config(dev_link_t * link)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = req.Size = 0;
req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle;
if ((err = CardServices(RequestWindow, &link->win, &req))) {
if ((err = pcmcia_request_window(&link->handle, &req, &link->win))) {
cs_error(link->handle, RequestWindow, err);
goto config_error;
}
local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
mem.CardOffset = 0x0;
mem.Page = 0;
if ((err = CardServices(MapMemPage, link->win, &mem))) {
if ((err = pcmcia_map_mem_page(link->win, &mem))) {
cs_error(link->handle, MapMemPage, err);
goto config_error;
}
......@@ -1171,11 +1165,11 @@ xirc2ps_release(dev_link_t *link)
local_info_t *local = dev->priv;
if (local->dingo)
iounmap(local->dingo_ccr - 0x0800);
CardServices(ReleaseWindow, link->win);
pcmcia_release_window(link->win);
}
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
} /* xirc2ps_release */
......@@ -1227,7 +1221,7 @@ xirc2ps_event(event_t event, int priority,
netif_device_detach(dev);
do_powerdown(dev);
}
CardServices(ReleaseConfiguration, link->handle);
pcmcia_release_configuration(link->handle);
}
break;
case CS_EVENT_PM_RESUME:
......@@ -1235,7 +1229,7 @@ xirc2ps_event(event_t event, int priority,
/* Fall through... */
case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf);
pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) {
do_reset(dev,1);
netif_device_attach(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment