struct pcmcia_config_check {
config_info_t conf;
- cistpl_cftable_entry_t dflt;
unsigned long ctl_base;
int skip_vcc;
int is_kme;
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct pcmcia_config_check *stk = priv_data;
/* Check for matching Vcc, unless we're desperate */
if (!stk->skip_vcc) {
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (stk->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
- goto next_entry;
- } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000)
- goto next_entry;
+ if (stk->conf.Vcc !=
+ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
+ return -ENODEV;
+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
+ if (stk->conf.Vcc !=
+ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
+ return -ENODEV;
}
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
- pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
+ pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
pdev->io.BasePort1 = io->win[0].base;
pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
if (!(io->flags & CISTPL_IO_16BIT))
pdev->io.BasePort2 = io->win[1].base;
pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
- goto next_entry;
+ return -ENODEV;
stk->ctl_base = pdev->io.BasePort2;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
pdev->io.NumPorts1 = io->win[0].len;
pdev->io.NumPorts2 = 0;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
- goto next_entry;
+ return -ENODEV;
stk->ctl_base = pdev->io.BasePort1 + 0x0e;
} else
- goto next_entry;
+ return -ENODEV;
/* If we've got this far, we're done */
return 0;
}
-next_entry:
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
-
return -ENODEV;
}
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf));
stk->skip_vcc = io_base = ctl_base = 0;
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
- memset(&stk->dflt, 0, sizeof(stk->dflt));
stk->skip_vcc = 1;
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
goto failed; /* No suitable config found */
static int bt3c_check_config(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
unsigned long try = (unsigned long) priv_data;
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
static int btuart_check_config(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
unsigned long try = (unsigned long) priv_data;
static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
static int dtl1_confcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
static int cm4000_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
if (!cfg->io.nwin)
static int cm4040_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int rc;
struct pcmcia_config_check {
config_info_t conf;
- cistpl_cftable_entry_t dflt;
unsigned long ctl_base;
int skip_vcc;
int is_kme;
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct pcmcia_config_check *stk = priv_data;
/* Check for matching Vcc, unless we're desperate */
if (!stk->skip_vcc) {
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (stk->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
- goto next_entry;
- } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000)
- goto next_entry;
+ if (stk->conf.Vcc !=
+ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
+ return -ENODEV;
+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
+ if (stk->conf.Vcc !=
+ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
+ return -ENODEV;
}
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
- pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
+ pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
pdev->conf.ConfigIndex = cfg->index;
pdev->io.BasePort1 = io->win[0].base;
pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
pdev->io.BasePort2 = io->win[1].base;
pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
- goto next_entry;
+ return -ENODEV;
stk->ctl_base = pdev->io.BasePort2;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
pdev->io.NumPorts1 = io->win[0].len;
pdev->io.NumPorts2 = 0;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
- goto next_entry;
+ return -ENODEV;
stk->ctl_base = pdev->io.BasePort1 + 0x0e;
} else
- goto next_entry;
+ return -ENODEV;
/* If we've got this far, we're done */
return 0;
}
-next_entry:
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
-
return -ENODEV;
}
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
stk->skip_vcc = io_base = ctl_base = 0;
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
- memset(&stk->dflt, 0, sizeof(stk->dflt));
stk->skip_vcc = 1;
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
goto failed; /* No suitable config found */
static int avmcs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
if (cf->io.nwin <= 0)
======================================================================*/
static int avma1cs_configcheck(struct pcmcia_device *p_dev,
- cistpl_cftable_entry_t *cf,
- void *priv_data)
+ cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
+ void *priv_data)
{
if (cf->io.nwin <= 0)
return -ENODEV;
static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int j;
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
struct sedlbauer_config_data {
- cistpl_cftable_entry_t dflt;
config_info_t conf;
win_req_t req;
};
static int sedlbauer_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct sedlbauer_config_data *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- cfg_mem->dflt = *cfg;
if (cfg->index == 0)
return -ENODEV;
/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
+ if (cfg_mem->conf.Vcc !=
+ cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
- } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000)
+ } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
+ if (cfg_mem->conf.Vcc !=
+ dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
}
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
- else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
- p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
+ else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
+ p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
/* Do we need to allocate an interrupt? */
- if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1)
+ if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
needs to be mapped to virtual space with ioremap() before it
is used.
*/
- if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) {
- cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem;
+ if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
+ cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
memreq_t map;
cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
cfg_mem->req.Attributes |= WIN_ENABLE;
static int teles_cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int j;
static int axnet_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int i;
static int pcnet_confcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int *has_shmem = priv_data;
static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int k;
static int smc_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
p_dev->io.BasePort1 = cf->io.win[0].base;
static int
xirc2ps_config_modem(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
unsigned int ioaddr;
static int
xirc2ps_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int *pass = priv_data;
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
-struct airo_cs_config_data {
- cistpl_cftable_entry_t dflt;
- win_req_t req;
-};
-
static int airo_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
- struct airo_cs_config_data *cfg_mem = priv_data;
-
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- cfg_mem->dflt = *cfg;
+ win_req_t *req = priv_data;
if (cfg->index == 0)
return -ENODEV;
/* Note that the CIS values need to be rescaled */
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
- else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
- p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
+ else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
+ p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
/* Do we need to allocate an interrupt? */
- if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1)
+ if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
needs to be mapped to virtual space with ioremap() before it
is used.
*/
- if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) {
- cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem;
+ if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
+ cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
memreq_t map;
- cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
- cfg_mem->req.Base = mem->win[0].host_addr;
- cfg_mem->req.Size = mem->win[0].len;
- cfg_mem->req.AccessSpeed = 0;
- if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0)
+ req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
+ req->Base = mem->win[0].host_addr;
+ req->Size = mem->win[0].len;
+ req->AccessSpeed = 0;
+ if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
return -ENODEV;
map.Page = 0;
map.CardOffset = mem->win[0].card_addr;
static int airo_config(struct pcmcia_device *link)
{
local_info_t *dev;
- struct airo_cs_config_data *cfg_mem;
+ win_req_t *req;
int last_fn, last_ret;
dev = link->priv;
DEBUG(0, "airo_config(0x%p)\n", link);
- cfg_mem = kzalloc(sizeof(struct airo_cs_config_data), GFP_KERNEL);
- if (!cfg_mem)
+ req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
+ if (!req)
return -ENOMEM;
/*
* and most client drivers will only use the CIS to fill in
* implementation-defined details.
*/
- last_ret = pcmcia_loop_config(link, airo_cs_config_check, cfg_mem);
+ last_ret = pcmcia_loop_config(link, airo_cs_config_check, req);
if (last_ret)
goto failed;
printk(" & 0x%04x-0x%04x", link->io.BasePort2,
link->io.BasePort2+link->io.NumPorts2-1);
if (link->win)
- printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base,
- cfg_mem->req.Base+cfg_mem->req.Size-1);
+ printk(", mem 0x%06lx-0x%06lx", req->Base,
+ req->Base+req->Size-1);
printk("\n");
- kfree(cfg_mem);
+ kfree(req);
return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed:
airo_release(link);
- kfree(cfg_mem);
+ kfree(req);
return -ENODEV;
} /* airo_config */
static int atmel_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
- cistpl_cftable_entry_t *dflt = priv_data;
-
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- *dflt = *cfg;
if (cfg->index == 0)
return -ENODEV;
+
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
local_info_t *dev;
int last_fn, last_ret;
struct pcmcia_device_id *did;
- cistpl_cftable_entry_t dflt = { 0 };
dev = link->priv;
did = handle_to_dev(link).driver_data;
these things without consulting the CIS, and most client drivers
will only use the CIS to fill in implementation-defined details.
*/
- if (pcmcia_loop_config(link, atmel_config_check, &dflt))
+ if (pcmcia_loop_config(link, atmel_config_check, NULL))
goto failed;
/*
* socket and make the device available to the system */
struct prism2_config_data {
- cistpl_cftable_entry_t dflt;
config_info_t conf;
};
static int prism2_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct prism2_config_data *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- cfg_mem->dflt = *cfg;
if (cfg->index == 0)
return -ENODEV;
PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
- "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index);
+ "(default 0x%02X)\n", cfg->index, dflt->index);
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
" this entry\n");
return -ENODEV;
}
- } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] /
+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
+ if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
10000 && !ignore_cis_vcc) {
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
"- skipping this entry\n");
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
- p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
+ p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */
- if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1)
+ if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) {
/* At least Compaq WL200 does not have IRQInfo1 set,
/* IO window settings */
PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
- "cfg_mem->dflt.io.nwin=%d\n",
- cfg->io.nwin, cfg_mem->dflt.io.nwin);
+ "dflt->io.nwin=%d\n",
+ cfg->io.nwin, dflt->io.nwin);
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
"io.base=0x%04x, len=%d\n", io->flags,
} while (0)
struct orinoco_cs_config_data {
- cistpl_cftable_entry_t dflt;
config_info_t conf;
};
static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct orinoco_cs_config_data *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- cfg_mem->dflt = *cfg;
if (cfg->index == 0)
goto next_entry;
if (!ignore_cis_vcc)
goto next_entry;
}
- } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) {
- DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000);
+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
+ if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+ DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
if (!ignore_cis_vcc)
goto next_entry;
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
- cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
*/
struct spectrum_cs_config_data {
- cistpl_cftable_entry_t dflt;
config_info_t conf;
};
static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct spectrum_cs_config_data *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- cfg_mem->dflt = *cfg;
if (cfg->index == 0)
goto next_entry;
if (!ignore_cis_vcc)
goto next_entry;
}
- } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) {
- DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000);
+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
+ if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+ DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
if (!ignore_cis_vcc)
goto next_entry;
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
- cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
static int parport_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
- cistpl_cftable_entry_t *dflt = priv_data;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
if (epp_mode)
p_dev->io.NumPorts2 = io->win[1].len;
}
if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
- goto next_entry;
+ return -ENODEV;
return 0;
}
-
-next_entry:
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- *dflt = *cfg;
- return -ENODEV;
}
static int parport_config(struct pcmcia_device *link)
{
parport_info_t *info = link->priv;
- cistpl_cftable_entry_t dflt = { 0 };
struct parport *p;
int last_ret, last_fn;
DEBUG(0, "parport_config(0x%p)\n", link);
- last_ret = pcmcia_loop_config(link, parport_config_check, &dflt);
+ last_ret = pcmcia_loop_config(link, parport_config_check, NULL);
if (last_ret) {
cs_error(link, RequestIO, last_ret);
goto failed;
tuple_t tuple;
cisparse_t parse;
u8 buf[256];
+ cistpl_cftable_entry_t dflt;
};
/**
int pcmcia_loop_config(struct pcmcia_device *p_dev,
int (*conf_check) (struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data),
void *priv_data)
{
struct pcmcia_cfg_mem *cfg_mem;
+
tuple_t *tuple;
int ret = -ENODEV;
/* default values */
p_dev->conf.ConfigIndex = cfg->index;
+ if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
+ cfg_mem->dflt = *cfg;
- ret = conf_check(p_dev, cfg, priv_data);
+ ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data);
if (!ret)
break;
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int aha152x_config_check(struct pcmcia_device *p_dev,
- cistpl_cftable_entry_t *cfg,
- void *priv_data)
+ cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
+ void *priv_data)
{
/* For New Media T&J, look for a SCSI window */
if (cfg->io.win[0].len >= 0x20)
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int fdomain_config_check(struct pcmcia_device *p_dev,
- cistpl_cftable_entry_t *cfg,
- void *priv_data)
+ cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
+ void *priv_data)
{
p_dev->io.BasePort1 = cfg->io.win[0].base;
return pcmcia_request_io(p_dev, &p_dev->io);
nsp_hw_data *data;
win_req_t req;
config_info_t conf;
- cistpl_cftable_entry_t dflt;
};
static int nsp_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct nsp_cs_configdata *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t));
if (cfg->index == 0)
return -ENODEV;
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
- else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000)
+ else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
+ if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
p_dev->conf.Vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
- } else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) {
+ } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
p_dev->conf.Vpp =
- cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
+ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
}
/* Do we need to allocate an interrupt? */
- if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) {
+ if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
- }
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
goto next_entry;
}
- if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) {
+ if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
memreq_t map;
cistpl_mem_t *mem =
- (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem;
+ (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
cfg_mem->req.Attributes |= WIN_ENABLE;
cfg_mem->req.Base = mem->win[0].host_addr;
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int qlogic_config_check(struct pcmcia_device *p_dev,
- cistpl_cftable_entry_t *cfg,
- void *priv_data)
+ cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
+ void *priv_data)
{
p_dev->io.BasePort1 = cfg->io.win[0].base;
p_dev->io.NumPorts1 = cfg->io.win[0].len;
static int SYM53C500_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
p_dev->io.BasePort1 = cfg->io.win[0].base;
static int simple_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
static const int size_table[2] = { 8, 16 };
static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
static int multi_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int *base2 = priv_data;
static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
int *base2 = priv_data;
static int ixj_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
- cistpl_cftable_entry_t *dflt = priv_data;
-
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.BasePort1 = io->win[0].base;
p_dev->io.BasePort2 = io->win[1].base;
p_dev->io.NumPorts2 = io->win[1].len;
}
- if (pcmcia_request_io(p_dev, &p_dev->io)) {
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- *dflt = *cfg;
- } else
+ if (!pcmcia_request_io(p_dev, &p_dev->io))
return 0;
}
return -ENODEV;
}
struct sl811_css_cfg {
- cistpl_cftable_entry_t dflt;
config_info_t conf;
};
static int sl811_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
+ cistpl_cftable_entry_t *dflt,
void *priv_data)
{
struct sl811_css_cfg *cfg_mem = priv_data;
- if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
- memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t));
-
if (cfg->index == 0)
return -ENODEV;
if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 !=
cfg_mem->conf.Vcc)
return -ENODEV;
- } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) {
- if (cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000
+ } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
+ if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000
!= cfg_mem->conf.Vcc)
return -ENODEV;
}
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
- else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
+ else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp =
- cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
+ dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
/* we need an interrupt */
- if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1)
+ if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
- if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) {
- cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io;
+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
int pcmcia_loop_config(struct pcmcia_device *p_dev,
int (*conf_check) (struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
void *priv_data),
void *priv_data);