From khadija_yhombi at openoffice.org Wed Sep 1 21:26:05 2010 From: khadija_yhombi at openoffice.org (khadija) Date: Thu, 2 Sep 2010 04:26:05 +0300 Subject: khadija Message-ID: <201009020118.o821HBGi014404@localhost.localdomain> Je sais que cette proposition pourrait ?tre une surprise pour vous, mais comme une situation d'urgence ? notre condition avec mes fils ici ? Dakar au S?n?gal. Soyez b?nis par Allah que vous m'aider ma famille et moi de transf?rer et d'investir notre argent dans votre pays. Je suis Khadija Yhombi de la R?publique d?mocratique du Congo (RD Congo) maintenant r?fugi? au Royaume-Uni dans le cadre du HCR des Nations Unies (Haut Commissariat pour les r?fugi?s). J'ai obtenu votre contact au cours d'une recherche d?sesp?r?e ici ? la Chambre internationale de commerce pour une op?ration d'investissement possible. Mon (d?funt) mari l'honorable Dr Kyelu Yhombi qui ?tait l'ancien ministre de l'?conomie des finances en RD Congo a ?t? assassin? par les rebelles dans la capitale en 2008. Et toutes nos propri?t?s ont ?t? totalement d?truites. Toutefois, nous avons r?ussi ? s'?chapper avec quelques-uns des documents de mon mari qui couvre un montant de 5 millions de dollars (cinq millions d! e dollars) qui est actuellement d?pos? en toute s?curit? dans un titre mondial ici ? Londres. C'est pourquoi je suis ici. La Global Security ? approuv? de joindre le HCR des Nations Unies pour m'aider dans la question, mais je cherche une personne de confiance au Maroc ou en Alg?rie qui va m'aider mes enfants et moi pour transf?rer et investir les fonds dans son pays parce que c'est un pays pacifique. Donc, mes enfants se d?placent ? partir de Dakar au S?n?gal, o? ils sont pris comme r?fugi?s au compte du HCR. Je suis pr?t ? vous offrir 20% sur la somme totale pour votre aide. S'il vous pla?t pour votre bonne information, cette transaction est 100% s?r et en aucune fa?on li?s ? l'op?ration ill?gale. Qu'Allah le TOUT-PUISSANT vous b?nisse pour toute aide. S'il vous pla?t si vous etes int?resser veuillez bien vouloir me contacter via mon e-mail (khadija1yhombi at inMail24.com) ou appelez-moi ? ce num?ro (00447031895054) pour plus de d?tails. Je veux en savoir plus sur vous Votre nom ....................... Votre ville actuelle........... Votre profession ... ... ... ... .. Votre num?ro de t?l?phone ... ... ... ... .... Votre ?ge ... Cordialement Khadija Yhombi From linux at dominikbrodowski.net Fri Sep 3 06:56:28 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:56:28 +0200 Subject: [RFC] PCMCIA patches for 2.6.37-rc1 Message-ID: <20100903105628.GA21255@comet.dominikbrodowski.net> Hey, here's my usual patch series with PCMCIA clenaup patches intended for submission after 2.6.36 is released. The patches will be sent to the PCMCIA list shortly, with CC to other lists if deemed appropriate. Also, they can be found in the "pcmcia-test" branch at git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git pcmcia-test and gitweb at http://git.kernel.org/?p=linux/kernel/git/brodo/pcmcia-2.6.git As usual, I'm interested in your input to this patch series. Best, Dominik Dominik Brodowski (15): pcmcia: do not use win_req_t when calling pcmcia_request_window() pcmcia: split up modify_configuration() into two fixup functions pcmcia: move Vpp setup to struct pcmcia_device pcmcia: remove Pin, Copy configuration register access pcmcia: simplify Status, ExtStatus register access pcmcia: simplify IntType pcmcia: move config_{base,index,regs} to struct pcmcia_device pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device pcmcia: Documentation update pcmcia: introduce autoconfiguration feature pcmcia: use autoconfiguration feature for ioports and iomem pcmcia: remove the "Finally, report what we've done" message pcmcia: move driver name to struct pcmcia_driver pcmcia: avoid messages on module (un)loading pcmcia: remove obsolete and wrong comments Documentation/pcmcia/driver-changes.txt | 25 ++ drivers/ata/pata_pcmcia.c | 77 ++---- drivers/bluetooth/bluecard_cs.c | 12 +- drivers/bluetooth/bt3c_cs.c | 64 ++-- drivers/bluetooth/btuart_cs.c | 62 ++-- drivers/bluetooth/dtl1_cs.c | 27 +-- drivers/char/pcmcia/cm4000_cs.c | 29 +-- drivers/char/pcmcia/cm4040_cs.c | 37 +-- drivers/char/pcmcia/ipwireless/main.c | 117 +++----- drivers/char/pcmcia/ipwireless/main.h | 5 - drivers/char/pcmcia/ipwireless/tty.h | 1 - drivers/char/pcmcia/synclink_cs.c | 44 +--- drivers/ide/ide-cs.c | 129 ++------ drivers/isdn/hardware/avm/avm_cs.c | 83 +----- drivers/isdn/hisax/avma1_cs.c | 97 +----- drivers/isdn/hisax/elsa_cs.c | 100 +------ drivers/isdn/hisax/sedlbauer_cs.c | 168 +--------- drivers/isdn/hisax/teles_cs.c | 98 +----- drivers/mmc/host/sdricoh_cs.c | 5 +- drivers/mtd/maps/pcmciamtd.c | 102 ++---- drivers/net/pcmcia/3c574_cs.c | 35 +-- drivers/net/pcmcia/3c589_cs.c | 47 +--- drivers/net/pcmcia/axnet_cs.c | 87 +---- drivers/net/pcmcia/com20020_cs.c | 43 +--- drivers/net/pcmcia/fmvj18x_cs.c | 67 ++--- drivers/net/pcmcia/ibmtr_cs.c | 89 ++---- drivers/net/pcmcia/nmclan_cs.c | 42 +--- drivers/net/pcmcia/pcnet_cs.c | 143 +++------ drivers/net/pcmcia/smc91c92_cs.c | 114 ++----- drivers/net/pcmcia/xirc2ps_cs.c | 161 +++------ drivers/net/wireless/airo_cs.c | 154 +-------- drivers/net/wireless/atmel_cs.c | 135 +------- drivers/net/wireless/b43/pcmcia.c | 24 +- drivers/net/wireless/hostap/hostap_cs.c | 102 +------ drivers/net/wireless/libertas/if_cs.c | 58 +--- drivers/net/wireless/orinoco/orinoco_cs.c | 131 +------- drivers/net/wireless/orinoco/spectrum_cs.c | 128 +------- drivers/net/wireless/ray_cs.c | 91 ++---- drivers/net/wireless/ray_cs.h | 2 - drivers/net/wireless/wl3501_cs.c | 47 +--- drivers/parport/parport_cs.c | 76 +---- drivers/pcmcia/au1000_generic.h | 1 - drivers/pcmcia/au1000_pb1x00.c | 1 - drivers/pcmcia/cistpl.c | 1 - drivers/pcmcia/cs.c | 1 - drivers/pcmcia/cs_internal.h | 9 - drivers/pcmcia/ds.c | 37 ++- drivers/pcmcia/i82092.c | 1 - drivers/pcmcia/i82365.c | 1 - drivers/pcmcia/m32r_cfc.c | 1 - drivers/pcmcia/m32r_pcc.c | 1 - drivers/pcmcia/m8xx_pcmcia.c | 1 - drivers/pcmcia/pcmcia_cis.c | 116 ++++++- drivers/pcmcia/pcmcia_resource.c | 379 +++++++++++++--------- drivers/pcmcia/pd6729.c | 1 - drivers/pcmcia/rsrc_iodyn.c | 1 - drivers/pcmcia/rsrc_mgr.c | 1 - drivers/pcmcia/rsrc_nonstatic.c | 1 - drivers/pcmcia/sa1100_generic.c | 1 - drivers/pcmcia/soc_common.h | 1 - drivers/pcmcia/socket_sysfs.c | 1 - drivers/pcmcia/tcic.c | 1 - drivers/pcmcia/xxs1500_ss.c | 1 - drivers/pcmcia/yenta_socket.c | 1 - drivers/scsi/pcmcia/aha152x_stub.c | 48 ++-- drivers/scsi/pcmcia/fdomain_stub.c | 24 +- drivers/scsi/pcmcia/nsp_cs.c | 178 ++--------- drivers/scsi/pcmcia/qlogic_stub.c | 24 +- drivers/scsi/pcmcia/sym53c500_cs.c | 22 +- drivers/serial/serial_cs.c | 200 +++++------- drivers/ssb/main.c | 1 - drivers/ssb/pcmcia.c | 1 - drivers/ssb/scan.c | 1 - drivers/staging/comedi/drivers/cb_das16_cs.c | 58 +--- drivers/staging/comedi/drivers/das08_cs.c | 129 +------- drivers/staging/comedi/drivers/ni_daq_700.c | 130 +------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 130 +------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 144 +-------- drivers/staging/comedi/drivers/ni_mio_cs.c | 23 +- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 124 +------- drivers/staging/wlags49_h2/wl_cs.c | 77 +---- drivers/staging/wlags49_h2/wl_internal.h | 1 - drivers/staging/wlags49_h2/wl_main.c | 19 -- drivers/telephony/ixj_pcmcia.c | 41 +-- drivers/usb/host/sl811_cs.c | 68 +---- include/pcmcia/cs.h | 95 ------ include/pcmcia/ds.h | 85 ++++-- include/pcmcia/ss.h | 1 - sound/pcmcia/pdaudiocf/pdaudiocf.c | 16 +- sound/pcmcia/pdaudiocf/pdaudiocf.h | 1 - sound/pcmcia/vx/vxpocket.c | 15 +- sound/pcmcia/vx/vxpocket.h | 1 - 92 files changed, 1241 insertions(+), 4034 deletions(-) delete mode 100644 include/pcmcia/cs.h From linux at dominikbrodowski.net Fri Sep 3 06:57:09 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:09 +0200 Subject: [PATCH 10/15] pcmcia: introduce autoconfiguration feature In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-10-git-send-email-linux@dominikbrodowski.net> Introduce an autoconfiguration feature to set certain values in pcmcia_loop_config(), instead of copying the same code over and over in each PCMCIA driver. At first, introduce the following options: CONF_AUTO_CHECK_VCC check or matching Vcc entry CONF_AUTO_SET_VPP set Vpp CONF_AUTO_AUDIO enable the speaker line CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-ide at vger.kernel.org CC: linux-usb at vger.kernel.org CC: laforge at gnumonks.org CC: linux-mtd at lists.infradead.org CC: linux-bluetooth at vger.kernel.org CC: alsa-devel at alsa-project.org CC: linux-serial at vger.kernel.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 23 +---- drivers/bluetooth/bt3c_cs.c | 7 +- drivers/bluetooth/btuart_cs.c | 7 +- drivers/bluetooth/dtl1_cs.c | 1 - drivers/char/pcmcia/cm4000_cs.c | 1 - drivers/char/pcmcia/cm4040_cs.c | 1 - drivers/char/pcmcia/ipwireless/main.c | 1 - drivers/char/pcmcia/synclink_cs.c | 1 - drivers/ide/ide-cs.c | 23 +---- drivers/isdn/hardware/avm/avm_cs.c | 1 - drivers/isdn/hisax/avma1_cs.c | 1 - drivers/isdn/hisax/elsa_cs.c | 1 - drivers/isdn/hisax/sedlbauer_cs.c | 25 +----- drivers/isdn/hisax/teles_cs.c | 1 - drivers/net/pcmcia/axnet_cs.c | 1 - drivers/net/pcmcia/fmvj18x_cs.c | 1 - drivers/net/pcmcia/pcnet_cs.c | 1 - drivers/net/pcmcia/smc91c92_cs.c | 2 - drivers/net/pcmcia/xirc2ps_cs.c | 5 +- drivers/net/wireless/airo_cs.c | 17 +--- drivers/net/wireless/atmel_cs.c | 17 +--- drivers/net/wireless/hostap/hostap_cs.c | 27 +----- drivers/net/wireless/libertas/if_cs.c | 1 - drivers/net/wireless/orinoco/orinoco_cs.c | 31 +------ drivers/net/wireless/orinoco/spectrum_cs.c | 24 +---- drivers/parport/parport_cs.c | 1 - drivers/pcmcia/pcmcia_cis.c | 36 ++++++- drivers/scsi/pcmcia/aha152x_stub.c | 1 - drivers/scsi/pcmcia/fdomain_stub.c | 1 - drivers/scsi/pcmcia/nsp_cs.c | 110 ++++++++------------- drivers/scsi/pcmcia/qlogic_stub.c | 1 - drivers/scsi/pcmcia/sym53c500_cs.c | 1 - drivers/serial/serial_cs.c | 10 +-- drivers/staging/comedi/drivers/cb_das16_cs.c | 1 - drivers/staging/comedi/drivers/das08_cs.c | 1 - drivers/staging/comedi/drivers/ni_daq_700.c | 10 +-- drivers/staging/comedi/drivers/ni_daq_dio24.c | 10 +-- drivers/staging/comedi/drivers/ni_labpc_cs.c | 11 +-- drivers/staging/comedi/drivers/ni_mio_cs.c | 1 - drivers/staging/comedi/drivers/quatech_daqp_cs.c | 1 - drivers/telephony/ixj_pcmcia.c | 1 - drivers/usb/host/sl811_cs.c | 24 +---- include/pcmcia/ds.h | 7 +- 43 files changed, 120 insertions(+), 329 deletions(-) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 76da55d..954f43c 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -169,34 +169,16 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { struct pcmcia_config_check { 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, - unsigned int vcc, 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 (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } - } - - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; @@ -249,6 +231,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; pdev->config_flags |= CONF_ENABLE_IRQ; + pdev->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; /* See if we have a manufacturer identifier. Use it to set is_kme for vendor quirks */ @@ -262,10 +245,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) if (!stk) goto out1; stk->is_kme = is_kme; - stk->skip_vcc = io_base = ctl_base = 0; + io_base = ctl_base = 0; if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { - stk->skip_vcc = 1; + pdev->config_flags &= ~CONF_AUTO_CHECK_VCC; if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) goto failed; /* No suitable config found */ } diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 3db9588..97338a3 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -659,7 +659,7 @@ static int bt3c_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 8; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP; return bt3c_config(link); } @@ -676,15 +676,11 @@ static void bt3c_detach(struct pcmcia_device *link) static int bt3c_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { unsigned long try = (unsigned long) priv_data; - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { p_dev->resource[0]->start = cf->io.win[0].base; @@ -697,7 +693,6 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index c5c4359..8a6864f 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -588,7 +588,7 @@ static int btuart_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 8; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP; return btuart_config(link); } @@ -605,15 +605,11 @@ static void btuart_detach(struct pcmcia_device *link) static int btuart_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int *try = priv_data; - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { p_dev->resource[0]->start = cf->io.win[0].base; @@ -626,7 +622,6 @@ static int btuart_check_config(struct pcmcia_device *p_dev, static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 38206df..4620cc3 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -592,7 +592,6 @@ static void dtl1_detach(struct pcmcia_device *link) static int dtl1_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 75caa8c..0b2f3b9 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1744,7 +1744,6 @@ static void cmm_cm4000_release(struct pcmcia_device * link) static int cm4000_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (!cfg->io.nwin) diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 0c87b80..acf88d5 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -518,7 +518,6 @@ static void cm4040_reader_release(struct pcmcia_device *link) static int cm4040_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int rc; diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index cd21b2b..1b7f092 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -78,7 +78,6 @@ static void signalled_reboot_callback(void *callback_data) static int ipwireless_probe(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { struct ipw_dev *ipw = priv_data; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 99feaed..c701434 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -564,7 +564,6 @@ static int mgslpc_probe(struct pcmcia_device *link) static int mgslpc_ioprobe(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (!cfg->io.nwin) diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 87ad049..25b8a10 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -99,6 +99,7 @@ static int ide_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; return ide_config(link); } /* ide_attach */ @@ -195,34 +196,16 @@ out_release: struct pcmcia_config_check { 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, - unsigned int vcc, 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 (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } - } - - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; @@ -271,10 +254,10 @@ static int ide_config(struct pcmcia_device *link) if (!stk) goto err_mem; stk->is_kme = is_kme; - stk->skip_vcc = io_base = ctl_base = 0; + io_base = ctl_base = 0; if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { - stk->skip_vcc = 1; + link->config_flags &= ~CONF_AUTO_CHECK_VCC; if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) goto failed; /* No suitable config found */ } diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 6ea5cd2..9dbab9c 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -110,7 +110,6 @@ static void avmcs_detach(struct pcmcia_device *link) static int avmcs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cf->io.nwin <= 0) diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 5dd47ad..2f2b000 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -117,7 +117,6 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link) static int avma1cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cf->io.nwin <= 0) diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 368c8a2..0a65280 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -163,7 +163,6 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link) static int elsa_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int j; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 791e23a..b69eccf 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -164,33 +164,11 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link) static int sedlbauer_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Use power settings for Vcc and Vpp if present */ - /* Note that the CIS values need to be rescaled */ - if (cfg->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000) - return -ENODEV; - } else if (dflt->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000) - return -ENODEV; - } - - if (cfg->vpp1.present & (1<vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -223,6 +201,9 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO; + /* In this loop, we scan the CIS for configuration table entries, each of which describes a valid card configuration, including diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 2ae71e3..6605480 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -145,7 +145,6 @@ static void __devexit teles_detach(struct pcmcia_device *link) static int teles_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int j; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index f361d28..17f1040 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -287,7 +287,6 @@ static int try_io_port(struct pcmcia_device *link) static int axnet_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int i; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index f6865ad..c1479e3 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -322,7 +322,6 @@ static int ungermann_try_io_port(struct pcmcia_device *link) static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { return 0; /* strange, but that's what the code did already before... */ diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index ddd4bd2..301f3d4 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -503,7 +503,6 @@ static int try_io_port(struct pcmcia_device *link) static int pcnet_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int *has_shmem = priv_data; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 8c16ba6..e127d2b 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -420,7 +420,6 @@ static int mhz_3288_power(struct pcmcia_device *link) static int mhz_mfc_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int k; @@ -590,7 +589,6 @@ static int mot_setup(struct pcmcia_device *link) static int smc_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->resource[0]->start = cf->io.win[0].base; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 7a4a99b..2bc2eb8 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -668,7 +668,6 @@ static int xirc2ps_config_modem(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { unsigned int ioaddr; @@ -688,7 +687,6 @@ static int xirc2ps_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int *pass = priv_data; @@ -826,7 +824,8 @@ xirc2ps_config(struct pcmcia_device * link) * the Mako if (on the first pass) the COR bit 5 is set. */ for (pass=0; pass < 2; pass++) - if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) + if (!pcmcia_loop_config(link, xirc2ps_config_check, + &pass)) goto port_found; /* if special option: * try to configure as Ethernet only. diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 5939d0c..63bf662 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -140,25 +140,11 @@ static void airo_detach(struct pcmcia_device *link) static int airo_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Use power settings for Vcc and Vpp if present */ - /* Note that the CIS values need to be rescaled */ - if (cfg->vpp1.present & (1<vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -193,6 +179,9 @@ static int airo_config(struct pcmcia_device *link) dev_dbg(&link->dev, "airo_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | + CONF_AUTO_AUDIO; + /* * In this loop, we scan the CIS for configuration table * entries, each of which describes a valid card diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 080266e..812decd 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -157,25 +157,11 @@ static int card_present(void *arg) static int atmel_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Use power settings for Vcc and Vpp if present */ - /* Note that the CIS values need to be rescaled */ - if (cfg->vpp1.present & (1<vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -207,6 +193,9 @@ static int atmel_config(struct pcmcia_device *link) dev_dbg(&link->dev, "atmel_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | + CONF_AUTO_AUDIO; + /* In this loop, we scan the CIS for configuration table entries, each of which describes a valid card configuration, including diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 5b0b582..d4f19af 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -472,7 +472,6 @@ static void prism2_detach(struct pcmcia_device *link) static int prism2_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) @@ -481,28 +480,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev, PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " "(default 0x%02X)\n", cfg->index, dflt->index); - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* 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 (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / - 10000 && !ignore_cis_vcc) { - PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" - " this entry\n"); - return -ENODEV; - } - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / - 10000 && !ignore_cis_vcc) { - PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " - "- skipping this entry\n"); - return -ENODEV; - } - } - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) @@ -553,6 +530,10 @@ static int prism2_config(struct pcmcia_device *link) } /* Look for an appropriate configuration table entry in the CIS */ + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | + CONF_AUTO_CHECK_VCC; + if (ignore_cis_vcc) + link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, prism2_config_check, NULL); if (ret) { if (!ignore_cis_vcc) diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 6020c19..031f3e6 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -797,7 +797,6 @@ static void if_cs_release(struct pcmcia_device *p_dev) static int if_cs_ioprobe(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 00316a1..b921738 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -145,39 +145,11 @@ static void orinoco_cs_detach(struct pcmcia_device *link) static int orinoco_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) goto next_entry; - /* 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 (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", - __func__, vcc, - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); - if (!ignore_cis_vcc) - goto next_entry; - } - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", - __func__, 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->vpp = - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - /* Do we need to allocate an interrupt? */ p_dev->config_flags |= CONF_ENABLE_IRQ; @@ -230,6 +202,9 @@ orinoco_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + if (ignore_cis_vcc) + link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); if (ret) { if (!ignore_cis_vcc) diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index ca2c6c0..f462c78 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -207,32 +207,11 @@ static void spectrum_cs_detach(struct pcmcia_device *link) static int spectrum_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) goto next_entry; - /* 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 (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", - __func__, vcc, - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); - if (!ignore_cis_vcc) - goto next_entry; - } - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", - __func__, 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->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; @@ -292,6 +271,9 @@ spectrum_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + if (ignore_cis_vcc) + link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); if (ret) { if (!ignore_cis_vcc) diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 63b3d3c..8c2a473 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -136,7 +136,6 @@ static void parport_detach(struct pcmcia_device *link) static int parport_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index ce8b94a..d3f8d47 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c @@ -131,7 +131,6 @@ struct pcmcia_cfg_mem { int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data); cisparse_t parse; cistpl_cftable_entry_t dflt; @@ -146,16 +145,46 @@ struct pcmcia_cfg_mem { */ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) { - cistpl_cftable_entry_t *cfg = &parse->cftable_entry; struct pcmcia_cfg_mem *cfg_mem = priv; + struct pcmcia_device *p_dev = cfg_mem->p_dev; + cistpl_cftable_entry_t *cfg = &parse->cftable_entry; + cistpl_cftable_entry_t *dflt = &cfg_mem->dflt; + unsigned int flags = p_dev->config_flags; + unsigned int vcc = p_dev->socket->socket.Vcc; + + dev_dbg(&p_dev->dev, "testing configuration %d, autoconf %x\n", + cfg->index, flags); /* default values */ cfg_mem->p_dev->config_index = cfg->index; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) cfg_mem->dflt = *cfg; + /* check for matching Vcc? */ + if (flags & CONF_AUTO_CHECK_VCC) { + if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; + } + } + + /* set Vpp? */ + if (flags & CONF_AUTO_SET_VPP) { + if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) + p_dev->vpp = + dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; + } + + /* enable audio? */ + if ((flags & CONF_AUTO_AUDIO) && (cfg->flags & CISTPL_CFTABLE_AUDIO)) + p_dev->config_flags |= CONF_ENABLE_SPKR; + return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, - cfg_mem->p_dev->socket->socket.Vcc, cfg_mem->priv_data); } @@ -176,7 +205,6 @@ 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, - unsigned int vcc, void *priv_data), void *priv_data) { diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index e1f7485..0b5fc2f 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -124,7 +124,6 @@ static void aha152x_detach(struct pcmcia_device *link) static int aha152x_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->io_lines = 10; diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index ae263b1..3b9f311 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -106,7 +106,6 @@ static void fdomain_detach(struct pcmcia_device *link) static int fdomain_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->io_lines = 10; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 7cb1ae6..9b4ac20 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1597,7 +1597,6 @@ static void nsp_cs_detach(struct pcmcia_device *link) static int nsp_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { struct nsp_hw_data *data = priv_data; @@ -1605,77 +1604,49 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Use power settings for Vcc and Vpp if present */ - /* Note that the CIS values need to be rescaled */ - if (cfg->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000) - return -ENODEV; - else if (dflt->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000) - return -ENODEV; - } - - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { - p_dev->vpp = - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { - p_dev->vpp = - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - } - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = - p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - goto next_entry; + /* IO window settings */ + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; + if (io->nwin > 1) { + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } + /* This reserves IO space but doesn't actually enable it */ + if (pcmcia_request_io(p_dev) != 0) + goto next_entry; + } - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { - cistpl_mem_t *mem = - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; - p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | - WIN_MEMORY_TYPE_CM | - WIN_ENABLE); - p_dev->resource[2]->start = mem->win[0].host_addr; - p_dev->resource[2]->end = mem->win[0].len; - if (p_dev->resource[2]->end < 0x1000) - p_dev->resource[2]->end = 0x1000; - if (pcmcia_request_window(p_dev, p_dev->resource[2], - 0) != 0) - goto next_entry; - if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], - mem->win[0].card_addr) != 0) - goto next_entry; - - data->MmioAddress = (unsigned long) - ioremap_nocache(p_dev->resource[2]->start, + if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { + cistpl_mem_t *mem = + (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; + p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | + WIN_MEMORY_TYPE_CM | + WIN_ENABLE); + p_dev->resource[2]->start = mem->win[0].host_addr; + p_dev->resource[2]->end = mem->win[0].len; + if (p_dev->resource[2]->end < 0x1000) + p_dev->resource[2]->end = 0x1000; + if (pcmcia_request_window(p_dev, p_dev->resource[2], 0) != 0) + goto next_entry; + if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], + mem->win[0].card_addr) != 0) + goto next_entry; + + data->MmioAddress = (unsigned long) + ioremap_nocache(p_dev->resource[2]->start, resource_size(p_dev->resource[2])); - data->MmioLength = resource_size(p_dev->resource[2]); - } - /* If we got this far, we're cool! */ - return 0; + data->MmioLength = resource_size(p_dev->resource[2]); } + /* If we got this far, we're cool! */ + return 0; next_entry: nsp_dbg(NSP_DEBUG_INIT, "next"); @@ -1692,6 +1663,9 @@ static int nsp_cs_config(struct pcmcia_device *link) nsp_dbg(NSP_DEBUG_INIT, "in"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO; + ret = pcmcia_loop_config(link, nsp_cs_config_check, data); if (ret) goto cs_failed; diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 7d3f49c..468fd12 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -179,7 +179,6 @@ static void qlogic_detach(struct pcmcia_device *link) static int qlogic_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->io_lines = 10; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 600630e..7a0bb9a 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -686,7 +686,6 @@ static struct scsi_host_template sym53c500_driver_template = { static int SYM53C500_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { p_dev->io_lines = 10; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 2285d5d..57e042b 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -406,16 +406,11 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { static const int size_table[2] = { 8, 16 }; int *try = priv_data; - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = - cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; - p_dev->io_lines = ((*try & 0x1) == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; @@ -431,7 +426,6 @@ static int simple_config_check(struct pcmcia_device *p_dev, static int simple_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; @@ -476,6 +470,7 @@ static int simple_config(struct pcmcia_device *link) /* First pass: look for a config entry that looks normal. * Two tries: without IO aliases, then with aliases */ + link->config_flags |= CONF_AUTO_SET_VPP; for (try = 0; try < 4; try++) if (!pcmcia_loop_config(link, simple_config_check, &try)) goto found_port; @@ -509,7 +504,6 @@ found_port: static int multi_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int *base2 = priv_data; @@ -530,7 +524,6 @@ static int multi_config_check(struct pcmcia_device *p_dev, static int multi_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int *base2 = priv_data; @@ -620,7 +613,6 @@ static int multi_config(struct pcmcia_device *link) static int serial_check_for_multi(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { struct serial_info *info = p_dev->priv; diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index ee91c89..678fbf6 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -712,7 +712,6 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index f8f3de5..12a96b7 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -194,7 +194,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 803683b..f22dc0f 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -532,19 +532,11 @@ static void dio700_cs_detach(struct pcmcia_device *link) static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -578,6 +570,8 @@ static void dio700_config(struct pcmcia_device *link) dev_dbg(&link->dev, "dio700_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO; + ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 6512f7a..6dc2b06 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -284,19 +284,11 @@ static void dio24_cs_detach(struct pcmcia_device *link) static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -329,6 +321,8 @@ static void dio24_config(struct pcmcia_device *link) dev_dbg(&link->dev, "dio24_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO; + ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 255cf40..6eacbd7 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -263,19 +263,11 @@ static void labpc_cs_detach(struct pcmcia_device *link) static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) return -ENODEV; - /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->config_flags |= CONF_ENABLE_SPKR; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -307,6 +299,9 @@ static void labpc_config(struct pcmcia_device *link) dev_dbg(&link->dev, "labpc_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ | + CONF_AUTO_AUDIO; + ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index b88f52d..da4e2a2 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -302,7 +302,6 @@ static int mio_cs_resume(struct pcmcia_device *link) static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { int base, ret; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index b8940d7..03a72d7 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1071,7 +1071,6 @@ static void daqp_cs_detach(struct pcmcia_device *link) static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if (cfg->index == 0) diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index e23270d..670a76b 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -112,7 +112,6 @@ failed: static int ixj_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 744c2cd..d960629 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -134,32 +134,11 @@ static void sl811_cs_release(struct pcmcia_device * link) static int sl811_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, - unsigned int vcc, void *priv_data) { 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<vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) - return -ENODEV; - } else if (dflt->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) - return -ENODEV; - } - - if (cfg->vpp1.present & (1<vpp = - cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (dflt->vpp1.present & (1<vpp = - dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - - /* we need an interrupt */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -184,6 +163,9 @@ static int sl811_cs_config(struct pcmcia_device *link) dev_dbg(&link->dev, "sl811_cs_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | + CONF_AUTO_CHECK_VCC; + if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) goto failed; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 50b03fd..0577e5f 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -177,7 +177,6 @@ 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, - unsigned int vcc, void *priv_data), void *priv_data); @@ -270,6 +269,12 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) #define CONF_ENABLE_PULSE_IRQ 0x04 #define CONF_ENABLE_ESR 0x08 +/* flags used by pcmcia_loop_config() autoconfiguration */ +#define CONF_AUTO_CHECK_VCC 0x10 /* check for matching Vcc? */ +#define CONF_AUTO_SET_VPP 0x20 /* set Vpp? */ +#define CONF_AUTO_AUDIO 0x40 /* enable audio line? */ + + #endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:06 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:06 +0200 Subject: [PATCH 07/15] pcmcia: move config_{base, index, regs} to struct pcmcia_device In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-7-git-send-email-linux@dominikbrodowski.net> Several drivers prefer to explicitly set config_{base,index,regs}, formerly known as ConfigBase, ConfigIndex and Present. Instead of passing these values inside config_req_t, store it in struct pcmcia_device. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-ide at vger.kernel.org CC: linux-usb at vger.kernel.org CC: laforge at gnumonks.org CC: linux-mtd at lists.infradead.org CC: linux-bluetooth at vger.kernel.org CC: alsa-devel at alsa-project.org CC: linux-serial at vger.kernel.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/bluetooth/bluecard_cs.c | 2 +- drivers/char/pcmcia/ipwireless/main.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 6 ++-- drivers/ide/ide-cs.c | 3 +- drivers/isdn/hardware/avm/avm_cs.c | 4 +- drivers/isdn/hisax/avma1_cs.c | 4 +- drivers/isdn/hisax/elsa_cs.c | 2 +- drivers/isdn/hisax/sedlbauer_cs.c | 2 +- drivers/isdn/hisax/teles_cs.c | 2 +- drivers/mtd/maps/pcmciamtd.c | 2 +- drivers/net/pcmcia/3c574_cs.c | 2 +- drivers/net/pcmcia/3c589_cs.c | 2 +- drivers/net/pcmcia/axnet_cs.c | 6 ++-- drivers/net/pcmcia/fmvj18x_cs.c | 22 ++++++------ drivers/net/pcmcia/ibmtr_cs.c | 4 +- drivers/net/pcmcia/nmclan_cs.c | 4 +- drivers/net/pcmcia/pcnet_cs.c | 6 ++-- drivers/net/pcmcia/smc91c92_cs.c | 10 +++--- drivers/net/pcmcia/xirc2ps_cs.c | 2 +- drivers/net/wireless/airo_cs.c | 2 +- drivers/net/wireless/hostap/hostap_cs.c | 2 +- drivers/net/wireless/ray_cs.c | 2 +- drivers/net/wireless/wl3501_cs.c | 2 +- drivers/parport/parport_cs.c | 2 +- drivers/pcmcia/cs_internal.h | 3 -- drivers/pcmcia/ds.c | 8 ++-- drivers/pcmcia/pcmcia_cis.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 38 +++++++++++----------- drivers/scsi/pcmcia/aha152x_stub.c | 2 +- drivers/scsi/pcmcia/fdomain_stub.c | 2 +- drivers/scsi/pcmcia/nsp_cs.c | 2 +- drivers/scsi/pcmcia/qlogic_stub.c | 2 +- drivers/serial/serial_cs.c | 6 ++-- drivers/staging/comedi/drivers/cb_das16_cs.c | 2 +- drivers/staging/comedi/drivers/das08_cs.c | 2 +- drivers/staging/comedi/drivers/ni_daq_700.c | 2 +- drivers/staging/comedi/drivers/ni_daq_dio24.c | 2 +- drivers/staging/comedi/drivers/ni_labpc_cs.c | 2 +- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- drivers/staging/wlags49_h2/wl_cs.c | 4 +- drivers/usb/host/sl811_cs.c | 2 +- include/pcmcia/cs.h | 15 -------- include/pcmcia/ds.h | 14 ++++++++ sound/pcmcia/pdaudiocf/pdaudiocf.c | 6 ++-- sound/pcmcia/vx/vxpocket.c | 4 +- 45 files changed, 107 insertions(+), 112 deletions(-) diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 4cb2dfe..08f4818 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -885,7 +885,7 @@ static int bluecard_config(struct pcmcia_device *link) bluecard_info_t *info = link->priv; int i, n; - link->conf.ConfigIndex = 0x20; + link->config_index = 0x20; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 64; diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 0f0be4d..05c4e68 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -92,7 +92,7 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, /* 0x40 causes it to generate level mode interrupts. */ /* 0x04 enables IREQ pin. */ - p_dev->conf.ConfigIndex = cfg->index | 0x44; + p_dev->config_index = cfg->index | 0x44; p_dev->io_lines = 16; ret = pcmcia_request_io(p_dev); if (ret) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index ba7ccf5..535aa08 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -594,8 +594,8 @@ static int mgslpc_config(struct pcmcia_device *link) goto failed; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 8; - link->conf.Present = PRESENT_OPTION; + link->config_index = 8; + link->config_regs = PRESENT_OPTION; ret = pcmcia_request_irq(link, mgslpc_isr); if (ret) @@ -608,7 +608,7 @@ static int mgslpc_config(struct pcmcia_device *link) info->irq_level = link->irq; dev_info(&link->dev, "index 0x%02x:", - link->conf.ConfigIndex); + link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index cf7cb49..07e3787 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -227,8 +227,7 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - - pdev->conf.ConfigIndex = cfg->index; + pdev->config_index = cfg->index; pdev->resource[0]->start = io->win[0].base; if (!(io->flags & CISTPL_IO_16BIT)) { pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 938ca41..2d8bbbf 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -80,8 +80,8 @@ static int avmcs_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.ConfigIndex = 1; - p_dev->conf.Present = PRESENT_OPTION; + p_dev->config_index = 1; + p_dev->config_regs = PRESENT_OPTION; return avmcs_config(p_dev); } /* avmcs_attach */ diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 7d5ff20..e25f6c7 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -85,8 +85,8 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.ConfigIndex = 1; - p_dev->conf.Present = PRESENT_OPTION; + p_dev->config_index = 1; + p_dev->config_regs = PRESENT_OPTION; return avma1cs_config(p_dev); } /* avma1cs_attach */ diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index df360c8..f276e84 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -211,7 +211,7 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x: ", - link->conf.ConfigIndex); + link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 169061f..43d0a4e 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -253,7 +253,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x:", - link->conf.ConfigIndex); + link->config_index); if (link->vpp) printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); if (link->conf.Attributes & CONF_ENABLE_IRQ) diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 46e72a1..614afc6 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -191,7 +191,7 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x:", - link->conf.ConfigIndex); + link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 663b48b..99c7257 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -575,7 +575,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) link->vpp = 0; } - link->conf.ConfigIndex = 0; + link->config_index = 0; DEBUG(2, "Setting Configuration"); ret = pcmcia_request_configuration(link, &link->conf); if (ret != 0) { diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 41ecb27..4b670b3 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -281,7 +281,7 @@ static int tc574_probe(struct pcmcia_device *link) link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 1; + link->config_index = 1; dev->netdev_ops = &el3_netdev_ops; SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 6888672..6549e2c 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -217,7 +217,7 @@ static int tc589_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 1; + link->config_index = 1; dev->netdev_ops = &el3_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 4d4928a..2c273ce 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -230,7 +230,7 @@ static int get_prom(struct pcmcia_device *link) }; /* Not much of a test, but the alternatives are messy */ - if (link->conf.ConfigBase != 0x03c0) + if (link->config_base != 0x03c0) return 0; axnet_reset_8390(dev); @@ -297,7 +297,7 @@ static int axnet_configcheck(struct pcmcia_device *p_dev, if (cfg->index == 0 || cfg->io.nwin == 0) return -ENODEV; - p_dev->conf.ConfigIndex = 0x05; + p_dev->config_index = 0x05; /* For multifunction cards, by convention, we configure the network function with window 0, and serial with window 1 */ if (io->nwin > 1) { @@ -325,7 +325,7 @@ static int axnet_config(struct pcmcia_device *link) dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); /* don't trust the CIS on this; Linksys got it wrong */ - link->conf.Present = 0x63; + link->config_regs = 0x63; ret = pcmcia_loop_config(link, axnet_configcheck, NULL); if (ret != 0) goto failed; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index caf2b2e..23f5333 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -312,7 +312,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) ret = pcmcia_request_io(link); if (ret == 0) { /* calculate ConfigIndex value */ - link->conf.ConfigIndex = + link->config_index = ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; return ret; } @@ -361,28 +361,28 @@ static int fmvj18x_config(struct pcmcia_device *link) link->card_id == PRODID_TDK_NP9610 || link->card_id == PRODID_TDK_MN3200) { /* MultiFunction Card */ - link->conf.ConfigBase = 0x800; - link->conf.ConfigIndex = 0x47; + link->config_base = 0x800; + link->config_index = 0x47; link->resource[1]->end = 8; } break; case MANFID_NEC: cardtype = NEC; /* MultiFunction Card */ - link->conf.ConfigBase = 0x800; - link->conf.ConfigIndex = 0x47; + link->config_base = 0x800; + link->config_index = 0x47; link->resource[1]->end = 8; break; case MANFID_KME: cardtype = KME; /* MultiFunction Card */ - link->conf.ConfigBase = 0x800; - link->conf.ConfigIndex = 0x47; + link->config_base = 0x800; + link->config_index = 0x47; link->resource[1]->end = 8; break; case MANFID_CONTEC: cardtype = CONTEC; break; case MANFID_FUJITSU: - if (link->conf.ConfigBase == 0x0fe0) + if (link->config_base == 0x0fe0) cardtype = MBH10302; else if (link->card_id == PRODID_FUJITSU_MBH10302) /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), @@ -402,10 +402,10 @@ static int fmvj18x_config(struct pcmcia_device *link) case MANFID_FUJITSU: if (link->card_id == PRODID_FUJITSU_MBH10304) { cardtype = XXX10304; /* MBH10304 with buggy CIS */ - link->conf.ConfigIndex = 0x20; + link->config_index = 0x20; } else { cardtype = MBH10302; /* NextCom NC5310, etc. */ - link->conf.ConfigIndex = 1; + link->config_index = 1; } break; case MANFID_UNGERMANN: @@ -413,7 +413,7 @@ static int fmvj18x_config(struct pcmcia_device *link) break; default: cardtype = MBH10302; - link->conf.ConfigIndex = 1; + link->config_index = 1; } } diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 1327f08..feedeeb 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -153,7 +153,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 4; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.Present = PRESENT_OPTION; + link->config_regs = PRESENT_OPTION; info->dev = dev; @@ -212,8 +212,8 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) dev_dbg(&link->dev, "ibmtr_config\n"); - link->conf.ConfigIndex = 0x61; link->io_lines = 16; + link->config_index = 0x61; /* Determine if this is PRIMARY or ALTERNATE. */ diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 90d1728..98c4a69 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -461,8 +461,8 @@ static int nmclan_probe(struct pcmcia_device *link) link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 1; - link->conf.Present = PRESENT_OPTION; + link->config_index = 1; + link->config_regs = PRESENT_OPTION; lp->tx_free_frames=AM2150_MAX_TX_FRAMES; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 0924ed6..49f463f 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -420,7 +420,7 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link) int i, j; /* Not much of a test, but the alternatives are messy */ - if (link->conf.ConfigBase != 0x03c0) + if (link->config_base != 0x03c0) return NULL; outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ @@ -557,7 +557,7 @@ static int pcnet_config(struct pcmcia_device *link) if ((link->manf_id == MANFID_IBM) && (link->card_id == PRODID_IBM_HOME_AND_AWAY)) - link->conf.ConfigIndex |= 0x10; + link->config_index |= 0x10; ret = pcmcia_request_configuration(link, &link->conf); if (ret) @@ -573,7 +573,7 @@ static int pcnet_config(struct pcmcia_device *link) dev->if_port = 0; } - if ((link->conf.ConfigBase == 0x03c0) && + if ((link->config_base == 0x03c0) && (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 2c2a878..59f5034 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -411,9 +411,9 @@ static int mhz_3288_power(struct pcmcia_device *link) mdelay(200); /* Now read and write the COR... */ - tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); + tmp = readb(smc->base + link->config_base + CISREG_COR); udelay(5); - writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); + writeb(tmp, smc->base + link->config_base + CISREG_COR); return 0; } @@ -464,7 +464,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) smc->base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); - offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; + offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; i = pcmcia_map_mem_page(link, link->resource[2], offset); if ((i == 0) && (smc->manfid == MANFID_MEGAHERTZ) && @@ -643,8 +643,8 @@ static int osi_config(struct pcmcia_device *link) link->resource[1]->end = 8; /* Enable Hard Decode, LAN, Modem */ - link->conf.ConfigIndex = 0x23; link->io_lines = 16; + link->config_index = 0x23; for (i = j = 0; j < 4; j++) { link->resource[1]->start = com[j]; @@ -654,7 +654,7 @@ static int osi_config(struct pcmcia_device *link) } if (i != 0) { /* Fallback: turn off hard decode */ - link->conf.ConfigIndex = 0x03; + link->config_index = 0x03; link->resource[1]->end = 0; i = pcmcia_request_io(link); } diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 1776f49..1c8ebf2 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -530,7 +530,7 @@ xirc2ps_probe(struct pcmcia_device *link) /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 1; + link->config_index = 1; /* Fill in card specific entries */ dev->netdev_ops = &netdev_ops; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index ccb2fdd..40f9ed7 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -240,7 +240,7 @@ static int airo_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x: ", - link->conf.ConfigIndex); + link->config_index); if (link->vpp) printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); printk(", irq %d", link->irq); diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 0fe6f82..5704d3f 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -601,7 +601,7 @@ static int prism2_config(struct pcmcia_device *link) /* Finally, report what we've done */ printk(KERN_INFO "%s: index 0x%02x: ", - dev_info, link->conf.ConfigIndex); + dev_info, link->config_index); if (link->vpp) printk(", Vpp %d.%d", link->vpp / 10, link->vpp % 10); diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 30cfd88..7fb66cc 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -319,7 +319,7 @@ static int ray_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.ConfigIndex = 1; + p_dev->config_index = 1; p_dev->priv = dev; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 92a9ad5..3947cf8 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1889,7 +1889,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.ConfigIndex = 1; + p_dev->config_index = 1; dev = alloc_etherdev(sizeof(struct wl3501_card)); if (!dev) diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index afd946e..8faf634 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -144,7 +144,7 @@ static int parport_config_check(struct pcmcia_device *p_dev, cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; if (epp_mode) - p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; + p_dev->config_index |= FORCE_EPP_MODE; p_dev->resource[0]->start = io->win[0].base; p_dev->resource[0]->end = io->win[0].len; if (io->nwin == 2) { diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index a0c5adb..42eef43 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -34,9 +34,6 @@ typedef struct config_t { struct kref ref; unsigned int state; unsigned int Attributes; - unsigned int ConfigBase; - unsigned char Option; - unsigned int CardValues; struct resource io[MAX_IO_WIN]; /* io ports */ struct resource mem[MAX_WIN]; /* mem areas */ diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 55570d9..00db600 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -276,13 +276,13 @@ static int pcmcia_device_probe(struct device *dev) ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, &cis_config); if (!ret) { - p_dev->conf.ConfigBase = cis_config.base; - p_dev->conf.Present = cis_config.rmask[0]; + p_dev->config_base = cis_config.base; + p_dev->config_regs = cis_config.rmask[0]; } else { dev_printk(KERN_INFO, dev, "pcmcia: could not parse base and rmask0 of CIS\n"); - p_dev->conf.ConfigBase = 0; - p_dev->conf.Present = 0; + p_dev->config_base = 0; + p_dev->config_regs = 0; } ret = p_drv->probe(p_dev); diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index 0ac54da..ac47cc4 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c @@ -151,7 +151,7 @@ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) struct pcmcia_cfg_mem *cfg_mem = priv; /* default values */ - cfg_mem->p_dev->conf.ConfigIndex = cfg->index; + cfg_mem->p_dev->config_index = cfg->index; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) cfg_mem->dflt = *cfg; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 660f394..ff83ab1 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -168,7 +168,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, return -EACCES; } - addr = (c->ConfigBase + where) >> 1; + addr = (p_dev->config_base + where) >> 1; ret = accessf(s, 1, addr, 1, val); @@ -443,6 +443,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, pccard_io_map iomap; unsigned char status = 0; unsigned char ext_status = 0; + unsigned char option = 0; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -473,7 +474,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, if (req->Attributes & CONF_ENABLE_SPKR) { s->socket.flags |= SS_SPKR_ENA; status = CCSR_AUDIO_ENA; - if (!(req->Present & PRESENT_STATUS)) + if (!(p_dev->config_regs & PRESENT_STATUS)) dev_warn(&p_dev->dev, "speaker requested, but " "PRESENT_STATUS not set!\n"); } @@ -482,54 +483,53 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, else s->socket.io_irq = 0; if (req->Attributes & CONF_ENABLE_ESR) { - req->Present |= PRESENT_EXT_STATUS; + p_dev->config_regs |= PRESENT_EXT_STATUS; ext_status = ESR_REQ_ATTN_ENA; } s->ops->set_socket(s, &s->socket); s->lock_count++; /* Set up CIS configuration registers */ - base = c->ConfigBase = req->ConfigBase; - c->CardValues = req->Present; - if (req->Present & PRESENT_COPY) { + base = p_dev->config_base; + if (p_dev->config_regs & PRESENT_COPY) { u16 tmp = 0; dev_warn(&p_dev->dev, "invalid write to CISREG_SCR\n"); pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); } - if (req->Present & PRESENT_PIN_REPLACE) { + if (p_dev->config_regs & PRESENT_PIN_REPLACE) { u16 tmp = 0; dev_warn(&p_dev->dev, "invalid write to CISREG_PRR\n"); pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); } - if (req->Present & PRESENT_OPTION) { + if (p_dev->config_regs & PRESENT_OPTION) { if (s->functions == 1) { - c->Option = req->ConfigIndex & COR_CONFIG_MASK; + option = p_dev->config_index & 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; + option = p_dev->config_index & COR_MFC_CONFIG_MASK; + option |= COR_FUNC_ENA|COR_IREQ_ENA; + if (p_dev->config_regs & PRESENT_IOBASE_0) + option |= COR_ADDR_DECODE; } if ((req->Attributes & CONF_ENABLE_IRQ) && !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) - c->Option |= COR_LEVEL_REQ; - pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); + option |= COR_LEVEL_REQ; + pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option); mdelay(40); } - if (req->Present & PRESENT_STATUS) + if (p_dev->config_regs & PRESENT_STATUS) pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); - if (req->Present & PRESENT_EXT_STATUS) + if (p_dev->config_regs & PRESENT_EXT_STATUS) pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &ext_status); - if (req->Present & PRESENT_IOBASE_0) { + if (p_dev->config_regs & PRESENT_IOBASE_0) { u8 b = c->io[0].start & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); b = (c->io[0].start >> 8) & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); } - if (req->Present & PRESENT_IOSIZE) { + if (p_dev->config_regs & PRESENT_IOSIZE) { u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); } diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 3c0046e..c368249 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -103,7 +103,7 @@ static int aha152x_probe(struct pcmcia_device *link) link->resource[0]->end = 0x20; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.Present = PRESENT_OPTION; + link->config_regs = PRESENT_OPTION; return aha152x_config_cs(link); } /* aha152x_attach */ diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 8ff7603..bb909e1 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -86,7 +86,7 @@ static int fdomain_probe(struct pcmcia_device *link) link->resource[0]->end = 0x10; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.Present = PRESENT_OPTION; + link->config_regs = PRESENT_OPTION; return fdomain_config(link); } /* fdomain_attach */ diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 7059526..a63c460 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1745,7 +1745,7 @@ static int nsp_cs_config(struct pcmcia_device *link) /* Finally, report what we've done */ printk(KERN_INFO "nsp_cs: index 0x%02x: ", - link->conf.ConfigIndex); + link->config_index); if (link->vpp) { printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); } diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 77f46a2..5e2cbe0 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -159,7 +159,7 @@ static int qlogic_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.Present = PRESENT_OPTION; + link->config_regs = PRESENT_OPTION; return qlogic_config(link); } /* qlogic_attach */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index a1906b5..8f25cc1 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -493,7 +493,7 @@ static int simple_config(struct pcmcia_device *link) found_port: if (info->multi && (info->manfid == MANFID_3COM)) - link->conf.ConfigIndex &= ~(0x08); + link->config_index &= ~(0x08); /* * Apply any configuration quirks. @@ -590,8 +590,8 @@ static int multi_config(struct pcmcia_device *link) info->prodid == PRODID_POSSIO_GCC)) { int err; - if (link->conf.ConfigIndex == 1 || - link->conf.ConfigIndex == 3) { + if (link->config_index == 1 || + link->config_index == 3) { err = setup_serial(link, info, base2, link->irq); base2 = link->resource[0]->start;; diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 11271b6..034cbfc 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -772,7 +772,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %u", link->irq); if (link->resource[0]) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 319aad4..e37ea79 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -268,7 +268,7 @@ static void das08_pcmcia_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %u", link->irq); if (link->resource[0]) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index d269bbd..8107e40 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -607,7 +607,7 @@ static void dio700_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index fcaa829..4f9daa3 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -358,7 +358,7 @@ static void dio24_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index a936c11..2e27a30 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -336,7 +336,7 @@ static void labpc_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index cd818fb..a2a32de 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1137,7 +1137,7 @@ static void daqp_cs_config(struct pcmcia_device *link) goto failed; /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); + dev_info(&link->dev, "index 0x%02x", link->config_index); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %u", link->irq); if (link->resource[0]) diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index b2efff6..778800f 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -148,8 +148,8 @@ static int wl_adapter_attach(struct pcmcia_device *link) link->resource[0]->end = HCF_NUM_IO_PORTS; link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 5; - link->conf.Present = PRESENT_OPTION; + link->config_index = 5; + link->config_regs = PRESENT_OPTION; link->priv = dev; lp = wl_priv(dev); diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 78bad51..5904053 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -200,7 +200,7 @@ static int sl811_cs_config(struct pcmcia_device *link) goto failed; dev_info(&link->dev, "index 0x%02x: ", - link->conf.ConfigIndex); + link->config_index); if (link->vpp) printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); printk(", irq %d", link->irq); diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 674edbc..47b6092 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -22,9 +22,6 @@ /* For RequestConfiguration */ typedef struct config_req_t { u_int Attributes; - u_int ConfigBase; - u_char ConfigIndex; - u_int Present; } config_req_t; /* Attributes for RequestConfiguration */ @@ -35,16 +32,4 @@ typedef struct config_req_t { #define CONF_ENABLE_ESR 0x10 #define CONF_VALID_CLIENT 0x100 -/* Configuration registers present */ -#define PRESENT_OPTION 0x001 -#define PRESENT_STATUS 0x002 -#define PRESENT_PIN_REPLACE 0x004 -#define PRESENT_COPY 0x008 -#define PRESENT_EXT_STATUS 0x010 -#define PRESENT_IOBASE_0 0x020 -#define PRESENT_IOBASE_1 0x040 -#define PRESENT_IOBASE_2 0x080 -#define PRESENT_IOBASE_3 0x100 -#define PRESENT_IOSIZE 0x200 - #endif /* _LINUX_CS_H */ diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 6137fbc..bc28f96 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -97,6 +97,9 @@ struct pcmcia_device { unsigned int vpp; unsigned int io_lines; /* number of I/O lines */ + unsigned int config_base; + unsigned int config_index; + unsigned int config_regs; /* PRESENT_ flags below */ /* Is the device suspended? */ u16 suspended:1; @@ -250,6 +253,17 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) 0x0c -> 2 0x10 -> 3 */ +/* config_reg{ister}s present for this PCMCIA device */ +#define PRESENT_OPTION 0x001 +#define PRESENT_STATUS 0x002 +#define PRESENT_PIN_REPLACE 0x004 +#define PRESENT_COPY 0x008 +#define PRESENT_EXT_STATUS 0x010 +#define PRESENT_IOBASE_0 0x020 +#define PRESENT_IOBASE_1 0x040 +#define PRESENT_IOBASE_2 0x080 +#define PRESENT_IOBASE_3 0x100 +#define PRESENT_IOSIZE 0x200 #endif /* __KERNEL__ */ diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 2e1282d..4df07fc 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -143,8 +143,8 @@ static int snd_pdacf_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; - link->conf.ConfigIndex = 1; - link->conf.Present = PRESENT_OPTION; + link->config_index = 1; + link->config_regs = PRESENT_OPTION; return pdacf_config(link); } @@ -216,7 +216,7 @@ static int pdacf_config(struct pcmcia_device *link) int ret; snd_printdd(KERN_DEBUG "pdacf_config called\n"); - link->conf.ConfigIndex = 0x5; + link->config_index = 0x5; ret = pcmcia_request_io(link); if (ret) diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index a48b3ee..16186ad 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -163,8 +163,8 @@ static int snd_vxpocket_new(struct snd_card *card, int ibl, link->resource[0]->end = 16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.ConfigIndex = 1; - link->conf.Present = PRESENT_OPTION; + link->config_index = 1; + link->config_regs = PRESENT_OPTION; *chip_ret = vxp; return 0; -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:13 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:13 +0200 Subject: [PATCH 14/15] pcmcia: avoid messages on module (un)loading In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-14-git-send-email-linux@dominikbrodowski.net> printk() statements on module load or unload are frowned upon. Also, add a few __init or __exit declarations. Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 3 --- drivers/char/pcmcia/cm4040_cs.c | 2 -- drivers/char/pcmcia/ipwireless/main.c | 6 ------ drivers/char/pcmcia/synclink_cs.c | 4 ---- drivers/isdn/hisax/avma1_cs.c | 2 +- drivers/mtd/maps/pcmciamtd.c | 2 -- drivers/net/wireless/airo_cs.c | 4 ++-- drivers/net/wireless/atmel_cs.c | 4 ++-- drivers/net/wireless/orinoco/orinoco_cs.c | 2 -- drivers/net/wireless/orinoco/spectrum_cs.c | 2 -- drivers/scsi/pcmcia/aha152x_stub.c | 3 --- drivers/scsi/pcmcia/nsp_cs.c | 3 --- 12 files changed, 5 insertions(+), 32 deletions(-) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index e932526..d8cbf56 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1889,8 +1889,6 @@ static int __init cmm_init(void) { int rc; - printk(KERN_INFO "%s\n", version); - cmm_class = class_create(THIS_MODULE, "cardman_4000"); if (IS_ERR(cmm_class)) return PTR_ERR(cmm_class); @@ -1915,7 +1913,6 @@ static int __init cmm_init(void) static void __exit cmm_exit(void) { - printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&cm4000_driver); unregister_chrdev(major, DEVICE_NAME); class_destroy(cmm_class); diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index d7e2bec..65980fa 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -653,7 +653,6 @@ static int __init cm4040_init(void) { int rc; - printk(KERN_INFO "%s\n", version); cmx_class = class_create(THIS_MODULE, "cardman_4040"); if (IS_ERR(cmx_class)) return PTR_ERR(cmx_class); @@ -678,7 +677,6 @@ static int __init cm4040_init(void) static void __exit cm4040_exit(void) { - printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&reader_driver); unregister_chrdev(major, DEVICE_NAME); class_destroy(cmx_class); diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index a1b8083..94b8eb4 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -307,9 +307,6 @@ static int __init init_ipwireless(void) { int ret; - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " - IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n"); - ret = ipwireless_tty_init(); if (ret != 0) return ret; @@ -326,9 +323,6 @@ static int __init init_ipwireless(void) */ static void __exit exit_ipwireless(void) { - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " - IPWIRELESS_PCMCIA_VERSION " removed\n"); - pcmcia_unregister_driver(&me); ipwireless_tty_release(); } diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 493dba5..d97a53c 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -2809,8 +2809,6 @@ static void synclink_cs_cleanup(void) { int rc; - printk("Unloading %s: version %s\n", driver_name, driver_version); - while(mgslpc_device_list) mgslpc_remove_device(mgslpc_device_list); @@ -2833,8 +2831,6 @@ static int __init synclink_cs_init(void) BREAKPOINT(); } - printk("%s %s\n", driver_name, driver_version); - if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0) return rc; diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 314bc86..62616c8 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -220,7 +220,7 @@ static struct pcmcia_driver avma1cs_driver = { static int __init init_avma1_cs(void) { - return(pcmcia_register_driver(&avma1cs_driver)); + return pcmcia_register_driver(&avma1cs_driver); } static void __exit exit_avma1_cs(void) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 214c695..5df89e7 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -762,8 +762,6 @@ static struct pcmcia_driver pcmciamtd_driver = { static int __init init_pcmciamtd(void) { - info(DRIVER_DESC); - if(bankwidth && bankwidth != 1 && bankwidth != 2) { info("bad bankwidth (%d), using default", bankwidth); bankwidth = 2; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 0fc8f63..b084278 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -254,12 +254,12 @@ static struct pcmcia_driver airo_driver = { .resume = airo_resume, }; -static int airo_cs_init(void) +static int __init airo_cs_init(void) { return pcmcia_register_driver(&airo_driver); } -static void airo_cs_cleanup(void) +static void __exit airo_cs_cleanup(void) { pcmcia_unregister_driver(&airo_driver); } diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 13c0c3b..fabe91a 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -317,12 +317,12 @@ static struct pcmcia_driver atmel_driver = { .resume = atmel_resume, }; -static int atmel_cs_init(void) +static int __init atmel_cs_init(void) { return pcmcia_register_driver(&atmel_driver); } -static void atmel_cs_cleanup(void) +static void __exit atmel_cs_cleanup(void) { pcmcia_unregister_driver(&atmel_driver); } diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 2821266..7af9946 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -389,8 +389,6 @@ static struct pcmcia_driver orinoco_driver = { static int __init init_orinoco_cs(void) { - printk(KERN_DEBUG "%s\n", version); - return pcmcia_register_driver(&orinoco_driver); } diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 5906e9a..797abee 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -372,8 +372,6 @@ static struct pcmcia_driver orinoco_driver = { static int __init init_spectrum_cs(void) { - printk(KERN_DEBUG "%s\n", version); - return pcmcia_register_driver(&orinoco_driver); } diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 49cbea3..e77dd02 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -85,8 +85,6 @@ static void aha152x_release_cs(struct pcmcia_device *link); static void aha152x_detach(struct pcmcia_device *p_dev); static int aha152x_config_cs(struct pcmcia_device *link); -static struct pcmcia_device *dev_list; - static int aha152x_probe(struct pcmcia_device *link) { scsi_info_t *info; @@ -231,7 +229,6 @@ static int __init init_aha152x_cs(void) static void __exit exit_aha152x_cs(void) { pcmcia_unregister_driver(&aha152x_cs_driver); - BUG_ON(dev_list != NULL); } module_init(init_aha152x_cs); diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 3bc0d4f..ce9fddc 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1800,14 +1800,11 @@ static struct pcmcia_driver nsp_driver = { static int __init nsp_cs_init(void) { - nsp_msg(KERN_INFO, "loading..."); - return pcmcia_register_driver(&nsp_driver); } static void __exit nsp_cs_exit(void) { - nsp_msg(KERN_INFO, "unloading..."); pcmcia_unregister_driver(&nsp_driver); } -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:01 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:01 +0200 Subject: [PATCH 02/15] pcmcia: split up modify_configuration() into two fixup functions In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-2-git-send-email-linux@dominikbrodowski.net> pcmcia_modify_configuration() was only used by two drivers to fix up one issue each: setting the Vpp to a different value, and reducing the IO width to 8 bit. Introduce two explicitly named functions handling these things, and remove one further typedef. CC: netdev at vger.kernel.org CC: linux-mtd at lists.infradead.org Signed-off-by: Dominik Brodowski --- drivers/mtd/maps/pcmciamtd.c | 8 +-- drivers/net/pcmcia/smc91c92_cs.c | 5 +- drivers/pcmcia/pcmcia_resource.c | 128 +++++++++++++++++++------------------- include/pcmcia/cs.h | 13 ---- include/pcmcia/ds.h | 4 +- 5 files changed, 69 insertions(+), 89 deletions(-) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index fb3c538..31ce404 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -316,15 +316,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) { struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; struct pcmcia_device *link = dev->p_dev; - modconf_t mod; - int ret; - - mod.Attributes = CONF_VPP1_CHANGE_VALID | CONF_VPP2_CHANGE_VALID; - mod.Vcc = 0; - mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); - ret = pcmcia_modify_configuration(link, &mod); + pcmcia_fixup_vpp(link, on ? dev->vpp : 0); } diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index acc6807..395e586 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -816,13 +816,10 @@ static int check_sig(struct pcmcia_device *link) } if (width) { - modconf_t mod = { - .Attributes = CONF_IO_CHANGE_WIDTH, - }; printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); smc91c92_suspend(link); - pcmcia_modify_configuration(link, &mod); + pcmcia_fixup_iowidth(link); smc91c92_resume(link); return check_sig(link); } diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 3ea2e94..45c1ac4 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -226,90 +226,90 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, EXPORT_SYMBOL(pcmcia_map_mem_page); -/** pcmcia_modify_configuration +/** + * pcmcia_fixup_iowidth() - reduce io width to 8bit * - * Modify a locked socket configuration + * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the + * IO width to 8bit after having called pcmcia_request_configuration() + * previously. */ -int pcmcia_modify_configuration(struct pcmcia_device *p_dev, - modconf_t *mod) +int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev) { - struct pcmcia_socket *s; - config_t *c; - int ret; - - s = p_dev->socket; + struct pcmcia_socket *s = p_dev->socket; + pccard_io_map io_off = { 0, 0, 0, 0, 1 }; + pccard_io_map io_on; + int i, ret = 0; mutex_lock(&s->ops_mutex); - c = p_dev->function_config; - if (!(s->state & SOCKET_PRESENT)) { - dev_dbg(&s->dev, "No card present\n"); - ret = -ENODEV; - goto unlock; - } - if (!(c->state & CONFIG_LOCKED)) { - dev_dbg(&s->dev, "Configuration isnt't locked\n"); + dev_dbg(&p_dev->dev, "fixup iowidth to 8bit\n"); + + if (!(s->state & SOCKET_PRESENT) || + !(p_dev->function_config->state & CONFIG_LOCKED)) { + dev_dbg(&s->dev, "No card? Config not locked?\n"); ret = -EACCES; goto unlock; } - if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { - dev_dbg(&s->dev, - "changing Vcc or IRQ is not allowed at this time\n"); - ret = -EINVAL; - goto unlock; - } + io_on.speed = io_speed; + for (i = 0; i < MAX_IO_WIN; i++) { + if (!s->io[i].res) + continue; + io_off.map = i; + io_on.map = i; - /* We only allow changing Vpp1 and Vpp2 to the same value */ - if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { - if (mod->Vpp1 != mod->Vpp2) { - dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); - ret = -EINVAL; - goto unlock; - } - s->socket.Vpp = mod->Vpp1; - if (s->ops->set_socket(s, &s->socket)) { - dev_printk(KERN_WARNING, &s->dev, - "Unable to set VPP\n"); - ret = -EIO; - goto unlock; - } - } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { - dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); - ret = -EINVAL; - goto unlock; + io_on.flags = MAP_ACTIVE | IO_DATA_PATH_WIDTH_8; + io_on.start = s->io[i].res->start; + io_on.stop = s->io[i].res->end; + + s->ops->set_io_map(s, &io_off); + mdelay(40); + s->ops->set_io_map(s, &io_on); } +unlock: + mutex_unlock(&s->ops_mutex); - if (mod->Attributes & CONF_IO_CHANGE_WIDTH) { - pccard_io_map io_off = { 0, 0, 0, 0, 1 }; - pccard_io_map io_on; - int i; + return ret; +} +EXPORT_SYMBOL(pcmcia_fixup_iowidth); - io_on.speed = io_speed; - for (i = 0; i < MAX_IO_WIN; i++) { - if (!s->io[i].res) - continue; - io_off.map = i; - io_on.map = i; - io_on.flags = MAP_ACTIVE | IO_DATA_PATH_WIDTH_8; - io_on.start = s->io[i].res->start; - io_on.stop = s->io[i].res->end; +/** + * pcmcia_fixup_vpp() - set Vpp to a new voltage level + * + * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to + * a new voltage level between calls to pcmcia_request_configuration() + * and pcmcia_disable_device(). + */ +int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) +{ + struct pcmcia_socket *s = p_dev->socket; + int ret = 0; - s->ops->set_io_map(s, &io_off); - mdelay(40); - s->ops->set_io_map(s, &io_on); - } + mutex_lock(&s->ops_mutex); + + dev_dbg(&p_dev->dev, "fixup Vpp to %d\n", new_vpp); + + if (!(s->state & SOCKET_PRESENT) || + !(p_dev->function_config->state & CONFIG_LOCKED)) { + dev_dbg(&s->dev, "No card? Config not locked?\n"); + ret = -EACCES; + goto unlock; } - ret = 0; + + s->socket.Vpp = new_vpp; + if (s->ops->set_socket(s, &s->socket)) { + dev_printk(KERN_WARNING, &s->dev, "Unable to set VPP\n"); + ret = -EIO; + goto unlock; + } + unlock: mutex_unlock(&s->ops_mutex); return ret; -} /* modify_configuration */ -EXPORT_SYMBOL(pcmcia_modify_configuration); +} +EXPORT_SYMBOL(pcmcia_fixup_vpp); int pcmcia_release_configuration(struct pcmcia_device *p_dev) diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 63cb9bb..e13d0cd 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -19,19 +19,6 @@ #include #endif -/* ModifyConfiguration */ -typedef struct modconf_t { - u_int Attributes; - u_int Vcc, Vpp1, Vpp2; -} modconf_t; - -/* Attributes for ModifyConfiguration */ -#define CONF_IRQ_CHANGE_VALID 0x0100 -#define CONF_VCC_CHANGE_VALID 0x0200 -#define CONF_VPP1_CHANGE_VALID 0x0400 -#define CONF_VPP2_CHANGE_VALID 0x0800 -#define CONF_IO_CHANGE_WIDTH 0x1000 - /* For RequestConfiguration */ typedef struct config_req_t { u_int Attributes; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 6f7cb38..8e307b9 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -212,7 +212,9 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, unsigned int offset); -int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); +int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp); +int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev); + void pcmcia_disable_device(struct pcmcia_device *p_dev); /* IO ports */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:11 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:11 +0200 Subject: [PATCH 12/15] pcmcia: remove the "Finally, report what we've done" message In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-12-git-send-email-linux@dominikbrodowski.net> Remove this unnecessary message -- this info is either available in sysfs or by enabling dynamic debug from the PCMCIA core. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-scsi at vger.kernel.org CC: linux-usb at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/synclink_cs.c | 7 ------- drivers/isdn/hisax/avma1_cs.c | 3 --- drivers/isdn/hisax/elsa_cs.c | 10 ---------- drivers/isdn/hisax/sedlbauer_cs.c | 12 ------------ drivers/isdn/hisax/teles_cs.c | 10 ---------- drivers/net/wireless/airo_cs.c | 11 ----------- drivers/net/wireless/hostap/hostap_cs.c | 15 +-------------- drivers/pcmcia/ds.c | 7 +++++++ drivers/scsi/pcmcia/nsp_cs.c | 15 --------------- drivers/staging/comedi/drivers/cb_das16_cs.c | 9 --------- drivers/staging/comedi/drivers/das08_cs.c | 9 --------- drivers/staging/comedi/drivers/ni_daq_700.c | 9 --------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 9 --------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 9 --------- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 9 --------- drivers/usb/host/sl811_cs.c | 8 -------- 16 files changed, 8 insertions(+), 144 deletions(-) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index a343b8f..7c71913 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -592,13 +592,6 @@ static int mgslpc_config(struct pcmcia_device *link) info->io_base = link->resource[0]->start; info->irq_level = link->irq; - - dev_info(&link->dev, "index 0x%02x:", - link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(", io %pR", link->resource[0]); - printk("\n"); return 0; failed: diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index cb09f0c..47590e0 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -162,9 +162,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) return -ENODEV; } - printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", - (unsigned int) link->resource[0]->start, link->irq); - icard.para[0] = link->irq; icard.para[1] = link->resource[0]->start; icard.protocol = isdnprot; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index f203a52..b37b9f0 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -196,16 +196,6 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) if (i != 0) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x: ", - link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - icard.para[0] = link->irq; icard.para[1] = link->resource[0]->start; icard.protocol = protocol; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index a88c88f..ff17dba 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -205,18 +205,6 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x:", - link->config_index); - if (link->vpp) - printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - icard.para[0] = link->irq; icard.para[1] = link->resource[0]->start; icard.protocol = protocol; diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 05a5631..13ba9ab 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -183,16 +183,6 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) if (i != 0) goto cs_failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x:", - link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - icard.para[0] = link->irq; icard.para[1] = link->resource[0]->start; icard.protocol = protocol; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 77682f2..4067bf1 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -193,17 +193,6 @@ static int airo_config(struct pcmcia_device *link) if (!((local_info_t *)link->priv)->eth_dev) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x: ", - link->config_index); - if (link->vpp) - printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); return 0; failed: diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index e57b201..d6ff0c7 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -544,19 +544,6 @@ static int prism2_config(struct pcmcia_device *link) spin_unlock_irqrestore(&local->irq_init_lock, flags); - /* Finally, report what we've done */ - printk(KERN_INFO "%s: index 0x%02x: ", - dev_info, link->config_index); - if (link->vpp) - printk(", Vpp %d.%d", link->vpp / 10, - link->vpp % 10); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - local->shutdown = 0; sandisk_enable_wireless(dev); @@ -568,7 +555,7 @@ static int prism2_config(struct pcmcia_device *link) return ret; failed_unlock: - spin_unlock_irqrestore(&local->irq_init_lock, flags); + spin_unlock_irqrestore(&local->irq_init_lock, flags); failed: kfree(hw_priv); prism2_release((u_long)link); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index dd43bd3..912c740 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -277,6 +277,8 @@ static int pcmcia_device_probe(struct device *dev) if (!ret) { p_dev->config_base = cis_config.base; p_dev->config_regs = cis_config.rmask[0]; + dev_dbg(dev, "base %x, regs %x", p_dev->config_base, + p_dev->config_regs); } else { dev_printk(KERN_INFO, dev, "pcmcia: could not parse base and rmask0 of CIS\n"); @@ -290,6 +292,11 @@ static int pcmcia_device_probe(struct device *dev) p_drv->drv.name, ret); goto put_module; } + dev_dbg(dev, "%s bound: Vpp %d.%d, idx %x, IRQ %d", p_drv->drv.name, + p_dev->vpp/10, p_dev->vpp%10, p_dev->config_index, p_dev->irq); + dev_dbg(dev, "resources: ioport %pR %pR iomem %pR %pR %pR", + p_dev->resource[0], p_dev->resource[1], p_dev->resource[2], + p_dev->resource[3], p_dev->resource[4]); mutex_lock(&s->ops_mutex); if ((s->pcmcia_pfc) && diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 3d6db73..efb0e64 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1687,21 +1687,6 @@ static int nsp_cs_config(struct pcmcia_device *link) info->host = host; - /* Finally, report what we've done */ - printk(KERN_INFO "nsp_cs: index 0x%02x: ", - link->config_index); - if (link->vpp) { - printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); - } - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(", io %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - if (link->resource[2]) - printk(", mem %pR", link->resource[2]); - printk("\n"); - return 0; cs_failed: diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index c43c689..0c4b27c 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -745,15 +745,6 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %u", link->irq); - if (link->resource[0]) - printk(", io %pR", link->resource[0]); - if (link->resource[1]) - printk(", io %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index d395909..6d89325 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -235,15 +235,6 @@ static void das08_pcmcia_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %u", link->irq); - if (link->resource[0]) - printk(", io %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 7129b0c..5244125 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -568,15 +568,6 @@ static void dio700_config(struct pcmcia_device *link) if (ret != 0) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(", io %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 4defdda..54dda4a 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -319,15 +319,6 @@ static void dio24_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 5123b31..22119f2 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -297,15 +297,6 @@ static void labpc_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %d", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index afd283d..de37ff7 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1103,15 +1103,6 @@ static void daqp_cs_config(struct pcmcia_device *link) if (ret) goto failed; - /* Finally, report what we've done */ - dev_info(&link->dev, "index 0x%02x", link->config_index); - printk(", irq %u", link->irq); - if (link->resource[0]) - printk(" & %pR", link->resource[0]); - if (link->resource[1]) - printk(" & %pR", link->resource[1]); - printk("\n"); - return; failed: diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 81d7eea..9ce95cd 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -164,14 +164,6 @@ static int sl811_cs_config(struct pcmcia_device *link) if (ret) goto failed; - dev_info(&link->dev, "index 0x%02x: ", - link->config_index); - if (link->vpp) - printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); - printk(", irq %d", link->irq); - printk(", io %pR", link->resource[0]); - printk("\n"); - if (sl811_hc_init(parent, link->resource[0]->start, link->irq) < 0) { failed: -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:10 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:10 +0200 Subject: [PATCH 11/15] pcmcia: use autoconfiguration feature for ioports and iomem In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-11-git-send-email-linux@dominikbrodowski.net> When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding fields in struct pcmcia_device *p_dev->resource[0,1,2] are set accordinly. Drivers wishing to override certain settings may do so in the callback function, but they no longer need to parse the CIS entries stored in cistpl_cftable_entry_t themselves. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-ide at vger.kernel.org CC: linux-usb at vger.kernel.org CC: laforge at gnumonks.org CC: linux-mtd at lists.infradead.org CC: linux-bluetooth at vger.kernel.org CC: alsa-devel at alsa-project.org CC: linux-serial at vger.kernel.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- Documentation/pcmcia/driver-changes.txt | 12 ++ drivers/ata/pata_pcmcia.c | 52 +++------ drivers/bluetooth/bt3c_cs.c | 53 +++++---- drivers/bluetooth/btuart_cs.c | 51 ++++---- drivers/bluetooth/dtl1_cs.c | 18 +-- drivers/char/pcmcia/cm4000_cs.c | 15 +-- drivers/char/pcmcia/cm4040_cs.c | 22 +--- drivers/char/pcmcia/ipwireless/main.c | 26 +--- drivers/char/pcmcia/synclink_cs.c | 16 +-- drivers/ide/ide-cs.c | 53 +++------ drivers/isdn/hardware/avm/avm_cs.c | 19 +--- drivers/isdn/hisax/avma1_cs.c | 22 +--- drivers/isdn/hisax/elsa_cs.c | 23 +--- drivers/isdn/hisax/sedlbauer_cs.c | 38 +----- drivers/isdn/hisax/teles_cs.c | 16 +-- drivers/net/pcmcia/axnet_cs.c | 32 +---- drivers/net/pcmcia/fmvj18x_cs.c | 5 +- drivers/net/pcmcia/pcnet_cs.c | 34 ++---- drivers/net/pcmcia/smc91c92_cs.c | 39 +++---- drivers/net/pcmcia/xirc2ps_cs.c | 69 ++++++----- drivers/net/wireless/airo_cs.c | 34 +----- drivers/net/wireless/atmel_cs.c | 28 +---- drivers/net/wireless/hostap/hostap_cs.c | 43 +------- drivers/net/wireless/libertas/if_cs.c | 16 +-- drivers/net/wireless/orinoco/orinoco_cs.c | 41 +------ drivers/net/wireless/orinoco/spectrum_cs.c | 45 +------- drivers/parport/parport_cs.c | 34 ++---- drivers/pcmcia/pcmcia_cis.c | 77 +++++++++++-- drivers/scsi/pcmcia/aha152x_stub.c | 34 +++--- drivers/scsi/pcmcia/fdomain_stub.c | 13 +-- drivers/scsi/pcmcia/nsp_cs.c | 47 ++------ drivers/scsi/pcmcia/qlogic_stub.c | 13 +-- drivers/scsi/pcmcia/sym53c500_cs.c | 13 +-- drivers/serial/serial_cs.c | 134 +++++++++++----------- drivers/staging/comedi/drivers/cb_das16_cs.c | 31 +---- drivers/staging/comedi/drivers/das08_cs.c | 33 +----- drivers/staging/comedi/drivers/ni_daq_700.c | 32 +----- drivers/staging/comedi/drivers/ni_daq_dio24.c | 32 +----- drivers/staging/comedi/drivers/ni_labpc_cs.c | 32 +----- drivers/staging/comedi/drivers/ni_mio_cs.c | 14 +-- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 32 +----- drivers/telephony/ixj_pcmcia.c | 32 ++---- drivers/usb/host/sl811_cs.c | 28 +---- include/pcmcia/ds.h | 30 ++---- 44 files changed, 503 insertions(+), 980 deletions(-) diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 62a029f..dd04361 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt @@ -1,4 +1,16 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: +* pcmcia_loop_config() and autoconfiguration (as of 2.6.36) + If struct pcmcia_device *p_dev->config_flags is set accordingly, + pcmcia_loop_config() now sets up certain configuration values + automatically, though the driver may still override the settings + in the callback function. The following autoconfiguration options + are provided at the moment: + CONF_AUTO_CHECK_VCC : check for matching Vcc + CONF_AUTO_SET_VPP : set Vpp + CONF_AUTO_AUDIO : auto-enable audio line, if required + CONF_AUTO_SET_IO : set ioport resources (->resource[0,1]) + CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2]) + * pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36) pcmcia_request_configuration() got renamed to pcmcia_enable_device(), as it mirrors pcmcia_disable_device(). Configuration settings are now diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 954f43c..eb95ad5 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -172,40 +172,28 @@ struct pcmcia_config_check { 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) +static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) { struct pcmcia_config_check *stk = priv_data; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - pdev->resource[0]->start = io->win[0].base; - if (!(io->flags & CISTPL_IO_16BIT)) { - pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - } - if (io->nwin == 2) { - pdev->resource[0]->end = 8; - pdev->resource[1]->start = io->win[1].base; - pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[1]->start; - } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { - pdev->resource[0]->end = io->win[0].len; - pdev->resource[1]->end = 0; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[0]->start + 0x0e; - } else + if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + } + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + + if (pdev->resource[1]->end) { + pdev->resource[0]->end = 8; + pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; + stk->ctl_base = pdev->resource[1]->start; + } else { + if (pdev->resource[0]->end < 16) return -ENODEV; - /* If we've got this far, we're done */ - return 0; + stk->ctl_base = pdev->resource[0]->start + 0x0e; } - return -ENODEV; + + return pcmcia_request_io(pdev); } /** @@ -228,10 +216,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) struct ata_port_operations *ops = &pcmcia_port_ops; /* Set up attributes in order to probe card and get resources */ - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - pdev->config_flags |= CONF_ENABLE_IRQ; - pdev->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; /* See if we have a manufacturer identifier. Use it to set is_kme for vendor quirks */ diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 97338a3..8b8be35 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -656,10 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; - - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | + CONF_AUTO_SET_IO; return bt3c_config(link); } @@ -673,38 +671,41 @@ static void bt3c_detach(struct pcmcia_device *link) kfree(info); } -static int bt3c_check_config(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data) { - unsigned long try = (unsigned long) priv_data; - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; + int *try = priv_data; - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && - (cf->io.win[0].base != 0)) { - p_dev->resource[0]->start = cf->io.win[0].base; - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -ENODEV; + if (try == 0) + p_dev->io_lines = 16; + + if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) + return -EINVAL; + + p_dev->resource[0]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + + return pcmcia_request_io(p_dev); } 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 }; int j; - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - for (j = 0; j < 5; j++) { - p_dev->resource[0]->start = base[j]; - p_dev->io_lines = base[j] ? 16 : 3; - if (!pcmcia_request_io(p_dev)) - return 0; - } + if (p_dev->io_lines > 3) + return -ENODEV; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = 8; + + for (j = 0; j < 5; j++) { + p_dev->resource[0]->start = base[j]; + p_dev->io_lines = base[j] ? 16 : 3; + if (!pcmcia_request_io(p_dev)) + return 0; } return -ENODEV; } diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 8a6864f..9f9bb69 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -585,10 +585,8 @@ static int btuart_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; - - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | + CONF_AUTO_SET_IO; return btuart_config(link); } @@ -602,38 +600,41 @@ static void btuart_detach(struct pcmcia_device *link) kfree(info); } -static int btuart_check_config(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data) { int *try = priv_data; - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && - (cf->io.win[0].base != 0)) { - p_dev->resource[0]->start = cf->io.win[0].base; - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -ENODEV; + if (try == 0) + p_dev->io_lines = 16; + + if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) + return -EINVAL; + + p_dev->resource[0]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + + return pcmcia_request_io(p_dev); } 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 }; int j; - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - for (j = 0; j < 5; j++) { - p_dev->resource[0]->start = base[j]; - p_dev->io_lines = base[j] ? 16 : 3; - if (!pcmcia_request_io(p_dev)) - return 0; - } + if (p_dev->io_lines > 3) + return -ENODEV; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = 8; + + for (j = 0; j < 5; j++) { + p_dev->resource[0]->start = base[j]; + p_dev->io_lines = base[j] ? 16 : 3; + if (!pcmcia_request_io(p_dev)) + return 0; } return -ENODEV; } diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 4620cc3..12cd177 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -571,10 +571,7 @@ static int dtl1_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; - - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; return dtl1_config(link); } @@ -589,17 +586,14 @@ static void dtl1_detach(struct pcmcia_device *link) kfree(info); } -static int dtl1_confcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data) { - if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) + if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8)) return -ENODEV; - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->resource[0]->end = cf->io.win[0].len; /*yo */ - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + return pcmcia_request_io(p_dev); } diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 0b2f3b9..79de9cc 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1741,19 +1741,8 @@ static void cmm_cm4000_release(struct pcmcia_device * link) /*==== Interface to PCMCIA Layer =======================================*/ -static int cm4000_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (!cfg->io.nwin) - return -ENODEV; - - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; - p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; - return pcmcia_request_io(p_dev); } @@ -1761,6 +1750,8 @@ static int cm4000_config(struct pcmcia_device * link, int devno) { struct cm4000_dev *dev; + link->config_flags |= CONF_AUTO_SET_IO; + /* read the config-tuples */ if (pcmcia_loop_config(link, cm4000_config_check, NULL)) goto cs_release; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index acf88d5..bf012d2 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -515,25 +515,9 @@ static void cm4040_reader_release(struct pcmcia_device *link) return; } -static int cm4040_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data) { - int rc; - if (!cfg->io.nwin) - return -ENODEV; - - /* Get the IOaddr */ - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; - p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; - rc = pcmcia_request_io(p_dev); - - dev_printk(KERN_INFO, &p_dev->dev, - "pcmcia_request_io returned 0x%x\n", rc); - return rc; + return pcmcia_request_io(p_dev); } @@ -542,6 +526,8 @@ static int reader_config(struct pcmcia_device *link, int devno) struct reader_dev *dev; int fail_rc; + link->config_flags |= CONF_AUTO_SET_IO; + if (pcmcia_loop_config(link, cm4040_config_check, NULL)) goto cs_release; diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 1b7f092..594c23b 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -75,22 +75,18 @@ static void signalled_reboot_callback(void *callback_data) schedule_work(&ipw->work_reboot); } -static int ipwireless_probe(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) { struct ipw_dev *ipw = priv_data; struct resource *io_resource; int ret; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; /* 0x40 causes it to generate level mode interrupts. */ /* 0x04 enables IREQ pin. */ - p_dev->config_index = cfg->index | 0x44; + p_dev->config_index |= 0x44; p_dev->io_lines = 16; ret = pcmcia_request_io(p_dev); if (ret) @@ -100,26 +96,18 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, resource_size(p_dev->resource[0]), IPWIRELESS_PCCARD_NAME); - if (cfg->mem.nwin == 0) - return 0; - p_dev->resource[2]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; - p_dev->resource[2]->start = cfg->mem.win[0].host_addr; - p_dev->resource[2]->end = cfg->mem.win[0].len; - if (p_dev->resource[2]->end < 0x1000) - p_dev->resource[2]->end = 0x1000; ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); if (ret != 0) goto exit1; - ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], - cfg->mem.win[0].card_addr); + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); if (ret != 0) goto exit2; - ipw->is_v2_card = cfg->mem.win[0].len == 0x100; + ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; ipw->attr_memory = ioremap(p_dev->resource[2]->start, resource_size(p_dev->resource[2])); @@ -165,13 +153,13 @@ static int config_ipwireless(struct ipw_dev *ipw) int ret = 0; ipw->is_v2_card = 0; + link->config_flags |= CONF_AUTO_SET_IO | CONF_AUTO_SET_IOMEM | + CONF_ENABLE_IRQ; ret = pcmcia_loop_config(link, ipwireless_probe, ipw); if (ret != 0) return ret; - link->config_flags |= CONF_ENABLE_IRQ; - INIT_WORK(&ipw->work_reboot, signalled_reboot_work); ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start, diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index c701434..a343b8f 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -561,19 +561,8 @@ static int mgslpc_probe(struct pcmcia_device *link) /* Card has been inserted. */ -static int mgslpc_ioprobe(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int mgslpc_ioprobe(struct pcmcia_device *p_dev, void *priv_data) { - if (!cfg->io.nwin) - return -ENODEV; - - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; - p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; - return pcmcia_request_io(p_dev); } @@ -585,11 +574,12 @@ static int mgslpc_config(struct pcmcia_device *link) if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_config(0x%p)\n", link); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); if (ret != 0) goto failed; - link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 8; link->config_regs = PRESENT_OPTION; diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 25b8a10..44a8918 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -96,10 +96,8 @@ static int ide_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->config_flags |= CONF_ENABLE_IRQ; - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; return ide_config(link); } /* ide_attach */ @@ -199,41 +197,28 @@ struct pcmcia_config_check { 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) +static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) { struct pcmcia_config_check *stk = priv_data; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - pdev->config_index = cfg->index; - pdev->resource[0]->start = io->win[0].base; - if (!(io->flags & CISTPL_IO_16BIT)) { - pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - } - if (io->nwin == 2) { - pdev->resource[0]->end = 8; - pdev->resource[1]->start = io->win[1].base; - pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[1]->start; - } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { - pdev->resource[0]->end = io->win[0].len; - pdev->resource[1]->end = 0; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[0]->start + 0x0e; - } else + if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + } + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + + if (pdev->resource[1]->end) { + pdev->resource[0]->end = 8; + pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; + stk->ctl_base = pdev->resource[1]->start; + } else { + if (pdev->resource[0]->end < 16) return -ENODEV; - /* If we've got this far, we're done */ - return 0; + stk->ctl_base = pdev->resource[0]->start + 0x0e; } - return -ENODEV; + + return pcmcia_request_io(pdev); } static int ide_config(struct pcmcia_device *link) diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 9dbab9c..403a995 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -72,13 +72,8 @@ static void avmcs_detach(struct pcmcia_device *p_dev); static int avmcs_probe(struct pcmcia_device *p_dev) { - - /* The io structure describes IO port mapping */ - p_dev->resource[0]->end = 16; - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - /* General socket configuration */ - p_dev->config_flags |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; p_dev->config_index = 1; p_dev->config_regs = PRESENT_OPTION; @@ -107,16 +102,12 @@ static void avmcs_detach(struct pcmcia_device *link) ======================================================================*/ -static int avmcs_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { - if (cf->io.nwin <= 0) - return -ENODEV; + p_dev->resource[0]->end = 16; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->resource[0]->end = cf->io.win[0].len; return pcmcia_request_io(p_dev); } diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 2f2b000..cb09f0c 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -76,14 +76,8 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) { dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); - /* The io structure describes IO port mapping */ - p_dev->resource[0]->end = 16; - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - p_dev->resource[1]->end = 16; - p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; - /* General socket configuration */ - p_dev->config_flags |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; p_dev->config_index = 1; p_dev->config_regs = PRESENT_OPTION; @@ -114,17 +108,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link) ======================================================================*/ -static int avma1cs_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { - if (cf->io.nwin <= 0) - return -ENODEV; - - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->resource[0]->end = cf->io.win[0].len; + p_dev->resource[0]->end = 16; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->io_lines = 5; + return pcmcia_request_io(p_dev); } diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 0a65280..f203a52 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -118,16 +118,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) local->cardnr = -1; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->resource[0]->end = 8; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - return elsa_cs_config(link); } /* elsa_cs_attach */ @@ -160,18 +150,17 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link) ======================================================================*/ -static int elsa_cs_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { int j; p_dev->io_lines = 3; + p_dev->resource[0]->end = 8; + p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - if ((cf->io.nwin > 0) && cf->io.win[0].base) { + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); - p_dev->resource[0]->start = cf->io.win[0].base; if (!pcmcia_request_io(p_dev)) return 0; } else { @@ -194,6 +183,8 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); dev = link->priv; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); if (i != 0) goto failed; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index b69eccf..a88c88f 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -128,8 +128,6 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) /* from old sedl_cs */ /* The io structure describes IO port mapping */ - link->resource[0]->end = 8; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; return sedlbauer_config(link); } /* sedlbauer_attach */ @@ -161,35 +159,13 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link) device available to the system. ======================================================================*/ -static int sedlbauer_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - p_dev->io_lines = 3; - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; - } + if (p_dev->config_index == 0) + return -EINVAL; - return 0; + p_dev->io_lines = 3; + return pcmcia_request_io(p_dev); } @@ -202,7 +178,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | - CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO; + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; /* In this loop, we scan the CIS for configuration table entries, diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 6605480..05a5631 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -105,10 +105,7 @@ static int __devinit teles_probe(struct pcmcia_device *link) and attributes of IO windows) are fixed by the nature of the device, and can be hard-wired here. */ - link->resource[0]->end = 96; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; return teles_cs_config(link); } /* teles_attach */ @@ -142,18 +139,17 @@ static void __devexit teles_detach(struct pcmcia_device *link) ======================================================================*/ -static int teles_cs_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { int j; p_dev->io_lines = 5; + p_dev->resource[0]->end = 96; + p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - if ((cf->io.nwin > 0) && cf->io.win[0].base) { + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); - p_dev->resource[0]->start = cf->io.win[0].base; if (!pcmcia_request_io(p_dev)) return 0; } else { diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 17f1040..9d9d997 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -284,34 +284,16 @@ static int try_io_port(struct pcmcia_device *link) } } -static int axnet_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data) { - int i; - cistpl_io_t *io = &cfg->io; - - if (cfg->index == 0 || cfg->io.nwin == 0) - return -ENODEV; + if (p_dev->config_index == 0) + return -EINVAL; p_dev->config_index = 0x05; - /* For multifunction cards, by convention, we configure the - network function with window 0, and serial with window 1 */ - if (io->nwin > 1) { - i = (io->win[1].len > io->win[0].len); - p_dev->resource[1]->start = io->win[1-i].base; - p_dev->resource[1]->end = io->win[1-i].len; - } else { - i = p_dev->resource[1]->end = 0; - } - p_dev->resource[0]->start = io->win[i].base; - p_dev->resource[0]->end = io->win[i].len; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) - return try_io_port(p_dev); + if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) + return -ENODEV; - return -ENODEV; + return try_io_port(p_dev); } static int axnet_config(struct pcmcia_device *link) @@ -324,6 +306,7 @@ static int axnet_config(struct pcmcia_device *link) /* don't trust the CIS on this; Linksys got it wrong */ link->config_regs = 0x63; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, axnet_configcheck, NULL); if (ret != 0) goto failed; @@ -331,7 +314,6 @@ static int axnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - link->config_flags |= CONF_ENABLE_IRQ; if (resource_size(link->resource[1]) == 8) link->config_flags |= CONF_ENABLE_SPKR; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index c1479e3..792ab38 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -319,10 +319,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) return ret; /* RequestIO failed */ } -static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data) { return 0; /* strange, but that's what the code did already before... */ } diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 301f3d4..0abf4f8 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -259,7 +259,7 @@ static int pcnet_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = dev; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; dev->netdev_ops = &pcnet_netdev_ops; @@ -500,37 +500,19 @@ static int try_io_port(struct pcmcia_device *link) } } -static int pcnet_confcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data) { int *has_shmem = priv_data; - int i; - cistpl_io_t *io = &cfg->io; - if (cfg->index == 0 || cfg->io.nwin == 0) - return -EINVAL; + *has_shmem = (p_dev->resource[2]->end >= 0x4000); - /* For multifunction cards, by convention, we configure the - network function with window 0, and serial with window 1 */ - if (io->nwin > 1) { - i = (io->win[1].len > io->win[0].len); - p_dev->resource[1]->start = io->win[1-i].base; - p_dev->resource[1]->end = io->win[1-i].len; - } else { - i = p_dev->resource[1]->end = 0; - } + if (p_dev->config_index == 0) + return -EINVAL; - *has_shmem = ((cfg->mem.nwin == 1) && - (cfg->mem.win[0].len >= 0x4000)); - p_dev->resource[0]->start = io->win[i].base; - p_dev->resource[0]->end = io->win[i].len; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) - return try_io_port(p_dev); + if (p_dev->resource[0]->end + p_dev->resource[1]->end - 32) + return -EINVAL; - return 0; + return try_io_port(p_dev); } static int pcnet_config(struct pcmcia_device *link) diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index e127d2b..a8cef28 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -323,9 +323,6 @@ static int smc91c92_probe(struct pcmcia_device *link) link->priv = dev; spin_lock_init(&smc->lock); - link->resource[0]->end = 16; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->config_flags |= CONF_ENABLE_IRQ; /* The SMC91c92-specific entries in the device structure. */ dev->netdev_ops = &smc_netdev_ops; @@ -417,18 +414,21 @@ static int mhz_3288_power(struct pcmcia_device *link) return 0; } -static int mhz_mfc_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) { int k; - p_dev->resource[1]->start = cf->io.win[0].base; + p_dev->io_lines = 16; + p_dev->resource[1]->start = p_dev->resource[0]->start; + p_dev->resource[1]->end = 8; + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = 16; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; for (k = 0; k < 0x400; k += 0x10) { if (k & 0x80) continue; p_dev->resource[0]->start = k ^ 0x300; - p_dev->io_lines = 16; if (!pcmcia_request_io(p_dev)) return 0; } @@ -442,9 +442,8 @@ static int mhz_mfc_config(struct pcmcia_device *link) unsigned int offset; int i; - link->config_flags |= CONF_ENABLE_SPKR; - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[1]->end = 8; + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | + CONF_AUTO_SET_IO; /* The Megahertz combo cards have modem-like CIS entries, so we have to explicitly try a bunch of port combinations. */ @@ -586,13 +585,12 @@ static int mot_setup(struct pcmcia_device *link) /*====================================================================*/ -static int smc_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data) { - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->end = 16; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + return pcmcia_request_io(p_dev); } @@ -601,7 +599,8 @@ static int smc_config(struct pcmcia_device *link) struct net_device *dev = link->priv; int i; - link->resource[0]->end = 16; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + i = pcmcia_loop_config(link, smc_configcheck, NULL); if (!i) dev->base_addr = link->resource[0]->start; @@ -634,7 +633,7 @@ static int osi_config(struct pcmcia_device *link) static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; int i, j; - link->config_flags |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; link->resource[0]->end = 64; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->end = 8; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 2bc2eb8..cecc074 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -528,7 +528,6 @@ xirc2ps_probe(struct pcmcia_device *link) link->priv = dev; /* General socket configuration */ - link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; /* Fill in card specific entries */ @@ -665,42 +664,53 @@ has_ce2_string(struct pcmcia_device * p_dev) } static int -xirc2ps_config_modem(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data) { unsigned int ioaddr; - if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { - for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { - p_dev->resource[1]->start = cf->io.win[0].base; - p_dev->resource[0]->start = ioaddr; - if (!pcmcia_request_io(p_dev)) - return 0; - } + if ((p_dev->resource[0]->start & 0xf) == 8) + return -ENODEV; + + p_dev->resource[0]->end = 16; + p_dev->resource[1]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->io_lines = 10; + + p_dev->resource[1]->start = p_dev->resource[0]->start; + for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { + p_dev->resource[0]->start = ioaddr; + if (!pcmcia_request_io(p_dev)) + return 0; } return -ENODEV; } static int -xirc2ps_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data) { int *pass = priv_data; + resource_size_t tmp = p_dev->resource[1]->start; - if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { - p_dev->resource[1]->start = cf->io.win[0].base; - p_dev->resource[0]->start = p_dev->resource[1]->start - + (*pass ? (cf->index & 0x20 ? -24:8) - : (cf->index & 0x20 ? 8:-24)); - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -ENODEV; + tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8) + : (p_dev->config_index & 0x20 ? 8 : -24)); + + if ((p_dev->resource[0]->start & 0xf) == 8) + return -ENODEV; + + p_dev->resource[0]->end = 18; + p_dev->resource[1]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->io_lines = 10; + p_dev->resource[1]->start = p_dev->resource[0]->start; + p_dev->resource[0]->start = tmp; + return pcmcia_request_io(p_dev); } @@ -803,21 +813,16 @@ xirc2ps_config(struct pcmcia_device * link) goto failure; } - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - link->io_lines = 10; if (local->modem) { int pass; + link->config_flags |= CONF_AUTO_SET_IO; - link->resource[1]->end = 8; - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; if (local->dingo) { /* Take the Modem IO port from the CIS and scan for a free * Ethernet port */ - link->resource[0]->end = 16; /* no Mako stuff anymore */ if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) goto port_found; } else { - link->resource[0]->end = 18; /* We do 2 passes here: The first one uses the regular mapping and * the second tries again, thereby considering that the 32 ports are * mirrored every 32 bytes. Actually we use a mirrored port for @@ -833,7 +838,9 @@ xirc2ps_config(struct pcmcia_device * link) } printk(KNOT_XIRC "no ports available\n"); } else { + link->io_lines = 10; link->resource[0]->end = 16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { link->resource[0]->start = ioaddr; if (!(err = pcmcia_request_io(link))) diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 63bf662..77682f2 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -137,36 +137,12 @@ static void airo_detach(struct pcmcia_device *link) ======================================================================*/ -static int airo_cs_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - } - - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; + if (p_dev->config_index == 0) + return -EINVAL; - /* If we got this far, we're cool! */ - return 0; + return pcmcia_request_io(p_dev); } @@ -180,7 +156,7 @@ static int airo_config(struct pcmcia_device *link) dev_dbg(&link->dev, "airo_config\n"); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | - CONF_AUTO_AUDIO; + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; /* * In this loop, we scan the CIS for configuration table diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 812decd..2029380 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -154,31 +154,11 @@ static int card_present(void *arg) return 0; } -static int atmel_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - } + if (p_dev->config_index == 0) + return -EINVAL; - /* This reserves IO space but doesn't actually enable it */ return pcmcia_request_io(p_dev); } @@ -194,7 +174,7 @@ static int atmel_config(struct pcmcia_device *link) dev_dbg(&link->dev, "atmel_config\n"); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | - CONF_AUTO_AUDIO; + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; /* In this loop, we scan the CIS for configuration table entries, diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index d4f19af..e57b201 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -469,46 +469,11 @@ static void prism2_detach(struct pcmcia_device *link) /* run after a CARD_INSERTION event is received to configure the PCMCIA * socket and make the device available to the system */ -static int prism2_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " - "(default 0x%02X)\n", cfg->index, dflt->index); - - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " - "dflt->io.nwin=%d\n", - cfg->io.nwin, dflt->io.nwin); - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - } + if (p_dev->config_index == 0) + return -EINVAL; - /* This reserves IO space but doesn't actually enable it */ return pcmcia_request_io(p_dev); } @@ -531,7 +496,7 @@ static int prism2_config(struct pcmcia_device *link) /* Look for an appropriate configuration table entry in the CIS */ link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | - CONF_AUTO_CHECK_VCC; + CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; if (ignore_cis_vcc) link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, prism2_config_check, NULL); diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 031f3e6..2c6f28a 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -794,20 +794,12 @@ static void if_cs_release(struct pcmcia_device *p_dev) * insertion event. */ -static int if_cs_ioprobe(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) { + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - if (cfg->io.nwin != 1) { + if (p_dev->resource[1]->end) { lbs_pr_err("wrong CIS (check number of IO windows)\n"); return -ENODEV; } @@ -833,6 +825,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev) card->p_dev = p_dev; p_dev->priv = card; + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { lbs_pr_err("error in pcmcia_loop_config\n"); goto out1; diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index b921738..263dfe9 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -142,42 +142,12 @@ static void orinoco_cs_detach(struct pcmcia_device *link) * device available to the system. */ -static int orinoco_cs_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - goto next_entry; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - goto next_entry; - } - return 0; + if (p_dev->config_index == 0) + return -EINVAL; -next_entry: - pcmcia_disable_device(p_dev); - return -ENODEV; + return pcmcia_request_io(p_dev); }; static int @@ -202,7 +172,8 @@ orinoco_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | + CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; if (ignore_cis_vcc) link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index f462c78..7844650 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -205,48 +205,12 @@ static void spectrum_cs_detach(struct pcmcia_device *link) */ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) - goto next_entry; - - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->vpp = - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - goto next_entry; - } - return 0; + if (p_dev->config_index == 0) + return -EINVAL; -next_entry: - pcmcia_disable_device(p_dev); - return -ENODEV; + return pcmcia_request_io(p_dev); }; static int @@ -271,7 +235,8 @@ spectrum_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | + CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; if (ignore_cis_vcc) link->config_flags &= ~CONF_AUTO_CHECK_VCC; ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8c2a473..3730184 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -100,9 +100,7 @@ static int parport_probe(struct pcmcia_device *link) link->priv = info; info->p_dev = link; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; return parport_config(link); } /* parport_attach */ @@ -133,27 +131,14 @@ static void parport_detach(struct pcmcia_device *link) ======================================================================*/ -static int parport_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int parport_config_check(struct pcmcia_device *p_dev, void *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_lines = io->flags & CISTPL_IO_LINES_MASK; - if (epp_mode) - p_dev->config_index |= FORCE_EPP_MODE; - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin == 2) { - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; - return 0; - } - return -ENODEV; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + + return pcmcia_request_io(p_dev); } static int parport_config(struct pcmcia_device *link) @@ -164,6 +149,9 @@ static int parport_config(struct pcmcia_device *link) dev_dbg(&link->dev, "parport_config\n"); + if (epp_mode) + link->config_index |= FORCE_EPP_MODE; + ret = pcmcia_loop_config(link, parport_config_check, NULL); if (ret) goto failed; diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index d3f8d47..9745c01 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c @@ -6,7 +6,7 @@ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * Copyright (C) 1999 David A. Hinds - * Copyright (C) 2004-2009 Dominik Brodowski + * Copyright (C) 2004-2010 Dominik Brodowski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -125,13 +125,24 @@ next_entry: return ret; } + +/** + * pcmcia_io_cfg_data_width() - convert cfgtable to data path width parameter + */ +static int pcmcia_io_cfg_data_width(unsigned int flags) +{ + if (!(flags & CISTPL_IO_8BIT)) + return IO_DATA_PATH_WIDTH_16; + if (!(flags & CISTPL_IO_16BIT)) + return IO_DATA_PATH_WIDTH_8; + return IO_DATA_PATH_WIDTH_AUTO; +} + + struct pcmcia_cfg_mem { struct pcmcia_device *p_dev; + int (*conf_check) (struct pcmcia_device *p_dev, void *priv_data); void *priv_data; - int (*conf_check) (struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data); cisparse_t parse; cistpl_cftable_entry_t dflt; }; @@ -184,16 +195,62 @@ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) if ((flags & CONF_AUTO_AUDIO) && (cfg->flags & CISTPL_CFTABLE_AUDIO)) p_dev->config_flags |= CONF_ENABLE_SPKR; - return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, - cfg_mem->priv_data); + + /* IO window settings? */ + if (flags & CONF_AUTO_SET_IO) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; + int i = 0; + + p_dev->resource[0]->start = p_dev->resource[0]->end = 0; + p_dev->resource[1]->start = p_dev->resource[1]->end = 0; + if (io->nwin == 0) + return -ENODEV; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + if (io->nwin > 1) { + /* For multifunction cards, by convention, we + * configure the network function with window 0, + * and serial with window 1 */ + i = (io->win[1].len > io->win[0].len); + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1-i].base; + p_dev->resource[1]->end = io->win[1-i].len; + } + p_dev->resource[0]->start = io->win[i].base; + p_dev->resource[0]->end = io->win[i].len; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + } + + /* MEM window settings? */ + if (flags & CONF_AUTO_SET_IOMEM) { + /* so far, we only set one memory window */ + cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; + + p_dev->resource[2]->start = p_dev->resource[2]->end = 0; + if (mem->nwin == 0) + return -ENODEV; + + p_dev->resource[2]->start = mem->win[0].host_addr; + p_dev->resource[2]->end = mem->win[0].len; + if (p_dev->resource[2]->end < 0x1000) + p_dev->resource[2]->end = 0x1000; + p_dev->card_addr = mem->win[0].card_addr; + } + + dev_dbg(&p_dev->dev, "checking configuration %d: %pR %pR %pR\n", + p_dev->config_index, p_dev->resource[0], p_dev->resource[1], + p_dev->resource[2]); + + return cfg_mem->conf_check(p_dev, cfg_mem->priv_data); } /** * pcmcia_loop_config() - loop over configuration options * @p_dev: the struct pcmcia_device which we need to loop for. * @conf_check: function to call for each configuration option. - * It gets passed the struct pcmcia_device, the CIS data - * describing the configuration option, and private data + * It gets passed the struct pcmcia_device and private data * being passed to pcmcia_loop_config() * @priv_data: private data to be passed to the conf_check function. * @@ -203,8 +260,6 @@ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) */ 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) { diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 0b5fc2f..bd9ce09 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -99,9 +99,7 @@ static int aha152x_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->end = 0x20; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; link->config_regs = PRESENT_OPTION; return aha152x_config_cs(link); @@ -121,24 +119,24 @@ static void aha152x_detach(struct pcmcia_device *link) /*====================================================================*/ -static int aha152x_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int aha152x_config_check(struct pcmcia_device *p_dev, void *priv_data) { p_dev->io_lines = 10; + /* For New Media T&J, look for a SCSI window */ - if (cfg->io.win[0].len >= 0x20) - p_dev->resource[0]->start = cfg->io.win[0].base; - else if ((cfg->io.nwin > 1) && - (cfg->io.win[1].len >= 0x20)) - p_dev->resource[0]->start = cfg->io.win[1].base; - if ((cfg->io.nwin > 0) && - (p_dev->resource[0]->start < 0xffff)) { - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -EINVAL; + if ((p_dev->resource[0]->end < 0x20) && + (p_dev->resource[1]->end >= 0x20)) + p_dev->resource[0]->start = p_dev->resource[1]->start; + + if (p_dev->resource[0]->start >= 0xffff) + return -EINVAL; + + p_dev->resource[1]->start = p_dev->resource[1]->end = 0; + p_dev->resource[0]->end = 0x20; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + + return pcmcia_request_io(p_dev); } static int aha152x_config_cs(struct pcmcia_device *link) diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 3b9f311..f2dc627 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -82,9 +82,7 @@ static int fdomain_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->end = 0x10; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; link->config_regs = PRESENT_OPTION; return fdomain_config(link); @@ -103,13 +101,12 @@ static void fdomain_detach(struct pcmcia_device *link) /*====================================================================*/ -static int fdomain_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int fdomain_config_check(struct pcmcia_device *p_dev, void *priv_data) { p_dev->io_lines = 10; - p_dev->resource[0]->start = cfg->io.win[0].base; + p_dev->resource[0]->end = 0x10; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; return pcmcia_request_io(p_dev); } diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 9b4ac20..3d6db73 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1556,13 +1556,6 @@ static int nsp_cs_probe(struct pcmcia_device *link) nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); - /* The io structure describes IO port mapping */ - link->resource[0]->end = 0x10; - link->resource[0]->flags = IO_DATA_PATH_WIDTH_AUTO; - - /* General socket configuration */ - link->config_flags |= CONF_ENABLE_IRQ; - ret = nsp_cs_config(link); nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); @@ -1594,50 +1587,27 @@ static void nsp_cs_detach(struct pcmcia_device *link) ethernet device available to the system. ======================================================================*/ -static int nsp_cs_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { struct nsp_hw_data *data = priv_data; if (cfg->index == 0) return -ENODEV; - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - goto next_entry; - } + /* This reserves IO space but doesn't actually enable it */ + if (pcmcia_request_io(p_dev) != 0) + goto next_entry; - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { - cistpl_mem_t *mem = - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; + if (resource_size(p_dev->resource[2])) { p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE); - p_dev->resource[2]->start = mem->win[0].host_addr; - p_dev->resource[2]->end = mem->win[0].len; if (p_dev->resource[2]->end < 0x1000) p_dev->resource[2]->end = 0x1000; if (pcmcia_request_window(p_dev, p_dev->resource[2], 0) != 0) goto next_entry; if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], - mem->win[0].card_addr) != 0) + p_dev->card_addr) != 0) goto next_entry; data->MmioAddress = (unsigned long) @@ -1664,7 +1634,8 @@ static int nsp_cs_config(struct pcmcia_device *link) nsp_dbg(NSP_DEBUG_INIT, "in"); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | - CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO; + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IOMEM | + CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, nsp_cs_config_check, data); if (ret) @@ -1727,7 +1698,7 @@ static int nsp_cs_config(struct pcmcia_device *link) printk(", io %pR", link->resource[0]); if (link->resource[1]) printk(" & %pR", link->resource[1]); - if (link->resource[1]) + if (link->resource[2]) printk(", mem %pR", link->resource[2]); printk("\n"); diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 468fd12..e8a06e3 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -155,9 +155,7 @@ static int qlogic_probe(struct pcmcia_device *link) return -ENOMEM; info->p_dev = link; link->priv = info; - link->resource[0]->end = 16; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; link->config_regs = PRESENT_OPTION; return qlogic_config(link); @@ -176,14 +174,11 @@ static void qlogic_detach(struct pcmcia_device *link) /*====================================================================*/ -static int qlogic_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int qlogic_config_check(struct pcmcia_device *p_dev, void *priv_data) { p_dev->io_lines = 10; - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; if (p_dev->resource[0]->start == 0) return -ENODEV; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 7a0bb9a..6ceb57c 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -683,14 +683,11 @@ static struct scsi_host_template sym53c500_driver_template = { .shost_attrs = SYM53C500_shost_attrs }; -static int SYM53C500_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data) { p_dev->io_lines = 10; - p_dev->resource[0]->start = cfg->io.win[0].base; - p_dev->resource[0]->end = cfg->io.win[0].len; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; if (p_dev->resource[0]->start == 0) return -ENODEV; @@ -857,9 +854,7 @@ SYM53C500_probe(struct pcmcia_device *link) return -ENOMEM; info->p_dev = link; link->priv = info; - link->resource[0]->end = 16; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->config_flags |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; return SYM53C500_config(link); } /* SYM53C500_attach */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 57e042b..b272443 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -332,7 +332,7 @@ static int serial_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; if (do_sound) link->config_flags |= CONF_ENABLE_SPKR; @@ -403,41 +403,45 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, /*====================================================================*/ -static int simple_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int simple_config_check(struct pcmcia_device *p_dev, void *priv_data) { static const int size_table[2] = { 8, 16 }; int *try = priv_data; - p_dev->io_lines = ((*try & 0x1) == 0) ? - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; + if (p_dev->resource[0]->start == 0) + return -ENODEV; - if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) - && (cf->io.win[0].base != 0)) { - p_dev->resource[0]->start = cf->io.win[0].base; - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -EINVAL; + if ((*try & 0x1) == 0) + p_dev->io_lines = 16; + + if (p_dev->resource[0]->end != size_table[(*try >> 1)]) + return -ENODEV; + + p_dev->resource[0]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + + return pcmcia_request_io(p_dev); } 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 }; int j; - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - for (j = 0; j < 5; j++) { - p_dev->resource[0]->start = base[j]; - p_dev->io_lines = base[j] ? 16 : 3; - if (!pcmcia_request_io(p_dev)) - return 0; - } + if (p_dev->io_lines > 3) + return -ENODEV; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = 8; + + for (j = 0; j < 5; j++) { + p_dev->resource[0]->start = base[j]; + p_dev->io_lines = base[j] ? 16 : 3; + if (!pcmcia_request_io(p_dev)) + return 0; } return -ENODEV; } @@ -465,12 +469,9 @@ static int simple_config(struct pcmcia_device *link) } } - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; - /* First pass: look for a config entry that looks normal. * Two tries: without IO aliases, then with aliases */ - link->config_flags |= CONF_AUTO_SET_VPP; + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_SET_IO; for (try = 0; try < 4; try++) if (!pcmcia_loop_config(link, simple_config_check, &try)) goto found_port; @@ -501,43 +502,44 @@ found_port: return setup_serial(link, info, link->resource[0]->start, link->irq); } -static int multi_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int multi_config_check(struct pcmcia_device *p_dev, void *priv_data) { - int *base2 = priv_data; + int *multi = priv_data; + + if (p_dev->resource[1]->end) + return -EINVAL; /* The quad port cards have bad CIS's, so just look for a window larger than 8 ports and assume it will be right */ - if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; - if (!pcmcia_request_io(p_dev)) { - *base2 = p_dev->resource[0]->start + 8; - return 0; - } - } - return -ENODEV; + if (p_dev->resource[0]->end <= 8) + return -EINVAL; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = *multi * 8; + + if (pcmcia_request_io(p_dev)) + return -ENODEV; + return 0; } 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; - if (cf->io.nwin == 2) { - p_dev->resource[0]->start = cf->io.win[0].base; - p_dev->resource[1]->start = cf->io.win[1].base; - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; - if (!pcmcia_request_io(p_dev)) { - *base2 = p_dev->resource[1]->start; - return 0; - } - } - return -ENODEV; + if (!p_dev->resource[0]->end || !p_dev->resource[1]->end) + return -ENODEV; + + p_dev->resource[0]->end = p_dev->resource[1]->end = 8; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + + if (pcmcia_request_io(p_dev)) + return -ENODEV; + + *base2 = p_dev->resource[0]->start + 8; + return 0; } static int multi_config(struct pcmcia_device *link) @@ -545,12 +547,12 @@ static int multi_config(struct pcmcia_device *link) struct serial_info *info = link->priv; int i, base2 = 0; + link->config_flags |= CONF_AUTO_SET_IO; /* First, look for a generic full-sized window */ - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = info->multi * 8; - if (pcmcia_loop_config(link, multi_config_check, &base2)) { + if (!pcmcia_loop_config(link, multi_config_check, &info->multi)) + base2 = link->resource[0]->start + 8; + else { /* If that didn't work, look for two windows */ - link->resource[0]->end = link->resource[1]->end = 8; info->multi = 2; if (pcmcia_loop_config(link, multi_config_check_notpicky, &base2)) { @@ -586,7 +588,7 @@ static int multi_config(struct pcmcia_device *link) link->config_index == 3) { err = setup_serial(link, info, base2, link->irq); - base2 = link->resource[0]->start;; + base2 = link->resource[0]->start; } else { err = setup_serial(link, info, link->resource[0]->start, link->irq); @@ -610,18 +612,18 @@ static int multi_config(struct pcmcia_device *link) return 0; } -static int serial_check_for_multi(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int serial_check_for_multi(struct pcmcia_device *p_dev, void *priv_data) { struct serial_info *info = p_dev->priv; - if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) - info->multi = cf->io.win[0].len >> 3; + if (!p_dev->resource[0]->end) + return -EINVAL; + + if ((!p_dev->resource[1]->end) && (p_dev->resource[0]->end % 8 == 0)) + info->multi = p_dev->resource[0]->end >> 3; - if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && - (cf->io.win[1].len == 8)) + if ((p_dev->resource[1]->end) && (p_dev->resource[0]->end == 8) + && (p_dev->resource[1]->end == 8)) info->multi = 2; return 0; /* break */ diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 678fbf6..c43c689 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -710,36 +710,12 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) + if (p_dev->config_index == 0) return -EINVAL; - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev); - } - - return 0; + return pcmcia_request_io(p_dev); } static void das16cs_pcmcia_config(struct pcmcia_device *link) @@ -748,6 +724,9 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); + /* Do we need to allocate an interrupt? */ + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 12a96b7..d395909 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -192,35 +192,12 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev); - } - return 0; + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); } @@ -238,6 +215,8 @@ static void das08_pcmcia_config(struct pcmcia_device *link) dev_dbg(&link->dev, "das08_pcmcia_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index f22dc0f..7129b0c 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -530,35 +530,12 @@ static void dio700_cs_detach(struct pcmcia_device *link) ======================================================================*/ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; - } + if (p_dev->config_index == 0) + return -EINVAL; - /* If we got this far, we're cool! */ - return 0; + return pcmcia_request_io(p_dev); } static void dio700_config(struct pcmcia_device *link) @@ -570,7 +547,8 @@ static void dio700_config(struct pcmcia_device *link) dev_dbg(&link->dev, "dio700_config\n"); - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | + CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); if (ret) { diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 6dc2b06..4defdda 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -282,35 +282,12 @@ static void dio24_cs_detach(struct pcmcia_device *link) ======================================================================*/ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; - } + if (p_dev->config_index == 0) + return -EINVAL; - /* If we got this far, we're cool! */ - return 0; + return pcmcia_request_io(p_dev); } static void dio24_config(struct pcmcia_device *link) @@ -321,7 +298,8 @@ static void dio24_config(struct pcmcia_device *link) dev_dbg(&link->dev, "dio24_config\n"); - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | + CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); if (ret) { diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 6eacbd7..5123b31 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -261,35 +261,12 @@ static void labpc_cs_detach(struct pcmcia_device *link) ======================================================================*/ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev) != 0) - return -ENODEV; - } + if (p_dev->config_index == 0) + return -EINVAL; - /* If we got this far, we're cool! */ - return 0; + return pcmcia_request_io(p_dev); } @@ -300,7 +277,7 @@ static void labpc_config(struct pcmcia_device *link) dev_dbg(&link->dev, "labpc_config\n"); link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ | - CONF_AUTO_AUDIO; + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); if (ret) { @@ -316,7 +293,6 @@ static void labpc_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index da4e2a2..f1e31d3 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -262,10 +262,6 @@ static struct pcmcia_device *cur_dev = NULL; static int cs_attach(struct pcmcia_device *link) { - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - link->resource[0]->end = 16; - link->config_flags |= CONF_ENABLE_IRQ; - cur_dev = link; mio_cs_config(link); @@ -299,15 +295,12 @@ static int mio_cs_resume(struct pcmcia_device *link) } -static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { int base, ret; - p_dev->resource[0]->end = cfg->io.win[0].len; - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; for (base = 0x000; base < 0x400; base += 0x20) { p_dev->resource[0]->start = base; @@ -324,6 +317,7 @@ static void mio_cs_config(struct pcmcia_device *link) int ret; DPRINTK("mio_cs_config(link=%p)\n", link); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); if (ret) { diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 03a72d7..afd283d 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1068,35 +1068,11 @@ static void daqp_cs_detach(struct pcmcia_device *link) ======================================================================*/ -static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; + if (p_dev->config_index == 0) + return -EINVAL; - /* Do we need to allocate an interrupt? */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= - pcmcia_io_cfg_data_width(io->flags); - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - if (io->nwin > 1) { - p_dev->resource[1]->flags = p_dev->resource[0]->flags; - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - } - - /* This reserves IO space but doesn't actually enable it */ return pcmcia_request_io(p_dev); } @@ -1106,6 +1082,8 @@ static void daqp_cs_config(struct pcmcia_device *link) dev_dbg(&link->dev, "daqp_cs_config\n"); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); if (ret) { dev_warn(&link->dev, "no configuration found\n"); diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 670a76b..76edd39 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -31,8 +31,6 @@ static int ixj_probe(struct pcmcia_device *p_dev) { dev_dbg(&p_dev->dev, "ixj_attach()\n"); /* Create new ixj device */ - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); if (!p_dev->priv) { return -ENOMEM; @@ -109,36 +107,28 @@ failed: return; } -static int ixj_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int ixj_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - p_dev->io_lines = 3; - if (io->nwin == 2) { - p_dev->resource[1]->start = io->win[1].base; - p_dev->resource[1]->end = io->win[1].len; - } - if (!pcmcia_request_io(p_dev)) - return 0; - } - return -ENODEV; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->io_lines = 3; + + return pcmcia_request_io(p_dev); } static int ixj_config(struct pcmcia_device * link) { IXJ *j; ixj_info_t *info; - cistpl_cftable_entry_t dflt = { 0 }; info = link->priv; dev_dbg(&link->dev, "ixj_config\n"); - if (pcmcia_loop_config(link, ixj_config_check, &dflt)) + link->config_flags = CONF_AUTO_SET_IO; + + if (pcmcia_loop_config(link, ixj_config_check, NULL)) goto failed; if (pcmcia_enable_device(link)) diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index d960629..81d7eea 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -131,28 +131,12 @@ static void sl811_cs_release(struct pcmcia_device * link) platform_device_unregister(&platform_dev); } -static int sl811_cs_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - void *priv_data) +static int sl811_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { - if (cfg->index == 0) - return -ENODEV; + if (p_dev->config_index == 0) + return -EINVAL; - /* IO window settings */ - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - p_dev->resource[0]->start = io->win[0].base; - p_dev->resource[0]->end = io->win[0].len; - - return pcmcia_request_io(p_dev); - } - pcmcia_disable_device(p_dev); - return -ENODEV; + return pcmcia_request_io(p_dev); } @@ -164,7 +148,7 @@ static int sl811_cs_config(struct pcmcia_device *link) dev_dbg(&link->dev, "sl811_cs_config\n"); link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | - CONF_AUTO_CHECK_VCC; + CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO; if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) goto failed; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 0577e5f..0b8c8d4 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -93,6 +93,7 @@ struct pcmcia_device { /* device setup */ unsigned int irq; struct resource *resource[PCMCIA_NUM_RESOURCES]; + resource_size_t card_addr; /* for the 1st IOMEM resource */ unsigned int vpp; unsigned int config_flags; /* CONF_ENABLE_ flags below */ @@ -175,8 +176,6 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); /* loop CIS entries for valid configuration */ 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); @@ -225,16 +224,6 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev); #define IO_DATA_PATH_WIDTH_16 0x08 #define IO_DATA_PATH_WIDTH_AUTO 0x10 -/* convert flag found in cfgtable to data path width parameter */ -static inline int pcmcia_io_cfg_data_width(unsigned int flags) -{ - if (!(flags & CISTPL_IO_8BIT)) - return IO_DATA_PATH_WIDTH_16; - if (!(flags & CISTPL_IO_16BIT)) - return IO_DATA_PATH_WIDTH_8; - return IO_DATA_PATH_WIDTH_AUTO; -} - /* IO memory */ #define WIN_MEMORY_TYPE_CM 0x00 /* default */ #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ @@ -264,16 +253,17 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) #define PRESENT_IOSIZE 0x200 /* flags to be passed to pcmcia_enable_device() */ -#define CONF_ENABLE_IRQ 0x01 -#define CONF_ENABLE_SPKR 0x02 -#define CONF_ENABLE_PULSE_IRQ 0x04 -#define CONF_ENABLE_ESR 0x08 +#define CONF_ENABLE_IRQ 0x0001 +#define CONF_ENABLE_SPKR 0x0002 +#define CONF_ENABLE_PULSE_IRQ 0x0004 +#define CONF_ENABLE_ESR 0x0008 /* flags used by pcmcia_loop_config() autoconfiguration */ -#define CONF_AUTO_CHECK_VCC 0x10 /* check for matching Vcc? */ -#define CONF_AUTO_SET_VPP 0x20 /* set Vpp? */ -#define CONF_AUTO_AUDIO 0x40 /* enable audio line? */ - +#define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ +#define CONF_AUTO_SET_VPP 0x0200 /* set Vpp? */ +#define CONF_AUTO_AUDIO 0x0400 /* enable audio line? */ +#define CONF_AUTO_SET_IO 0x0800 /* set ->resource[0,1] */ +#define CONF_AUTO_SET_IOMEM 0x1000 /* set ->resource[2] */ #endif /* __KERNEL__ */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:12 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:12 +0200 Subject: [PATCH 13/15] pcmcia: move driver name to struct pcmcia_driver In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-13-git-send-email-linux@dominikbrodowski.net> Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 4 +--- drivers/bluetooth/bluecard_cs.c | 4 +--- drivers/bluetooth/bt3c_cs.c | 4 +--- drivers/bluetooth/btuart_cs.c | 4 +--- drivers/bluetooth/dtl1_cs.c | 4 +--- drivers/char/pcmcia/cm4000_cs.c | 4 +--- drivers/char/pcmcia/cm4040_cs.c | 4 +--- drivers/char/pcmcia/ipwireless/main.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 4 +--- drivers/ide/ide-cs.c | 4 +--- drivers/isdn/hardware/avm/avm_cs.c | 4 +--- drivers/isdn/hisax/avma1_cs.c | 4 +--- drivers/isdn/hisax/elsa_cs.c | 4 +--- drivers/isdn/hisax/sedlbauer_cs.c | 4 +--- drivers/isdn/hisax/teles_cs.c | 4 +--- drivers/mmc/host/sdricoh_cs.c | 4 +--- drivers/mtd/maps/pcmciamtd.c | 4 +--- drivers/net/pcmcia/3c574_cs.c | 4 +--- drivers/net/pcmcia/3c589_cs.c | 4 +--- drivers/net/pcmcia/axnet_cs.c | 4 +--- drivers/net/pcmcia/com20020_cs.c | 4 +--- drivers/net/pcmcia/fmvj18x_cs.c | 4 +--- drivers/net/pcmcia/ibmtr_cs.c | 4 +--- drivers/net/pcmcia/nmclan_cs.c | 4 +--- drivers/net/pcmcia/pcnet_cs.c | 4 +--- drivers/net/pcmcia/smc91c92_cs.c | 4 +--- drivers/net/pcmcia/xirc2ps_cs.c | 4 +--- drivers/net/wireless/airo_cs.c | 4 +--- drivers/net/wireless/atmel_cs.c | 4 +--- drivers/net/wireless/b43/pcmcia.c | 4 +--- drivers/net/wireless/hostap/hostap_cs.c | 4 +--- drivers/net/wireless/libertas/if_cs.c | 4 +--- drivers/net/wireless/orinoco/orinoco_cs.c | 4 +--- drivers/net/wireless/orinoco/spectrum_cs.c | 4 +--- drivers/net/wireless/ray_cs.c | 4 +--- drivers/net/wireless/wl3501_cs.c | 4 +--- drivers/parport/parport_cs.c | 4 +--- drivers/pcmcia/ds.c | 21 +++++++++++---------- drivers/scsi/pcmcia/aha152x_stub.c | 4 +--- drivers/scsi/pcmcia/fdomain_stub.c | 4 +--- drivers/scsi/pcmcia/nsp_cs.c | 4 +--- drivers/scsi/pcmcia/qlogic_stub.c | 2 -- drivers/scsi/pcmcia/sym53c500_cs.c | 4 +--- drivers/serial/serial_cs.c | 4 +--- drivers/staging/comedi/drivers/cb_das16_cs.c | 4 +--- drivers/staging/comedi/drivers/das08_cs.c | 4 +--- drivers/staging/comedi/drivers/ni_daq_700.c | 4 +--- drivers/staging/comedi/drivers/ni_daq_dio24.c | 4 +--- drivers/staging/comedi/drivers/ni_labpc_cs.c | 4 +--- drivers/staging/comedi/drivers/ni_mio_cs.c | 4 +--- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 4 +--- drivers/staging/wlags49_h2/wl_cs.c | 4 +--- drivers/telephony/ixj_pcmcia.c | 4 +--- drivers/usb/host/sl811_cs.c | 4 +--- include/pcmcia/ds.h | 2 ++ sound/pcmcia/pdaudiocf/pdaudiocf.c | 4 +--- sound/pcmcia/vx/vxpocket.c | 4 +--- 57 files changed, 67 insertions(+), 172 deletions(-) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index eb95ad5..35f6a9f 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -397,9 +397,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcmcia_devices); static struct pcmcia_driver pcmcia_driver = { .owner = THIS_MODULE, - .drv = { - .name = DRV_NAME, - }, + .name = DRV_NAME, .id_table = pcmcia_devices, .probe = pcmcia_init_one, .remove = pcmcia_remove_one, diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index c9dd5b7..4104b7f 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -940,9 +940,7 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids); static struct pcmcia_driver bluecard_driver = { .owner = THIS_MODULE, - .drv = { - .name = "bluecard_cs", - }, + .name = "bluecard_cs", .probe = bluecard_probe, .remove = bluecard_detach, .id_table = bluecard_ids, diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 8b8be35..0c8a655 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -769,9 +769,7 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids); static struct pcmcia_driver bt3c_driver = { .owner = THIS_MODULE, - .drv = { - .name = "bt3c_cs", - }, + .name = "bt3c_cs", .probe = bt3c_probe, .remove = bt3c_detach, .id_table = bt3c_ids, diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 9f9bb69..f8a0708 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -697,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, btuart_ids); static struct pcmcia_driver btuart_driver = { .owner = THIS_MODULE, - .drv = { - .name = "btuart_cs", - }, + .name = "btuart_cs", .probe = btuart_probe, .remove = btuart_detach, .id_table = btuart_ids, diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 12cd177..26ee0cf 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -647,9 +647,7 @@ MODULE_DEVICE_TABLE(pcmcia, dtl1_ids); static struct pcmcia_driver dtl1_driver = { .owner = THIS_MODULE, - .drv = { - .name = "dtl1_cs", - }, + .name = "dtl1_cs", .probe = dtl1_probe, .remove = dtl1_detach, .id_table = dtl1_ids, diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 79de9cc..e932526 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1877,9 +1877,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4000_ids); static struct pcmcia_driver cm4000_driver = { .owner = THIS_MODULE, - .drv = { - .name = "cm4000_cs", - }, + .name = "cm4000_cs", .probe = cm4000_probe, .remove = cm4000_detach, .suspend = cm4000_suspend, diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index bf012d2..d7e2bec 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -643,9 +643,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4040_ids); static struct pcmcia_driver reader_driver = { .owner = THIS_MODULE, - .drv = { - .name = "cm4040_cs", - }, + .name = "cm4040_cs", .probe = reader_probe, .remove = reader_detach, .id_table = cm4040_ids, diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 594c23b..a1b8083 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -295,7 +295,7 @@ static struct pcmcia_driver me = { .owner = THIS_MODULE, .probe = ipwireless_attach, .remove = ipwireless_detach, - .drv = { .name = IPWIRELESS_PCCARD_NAME }, + .name = IPWIRELESS_PCCARD_NAME, .id_table = ipw_ids }; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 7c71913..493dba5 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -2773,9 +2773,7 @@ MODULE_DEVICE_TABLE(pcmcia, mgslpc_ids); static struct pcmcia_driver mgslpc_driver = { .owner = THIS_MODULE, - .drv = { - .name = "synclink_cs", - }, + .name = "synclink_cs", .probe = mgslpc_probe, .remove = mgslpc_detach, .id_table = mgslpc_ids, diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 44a8918..f7f1ca0 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -406,9 +406,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids); static struct pcmcia_driver ide_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "ide-cs", - }, + .name = "ide-cs", .probe = ide_probe, .remove = ide_detach, .id_table = ide_ids, diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 403a995..b172361 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -210,9 +210,7 @@ MODULE_DEVICE_TABLE(pcmcia, avmcs_ids); static struct pcmcia_driver avmcs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "avm_cs", - }, + .name = "avm_cs", .probe = avmcs_probe, .remove = avmcs_detach, .id_table = avmcs_ids, diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 47590e0..314bc86 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -210,9 +210,7 @@ MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids); static struct pcmcia_driver avma1cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "avma1_cs", - }, + .name = "avma1_cs", .probe = avma1cs_probe, .remove = __devexit_p(avma1cs_detach), .id_table = avma1cs_ids, diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index b37b9f0..2d439a7 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -266,9 +266,7 @@ MODULE_DEVICE_TABLE(pcmcia, elsa_ids); static struct pcmcia_driver elsa_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "elsa_cs", - }, + .name = "elsa_cs", .probe = elsa_cs_probe, .remove = __devexit_p(elsa_cs_detach), .id_table = elsa_ids, diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index ff17dba..9e5c4fd 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -284,9 +284,7 @@ MODULE_DEVICE_TABLE(pcmcia, sedlbauer_ids); static struct pcmcia_driver sedlbauer_driver = { .owner = THIS_MODULE, - .drv = { - .name = "sedlbauer_cs", - }, + .name = "sedlbauer_cs", .probe = sedlbauer_probe, .remove = __devexit_p(sedlbauer_detach), .id_table = sedlbauer_ids, diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 13ba9ab..82f09b8 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -255,9 +255,7 @@ MODULE_DEVICE_TABLE(pcmcia, teles_ids); static struct pcmcia_driver teles_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "teles_cs", - }, + .name = "teles_cs", .probe = teles_probe, .remove = __devexit_p(teles_detach), .id_table = teles_ids, diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index 7a7273b..f472c27 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c @@ -535,9 +535,7 @@ static int sdricoh_pcmcia_resume(struct pcmcia_device *link) #endif static struct pcmcia_driver sdricoh_driver = { - .drv = { - .name = DRIVER_NAME, - }, + .name = DRIVER_NAME, .probe = sdricoh_pcmcia_probe, .remove = sdricoh_pcmcia_detach, .id_table = pcmcia_ids, diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 388db9e..214c695 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -750,9 +750,7 @@ static struct pcmcia_device_id pcmciamtd_ids[] = { MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); static struct pcmcia_driver pcmciamtd_driver = { - .drv = { - .name = "pcmciamtd" - }, + .name = "pcmciamtd", .probe = pcmciamtd_probe, .remove = pcmciamtd_detach, .owner = THIS_MODULE, diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 8abce76..ba52b0b 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -1196,9 +1196,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids); static struct pcmcia_driver tc574_driver = { .owner = THIS_MODULE, - .drv = { - .name = "3c574_cs", - }, + .name = "3c574_cs", .probe = tc574_probe, .remove = tc574_detach, .id_table = tc574_ids, diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 34195c4..551759c 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -953,9 +953,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids); static struct pcmcia_driver tc589_driver = { .owner = THIS_MODULE, - .drv = { - .name = "3c589_cs", - }, + .name = "3c589_cs", .probe = tc589_probe, .remove = tc589_detach, .id_table = tc589_ids, diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 9d9d997..fb5a39b 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -761,9 +761,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids); static struct pcmcia_driver axnet_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "axnet_cs", - }, + .name = "axnet_cs", .probe = axnet_probe, .remove = axnet_detach, .id_table = axnet_ids, diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 039731b..a5d918e 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -364,9 +364,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids); static struct pcmcia_driver com20020_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "com20020_cs", - }, + .name = "com20020_cs", .probe = com20020_probe, .remove = com20020_detach, .id_table = com20020_ids, diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 792ab38..1c32759 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -697,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids); static struct pcmcia_driver fmvj18x_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "fmvj18x_cs", - }, + .name = "fmvj18x_cs", .probe = fmvj18x_probe, .remove = fmvj18x_detach, .id_table = fmvj18x_ids, diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index b298a3d..d3c9f01 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -394,9 +394,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids); static struct pcmcia_driver ibmtr_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "ibmtr_cs", - }, + .name = "ibmtr_cs", .probe = ibmtr_attach, .remove = ibmtr_detach, .id_table = ibmtr_ids, diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 51bf76d..8e5730c 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -1533,9 +1533,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); static struct pcmcia_driver nmclan_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "nmclan_cs", - }, + .name = "nmclan_cs", .probe = nmclan_probe, .remove = nmclan_detach, .id_table = nmclan_ids, diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 0abf4f8..44af103 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -1723,9 +1723,7 @@ MODULE_FIRMWARE("cis/PE-200.cis"); MODULE_FIRMWARE("cis/tamarack.cis"); static struct pcmcia_driver pcnet_driver = { - .drv = { - .name = "pcnet_cs", - }, + .name = "pcnet_cs", .probe = pcnet_probe, .remove = pcnet_detach, .owner = THIS_MODULE, diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index a8cef28..e4c4fb6 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -2090,9 +2090,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids); static struct pcmcia_driver smc91c92_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "smc91c92_cs", - }, + .name = "smc91c92_cs", .probe = smc91c92_probe, .remove = smc91c92_detach, .id_table = smc91c92_ids, diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index cecc074..18cdc84 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -1832,9 +1832,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids); static struct pcmcia_driver xirc2ps_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "xirc2ps_cs", - }, + .name = "xirc2ps_cs", .probe = xirc2ps_probe, .remove = xirc2ps_detach, .id_table = xirc2ps_ids, diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 4067bf1..0fc8f63 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -246,9 +246,7 @@ MODULE_DEVICE_TABLE(pcmcia, airo_ids); static struct pcmcia_driver airo_driver = { .owner = THIS_MODULE, - .drv = { - .name = "airo_cs", - }, + .name = "airo_cs", .probe = airo_probe, .remove = airo_detach, .id_table = airo_ids, diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 2029380..13c0c3b 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -309,9 +309,7 @@ MODULE_DEVICE_TABLE(pcmcia, atmel_ids); static struct pcmcia_driver atmel_driver = { .owner = THIS_MODULE, - .drv = { - .name = "atmel_cs", - }, + .name = "atmel_cs", .probe = atmel_probe, .remove = atmel_detach, .id_table = atmel_ids, diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 61abab1..8826dd8 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -121,9 +121,7 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) static struct pcmcia_driver b43_pcmcia_driver = { .owner = THIS_MODULE, - .drv = { - .name = "b43-pcmcia", - }, + .name = "b43-pcmcia", .id_table = b43_pcmcia_tbl, .probe = b43_pcmcia_probe, .remove = __devexit_p(b43_pcmcia_remove), diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index d6ff0c7..ba64570 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -707,9 +707,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); static struct pcmcia_driver hostap_driver = { - .drv = { - .name = "hostap_cs", - }, + .name = "hostap_cs", .probe = hostap_cs_probe, .remove = prism2_detach, .owner = THIS_MODULE, diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 2c6f28a..c2bd2f0 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -988,9 +988,7 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); static struct pcmcia_driver lbs_driver = { .owner = THIS_MODULE, - .drv = { - .name = DRV_NAME, - }, + .name = DRV_NAME, .probe = if_cs_probe, .remove = if_cs_detach, .id_table = if_cs_ids, diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 263dfe9..2821266 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -378,9 +378,7 @@ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); static struct pcmcia_driver orinoco_driver = { .owner = THIS_MODULE, - .drv = { - .name = DRIVER_NAME, - }, + .name = DRIVER_NAME, .probe = orinoco_cs_probe, .remove = orinoco_cs_detach, .id_table = orinoco_cs_ids, diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 7844650..5906e9a 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -361,9 +361,7 @@ MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); static struct pcmcia_driver orinoco_driver = { .owner = THIS_MODULE, - .drv = { - .name = DRIVER_NAME, - }, + .name = DRIVER_NAME, .probe = spectrum_cs_probe, .remove = spectrum_cs_detach, .suspend = spectrum_cs_suspend, diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 1457f34..b5a2c9e 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -2843,9 +2843,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids); static struct pcmcia_driver ray_driver = { .owner = THIS_MODULE, - .drv = { - .name = "ray_cs", - }, + .name = "ray_cs", .probe = ray_probe, .remove = ray_detach, .id_table = ray_ids, diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 101b6ff..d3ed38f 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -2054,9 +2054,7 @@ MODULE_DEVICE_TABLE(pcmcia, wl3501_ids); static struct pcmcia_driver wl3501_driver = { .owner = THIS_MODULE, - .drv = { - .name = "wl3501_cs", - }, + .name = "wl3501_cs", .probe = wl3501_probe, .remove = wl3501_detach, .id_table = wl3501_ids, diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 3730184..6f4c956 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -221,9 +221,7 @@ MODULE_DEVICE_TABLE(pcmcia, parport_ids); static struct pcmcia_driver parport_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "parport_cs", - }, + .name = "parport_cs", .probe = parport_probe, .remove = parport_detach, .id_table = parport_ids, diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 912c740..100c441 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -51,7 +51,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) if (!p_drv->probe || !p_drv->remove) printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " - "function\n", p_drv->drv.name); + "function\n", p_drv->name); while (did && did->match_flags) { for (i = 0; i < 4; i++) { @@ -64,7 +64,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) printk(KERN_DEBUG "pcmcia: %s: invalid hash for " "product string \"%s\": is 0x%x, should " - "be 0x%x\n", p_drv->drv.name, did->prod_id[i], + "be 0x%x\n", p_drv->name, did->prod_id[i], did->prod_id_hash[i], hash); printk(KERN_DEBUG "pcmcia: see " "Documentation/pcmcia/devicetable.txt for " @@ -179,10 +179,11 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) /* initialize common fields */ driver->drv.bus = &pcmcia_bus_type; driver->drv.owner = driver->owner; + driver->drv.name = driver->name; mutex_init(&driver->dynids.lock); INIT_LIST_HEAD(&driver->dynids.list); - pr_debug("registering driver %s\n", driver->drv.name); + pr_debug("registering driver %s\n", driver->name); error = driver_register(&driver->drv); if (error < 0) @@ -202,7 +203,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); */ void pcmcia_unregister_driver(struct pcmcia_driver *driver) { - pr_debug("unregistering driver %s\n", driver->drv.name); + pr_debug("unregistering driver %s\n", driver->name); driver_unregister(&driver->drv); pcmcia_free_dynids(driver); } @@ -263,7 +264,7 @@ static int pcmcia_device_probe(struct device *dev) p_drv = to_pcmcia_drv(dev->driver); s = p_dev->socket; - dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); + dev_dbg(dev, "trying to bind to %s\n", p_drv->name); if ((!p_drv->probe) || (!p_dev->function_config) || (!try_module_get(p_drv->owner))) { @@ -289,10 +290,10 @@ static int pcmcia_device_probe(struct device *dev) ret = p_drv->probe(p_dev); if (ret) { dev_dbg(dev, "binding to %s failed with %d\n", - p_drv->drv.name, ret); + p_drv->name, ret); goto put_module; } - dev_dbg(dev, "%s bound: Vpp %d.%d, idx %x, IRQ %d", p_drv->drv.name, + dev_dbg(dev, "%s bound: Vpp %d.%d, idx %x, IRQ %d", p_drv->name, p_dev->vpp/10, p_dev->vpp%10, p_dev->config_index, p_dev->irq); dev_dbg(dev, "resources: ioport %pR %pR iomem %pR %pR %pR", p_dev->resource[0], p_dev->resource[1], p_dev->resource[2], @@ -380,13 +381,13 @@ static int pcmcia_device_remove(struct device *dev) if (p_dev->_irq || p_dev->_io || p_dev->_locked) dev_printk(KERN_INFO, dev, "pcmcia: driver %s did not release config properly\n", - p_drv->drv.name); + p_drv->name); for (i = 0; i < MAX_WIN; i++) if (p_dev->_win & CLIENT_WIN_REQ(i)) dev_printk(KERN_INFO, dev, "pcmcia: driver %s did not release window properly\n", - p_drv->drv.name); + p_drv->name); /* references from pcmcia_probe_device */ pcmcia_put_dev(p_dev); @@ -1142,7 +1143,7 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) dev_printk(KERN_ERR, dev, "pcmcia: device %s (driver %s) did " "not want to go to sleep (%d)\n", - p_dev->devname, p_drv->drv.name, ret); + p_dev->devname, p_drv->name, ret); mutex_lock(&p_dev->socket->ops_mutex); p_dev->suspended = 0; mutex_unlock(&p_dev->socket->ops_mutex); diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index bd9ce09..49cbea3 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -216,9 +216,7 @@ MODULE_DEVICE_TABLE(pcmcia, aha152x_ids); static struct pcmcia_driver aha152x_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "aha152x_cs", - }, + .name = "aha152x_cs", .probe = aha152x_probe, .remove = aha152x_detach, .id_table = aha152x_ids, diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index f2dc627..cd69c26 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -188,9 +188,7 @@ MODULE_DEVICE_TABLE(pcmcia, fdomain_ids); static struct pcmcia_driver fdomain_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "fdomain_cs", - }, + .name = "fdomain_cs", .probe = fdomain_probe, .remove = fdomain_detach, .id_table = fdomain_ids, diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index efb0e64..3bc0d4f 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1790,9 +1790,7 @@ MODULE_DEVICE_TABLE(pcmcia, nsp_cs_ids); static struct pcmcia_driver nsp_driver = { .owner = THIS_MODULE, - .drv = { - .name = "nsp_cs", - }, + .name = "nsp_cs", .probe = nsp_cs_probe, .remove = nsp_cs_detach, .id_table = nsp_cs_ids, diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index e8a06e3..9c96ca8 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -294,9 +294,7 @@ MODULE_DEVICE_TABLE(pcmcia, qlogic_ids); static struct pcmcia_driver qlogic_cs_driver = { .owner = THIS_MODULE, - .drv = { .name = "qlogic_cs", - }, .probe = qlogic_probe, .remove = qlogic_detach, .id_table = qlogic_ids, diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 6ceb57c..0ae27cb 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -873,9 +873,7 @@ MODULE_DEVICE_TABLE(pcmcia, sym53c500_ids); static struct pcmcia_driver sym53c500_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "sym53c500_cs", - }, + .name = "sym53c500_cs", .probe = SYM53C500_probe, .remove = SYM53C500_detach, .id_table = sym53c500_ids, diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index b272443..3fb7734 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -874,9 +874,7 @@ MODULE_FIRMWARE("cis/RS-COM-2P.cis"); static struct pcmcia_driver serial_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "serial_cs", - }, + .name = "serial_cs", .probe = serial_probe, .remove = serial_detach, .id_table = serial_ids, diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 0c4b27c..a885cd7 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -795,9 +795,7 @@ struct pcmcia_driver das16cs_driver = { .resume = das16cs_pcmcia_resume, .id_table = das16cs_id_table, .owner = THIS_MODULE, - .drv = { - .name = "cb_das16_cs", - }, + .name = "cb_das16_cs", }; static int __init init_das16cs_pcmcia_cs(void) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 6d89325..def167e 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -305,9 +305,7 @@ struct pcmcia_driver das08_cs_driver = { .resume = das08_pcmcia_resume, .id_table = das08_cs_id_table, .owner = THIS_MODULE, - .drv = { - .name = "pcm-das08", - }, + .name = "pcm-das08", }; static int __init init_das08_pcmcia_cs(void) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 5244125..9cc8401 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -634,9 +634,7 @@ struct pcmcia_driver dio700_cs_driver = { .resume = dio700_cs_resume, .id_table = dio700_cs_ids, .owner = THIS_MODULE, - .drv = { - .name = "ni_daq_700", - }, + .name = "ni_daq_700", }; static int __init init_dio700_cs(void) diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 54dda4a..b3f7c66 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -384,9 +384,7 @@ struct pcmcia_driver dio24_cs_driver = { .resume = dio24_cs_resume, .id_table = dio24_cs_ids, .owner = THIS_MODULE, - .drv = { - .name = "ni_daq_dio24", - }, + .name = "ni_daq_dio24", }; static int __init init_dio24_cs(void) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 22119f2..6b7c5d0 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -360,9 +360,7 @@ struct pcmcia_driver labpc_cs_driver = { .resume = labpc_cs_resume, .id_table = labpc_cs_ids, .owner = THIS_MODULE, - .drv = { - .name = "daqcard-1200", - }, + .name = "daqcard-1200", }; static int __init init_labpc_cs(void) diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index f1e31d3..4956327 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -437,9 +437,7 @@ struct pcmcia_driver ni_mio_cs_driver = { .resume = &mio_cs_resume, .id_table = ni_mio_cs_ids, .owner = THIS_MODULE, - .drv = { - .name = "ni_mio_cs", - }, + .name = "ni_mio_cs", }; int init_module(void) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index de37ff7..32fecf5 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1168,9 +1168,7 @@ static struct pcmcia_driver daqp_cs_driver = { .resume = daqp_cs_resume, .id_table = daqp_cs_id_table, .owner = THIS_MODULE, - .drv = { - .name = "quatech_daqp_cs", - }, + .name = "quatech_daqp_cs", }; int __init init_module(void) diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 62a70af..aa3cc51 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -455,9 +455,7 @@ MODULE_DEVICE_TABLE(pcmcia, wl_adapter_ids); static struct pcmcia_driver wlags49_driver = { .owner = THIS_MODULE, - .drv = { - .name = DRIVER_NAME, - }, + .name = DRIVER_NAME, .probe = wl_adapter_attach, .remove = wl_adapter_detach, .id_table = wl_adapter_ids, diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 76edd39..d005b9e 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -165,9 +165,7 @@ MODULE_DEVICE_TABLE(pcmcia, ixj_ids); static struct pcmcia_driver ixj_driver = { .owner = THIS_MODULE, - .drv = { - .name = "ixj_cs", - }, + .name = "ixj_cs", .probe = ixj_probe, .remove = ixj_detach, .id_table = ixj_ids, diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 9ce95cd..3775c03 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -195,9 +195,7 @@ MODULE_DEVICE_TABLE(pcmcia, sl811_ids); static struct pcmcia_driver sl811_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "sl811_cs", - }, + .name = "sl811_cs", .probe = sl811_cs_probe, .remove = sl811_cs_detach, .id_table = sl811_ids, diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 0b8c8d4..d830c87 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -47,6 +47,8 @@ struct pcmcia_dynids { }; struct pcmcia_driver { + const char *name; + int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 2476d5f..8cc4733 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -287,9 +287,7 @@ MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids); static struct pcmcia_driver pdacf_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "snd-pdaudiocf", - }, + .name = "snd-pdaudiocf", .probe = snd_pdacf_probe, .remove = snd_pdacf_detach, .id_table = snd_pdacf_ids, diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 017a8d6..80000d6 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -358,9 +358,7 @@ MODULE_DEVICE_TABLE(pcmcia, vxp_ids); static struct pcmcia_driver vxp_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "snd-vxpocket", - }, + .name = "snd-vxpocket", .probe = vxpocket_probe, .remove = vxpocket_detach, .id_table = vxp_ids, -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:14 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:14 +0200 Subject: [PATCH 15/15] pcmcia: remove obsolete and wrong comments In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-15-git-send-email-linux@dominikbrodowski.net> What's worse than no comment? A wrong comment. Several PCMCIA device drivers contained the same comments, which were based on how the PCMCIA subsystem worked in the old days of 2.4., and which were originally part of a "dummy_cs" driver. These comments no longer matched at all what is happening now, and therefore should be removed. Signed-off-by: Dominik Brodowski --- drivers/ide/ide-cs.c | 45 ------------ drivers/isdn/hardware/avm/avm_cs.c | 51 ------------- drivers/isdn/hisax/avma1_cs.c | 57 --------------- drivers/isdn/hisax/elsa_cs.c | 55 -------------- drivers/isdn/hisax/sedlbauer_cs.c | 84 ---------------------- drivers/isdn/hisax/teles_cs.c | 62 ---------------- drivers/mtd/maps/pcmciamtd.c | 21 ------ drivers/net/pcmcia/3c574_cs.c | 23 +------ drivers/net/pcmcia/3c589_cs.c | 35 +--------- drivers/net/pcmcia/axnet_cs.c | 33 --------- drivers/net/pcmcia/com20020_cs.c | 33 --------- drivers/net/pcmcia/ibmtr_cs.c | 33 --------- drivers/net/pcmcia/nmclan_cs.c | 28 ------- drivers/net/pcmcia/pcnet_cs.c | 42 ----------- drivers/net/pcmcia/smc91c92_cs.c | 33 --------- drivers/net/pcmcia/xirc2ps_cs.c | 53 -------------- drivers/net/wireless/airo_cs.c | 71 ------------------ drivers/net/wireless/atmel_cs.c | 69 ------------------ drivers/net/wireless/hostap/hostap_cs.c | 8 -- drivers/net/wireless/libertas/if_cs.c | 30 -------- drivers/net/wireless/orinoco/orinoco_cs.c | 44 ----------- drivers/net/wireless/orinoco/spectrum_cs.c | 44 ----------- drivers/net/wireless/ray_cs.c | 35 +--------- drivers/net/wireless/wl3501_cs.c | 35 --------- drivers/parport/parport_cs.c | 33 --------- drivers/scsi/pcmcia/nsp_cs.c | 26 ------- drivers/serial/serial_cs.c | 32 -------- drivers/staging/comedi/drivers/cb_das16_cs.c | 5 -- drivers/staging/comedi/drivers/das08_cs.c | 68 ----------------- drivers/staging/comedi/drivers/ni_daq_700.c | 61 ---------------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 61 ---------------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 75 ------------------- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 64 ---------------- drivers/staging/wlags49_h2/wl_cs.c | 61 ---------------- drivers/staging/wlags49_h2/wl_main.c | 19 ----- 35 files changed, 3 insertions(+), 1526 deletions(-) diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index f7f1ca0..5fee99e 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -71,17 +71,6 @@ static int ide_config(struct pcmcia_device *); static void ide_detach(struct pcmcia_device *p_dev); - - - -/*====================================================================== - - ide_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int ide_probe(struct pcmcia_device *link) { ide_info_t *info; @@ -102,15 +91,6 @@ static int ide_probe(struct pcmcia_device *link) return ide_config(link); } /* ide_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void ide_detach(struct pcmcia_device *link) { ide_info_t *info = link->priv; @@ -184,14 +164,6 @@ out_release: return NULL; } -/*====================================================================== - - ide_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ide device available to the system. - -======================================================================*/ - struct pcmcia_config_check { unsigned long ctl_base; int is_kme; @@ -292,14 +264,6 @@ failed: return -ENODEV; } /* ide_config */ -/*====================================================================== - - After a card is removed, ide_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void ide_release(struct pcmcia_device *link) { ide_info_t *info = link->priv; @@ -325,15 +289,6 @@ static void ide_release(struct pcmcia_device *link) } /* ide_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. A CARD_REMOVAL event - also sets some flags to discourage the ide drivers from - talking to the ports. - -======================================================================*/ - static struct pcmcia_device_id ide_ids[] = { PCMCIA_DEVICE_FUNC_ID(4), PCMCIA_DEVICE_MANF_CARD(0x0000, 0x0000), /* Corsair */ diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index b172361..91f06a3 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -38,38 +38,10 @@ MODULE_LICENSE("GPL"); /*====================================================================*/ -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card insertion - and ejection events. They are invoked from the skeleton event - handler. -*/ - static int avmcs_config(struct pcmcia_device *link); static void avmcs_release(struct pcmcia_device *link); - -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void avmcs_detach(struct pcmcia_device *p_dev); -/*====================================================================== - - avmcs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int avmcs_probe(struct pcmcia_device *p_dev) { /* General socket configuration */ @@ -80,28 +52,12 @@ static int avmcs_probe(struct pcmcia_device *p_dev) return avmcs_config(p_dev); } /* avmcs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ static void avmcs_detach(struct pcmcia_device *link) { avmcs_release(link); } /* avmcs_detach */ -/*====================================================================== - - avmcs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { p_dev->resource[0]->end = 16; @@ -185,13 +141,6 @@ static int avmcs_config(struct pcmcia_device *link) } /* avmcs_config */ -/*====================================================================== - - After a card is removed, avmcs_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ static void avmcs_release(struct pcmcia_device *link) { diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 62616c8..ac4dd78 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -39,39 +39,10 @@ module_param(isdnprot, int, 0); /*====================================================================*/ -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card insertion - and ejection events. They are invoked from the skeleton event - handler. -*/ - static int avma1cs_config(struct pcmcia_device *link) __devinit ; static void avma1cs_release(struct pcmcia_device *link); - -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; - -/*====================================================================== - - avma1cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) { dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); @@ -84,15 +55,6 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) return avma1cs_config(p_dev); } /* avma1cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void __devexit avma1cs_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); @@ -100,14 +62,6 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link) kfree(link->priv); } /* avma1cs_detach */ -/*====================================================================== - - avma1cs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { p_dev->resource[0]->end = 16; @@ -180,14 +134,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) return 0; } /* avma1cs_config */ -/*====================================================================== - - After a card is removed, avma1cs_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void avma1cs_release(struct pcmcia_device *link) { unsigned long minor = (unsigned long) link->priv; @@ -200,7 +146,6 @@ static void avma1cs_release(struct pcmcia_device *link) pcmcia_disable_device(link); } /* avma1cs_release */ - static struct pcmcia_device_id avma1cs_ids[] = { PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), @@ -216,8 +161,6 @@ static struct pcmcia_driver avma1cs_driver = { .id_table = avma1cs_ids, }; -/*====================================================================*/ - static int __init init_avma1_cs(void) { return pcmcia_register_driver(&avma1cs_driver); diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 2d439a7..496d477 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -63,26 +63,8 @@ MODULE_LICENSE("Dual MPL/GPL"); static int protocol = 2; /* EURO-ISDN Default */ module_param(protocol, int, 0); -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card insertion - and ejection events. They are invoked from the elsa_cs event - handler. -*/ - static int elsa_cs_config(struct pcmcia_device *link) __devinit ; static void elsa_cs_release(struct pcmcia_device *link); - -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; typedef struct local_info_t { @@ -91,18 +73,6 @@ typedef struct local_info_t { int cardnr; } local_info_t; -/*====================================================================== - - elsa_cs_attach() creates an "instance" of the driver, allocatingx - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int __devinit elsa_cs_probe(struct pcmcia_device *link) { local_info_t *local; @@ -121,15 +91,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) return elsa_cs_config(link); } /* elsa_cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void __devexit elsa_cs_detach(struct pcmcia_device *link) { local_info_t *info = link->priv; @@ -142,14 +103,6 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link) kfree(info); } /* elsa_cs_detach */ -/*====================================================================== - - elsa_cs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { int j; @@ -215,14 +168,6 @@ failed: return -ENODEV; } /* elsa_cs_config */ -/*====================================================================== - - After a card is removed, elsa_cs_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void elsa_cs_release(struct pcmcia_device *link) { local_info_t *local = link->priv; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 9e5c4fd..360204b 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -63,26 +63,9 @@ MODULE_LICENSE("Dual MPL/GPL"); static int protocol = 2; /* EURO-ISDN Default */ module_param(protocol, int, 0); -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the sedlbauer - event handler. -*/ - static int sedlbauer_config(struct pcmcia_device *link) __devinit ; static void sedlbauer_release(struct pcmcia_device *link); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; typedef struct local_info_t { @@ -91,18 +74,6 @@ typedef struct local_info_t { int cardnr; } local_info_t; -/*====================================================================== - - sedlbauer_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int __devinit sedlbauer_probe(struct pcmcia_device *link) { local_info_t *local; @@ -117,30 +88,9 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) local->p_dev = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - - /* from old sedl_cs - */ - /* The io structure describes IO port mapping */ - return sedlbauer_config(link); } /* sedlbauer_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void __devexit sedlbauer_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); @@ -152,13 +102,6 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link) kfree(link->priv); } /* sedlbauer_detach */ -/*====================================================================== - - sedlbauer_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data) { if (p_dev->config_index == 0) @@ -168,8 +111,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data) return pcmcia_request_io(p_dev); } - - static int __devinit sedlbauer_config(struct pcmcia_device *link) { int ret; @@ -180,27 +121,10 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; - /* - In this loop, we scan the CIS for configuration table entries, - each of which describes a valid card configuration, including - voltage, IO window, memory window, and interrupt settings. - - We make no assumptions about the card to be configured: we use - just the information available in the CIS. In an ideal world, - this would work for any PCMCIA card, but it requires a complete - and accurate CIS. In practice, a driver usually "knows" most of - these things without consulting the CIS, and most client drivers - will only use the CIS to fill in implementation-defined details. - */ ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); if (ret) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -228,14 +152,6 @@ failed: } /* sedlbauer_config */ -/*====================================================================== - - After a card is removed, sedlbauer_release() will unregister the - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void sedlbauer_release(struct pcmcia_device *link) { local_info_t *local = link->priv; diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 82f09b8..282a446 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -44,26 +44,8 @@ MODULE_LICENSE("GPL"); static int protocol = 2; /* EURO-ISDN Default */ module_param(protocol, int, 0); -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card insertion - and ejection events. They are invoked from the teles_cs event - handler. -*/ - static int teles_cs_config(struct pcmcia_device *link) __devinit ; static void teles_cs_release(struct pcmcia_device *link); - -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void teles_detach(struct pcmcia_device *p_dev) __devexit ; typedef struct local_info_t { @@ -72,18 +54,6 @@ typedef struct local_info_t { int cardnr; } local_info_t; -/*====================================================================== - - teles_attach() creates an "instance" of the driver, allocatingx - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int __devinit teles_probe(struct pcmcia_device *link) { local_info_t *local; @@ -98,27 +68,11 @@ static int __devinit teles_probe(struct pcmcia_device *link) local->p_dev = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; return teles_cs_config(link); } /* teles_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void __devexit teles_detach(struct pcmcia_device *link) { local_info_t *info = link->priv; @@ -131,14 +85,6 @@ static void __devexit teles_detach(struct pcmcia_device *link) kfree(info); } /* teles_detach */ -/*====================================================================== - - teles_cs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) { int j; @@ -204,14 +150,6 @@ cs_failed: return -ENODEV; } /* teles_cs_config */ -/*====================================================================== - - After a card is removed, teles_cs_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void teles_cs_release(struct pcmcia_device *link) { local_info_t *local = link->priv; diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 5df89e7..57a1acf 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -321,11 +321,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) } -/* After a card is removed, pcmciamtd_release() will unregister the - * device, and release the PCMCIA configuration. If the device is - * still open, this will be postponed until it is closed. - */ - static void pcmciamtd_release(struct pcmcia_device *link) { struct pcmciamtd_dev *dev = link->priv; @@ -475,11 +470,6 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev } -/* pcmciamtd_config() is scheduled to run after a CARD_INSERTION event - * is received, to configure the PCMCIA socket, and to make the - * MTD device available to the system. - */ - static int pcmciamtd_config(struct pcmcia_device *link) { struct pcmciamtd_dev *dev = link->priv; @@ -676,12 +666,6 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) } -/* This deletes a driver "instance". The device is de-registered - * with Card Services. If it has been released, all local data - * structures are freed. Otherwise, the structures will be freed - * when the device is released. - */ - static void pcmciamtd_detach(struct pcmcia_device *link) { struct pcmciamtd_dev *dev = link->priv; @@ -699,11 +683,6 @@ static void pcmciamtd_detach(struct pcmcia_device *link) } -/* pcmciamtd_attach() creates an "instance" of the driver, allocating - * local data structures for one device. The device is registered - * with Card Services. - */ - static int pcmciamtd_probe(struct pcmcia_device *link) { struct pcmciamtd_dev *dev; diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index ba52b0b..ff824e1 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -287,16 +287,7 @@ static int tc574_probe(struct pcmcia_device *link) dev->watchdog_timeo = TX_TIMEOUT; return tc574_config(link); -} /* tc574_attach */ - -/* - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -*/ +} static void tc574_detach(struct pcmcia_device *link) { @@ -311,12 +302,6 @@ static void tc574_detach(struct pcmcia_device *link) free_netdev(dev); } /* tc574_detach */ -/* - tc574_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. -*/ - static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; static int tc574_config(struct pcmcia_device *link) @@ -463,12 +448,6 @@ failed: } /* tc574_config */ -/* - After a card is removed, tc574_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. -*/ - static void tc574_release(struct pcmcia_device *link) { pcmcia_disable_device(link); diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 551759c..a07e222 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -175,14 +175,6 @@ static const struct ethtool_ops netdev_ethtool_ops; static void tc589_detach(struct pcmcia_device *p_dev); -/*====================================================================== - - tc589_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static const struct net_device_ops el3_netdev_ops = { .ndo_open = el3_open, .ndo_stop = el3_close, @@ -224,16 +216,7 @@ static int tc589_probe(struct pcmcia_device *link) SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); return tc589_config(link); -} /* tc589_attach */ - -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ +} static void tc589_detach(struct pcmcia_device *link) { @@ -248,14 +231,6 @@ static void tc589_detach(struct pcmcia_device *link) free_netdev(dev); } /* tc589_detach */ -/*====================================================================== - - tc589_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int tc589_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -350,14 +325,6 @@ failed: return -ENODEV; } /* tc589_config */ -/*====================================================================== - - After a card is removed, tc589_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void tc589_release(struct pcmcia_device *link) { pcmcia_disable_device(link); diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index fb5a39b..9e8b28b 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -139,14 +139,6 @@ static const struct net_device_ops axnet_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/*====================================================================== - - axnet_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int axnet_probe(struct pcmcia_device *link) { axnet_dev_t *info; @@ -175,15 +167,6 @@ static int axnet_probe(struct pcmcia_device *link) return axnet_config(link); } /* axnet_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void axnet_detach(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -246,14 +229,6 @@ static int get_prom(struct pcmcia_device *link) return 1; } /* get_prom */ -/*====================================================================== - - axnet_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int try_io_port(struct pcmcia_device *link) { int j, ret; @@ -392,14 +367,6 @@ failed: return -ENODEV; } /* axnet_config */ -/*====================================================================== - - After a card is removed, axnet_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void axnet_release(struct pcmcia_device *link) { pcmcia_disable_device(link); diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index a5d918e..b706a72 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -122,14 +122,6 @@ typedef struct com20020_dev_t { struct net_device *dev; } com20020_dev_t; -/*====================================================================== - - com20020_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int com20020_probe(struct pcmcia_device *p_dev) { com20020_dev_t *info; @@ -172,15 +164,6 @@ fail_alloc_info: return -ENOMEM; } /* com20020_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void com20020_detach(struct pcmcia_device *link) { struct com20020_dev_t *info = link->priv; @@ -219,14 +202,6 @@ static void com20020_detach(struct pcmcia_device *link) } /* com20020_detach */ -/*====================================================================== - - com20020_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int com20020_config(struct pcmcia_device *link) { struct arcnet_local *lp; @@ -314,14 +289,6 @@ failed: return -ENODEV; } /* com20020_config */ -/*====================================================================== - - After a card is removed, com20020_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void com20020_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "com20020_release\n"); diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index d3c9f01..bf7dff9 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -121,14 +121,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { return tok_interrupt(irq, dev); }; -/*====================================================================== - - ibmtr_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int __devinit ibmtr_attach(struct pcmcia_device *link) { ibmtr_dev_t *info; @@ -161,15 +153,6 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) return ibmtr_config(link); } /* ibmtr_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void ibmtr_detach(struct pcmcia_device *link) { struct ibmtr_dev_t *info = link->priv; @@ -194,14 +177,6 @@ static void ibmtr_detach(struct pcmcia_device *link) kfree(info); } /* ibmtr_detach */ -/*====================================================================== - - ibmtr_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - token-ring device available to the system. - -======================================================================*/ - static int __devinit ibmtr_config(struct pcmcia_device *link) { ibmtr_dev_t *info = link->priv; @@ -297,14 +272,6 @@ failed: return -ENODEV; } /* ibmtr_config */ -/*====================================================================== - - After a card is removed, ibmtr_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void ibmtr_release(struct pcmcia_device *link) { ibmtr_dev_t *info = link->priv; diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 8e5730c..1eca4f5 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -434,13 +434,6 @@ static const struct net_device_ops mace_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/* ---------------------------------------------------------------------------- -nmclan_attach - Creates an "instance" of the driver, allocating local data - structures for one device. The device is registered with Card - Services. ----------------------------------------------------------------------------- */ - static int nmclan_probe(struct pcmcia_device *link) { mace_private *lp; @@ -472,14 +465,6 @@ static int nmclan_probe(struct pcmcia_device *link) return nmclan_config(link); } /* nmclan_attach */ -/* ---------------------------------------------------------------------------- -nmclan_detach - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. ----------------------------------------------------------------------------- */ - static void nmclan_detach(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -623,13 +608,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr) return 0; } /* mace_init */ -/* ---------------------------------------------------------------------------- -nmclan_config - This routine is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. ----------------------------------------------------------------------------- */ - static int nmclan_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -710,12 +688,6 @@ failed: return -ENODEV; } /* nmclan_config */ -/* ---------------------------------------------------------------------------- -nmclan_release - After a card is removed, nmclan_release() will unregister the - net device, and release the PCMCIA configuration. If the device - is still open, this will be postponed until it is closed. ----------------------------------------------------------------------------- */ static void nmclan_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "nmclan_release\n"); diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 44af103..9d74284 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -237,14 +237,6 @@ static const struct net_device_ops pcnet_netdev_ops = { #endif }; -/*====================================================================== - - pcnet_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int pcnet_probe(struct pcmcia_device *link) { pcnet_dev_t *info; @@ -266,15 +258,6 @@ static int pcnet_probe(struct pcmcia_device *link) return pcnet_config(link); } /* pcnet_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void pcnet_detach(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -461,14 +444,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) return &default_info; } /* get_hwired */ -/*====================================================================== - - pcnet_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int try_io_port(struct pcmcia_device *link) { int j, ret; @@ -641,14 +616,6 @@ failed: return -ENODEV; } /* pcnet_config */ -/*====================================================================== - - After a card is removed, pcnet_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void pcnet_release(struct pcmcia_device *link) { pcnet_dev_t *info = PRIV(link->priv); @@ -661,15 +628,6 @@ static void pcnet_release(struct pcmcia_device *link) pcmcia_disable_device(link); } -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. A CARD_REMOVAL event - also sets some flags to discourage the net drivers from trying - to talk to the card any more. - -======================================================================*/ - static int pcnet_suspend(struct pcmcia_device *link) { struct net_device *dev = link->priv; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index e4c4fb6..0af2fc8 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -299,14 +299,6 @@ static const struct net_device_ops smc_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/*====================================================================== - - smc91c92_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int smc91c92_probe(struct pcmcia_device *link) { struct smc_private *smc; @@ -338,15 +330,6 @@ static int smc91c92_probe(struct pcmcia_device *link) return smc91c92_config(link); } /* smc91c92_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void smc91c92_detach(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -819,14 +802,6 @@ static int check_sig(struct pcmcia_device *link) return -ENODEV; } -/*====================================================================== - - smc91c92_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. - -======================================================================*/ - static int smc91c92_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -977,14 +952,6 @@ config_failed: return -ENODEV; } /* smc91c92_config */ -/*====================================================================== - - After a card is removed, smc91c92_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void smc91c92_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "smc91c92_release\n"); diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 18cdc84..1fece61 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -266,33 +266,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg); static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len); -/* - * The event() function is this driver's Card Services event handler. - * It will be called by Card Services when an appropriate card status - * event is received. The config() and release() entry points are - * used to configure or release a socket, in response to card insertion - * and ejection events. They are invoked from the event handler. - */ - static int has_ce2_string(struct pcmcia_device * link); static int xirc2ps_config(struct pcmcia_device * link); static void xirc2ps_release(struct pcmcia_device * link); - -/**************** - * The attach() and detach() entry points are used to create and destroy - * "instances" of the driver, where each instance represents everything - * needed to manage one actual PCMCIA card. - */ - static void xirc2ps_detach(struct pcmcia_device *p_dev); -/**************** - * You'll also need to prototype all the functions that will actually - * be used to talk to your device. See 'pcmem_cs' for a good example - * of a fully self-sufficient driver; the other drivers rely more or - * less on other parts of the kernel. - */ - static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); typedef struct local_info_t { @@ -500,16 +478,6 @@ static const struct net_device_ops netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/**************** - * xirc2ps_attach() creates an "instance" of the driver, allocating - * local data structures for one device. The device is registered - * with Card Services. - * - * The dev_link structure is initialized, but we don't actually - * configure the card at this point -- we wait until we receive a - * card insertion event. - */ - static int xirc2ps_probe(struct pcmcia_device *link) { @@ -539,13 +507,6 @@ xirc2ps_probe(struct pcmcia_device *link) return xirc2ps_config(link); } /* xirc2ps_attach */ -/**************** - * This deletes a driver "instance". The device is de-registered - * with Card Services. If it has been released, all local data - * structures are freed. Otherwise, the structures will be freed - * when the device is released. - */ - static void xirc2ps_detach(struct pcmcia_device *link) { @@ -733,11 +694,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev, }; -/**************** - * xirc2ps_config() is scheduled to run after a CARD_INSERTION event - * is received, to configure the PCMCIA socket, and to make the - * ethernet device available to the system. - */ static int xirc2ps_config(struct pcmcia_device * link) { @@ -861,10 +817,6 @@ xirc2ps_config(struct pcmcia_device * link) if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) goto config_error; - /**************** - * This actually configures the PCMCIA socket -- setting up - * the I/O windows and the interrupt mapping. - */ link->config_flags |= CONF_ENABLE_IRQ; if (do_sound) link->config_flags |= CONF_ENABLE_SPKR; @@ -980,11 +932,6 @@ xirc2ps_config(struct pcmcia_device * link) return -ENODEV; } /* xirc2ps_config */ -/**************** - * After a card is removed, xirc2ps_release() will unregister the net - * device, and release the PCMCIA configuration. If the device is - * still open, this will be postponed until it is closed. - */ static void xirc2ps_release(struct pcmcia_device *link) { diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index b084278..df2484d 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -53,42 +53,15 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); /*====================================================================*/ -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the airo_cs - event handler. -*/ - static int airo_config(struct pcmcia_device *link); static void airo_release(struct pcmcia_device *link); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void airo_detach(struct pcmcia_device *p_dev); typedef struct local_info_t { struct net_device *eth_dev; } local_info_t; -/*====================================================================== - - airo_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - - ======================================================================*/ - static int airo_probe(struct pcmcia_device *p_dev) { local_info_t *local; @@ -106,15 +79,6 @@ static int airo_probe(struct pcmcia_device *p_dev) return airo_config(p_dev); } /* airo_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - - ======================================================================*/ - static void airo_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "airo_detach\n"); @@ -129,14 +93,6 @@ static void airo_detach(struct pcmcia_device *link) kfree(link->priv); } /* airo_detach */ -/*====================================================================== - - airo_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - - ======================================================================*/ - static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { if (p_dev->config_index == 0) @@ -158,20 +114,6 @@ static int airo_config(struct pcmcia_device *link) link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; - /* - * In this loop, we scan the CIS for configuration table - * entries, each of which describes a valid card - * configuration, including voltage, IO window, memory window, - * and interrupt settings. - * - * We make no assumptions about the card to be configured: we - * use just the information available in the CIS. In an ideal - * world, this would work for any PCMCIA card, but it requires - * a complete and accurate CIS. In practice, a driver usually - * "knows" most of these things without consulting the CIS, - * and most client drivers will only use the CIS to fill in - * implementation-defined details. - */ ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); if (ret) goto failed; @@ -179,11 +121,6 @@ static int airo_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -200,14 +137,6 @@ static int airo_config(struct pcmcia_device *link) return -ENODEV; } /* airo_config */ -/*====================================================================== - - After a card is removed, airo_release() will unregister the - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - - ======================================================================*/ - static void airo_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "airo_release\n"); diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index fabe91a..c96e19d 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -63,42 +63,15 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); /*====================================================================*/ -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the atmel_cs - event handler. -*/ - static int atmel_config(struct pcmcia_device *link); static void atmel_release(struct pcmcia_device *link); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static void atmel_detach(struct pcmcia_device *p_dev); typedef struct local_info_t { struct net_device *eth_dev; } local_info_t; -/*====================================================================== - - atmel_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - - ======================================================================*/ - static int atmel_probe(struct pcmcia_device *p_dev) { local_info_t *local; @@ -116,15 +89,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) return atmel_config(p_dev); } /* atmel_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - - ======================================================================*/ - static void atmel_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "atmel_detach\n"); @@ -134,14 +98,6 @@ static void atmel_detach(struct pcmcia_device *link) kfree(link->priv); } -/*====================================================================== - - atmel_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - - ======================================================================*/ - /* Call-back function to interrogate PCMCIA-specific information about the current existance of the card */ static int card_present(void *arg) @@ -176,18 +132,6 @@ static int atmel_config(struct pcmcia_device *link) link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; - /* - In this loop, we scan the CIS for configuration table entries, - each of which describes a valid card configuration, including - voltage, IO window, memory window, and interrupt settings. - - We make no assumptions about the card to be configured: we use - just the information available in the CIS. In an ideal world, - this would work for any PCMCIA card, but it requires a complete - and accurate CIS. In practice, a driver usually "knows" most of - 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, NULL)) goto failed; @@ -196,11 +140,6 @@ static int atmel_config(struct pcmcia_device *link) goto failed; } - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -223,14 +162,6 @@ static int atmel_config(struct pcmcia_device *link) return -ENODEV; } -/*====================================================================== - - After a card is removed, atmel_release() will unregister the - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - - ======================================================================*/ - static void atmel_release(struct pcmcia_device *link) { struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ba64570..bd8a413 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -466,9 +466,6 @@ static void prism2_detach(struct pcmcia_device *link) } -/* run after a CARD_INSERTION event is received to configure the PCMCIA - * socket and make the device available to the system */ - static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) { if (p_dev->config_index == 0) @@ -530,11 +527,6 @@ static int prism2_config(struct pcmcia_device *link) if (ret) goto failed_unlock; - /* - * This actually configures the PCMCIA socket -- setting up - * the I/O windows and the interrupt mapping, and putting the - * card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed_unlock; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index c2bd2f0..ff1280f 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -760,15 +760,6 @@ static int if_cs_host_to_card(struct lbs_private *priv, } -/********************************************************************/ -/* Card Services */ -/********************************************************************/ - -/* - * After a card is removed, if_cs_release() will unregister the - * device, and release the PCMCIA configuration. If the device is - * still open, this will be postponed until it is closed. - */ static void if_cs_release(struct pcmcia_device *p_dev) { struct if_cs_card *card = p_dev->priv; @@ -784,16 +775,6 @@ static void if_cs_release(struct pcmcia_device *p_dev) } -/* - * This creates an "instance" of the driver, allocating local data - * structures for one device. The device is registered with Card - * Services. - * - * The dev_link structure is initialized, but we don't actually - * configure the card at this point -- we wait until we receive a card - * insertion event. - */ - static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) { p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; @@ -849,11 +830,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev) goto out1; } - /* - * This actually configures the PCMCIA socket -- setting up - * the I/O windows and the interrupt mapping, and putting the - * card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(p_dev); if (ret) { lbs_pr_err("error in pcmcia_enable_device\n"); @@ -950,12 +926,6 @@ out: } -/* - * This deletes a driver "instance". The device is de-registered with - * Card Services. If it has been released, all local data structures - * are freed. Otherwise, the structures will be freed when the device - * is released. - */ static void if_cs_detach(struct pcmcia_device *p_dev) { struct if_cs_card *card = p_dev->priv; diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 7af9946..d356f07 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -92,14 +92,6 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) /* PCMCIA stuff */ /********************************************************************/ -/* - * This creates an "instance" of the driver, allocating local data - * structures for one device. The device is registered with Card - * Services. - * - * The dev_link structure is initialized, but we don't actually - * configure the card at this point -- we wait until we receive a card - * insertion event. */ static int orinoco_cs_probe(struct pcmcia_device *link) { @@ -119,12 +111,6 @@ orinoco_cs_probe(struct pcmcia_device *link) return orinoco_cs_config(link); } /* orinoco_cs_attach */ -/* - * This deletes a driver "instance". The device is de-registered with - * Card Services. If it has been released, all local data structures - * are freed. Otherwise, the structures will be freed when the device - * is released. - */ static void orinoco_cs_detach(struct pcmcia_device *link) { struct orinoco_private *priv = link->priv; @@ -136,12 +122,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link) free_orinocodev(priv); } /* orinoco_cs_detach */ -/* - * orinoco_cs_config() is scheduled to run after a CARD_INSERTION - * event is received, to configure the PCMCIA socket, and to make the - * device available to the system. - */ - static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { if (p_dev->config_index == 0) @@ -158,20 +138,6 @@ orinoco_cs_config(struct pcmcia_device *link) int ret; void __iomem *mem; - /* - * In this loop, we scan the CIS for configuration table - * entries, each of which describes a valid card - * configuration, including voltage, IO window, memory window, - * and interrupt settings. - * - * We make no assumptions about the card to be configured: we - * use just the information available in the CIS. In an ideal - * world, this would work for any PCMCIA card, but it requires - * a complete and accurate CIS. In practice, a driver usually - * "knows" most of these things without consulting the CIS, - * and most client drivers will only use the CIS to fill in - * implementation-defined details. - */ link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; if (ignore_cis_vcc) @@ -199,11 +165,6 @@ orinoco_cs_config(struct pcmcia_device *link) hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); - /* - * This actually configures the PCMCIA socket -- setting up - * the I/O windows and the interrupt mapping, and putting the - * card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -228,11 +189,6 @@ orinoco_cs_config(struct pcmcia_device *link) return -ENODEV; } /* orinoco_cs_config */ -/* - * After a card is removed, orinoco_cs_release() will unregister the - * device, and release the PCMCIA configuration. If the device is - * still open, this will be postponed until it is closed. - */ static void orinoco_cs_release(struct pcmcia_device *link) { diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 797abee..61662f6 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -153,14 +153,6 @@ spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle) /* PCMCIA stuff */ /********************************************************************/ -/* - * This creates an "instance" of the driver, allocating local data - * structures for one device. The device is registered with Card - * Services. - * - * The dev_link structure is initialized, but we don't actually - * configure the card at this point -- we wait until we receive a card - * insertion event. */ static int spectrum_cs_probe(struct pcmcia_device *link) { @@ -181,12 +173,6 @@ spectrum_cs_probe(struct pcmcia_device *link) return spectrum_cs_config(link); } /* spectrum_cs_attach */ -/* - * This deletes a driver "instance". The device is de-registered with - * Card Services. If it has been released, all local data structures - * are freed. Otherwise, the structures will be freed when the device - * is released. - */ static void spectrum_cs_detach(struct pcmcia_device *link) { struct orinoco_private *priv = link->priv; @@ -198,12 +184,6 @@ static void spectrum_cs_detach(struct pcmcia_device *link) free_orinocodev(priv); } /* spectrum_cs_detach */ -/* - * spectrum_cs_config() is scheduled to run after a CARD_INSERTION - * event is received, to configure the PCMCIA socket, and to make the - * device available to the system. - */ - static int spectrum_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { @@ -221,20 +201,6 @@ spectrum_cs_config(struct pcmcia_device *link) int ret; void __iomem *mem; - /* - * In this loop, we scan the CIS for configuration table - * entries, each of which describes a valid card - * configuration, including voltage, IO window, memory window, - * and interrupt settings. - * - * We make no assumptions about the card to be configured: we - * use just the information available in the CIS. In an ideal - * world, this would work for any PCMCIA card, but it requires - * a complete and accurate CIS. In practice, a driver usually - * "knows" most of these things without consulting the CIS, - * and most client drivers will only use the CIS to fill in - * implementation-defined details. - */ link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; if (ignore_cis_vcc) @@ -263,11 +229,6 @@ spectrum_cs_config(struct pcmcia_device *link) hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); hw->eeprom_pda = true; - /* - * This actually configures the PCMCIA socket -- setting up - * the I/O windows and the interrupt mapping, and putting the - * card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -296,11 +257,6 @@ spectrum_cs_config(struct pcmcia_device *link) return -ENODEV; } /* spectrum_cs_config */ -/* - * After a card is removed, spectrum_cs_release() will unregister the - * device, and release the PCMCIA configuration. If the device is - * still open, this will be postponed until it is closed. - */ static void spectrum_cs_release(struct pcmcia_device *link) { diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index b5a2c9e..af5b17c 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -168,13 +168,6 @@ static int bc; */ static char *phy_addr = NULL; - -/* A struct pcmcia_device structure has fields for most things that are needed - to keep track of a socket, but there will usually be some device - specific information that also needs to be kept track of. The - 'priv' pointer in a struct pcmcia_device structure can be used to point to - a device-specific private data structure, like this. -*/ static unsigned int ray_mem_speed = 500; /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ @@ -289,14 +282,6 @@ static const struct net_device_ops ray_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/*============================================================================= - ray_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. -=============================================================================*/ static int ray_probe(struct pcmcia_device *p_dev) { ray_dev_t *local; @@ -351,12 +336,6 @@ fail_alloc_dev: return -ENOMEM; } /* ray_attach */ -/*============================================================================= - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. -=============================================================================*/ static void ray_detach(struct pcmcia_device *link) { struct net_device *dev; @@ -379,11 +358,6 @@ static void ray_detach(struct pcmcia_device *link) dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); } /* ray_detach */ -/*============================================================================= - ray_config() is run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. -=============================================================================*/ #define MAX_TUPLE_SIZE 128 static int ray_config(struct pcmcia_device *link) { @@ -409,9 +383,6 @@ static int ray_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - /* This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -771,11 +742,7 @@ static void join_net(u_long data) local->card_status = CARD_DOING_ACQ; } -/*============================================================================ - After a card is removed, ray_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. -=============================================================================*/ + static void ray_release(struct pcmcia_device *link) { struct net_device *dev = link->priv; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index d3ed38f..ca3f896 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -77,13 +77,6 @@ #define WL3501_RESUME 0 #define WL3501_SUSPEND 1 -/* - * The event() function is this driver's Card Services event handler. It will - * be called by Card Services when an appropriate card status event is - * received. The config() and release() entry points are used to configure or - * release a socket, in response to card insertion and ejection events. They - * are invoked from the wl24 event handler. - */ static int wl3501_config(struct pcmcia_device *link); static void wl3501_release(struct pcmcia_device *link); @@ -1868,15 +1861,6 @@ static const struct net_device_ops wl3501_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -/** - * wl3501_attach - creates an "instance" of the driver - * - * Creates an "instance" of the driver, allocating local data structures for - * one device. The device is registered with Card Services. - * - * The dev_link structure is initialized, but we don't actually configure the - * card at this point -- we wait until we receive a card insertion event. - */ static int wl3501_probe(struct pcmcia_device *p_dev) { struct net_device *dev; @@ -1912,14 +1896,6 @@ out_link: return -ENOMEM; } -/** - * wl3501_config - configure the PCMCIA socket and make eth device available - * @link - FILL_IN - * - * wl3501_config() is scheduled to run after a CARD_INSERTION event is - * received, to configure the PCMCIA socket, and to make the ethernet device - * available to the system. - */ static int wl3501_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -1950,9 +1926,6 @@ static int wl3501_config(struct pcmcia_device *link) if (ret) goto failed; - /* This actually configures the PCMCIA socket -- setting up the I/O - * windows and the interrupt mapping. */ - ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -2008,14 +1981,6 @@ failed: return -ENODEV; } -/** - * wl3501_release - unregister the net, release PCMCIA configuration - * @arg - link - * - * After a card is removed, wl3501_release() will unregister the net device, - * and release the PCMCIA configuration. If the device is still open, this - * will be postponed until it is closed. - */ static void wl3501_release(struct pcmcia_device *link) { pcmcia_disable_device(link); diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 6f4c956..787ebde 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -80,14 +80,6 @@ static void parport_detach(struct pcmcia_device *p_dev); static int parport_config(struct pcmcia_device *link); static void parport_cs_release(struct pcmcia_device *); -/*====================================================================== - - parport_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int parport_probe(struct pcmcia_device *link) { parport_info_t *info; @@ -105,15 +97,6 @@ static int parport_probe(struct pcmcia_device *link) return parport_config(link); } /* parport_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void parport_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "parport_detach\n"); @@ -123,14 +106,6 @@ static void parport_detach(struct pcmcia_device *link) kfree(link->priv); } /* parport_detach */ -/*====================================================================== - - parport_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - parport device available to the system. - -======================================================================*/ - static int parport_config_check(struct pcmcia_device *p_dev, void *priv_data) { p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; @@ -187,14 +162,6 @@ failed: return -ENODEV; } /* parport_config */ -/*====================================================================== - - After a card is removed, parport_cs_release() will unregister the - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void parport_cs_release(struct pcmcia_device *link) { parport_info_t *info = link->priv; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index ce9fddc..e0378b5 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1530,15 +1530,6 @@ static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt) PCMCIA functions **********************************************************************/ -/*====================================================================== - nsp_cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. -======================================================================*/ static int nsp_cs_probe(struct pcmcia_device *link) { scsi_info_t *info; @@ -1563,12 +1554,6 @@ static int nsp_cs_probe(struct pcmcia_device *link) } /* nsp_cs_attach */ -/*====================================================================== - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. -======================================================================*/ static void nsp_cs_detach(struct pcmcia_device *link) { nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); @@ -1581,12 +1566,6 @@ static void nsp_cs_detach(struct pcmcia_device *link) } /* nsp_cs_detach */ -/*====================================================================== - nsp_cs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ethernet device available to the system. -======================================================================*/ - static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) { struct nsp_hw_data *data = priv_data; @@ -1697,11 +1676,6 @@ static int nsp_cs_config(struct pcmcia_device *link) } /* nsp_cs_config */ -/*====================================================================== - After a card is removed, nsp_cs_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. -======================================================================*/ static void nsp_cs_release(struct pcmcia_device *link) { scsi_info_t *info = link->priv; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 3fb7734..69e9b98 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -262,13 +262,6 @@ static const struct serial_quirk quirks[] = { static int serial_config(struct pcmcia_device * link); -/*====================================================================== - - After a card is removed, serial_remove() will unregister - the serial device(s), and release the PCMCIA configuration. - -======================================================================*/ - static void serial_remove(struct pcmcia_device *link) { struct serial_info *info = link->priv; @@ -311,14 +304,6 @@ static int serial_resume(struct pcmcia_device *link) return 0; } -/*====================================================================== - - serial_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int serial_probe(struct pcmcia_device *link) { struct serial_info *info; @@ -339,15 +324,6 @@ static int serial_probe(struct pcmcia_device *link) return serial_config(link); } -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void serial_detach(struct pcmcia_device *link) { struct serial_info *info = link->priv; @@ -630,14 +606,6 @@ static int serial_check_for_multi(struct pcmcia_device *p_dev, void *priv_data) } -/*====================================================================== - - serial_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - serial device available to the system. - -======================================================================*/ - static int serial_config(struct pcmcia_device * link) { struct serial_info *info = link->priv; diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index a885cd7..0345b4c 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -736,11 +736,6 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index def167e..0b32a2d 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -114,40 +114,15 @@ static void das08_pcmcia_release(struct pcmcia_device *link); static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); static int das08_pcmcia_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int das08_pcmcia_attach(struct pcmcia_device *); static void das08_pcmcia_detach(struct pcmcia_device *); -/* - You'll also need to prototype all the functions that will actually - be used to talk to your device. See 'memory_cs' for a good example - of a fully self-sufficient driver; the other drivers rely more or - less on other parts of the kernel. -*/ - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -/*====================================================================== - - das08_pcmcia_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int das08_pcmcia_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -168,15 +143,6 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) return 0; } /* das08_pcmcia_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void das08_pcmcia_detach(struct pcmcia_device *link) { @@ -200,15 +166,6 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, return pcmcia_request_io(p_dev); } - -/*====================================================================== - - das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static void das08_pcmcia_config(struct pcmcia_device *link) { int ret; @@ -226,11 +183,6 @@ static void das08_pcmcia_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -242,32 +194,12 @@ failed: } /* das08_pcmcia_config */ -/*====================================================================== - - After a card is removed, das08_pcmcia_release() will unregister the - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void das08_pcmcia_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "das08_pcmcia_release\n"); pcmcia_disable_device(link); } /* das08_pcmcia_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - static int das08_pcmcia_suspend(struct pcmcia_device *link) { struct local_info_t *local = link->priv; diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 9cc8401..fc772a8 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -434,47 +434,20 @@ static int dio700_detach(struct comedi_device *dev) return 0; }; -/* PCMCIA crap -- watch your words, please! */ - static void dio700_config(struct pcmcia_device *link); static void dio700_release(struct pcmcia_device *link); static int dio700_cs_suspend(struct pcmcia_device *p_dev); static int dio700_cs_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int dio700_cs_attach(struct pcmcia_device *); static void dio700_cs_detach(struct pcmcia_device *); -/* - You'll also need to prototype all the functions that will actually - be used to talk to your device. See 'memory_cs' for a good example - of a fully self-sufficient driver; the other drivers rely more or - less on other parts of the kernel. -*/ - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -/*====================================================================== - - dio700_cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int dio700_cs_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -497,15 +470,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) return 0; } /* dio700_cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void dio700_cs_detach(struct pcmcia_device *link) { @@ -521,14 +485,6 @@ static void dio700_cs_detach(struct pcmcia_device *link) } /* dio700_cs_detach */ -/*====================================================================== - - dio700_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -559,11 +515,6 @@ static void dio700_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret != 0) goto failed; @@ -583,18 +534,6 @@ static void dio700_release(struct pcmcia_device *link) pcmcia_disable_device(link); } /* dio700_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - static int dio700_cs_suspend(struct pcmcia_device *link) { struct local_info_t *local = link->priv; diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index b3f7c66..c9c2858 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -186,47 +186,20 @@ static int dio24_detach(struct comedi_device *dev) return 0; }; -/* PCMCIA crap -- watch your words! */ - static void dio24_config(struct pcmcia_device *link); static void dio24_release(struct pcmcia_device *link); static int dio24_cs_suspend(struct pcmcia_device *p_dev); static int dio24_cs_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int dio24_cs_attach(struct pcmcia_device *); static void dio24_cs_detach(struct pcmcia_device *); -/* - You'll also need to prototype all the functions that will actually - be used to talk to your device. See 'memory_cs' for a good example - of a fully self-sufficient driver; the other drivers rely more or - less on other parts of the kernel. -*/ - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -/*====================================================================== - - dio24_cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int dio24_cs_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -249,15 +222,6 @@ static int dio24_cs_attach(struct pcmcia_device *link) return 0; } /* dio24_cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void dio24_cs_detach(struct pcmcia_device *link) { @@ -273,14 +237,6 @@ static void dio24_cs_detach(struct pcmcia_device *link) } /* dio24_cs_detach */ -/*====================================================================== - - dio24_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -310,11 +266,6 @@ static void dio24_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -334,18 +285,6 @@ static void dio24_release(struct pcmcia_device *link) pcmcia_disable_device(link); } /* dio24_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - static int dio24_cs_suspend(struct pcmcia_device *link) { struct local_info_t *local = link->priv; diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 6b7c5d0..6facbc8 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -152,59 +152,20 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) return labpc_common_attach(dev, iobase, irq, 0); } -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the dummy - event handler. - - Kernel version 2.6.16 upwards uses suspend() and resume() functions - instead of an event() function. -*/ - static void labpc_config(struct pcmcia_device *link); static void labpc_release(struct pcmcia_device *link); static int labpc_cs_suspend(struct pcmcia_device *p_dev); static int labpc_cs_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int labpc_cs_attach(struct pcmcia_device *); static void labpc_cs_detach(struct pcmcia_device *); -/* - You'll also need to prototype all the functions that will actually - be used to talk to your device. See 'memory_cs' for a good example - of a fully self-sufficient driver; the other drivers rely more or - less on other parts of the kernel. -*/ - struct local_info_t { struct pcmcia_device *link; int stop; struct bus_operations *bus; }; -/*====================================================================== - - labpc_cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int labpc_cs_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -225,15 +186,6 @@ static int labpc_cs_attach(struct pcmcia_device *link) return 0; } /* labpc_cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void labpc_cs_detach(struct pcmcia_device *link) { dev_dbg(&link->dev, "labpc_cs_detach\n"); @@ -252,14 +204,6 @@ static void labpc_cs_detach(struct pcmcia_device *link) } /* labpc_cs_detach */ -/*====================================================================== - - labpc_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { @@ -288,11 +232,6 @@ static void labpc_config(struct pcmcia_device *link) if (!link->irq) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -311,18 +250,6 @@ static void labpc_release(struct pcmcia_device *link) pcmcia_disable_device(link); } /* labpc_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - static int labpc_cs_suspend(struct pcmcia_device *link) { struct local_info_t *local = link->priv; @@ -340,8 +267,6 @@ static int labpc_cs_resume(struct pcmcia_device *link) return 0; } /* labpc_cs_resume */ -/*====================================================================*/ - static struct pcmcia_device_id labpc_cs_ids[] = { /* N.B. These IDs should match those in labpc_cs_boards (ni_labpc.c) */ PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0103), /* daqcard-1200 */ diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 32fecf5..ebba9bb 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -968,43 +968,14 @@ static int daqp_detach(struct comedi_device *dev) ======================================================================*/ -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. - - Kernel version 2.6.16 upwards uses suspend() and resume() functions - instead of an event() function. -*/ - static void daqp_cs_config(struct pcmcia_device *link); static void daqp_cs_release(struct pcmcia_device *link); static int daqp_cs_suspend(struct pcmcia_device *p_dev); static int daqp_cs_resume(struct pcmcia_device *p_dev); -/* - The attach() and detach() entry points are used to create and destroy - "instances" of the driver, where each instance represents everything - needed to manage one actual PCMCIA card. -*/ - static int daqp_cs_attach(struct pcmcia_device *); static void daqp_cs_detach(struct pcmcia_device *); -/*====================================================================== - - daqp_cs_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - - The dev_link structure is initialized, but we don't actually - configure the card at this point -- we wait until we receive a - card insertion event. - -======================================================================*/ - static int daqp_cs_attach(struct pcmcia_device *link) { struct local_info_t *local; @@ -1035,15 +1006,6 @@ static int daqp_cs_attach(struct pcmcia_device *link) return 0; } /* daqp_cs_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void daqp_cs_detach(struct pcmcia_device *link) { struct local_info_t *dev = link->priv; @@ -1059,15 +1021,6 @@ static void daqp_cs_detach(struct pcmcia_device *link) } /* daqp_cs_detach */ -/*====================================================================== - - daqp_cs_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - device available to the system. - -======================================================================*/ - - static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) { if (p_dev->config_index == 0) @@ -1094,11 +1047,6 @@ static void daqp_cs_config(struct pcmcia_device *link) if (ret) goto failed; - /* - This actually configures the PCMCIA socket -- setting up - the I/O windows and the interrupt mapping, and putting the - card and host interface into "Memory and IO" mode. - */ ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -1117,18 +1065,6 @@ static void daqp_cs_release(struct pcmcia_device *link) pcmcia_disable_device(link); } /* daqp_cs_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - static int daqp_cs_suspend(struct pcmcia_device *link) { struct local_info_t *local = link->priv; diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index aa3cc51..6555891 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -163,27 +163,6 @@ static int wl_adapter_attach(struct pcmcia_device *link) -/******************************************************************************* - * wl_adapter_detach() - ******************************************************************************* - * - * DESCRIPTION: - * - * This deletes a driver "instance". The device is de-registered with Card - * Services. If it has been released, then the net device is unregistered, and - * all local data structures are freed. Otherwise, the structures will be - * freed when the device is released. - * - * PARAMETERS: - * - * link - pointer to the dev_link_t structure representing the device to - * detach - * - * RETURNS: - * - * N/A - * - ******************************************************************************/ static void wl_adapter_detach(struct pcmcia_device *link) { struct net_device *dev = link->priv; @@ -207,26 +186,6 @@ static void wl_adapter_detach(struct pcmcia_device *link) /*============================================================================*/ -/******************************************************************************* - * wl_adapter_release() - ******************************************************************************* - * - * DESCRIPTION: - * - * After a card is removed, this routine will release the PCMCIA - * configuration. If the device is still open, this will be postponed until it - * is closed. - * - * PARAMETERS: - * - * arg - a u_long representing a pointer to a dev_link_t structure for the - * device to be released. - * - * RETURNS: - * - * N/A - * - ******************************************************************************/ void wl_adapter_release(struct pcmcia_device *link) { DBG_FUNC("wl_adapter_release"); @@ -266,26 +225,6 @@ static int wl_adapter_resume(struct pcmcia_device *link) return 0; } /* wl_adapter_resume */ -/******************************************************************************* - * wl_adapter_insert() - ******************************************************************************* - * - * DESCRIPTION: - * - * wl_adapter_insert() is scheduled to run after a CARD_INSERTION event is - * received, to configure the PCMCIA socket, and to make the ethernet device - * available to the system. - * - * PARAMETERS: - * - * link - pointer to the dev_link_t structure representing the device to - * insert - * - * RETURNS: - * - * N/A - * - ******************************************************************************/ void wl_adapter_insert(struct pcmcia_device *link) { struct net_device *dev; diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c index 88d0d47..8e3536a 100644 --- a/drivers/staging/wlags49_h2/wl_main.c +++ b/drivers/staging/wlags49_h2/wl_main.c @@ -414,25 +414,6 @@ extern memimage fw_image; // firmware image to be downloaded #endif /* HCF_STA */ -/******************************************************************************* - * wl_insert() - ******************************************************************************* - * - * DESCRIPTION: - * - * wl_insert() is scheduled to run after a CARD_INSERTION event is - * received, to configure the PCMCIA socket, and to make the ethernet device - * available to the system. - * - * PARAMETERS: - * - * dev - a pointer to the net_device struct of the wireless device - * - * RETURNS: - * - * TRUE or FALSE - * - ******************************************************************************/ int wl_insert( struct net_device *dev ) { int result = 0; -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:05 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:05 +0200 Subject: [PATCH 06/15] pcmcia: simplify IntType In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-6-git-send-email-linux@dominikbrodowski.net> IntType was only set to INT_MEMORY (driver pcmciamtd) or INT_MEMORY_AND_IO (all other drivers). As this flags seems to relate to ioport access, make it conditional to the driver having requested IO port access. There are two drivers which do not request IO ports, but did set INT_MEMORY_AND_IO: ray_cs and b43. For those, we consistently only set INT_MEMORY in future. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-ide at vger.kernel.org CC: linux-usb at vger.kernel.org CC: laforge at gnumonks.org CC: linux-mtd at lists.infradead.org CC: linux-bluetooth at vger.kernel.org CC: alsa-devel at alsa-project.org CC: linux-serial at vger.kernel.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 1 - drivers/bluetooth/bluecard_cs.c | 1 - drivers/bluetooth/bt3c_cs.c | 1 - drivers/bluetooth/btuart_cs.c | 1 - drivers/bluetooth/dtl1_cs.c | 1 - drivers/char/pcmcia/cm4000_cs.c | 3 --- drivers/char/pcmcia/cm4040_cs.c | 3 --- drivers/char/pcmcia/ipwireless/main.c | 1 - drivers/char/pcmcia/synclink_cs.c | 2 -- drivers/ide/ide-cs.c | 1 - drivers/isdn/hardware/avm/avm_cs.c | 1 - drivers/isdn/hisax/avma1_cs.c | 1 - drivers/isdn/hisax/elsa_cs.c | 1 - drivers/isdn/hisax/sedlbauer_cs.c | 1 - drivers/isdn/hisax/teles_cs.c | 1 - drivers/mtd/maps/pcmciamtd.c | 2 -- drivers/net/pcmcia/3c574_cs.c | 1 - drivers/net/pcmcia/3c589_cs.c | 1 - drivers/net/pcmcia/axnet_cs.c | 1 - drivers/net/pcmcia/com20020_cs.c | 1 - drivers/net/pcmcia/fmvj18x_cs.c | 1 - drivers/net/pcmcia/ibmtr_cs.c | 1 - drivers/net/pcmcia/nmclan_cs.c | 1 - drivers/net/pcmcia/pcnet_cs.c | 1 - drivers/net/pcmcia/smc91c92_cs.c | 1 - drivers/net/pcmcia/xirc2ps_cs.c | 1 - drivers/net/wireless/airo_cs.c | 1 - drivers/net/wireless/atmel_cs.c | 1 - drivers/net/wireless/b43/pcmcia.c | 1 - drivers/net/wireless/hostap/hostap_cs.c | 1 - drivers/net/wireless/libertas/if_cs.c | 1 - drivers/net/wireless/orinoco/orinoco_cs.c | 1 - drivers/net/wireless/orinoco/spectrum_cs.c | 1 - drivers/net/wireless/ray_cs.c | 1 - drivers/net/wireless/wl3501_cs.c | 1 - drivers/parport/parport_cs.c | 1 - drivers/pcmcia/cs_internal.h | 1 - drivers/pcmcia/pcmcia_resource.c | 10 +--------- drivers/scsi/pcmcia/aha152x_stub.c | 1 - drivers/scsi/pcmcia/fdomain_stub.c | 1 - drivers/scsi/pcmcia/nsp_cs.c | 1 - drivers/scsi/pcmcia/qlogic_stub.c | 1 - drivers/scsi/pcmcia/sym53c500_cs.c | 1 - drivers/serial/serial_cs.c | 2 -- drivers/staging/comedi/drivers/cb_das16_cs.c | 1 - drivers/staging/comedi/drivers/das08_cs.c | 1 - drivers/staging/comedi/drivers/ni_daq_700.c | 1 - drivers/staging/comedi/drivers/ni_daq_dio24.c | 1 - drivers/staging/comedi/drivers/ni_labpc_cs.c | 1 - drivers/staging/comedi/drivers/ni_mio_cs.c | 1 - drivers/staging/comedi/drivers/quatech_daqp_cs.c | 1 - drivers/staging/wlags49_h2/wl_cs.c | 1 - drivers/telephony/ixj_pcmcia.c | 1 - drivers/usb/host/sl811_cs.c | 1 - include/pcmcia/cs.h | 7 ------- sound/pcmcia/pdaudiocf/pdaudiocf.c | 1 - sound/pcmcia/vx/vxpocket.c | 1 - 57 files changed, 1 insertions(+), 78 deletions(-) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 12cdc9f..c2679c0 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -250,7 +250,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; pdev->conf.Attributes = CONF_ENABLE_IRQ; - pdev->conf.IntType = INT_MEMORY_AND_IO; /* See if we have a manufacturer identifier. Use it to set is_kme for vendor quirks */ diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index d52e90a..4cb2dfe 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -866,7 +866,6 @@ static int bluecard_probe(struct pcmcia_device *link) link->priv = info; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return bluecard_config(link); } diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 2c8d981..fb01807 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -661,7 +661,6 @@ static int bt3c_probe(struct pcmcia_device *link) link->resource[0]->end = 8; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return bt3c_config(link); } diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 7ea6fa4..897c7c7 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -590,7 +590,6 @@ static int btuart_probe(struct pcmcia_device *link) link->resource[0]->end = 8; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return btuart_config(link); } diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index db7c8db..b4c9a2e 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -576,7 +576,6 @@ static int dtl1_probe(struct pcmcia_device *link) link->resource[0]->end = 8; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return dtl1_config(link); } diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index ec73d9f..d2accd6 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1767,8 +1767,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno) if (pcmcia_loop_config(link, cm4000_config_check, NULL)) goto cs_release; - link->conf.IntType = 00000002; - if (pcmcia_request_configuration(link, &link->conf)) goto cs_release; @@ -1829,7 +1827,6 @@ static int cm4000_probe(struct pcmcia_device *link) dev->p_dev = link; link->priv = dev; - link->conf.IntType = INT_MEMORY_AND_IO; dev_table[i] = link; init_waitqueue_head(&dev->devq); diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 815cde1..a32eba0 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -547,8 +547,6 @@ static int reader_config(struct pcmcia_device *link, int devno) if (pcmcia_loop_config(link, cm4040_config_check, NULL)) goto cs_release; - link->conf.IntType = 00000002; - fail_rc = pcmcia_request_configuration(link, &link->conf); if (fail_rc != 0) { dev_printk(KERN_INFO, &link->dev, @@ -599,7 +597,6 @@ static int reader_probe(struct pcmcia_device *link) link->priv = dev; dev->p_dev = link; - link->conf.IntType = INT_MEMORY_AND_IO; dev_table[i] = link; init_waitqueue_head(&dev->devq); diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 8d2b86a..0f0be4d 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -173,7 +173,6 @@ static int config_ipwireless(struct ipw_dev *ipw) return ret; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; INIT_WORK(&ipw->work_reboot, signalled_reboot_work); diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 9ecd6be..ba7ccf5 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -551,7 +551,6 @@ static int mgslpc_probe(struct pcmcia_device *link) /* Initialize the struct pcmcia_device structure */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; ret = mgslpc_config(link); if (ret) @@ -595,7 +594,6 @@ static int mgslpc_config(struct pcmcia_device *link) goto failed; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 8; link->conf.Present = PRESENT_OPTION; diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 82690e4..cf7cb49 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -100,7 +100,6 @@ static int ide_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return ide_config(link); } /* ide_attach */ diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 09b1795..938ca41 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -80,7 +80,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.ConfigIndex = 1; p_dev->conf.Present = PRESENT_OPTION; diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 94263c2..7d5ff20 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -85,7 +85,6 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.ConfigIndex = 1; p_dev->conf.Present = PRESENT_OPTION; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index b3c08aa..df360c8 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -130,7 +130,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return elsa_cs_config(link); } /* elsa_cs_attach */ diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 40001ad..169061f 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -133,7 +133,6 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; return sedlbauer_config(link); } /* sedlbauer_attach */ diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 7296102..46e72a1 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -110,7 +110,6 @@ static int __devinit teles_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return teles_cs_config(link); } /* teles_attach */ diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index ab94c8a..663b48b 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -575,7 +575,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) link->vpp = 0; } - link->conf.IntType = INT_MEMORY; link->conf.ConfigIndex = 0; DEBUG(2, "Setting Configuration"); ret = pcmcia_request_configuration(link, &link->conf); @@ -720,7 +719,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link) link->priv = dev; link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY; return pcmciamtd_config(link); } diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index c683f77..41ecb27 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -281,7 +281,6 @@ static int tc574_probe(struct pcmcia_device *link) link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; dev->netdev_ops = &el3_netdev_ops; diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 61f9cf2..6888672 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -217,7 +217,6 @@ static int tc589_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; dev->netdev_ops = &el3_netdev_ops; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 8734ed8..4d4928a 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -167,7 +167,6 @@ static int axnet_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = dev; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; dev->netdev_ops = &axnet_netdev_ops; diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 3c400cf..a58eafe 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -161,7 +161,6 @@ static int com20020_probe(struct pcmcia_device *p_dev) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->resource[0]->end = 16; p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.IntType = INT_MEMORY_AND_IO; info->dev = dev; p_dev->priv = info; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index dfd3284..caf2b2e 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -253,7 +253,6 @@ static int fmvj18x_probe(struct pcmcia_device *link) /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; dev->netdev_ops = &fjn_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index dbdea7f..1327f08 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -153,7 +153,6 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 4; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.Present = PRESENT_OPTION; info->dev = dev; diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 68f2dee..90d1728 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -461,7 +461,6 @@ static int nmclan_probe(struct pcmcia_device *link) link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 1dd0dfa..0924ed6 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -261,7 +261,6 @@ static int pcnet_probe(struct pcmcia_device *link) link->priv = dev; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; dev->netdev_ops = &pcnet_netdev_ops; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 2031a27..2c2a878 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -327,7 +327,6 @@ static int smc91c92_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; /* The SMC91c92-specific entries in the device structure. */ dev->netdev_ops = &smc_netdev_ops; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 59398a6..1776f49 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -530,7 +530,6 @@ xirc2ps_probe(struct pcmcia_device *link) /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; /* Fill in card specific entries */ diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index ab60f10..ccb2fdd 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -104,7 +104,6 @@ static int airo_probe(struct pcmcia_device *p_dev) device, and can be hard-wired here. */ p_dev->conf.Attributes = 0; - p_dev->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ local = kzalloc(sizeof(local_info_t), GFP_KERNEL); diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index d6d585c..8b75158 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -114,7 +114,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) device, and can be hard-wired here. */ p_dev->conf.Attributes = 0; - p_dev->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ local = kzalloc(sizeof(local_info_t), GFP_KERNEL); diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 618d9b5..138b26f 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -73,7 +73,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) err = -ENODEV; dev->conf.Attributes = CONF_ENABLE_IRQ; - dev->conf.IntType = INT_MEMORY_AND_IO; dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | WIN_USE_WAIT; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 3fa285b..0fe6f82 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -437,7 +437,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev) int ret; PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); - p_dev->conf.IntType = INT_MEMORY_AND_IO; ret = prism2_config(p_dev); if (ret) { diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 9c29839..814b7fa 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -836,7 +836,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev) p_dev->priv = card; p_dev->conf.Attributes = 0; - p_dev->conf.IntType = INT_MEMORY_AND_IO; if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { lbs_pr_err("error in pcmcia_loop_config\n"); diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index f7e3fa6..1147d6b 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -123,7 +123,6 @@ orinoco_cs_probe(struct pcmcia_device *link) * number, sizes, and attributes of IO windows) are fixed by * the nature of the device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; return orinoco_cs_config(link); } /* orinoco_cs_attach */ diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 1bbad10..20b08ab 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -185,7 +185,6 @@ spectrum_cs_probe(struct pcmcia_device *link) * number, sizes, and attributes of IO windows) are fixed by * the nature of the device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; return spectrum_cs_config(link); } /* spectrum_cs_attach */ diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index ab34cb8..30cfd88 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -319,7 +319,6 @@ static int ray_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.ConfigIndex = 1; p_dev->priv = dev; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index a1cc2d4..92a9ad5 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1889,7 +1889,6 @@ static int wl3501_probe(struct pcmcia_device *p_dev) /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; - p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.ConfigIndex = 1; dev = alloc_etherdev(sizeof(struct wl3501_card)); diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 23e50f4..afd946e 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -104,7 +104,6 @@ static int parport_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return parport_config(link); } /* parport_attach */ diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 7ef464d..a0c5adb 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -34,7 +34,6 @@ typedef struct config_t { struct kref ref; unsigned int state; unsigned int Attributes; - unsigned int IntType; unsigned int ConfigBase; unsigned char Option; unsigned int CardValues; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index e119663..660f394 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -447,11 +447,6 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, if (!(s->state & SOCKET_PRESENT)) return -ENODEV; - if (req->IntType & INT_CARDBUS) { - dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); - return -EINVAL; - } - mutex_lock(&s->ops_mutex); c = p_dev->function_config; if (c->state & CONFIG_LOCKED) { @@ -470,12 +465,9 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, } /* Pick memory or I/O card, DMA mode, interrupt */ - c->IntType = req->IntType; c->Attributes = req->Attributes; - if (req->IntType & INT_MEMORY_AND_IO) + if (p_dev->_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) { diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 61f49bd..3c0046e 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -103,7 +103,6 @@ static int aha152x_probe(struct pcmcia_device *link) link->resource[0]->end = 0x20; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.Present = PRESENT_OPTION; return aha152x_config_cs(link); diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 13dbe5c..8ff7603 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -86,7 +86,6 @@ static int fdomain_probe(struct pcmcia_device *link) link->resource[0]->end = 0x10; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.Present = PRESENT_OPTION; return fdomain_config(link); diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index e14fcd1..7059526 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1563,7 +1563,6 @@ static int nsp_cs_probe(struct pcmcia_device *link) /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; ret = nsp_cs_config(link); diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index eb775f1..77f46a2 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -159,7 +159,6 @@ static int qlogic_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.Present = PRESENT_OPTION; return qlogic_config(link); diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 321e390..9aaf974 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -862,7 +862,6 @@ SYM53C500_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; return SYM53C500_config(link); } /* SYM53C500_attach */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 8035f1e..a1906b5 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -337,8 +337,6 @@ static int serial_probe(struct pcmcia_device *link) if (do_sound) link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.IntType = INT_MEMORY_AND_IO; - return serial_config(link); } diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index f8ede11..11271b6 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -694,7 +694,6 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) /* Initialize the pcmcia_device structure */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; cur_dev = link; diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 48d9fb1..319aad4 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -170,7 +170,6 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; cur_dev = link; diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 8cf56cb..d269bbd 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -499,7 +499,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; pcmcia_cur_dev = link; diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index ba69343..fcaa829 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -251,7 +251,6 @@ static int dio24_cs_attach(struct pcmcia_device *link) device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; pcmcia_cur_dev = link; diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 5d5f11f..a936c11 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -227,7 +227,6 @@ static int labpc_cs_attach(struct pcmcia_device *link) device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; pcmcia_cur_dev = link; diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 1f24263..be7e021 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -266,7 +266,6 @@ static int cs_attach(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->resource[0]->end = 16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; cur_dev = link; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index bf489d7..cd818fb 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1039,7 +1039,6 @@ static int daqp_cs_attach(struct pcmcia_device *link) device, and can be hard-wired here. */ link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; daqp_cs_config(link); diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 19c3354..b2efff6 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -148,7 +148,6 @@ static int wl_adapter_attach(struct pcmcia_device *link) link->resource[0]->end = HCF_NUM_IO_PORTS; link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 5; link->conf.Present = PRESENT_OPTION; diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index a1900e5..5ccc6d0 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -34,7 +34,6 @@ static int ixj_probe(struct pcmcia_device *p_dev) /* Create new ixj device */ p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); if (!p_dev->priv) { return -ENOMEM; diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 8e84752..78bad51 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -228,7 +228,6 @@ static int sl811_cs_probe(struct pcmcia_device *link) link->priv = local; link->conf.Attributes = 0; - link->conf.IntType = INT_MEMORY_AND_IO; return sl811_cs_config(link); } diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 29d693f..674edbc 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -22,7 +22,6 @@ /* For RequestConfiguration */ typedef struct config_req_t { u_int Attributes; - u_int IntType; u_int ConfigBase; u_char ConfigIndex; u_int Present; @@ -36,12 +35,6 @@ typedef struct config_req_t { #define CONF_ENABLE_ESR 0x10 #define CONF_VALID_CLIENT 0x100 -/* IntType field */ -#define INT_MEMORY 0x01 -#define INT_MEMORY_AND_IO 0x02 -#define INT_CARDBUS 0x04 -#define INT_ZOOMED_VIDEO 0x08 - /* Configuration registers present */ #define PRESENT_OPTION 0x001 #define PRESENT_STATUS 0x002 diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 7ab9174..2e1282d 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -143,7 +143,6 @@ static int snd_pdacf_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index a6edfc3..a48b3ee 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -163,7 +163,6 @@ static int snd_vxpocket_new(struct snd_card *card, int ibl, link->resource[0]->end = 16; link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:03 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:03 +0200 Subject: [PATCH 04/15] pcmcia: remove Pin, Copy configuration register access In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-4-git-send-email-linux@dominikbrodowski.net> The "Pin" and "Copy" configuration registers (CISREG_SCR, CISREG_PPR) do not seem to be utilized anywhere. If a device would request a write to these registers, "0" would be written. Continue to do so, but warn of unexpected behavior -- and remove the "Pin" and "Copy" entries from config_req_t. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 2 +- drivers/pcmcia/pcmcia_resource.c | 14 ++++++++------ include/pcmcia/cs.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index da055dc..9487340 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -36,7 +36,7 @@ typedef struct config_t { unsigned int Attributes; unsigned int IntType; unsigned int ConfigBase; - unsigned char Status, Pin, Copy, Option, ExtStatus; + unsigned char Status, Option, ExtStatus; unsigned int CardValues; struct resource io[MAX_IO_WIN]; /* io ports */ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index fb28178..e431567 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -489,8 +489,14 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, base = c->ConfigBase = req->ConfigBase; 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); + u16 tmp = 0; + dev_warn(&p_dev->dev, "invalid write to CISREG_SCR\n"); + pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); + } + if (req->Present & PRESENT_PIN_REPLACE) { + u16 tmp = 0; + dev_warn(&p_dev->dev, "invalid write to CISREG_PRR\n"); + pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); } if (req->Present & PRESENT_OPTION) { if (s->functions == 1) { @@ -511,10 +517,6 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, 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); diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index ccb8e6e..e656abe 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -24,7 +24,7 @@ typedef struct config_req_t { u_int Attributes; u_int IntType; u_int ConfigBase; - u_char Status, Pin, Copy, ExtStatus; + u_char Status, ExtStatus; u_char ConfigIndex; u_int Present; } config_req_t; -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:04 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:04 +0200 Subject: [PATCH 05/15] pcmcia: simplify Status, ExtStatus register access In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-5-git-send-email-linux@dominikbrodowski.net> The Status (CISREG_CCSR) and ExtStatus (CISREG_ESR) registers were only accessed to enable audio output for some drivers and IRQ for serial_cs.c. The former also required setting config_req_t.Attributes to CONF_ENABLE_SPKR; the latter can be simplified to setting this field to CONF_ENABLE_ESR. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-serial at vger.kernel.org CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/isdn/hisax/sedlbauer_cs.c | 4 +-- drivers/net/pcmcia/axnet_cs.c | 4 +-- drivers/net/pcmcia/pcnet_cs.c | 5 +-- drivers/net/pcmcia/smc91c92_cs.c | 2 - drivers/net/pcmcia/xirc2ps_cs.c | 5 +-- drivers/net/wireless/airo_cs.c | 4 +-- drivers/net/wireless/atmel_cs.c | 4 +-- drivers/net/wireless/hostap/hostap_cs.c | 4 +-- drivers/pcmcia/cs_internal.h | 2 +- drivers/pcmcia/pcmcia_resource.c | 28 +++++++++++++++++-------- drivers/scsi/pcmcia/nsp_cs.c | 4 +-- drivers/serial/serial_cs.c | 11 +++------ drivers/staging/comedi/drivers/ni_daq_700.c | 4 +-- drivers/staging/comedi/drivers/ni_daq_dio24.c | 4 +-- drivers/staging/comedi/drivers/ni_labpc_cs.c | 4 +-- include/pcmcia/cs.h | 2 +- 16 files changed, 38 insertions(+), 53 deletions(-) diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index ad07d61..40001ad 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -175,10 +175,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 5f05ffb..8734ed8 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -334,10 +334,8 @@ static int axnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - if (resource_size(link->resource[1]) == 8) { + if (resource_size(link->resource[1]) == 8) link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; - } ret = pcmcia_request_configuration(link, &link->conf); if (ret) diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 15e80ea..1dd0dfa 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -553,10 +553,9 @@ static int pcnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - if (resource_size(link->resource[1]) == 8) { + if (resource_size(link->resource[1]) == 8) link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; - } + if ((link->manf_id == MANFID_IBM) && (link->card_id == PRODID_IBM_HOME_AND_AWAY)) link->conf.ConfigIndex |= 0x10; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 395e586..2031a27 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -446,7 +446,6 @@ static int mhz_mfc_config(struct pcmcia_device *link) int i; link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->end = 8; @@ -640,7 +639,6 @@ static int osi_config(struct pcmcia_device *link) int i, j; link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; link->resource[0]->end = 64; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->end = 8; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 4308bda..59398a6 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -812,10 +812,9 @@ xirc2ps_config(struct pcmcia_device * link) if (local->modem) { int pass; - if (do_sound) { + if (do_sound) link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status |= CCSR_AUDIO_ENA; - } + link->resource[1]->end = 8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; if (local->dingo) { diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 488e7b4..ab60f10 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -158,10 +158,8 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 479f508..d6d585c 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -175,10 +175,8 @@ static int atmel_config_check(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 3f35dd4..3fa285b 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -484,10 +484,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev, "(default 0x%02X)\n", cfg->index, dflt->index); /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 9487340..7ef464d 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -36,7 +36,7 @@ typedef struct config_t { unsigned int Attributes; unsigned int IntType; unsigned int ConfigBase; - unsigned char Status, Option, ExtStatus; + unsigned char Option; unsigned int CardValues; struct resource io[MAX_IO_WIN]; /* io ports */ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index e431567..e119663 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -441,6 +441,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, struct pcmcia_socket *s = p_dev->socket; config_t *c; pccard_io_map iomap; + unsigned char status = 0; + unsigned char ext_status = 0; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -476,12 +478,21 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, 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) + if (req->Attributes & CONF_ENABLE_SPKR) { s->socket.flags |= SS_SPKR_ENA; + status = CCSR_AUDIO_ENA; + if (!(req->Present & PRESENT_STATUS)) + dev_warn(&p_dev->dev, "speaker requested, but " + "PRESENT_STATUS not set!\n"); + } if (req->Attributes & CONF_ENABLE_IRQ) s->socket.io_irq = s->pcmcia_irq; else s->socket.io_irq = 0; + if (req->Attributes & CONF_ENABLE_ESR) { + req->Present |= PRESENT_EXT_STATUS; + ext_status = ESR_REQ_ATTN_ENA; + } s->ops->set_socket(s, &s->socket); s->lock_count++; @@ -513,14 +524,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, 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_EXT_STATUS) { - c->ExtStatus = req->ExtStatus; - pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); - } + if (req->Present & PRESENT_STATUS) + pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); + + if (req->Present & PRESENT_EXT_STATUS) + pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, + &ext_status); + if (req->Present & PRESENT_IOBASE_0) { u8 b = c->io[0].start & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index e475ec5..e14fcd1 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1608,10 +1608,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index b851c1f..8035f1e 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -183,10 +183,8 @@ static void quirk_config_socket(struct pcmcia_device *link) { struct serial_info *info = link->priv; - if (info->multi) { - link->conf.Present |= PRESENT_EXT_STATUS; - link->conf.ExtStatus = ESR_REQ_ATTN_ENA; - } + if (info->multi) + link->conf.Attributes |= CONF_ENABLE_ESR; } static const struct serial_quirk quirks[] = { @@ -336,10 +334,9 @@ static int serial_probe(struct pcmcia_device *link) link->priv = info; link->conf.Attributes = CONF_ENABLE_IRQ; - if (do_sound) { + if (do_sound) link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; - } + link->conf.IntType = INT_MEMORY_AND_IO; return serial_config(link); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index cc15666..8cf56cb 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -550,10 +550,8 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 773ae20..ba69343 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -302,10 +302,8 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 68c4ecb..5d5f11f 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -281,10 +281,8 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Does this card need audio output? */ - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { + if (cfg->flags & CISTPL_CFTABLE_AUDIO) p_dev->conf.Attributes |= CONF_ENABLE_SPKR; - p_dev->conf.Status = CCSR_AUDIO_ENA; - } /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index e656abe..29d693f 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -24,7 +24,6 @@ typedef struct config_req_t { u_int Attributes; u_int IntType; u_int ConfigBase; - u_char Status, ExtStatus; u_char ConfigIndex; u_int Present; } config_req_t; @@ -34,6 +33,7 @@ typedef struct config_req_t { #define CONF_ENABLE_DMA 0x02 #define CONF_ENABLE_SPKR 0x04 #define CONF_ENABLE_PULSE_IRQ 0x08 +#define CONF_ENABLE_ESR 0x10 #define CONF_VALID_CLIENT 0x100 /* IntType field */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:00 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:00 +0200 Subject: [PATCH 01/15] pcmcia: do not use win_req_t when calling pcmcia_request_window() In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-1-git-send-email-linux@dominikbrodowski.net> Instead of win_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four iomem ranges. After a call to pcmcia_request_window(), the windows found there are reserved and may be used until pcmcia_release_window() is called. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-mtd at lists.infradead.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- Documentation/pcmcia/driver-changes.txt | 7 +++ drivers/char/pcmcia/ipwireless/main.c | 87 +++++++++++++------------------ drivers/char/pcmcia/ipwireless/main.h | 4 -- drivers/mtd/maps/pcmciamtd.c | 53 ++++++++++--------- drivers/net/pcmcia/fmvj18x_cs.c | 29 ++++------ drivers/net/pcmcia/ibmtr_cs.c | 42 +++++++-------- drivers/net/pcmcia/pcnet_cs.c | 44 ++++++++-------- drivers/net/pcmcia/smc91c92_cs.c | 15 +++--- drivers/net/pcmcia/xirc2ps_cs.c | 16 +++--- drivers/net/wireless/b43/pcmcia.c | 14 ++--- drivers/net/wireless/ray_cs.c | 44 +++++++-------- drivers/net/wireless/ray_cs.h | 2 - drivers/pcmcia/pcmcia_resource.c | 60 ++++++++++++---------- drivers/scsi/pcmcia/nsp_cs.c | 47 ++++++---------- include/pcmcia/cs.h | 24 --------- include/pcmcia/ds.h | 28 +++++++--- 16 files changed, 240 insertions(+), 276 deletions(-) diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 26c0f9c..86e0f49 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt @@ -1,4 +1,11 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: +* pcmcia_request_window changes (as of 2.6.36) + Instead of win_req_t, drivers are now requested to fill out + struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport + ranges. After a call to pcmcia_request_window(), the regions found there + are reserved and may be used immediately -- until pcmcia_release_window() + is called. + * pcmcia_request_io changes (as of 2.6.36) Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 67bdb05..8d2b86a 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -105,62 +105,54 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, if (cfg->mem.nwin == 0) return 0; - ipw->request_common_memory.Attributes = + p_dev->resource[2]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; - ipw->request_common_memory.Base = cfg->mem.win[0].host_addr; - ipw->request_common_memory.Size = cfg->mem.win[0].len; - if (ipw->request_common_memory.Size < 0x1000) - ipw->request_common_memory.Size = 0x1000; - ipw->request_common_memory.AccessSpeed = 0; - - ret = pcmcia_request_window(p_dev, &ipw->request_common_memory, - &ipw->handle_common_memory); + p_dev->resource[2]->start = cfg->mem.win[0].host_addr; + p_dev->resource[2]->end = cfg->mem.win[0].len; + if (p_dev->resource[2]->end < 0x1000) + p_dev->resource[2]->end = 0x1000; + ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); if (ret != 0) goto exit1; - ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], cfg->mem.win[0].card_addr); - if (ret != 0) goto exit2; ipw->is_v2_card = cfg->mem.win[0].len == 0x100; - ipw->common_memory = ioremap(ipw->request_common_memory.Base, - ipw->request_common_memory.Size); - request_mem_region(ipw->request_common_memory.Base, - ipw->request_common_memory.Size, + ipw->attr_memory = ioremap(p_dev->resource[2]->start, + resource_size(p_dev->resource[2])); + request_mem_region(p_dev->resource[2]->start, + resource_size(p_dev->resource[2]), IPWIRELESS_PCCARD_NAME); - ipw->request_attr_memory.Attributes = - WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; - ipw->request_attr_memory.Base = 0; - ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ - ipw->request_attr_memory.AccessSpeed = 0; - - ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory, - &ipw->handle_attr_memory); - + p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | + WIN_ENABLE; + p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ + ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); if (ret != 0) goto exit2; - ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); if (ret != 0) goto exit3; - ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, - ipw->request_attr_memory.Size); - request_mem_region(ipw->request_attr_memory.Base, - ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); + ipw->attr_memory = ioremap(p_dev->resource[3]->start, + resource_size(p_dev->resource[3])); + request_mem_region(p_dev->resource[3]->start, + resource_size(p_dev->resource[3]), + IPWIRELESS_PCCARD_NAME); return 0; exit3: exit2: if (ipw->common_memory) { - release_mem_region(ipw->request_common_memory.Base, - ipw->request_common_memory.Size); + release_mem_region(p_dev->resource[2]->start, + resource_size(p_dev->resource[2])); iounmap(ipw->common_memory); } exit1: @@ -201,13 +193,9 @@ static int config_ipwireless(struct ipw_dev *ipw) (unsigned int) link->irq); if (ipw->attr_memory && ipw->common_memory) printk(KERN_INFO IPWIRELESS_PCCARD_NAME - ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", - ipw->request_attr_memory.Base, - ipw->request_attr_memory.Base - + ipw->request_attr_memory.Size - 1, - ipw->request_common_memory.Base, - ipw->request_common_memory.Base - + ipw->request_common_memory.Size - 1); + ": attr memory %pR, common memory %pR\n", + link->resource[3], + link->resource[2]); ipw->network = ipwireless_network_create(ipw->hardware); if (!ipw->network) @@ -231,17 +219,16 @@ static int config_ipwireless(struct ipw_dev *ipw) return 0; exit: - if (ipw->attr_memory) { - release_mem_region(ipw->request_attr_memory.Base, - ipw->request_attr_memory.Size); - iounmap(ipw->attr_memory); - - } if (ipw->common_memory) { - release_mem_region(ipw->request_common_memory.Base, - ipw->request_common_memory.Size); + release_mem_region(link->resource[2]->start, + resource_size(link->resource[2])); iounmap(ipw->common_memory); } + if (ipw->attr_memory) { + release_mem_region(link->resource[3]->start, + resource_size(link->resource[3])); + iounmap(ipw->attr_memory); + } pcmcia_disable_device(link); return -1; } @@ -249,13 +236,13 @@ exit: static void release_ipwireless(struct ipw_dev *ipw) { if (ipw->common_memory) { - release_mem_region(ipw->request_common_memory.Base, - ipw->request_common_memory.Size); + release_mem_region(ipw->link->resource[2]->start, + resource_size(ipw->link->resource[2])); iounmap(ipw->common_memory); } if (ipw->attr_memory) { - release_mem_region(ipw->request_attr_memory.Base, - ipw->request_attr_memory.Size); + release_mem_region(ipw->link->resource[3]->start, + resource_size(ipw->link->resource[3])); iounmap(ipw->attr_memory); } pcmcia_disable_device(ipw->link); diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/char/pcmcia/ipwireless/main.h index c207be8..9040219 100644 --- a/drivers/char/pcmcia/ipwireless/main.h +++ b/drivers/char/pcmcia/ipwireless/main.h @@ -45,13 +45,9 @@ struct ipw_dev { struct pcmcia_device *link; int is_v2_card; - window_handle_t handle_attr_memory; void __iomem *attr_memory; - win_req_t request_attr_memory; - window_handle_t handle_common_memory; void __iomem *common_memory; - win_req_t request_common_memory; /* Reference to attribute memory, containing CIS data */ void *attribute_memory; diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index e9ca5ba..fb3c538 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -101,7 +101,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)") static caddr_t remap_window(struct map_info *map, unsigned long to) { struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; - window_handle_t win = (window_handle_t)map->map_priv_2; + struct resource *win = (struct resource *) map->map_priv_2; unsigned int offset; int ret; @@ -339,7 +339,7 @@ static void pcmciamtd_release(struct pcmcia_device *link) DEBUG(3, "link = 0x%p", link); - if (link->win) { + if (link->resource[2]->end) { if(dev->win_base) { iounmap(dev->win_base); dev->win_base = NULL; @@ -491,9 +491,8 @@ static int pcmciamtd_config(struct pcmcia_device *link) { struct pcmciamtd_dev *dev = link->priv; struct mtd_info *mtd = NULL; - win_req_t req; int ret; - int i; + int i, j = 0; static char *probes[] = { "jedec_probe", "cfi_probe" }; int new_name = 0; @@ -520,28 +519,34 @@ static int pcmciamtd_config(struct pcmcia_device *link) * smaller windows until we succeed */ - req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; - req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; - req.Base = 0; - req.AccessSpeed = mem_speed; - link->win = (window_handle_t)link; - req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; + link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; + link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ? + WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; + link->resource[2]->start = 0; + link->resource[2]->end = (force_size) ? force_size << 20 : + MAX_PCMCIA_ADDR; dev->win_size = 0; do { int ret; - DEBUG(2, "requesting window with size = %dKiB memspeed = %d", - req.Size >> 10, req.AccessSpeed); - ret = pcmcia_request_window(link, &req, &link->win); + DEBUG(2, "requesting window with size = %luKiB memspeed = %d", + (unsigned long) resource_size(link->resource[2]) >> 10, + mem_speed); + ret = pcmcia_request_window(link, link->resource[2], mem_speed); DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); if(ret) { - req.Size >>= 1; + j++; + link->resource[2]->start = 0; + link->resource[2]->end = (force_size) ? + force_size << 20 : MAX_PCMCIA_ADDR; + link->resource[2]->end >>= j; } else { - DEBUG(2, "Got window of size %dKiB", req.Size >> 10); - dev->win_size = req.Size; + DEBUG(2, "Got window of size %luKiB", (unsigned long) + resource_size(link->resource[2]) >> 10); + dev->win_size = resource_size(link->resource[2]); break; } - } while(req.Size >= 0x1000); + } while (link->resource[2]->end >= 0x1000); DEBUG(2, "dev->win_size = %d", dev->win_size); @@ -553,20 +558,20 @@ static int pcmciamtd_config(struct pcmcia_device *link) DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); /* Get write protect status */ - DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); - dev->win_base = ioremap(req.Base, req.Size); + dev->win_base = ioremap(link->resource[2]->start, + resource_size(link->resource[2])); if(!dev->win_base) { - dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", - req.Base, req.Size); + dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", + link->resource[2]); pcmciamtd_release(link); return -ENODEV; } - DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", - dev, req.Base, dev->win_base, req.Size); + DEBUG(1, "mapped window dev = %p @ %pR, base = %p", + dev, link->resource[2], dev->win_base); dev->offset = 0; dev->pcmcia_map.map_priv_1 = (unsigned long)dev; - dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; + dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; link->conf.Attributes = 0; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 98fffb0..dfd3284 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -544,20 +544,18 @@ failed: static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) { - win_req_t req; u_char __iomem *base; int i, j; /* Allocate a small memory window */ - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; - req.Base = 0; req.Size = 0; - req.AccessSpeed = 0; - i = pcmcia_request_window(link, &req, &link->win); + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; + link->resource[2]->start = 0; link->resource[2]->end = 0; + i = pcmcia_request_window(link, link->resource[2], 0); if (i != 0) return -1; - base = ioremap(req.Base, req.Size); - pcmcia_map_mem_page(link, link->win, 0); + base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); + pcmcia_map_mem_page(link, link->resource[2], 0); /* * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format @@ -582,7 +580,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) } iounmap(base); - j = pcmcia_release_window(link, link->win); + j = pcmcia_release_window(link, link->resource[2]); return (i != 0x200) ? 0 : -1; } /* fmvj18x_get_hwinfo */ @@ -590,27 +588,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) static int fmvj18x_setup_mfc(struct pcmcia_device *link) { - win_req_t req; int i; struct net_device *dev = link->priv; unsigned int ioaddr; local_info_t *lp = netdev_priv(dev); /* Allocate a small memory window */ - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; - req.Base = 0; req.Size = 0; - req.AccessSpeed = 0; - i = pcmcia_request_window(link, &req, &link->win); + link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; + link->resource[3]->start = link->resource[3]->end = 0; + i = pcmcia_request_window(link, link->resource[3], 0); if (i != 0) return -1; - lp->base = ioremap(req.Base, req.Size); + lp->base = ioremap(link->resource[3]->start, + resource_size(link->resource[3])); if (lp->base == NULL) { printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); return -1; } - i = pcmcia_map_mem_page(link, link->win, 0); + i = pcmcia_map_mem_page(link, link->resource[3], 0); if (i != 0) { iounmap(lp->base); lp->base = NULL; @@ -638,7 +635,6 @@ static void fmvj18x_release(struct pcmcia_device *link) struct net_device *dev = link->priv; local_info_t *lp = netdev_priv(dev); u_char __iomem *tmp; - int j; dev_dbg(&link->dev, "fmvj18x_release\n"); @@ -646,7 +642,6 @@ static void fmvj18x_release(struct pcmcia_device *link) tmp = lp->base; lp->base = NULL; /* set NULL before iounmap */ iounmap(tmp); - j = pcmcia_release_window(link, link->win); } pcmcia_disable_device(link); diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index b0d06a3..dbdea7f 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -102,9 +102,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev); typedef struct ibmtr_dev_t { struct pcmcia_device *p_dev; - struct net_device *dev; - window_handle_t sram_win_handle; - struct tok_info *ti; + struct net_device *dev; + struct tok_info *ti; } ibmtr_dev_t; static void netdev_get_drvinfo(struct net_device *dev, @@ -210,7 +209,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ibmtr_dev_t *info = link->priv; struct net_device *dev = info->dev; struct tok_info *ti = netdev_priv(dev); - win_req_t req; int i, ret; dev_dbg(&link->dev, "ibmtr_config\n"); @@ -240,37 +238,37 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); /* Allocate the MMIO memory window */ - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; - req.Attributes |= WIN_USE_WAIT; - req.Base = 0; - req.Size = 0x2000; - req.AccessSpeed = 250; - ret = pcmcia_request_window(link, &req, &link->win); + link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; + link->resource[2]->flags |= WIN_USE_WAIT; + link->resource[2]->start = 0; + link->resource[2]->end = 0x2000; + ret = pcmcia_request_window(link, link->resource[2], 250); if (ret) goto failed; - ret = pcmcia_map_mem_page(link, link->win, mmiobase); + ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); if (ret) goto failed; - ti->mmio = ioremap(req.Base, req.Size); + ti->mmio = ioremap(link->resource[2]->start, + resource_size(link->resource[2])); /* Allocate the SRAM memory window */ - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; - req.Attributes |= WIN_USE_WAIT; - req.Base = 0; - req.Size = sramsize * 1024; - req.AccessSpeed = 250; - ret = pcmcia_request_window(link, &req, &info->sram_win_handle); + link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; + link->resource[3]->flags |= WIN_USE_WAIT; + link->resource[3]->start = 0; + link->resource[3]->end = sramsize * 1024; + ret = pcmcia_request_window(link, link->resource[3], 250); if (ret) goto failed; - ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); + ret = pcmcia_map_mem_page(link, link->resource[3], srambase); if (ret) goto failed; ti->sram_base = srambase >> 12; - ti->sram_virt = ioremap(req.Base, req.Size); - ti->sram_phys = req.Base; + ti->sram_virt = ioremap(link->resource[3]->start, + resource_size(link->resource[3])); + ti->sram_phys = link->resource[3]->start; ret = pcmcia_request_configuration(link, &link->conf); if (ret) @@ -316,7 +314,7 @@ static void ibmtr_release(struct pcmcia_device *link) dev_dbg(&link->dev, "ibmtr_release\n"); - if (link->win) { + if (link->resource[2]->end) { struct tok_info *ti = netdev_priv(dev); iounmap(ti->mmio); } diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index c3edfe4..15e80ea 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -300,22 +300,22 @@ static void pcnet_detach(struct pcmcia_device *link) static hw_info_t *get_hwinfo(struct pcmcia_device *link) { struct net_device *dev = link->priv; - win_req_t req; u_char __iomem *base, *virt; int i, j; /* Allocate a small memory window */ - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; - req.Base = 0; req.Size = 0; - req.AccessSpeed = 0; - i = pcmcia_request_window(link, &req, &link->win); + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; + link->resource[2]->start = 0; link->resource[2]->end = 0; + i = pcmcia_request_window(link, link->resource[2], 0); if (i != 0) return NULL; - virt = ioremap(req.Base, req.Size); + virt = ioremap(link->resource[2]->start, + resource_size(link->resource[2])); for (i = 0; i < NR_INFO; i++) { - pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); - base = &virt[hw_info[i].offset & (req.Size-1)]; + pcmcia_map_mem_page(link, link->resource[2], + hw_info[i].offset & ~(resource_size(link->resource[2])-1)); + base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)]; if ((readb(base+0) == hw_info[i].a0) && (readb(base+2) == hw_info[i].a1) && (readb(base+4) == hw_info[i].a2)) { @@ -326,7 +326,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) } iounmap(virt); - j = pcmcia_release_window(link, link->win); + j = pcmcia_release_window(link, link->resource[2]); return (i < NR_INFO) ? hw_info+i : NULL; } /* get_hwinfo */ @@ -1459,7 +1459,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, { struct net_device *dev = link->priv; pcnet_dev_t *info = PRIV(dev); - win_req_t req; int i, window_size, offset, ret; window_size = (stop_pg - start_pg) << 8; @@ -1470,22 +1469,22 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, window_size = roundup_pow_of_two(window_size); /* Allocate a memory window */ - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; - req.Attributes |= WIN_USE_WAIT; - req.Base = 0; req.Size = window_size; - req.AccessSpeed = mem_speed; - ret = pcmcia_request_window(link, &req, &link->win); + link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; + link->resource[3]->flags |= WIN_USE_WAIT; + link->resource[3]->start = 0; link->resource[3]->end = window_size; + ret = pcmcia_request_window(link, link->resource[3], mem_speed); if (ret) goto failed; offset = (start_pg << 8) + cm_offset; offset -= offset % window_size; - ret = pcmcia_map_mem_page(link, link->win, offset); + ret = pcmcia_map_mem_page(link, link->resource[3], offset); if (ret) goto failed; /* Try scribbling on the buffer */ - info->base = ioremap(req.Base, window_size); + info->base = ioremap(link->resource[3]->start, + resource_size(link->resource[3])); for (i = 0; i < (TX_PAGES<<8); i += 2) __raw_writew((i>>1), info->base+offset+i); udelay(100); @@ -1494,19 +1493,20 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, pcnet_reset_8390(dev); if (i != (TX_PAGES<<8)) { iounmap(info->base); - pcmcia_release_window(link, link->win); - info->base = NULL; link->win = 0; + pcmcia_release_window(link, link->resource[3]); + info->base = NULL; goto failed; } ei_status.mem = info->base + offset; - ei_status.priv = req.Size; + ei_status.priv = resource_size(link->resource[3]); dev->mem_start = (u_long)ei_status.mem; - dev->mem_end = dev->mem_start + req.Size; + dev->mem_end = dev->mem_start + resource_size(link->resource[3]); ei_status.tx_start_page = start_pg; ei_status.rx_start_page = start_pg + TX_PAGES; - ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); + ei_status.stop_page = start_pg + ( + (resource_size(link->resource[3]) - offset) >> 8); /* set up block i/o functions */ ei_status.get_8390_hdr = &shmem_get_8390_hdr; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 377367d..acc6807 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -442,7 +442,6 @@ static int mhz_mfc_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; struct smc_private *smc = netdev_priv(dev); - win_req_t req; unsigned int offset; int i; @@ -459,16 +458,16 @@ static int mhz_mfc_config(struct pcmcia_device *link) dev->base_addr = link->resource[0]->start; /* Allocate a memory window, for accessing the ISR */ - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; - req.Base = req.Size = 0; - req.AccessSpeed = 0; - i = pcmcia_request_window(link, &req, &link->win); + link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; + link->resource[2]->start = link->resource[2]->end = 0; + i = pcmcia_request_window(link, link->resource[2], 0); if (i != 0) return -ENODEV; - smc->base = ioremap(req.Base, req.Size); + smc->base = ioremap(link->resource[2]->start, + resource_size(link->resource[2])); offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; - i = pcmcia_map_mem_page(link, link->win, offset); + i = pcmcia_map_mem_page(link, link->resource[2], offset); if ((i == 0) && (smc->manfid == MANFID_MEGAHERTZ) && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) @@ -999,7 +998,7 @@ config_failed: static void smc91c92_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "smc91c92_release\n"); - if (link->win) { + if (link->resource[2]->end) { struct net_device *dev = link->priv; struct smc_private *smc = netdev_priv(dev); iounmap(smc->base); diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f581952..4308bda 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -869,8 +869,6 @@ xirc2ps_config(struct pcmcia_device * link) goto config_error; if (local->dingo) { - win_req_t req; - /* Reset the modem's BAR to the correct value * This is necessary because in the RequestConfiguration call, * the base address of the ethernet port (BasePort1) is written @@ -890,14 +888,14 @@ xirc2ps_config(struct pcmcia_device * link) * is at 0x0800. So we allocate a window into the attribute * memory and write direct to the CIS registers */ - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; - req.Base = req.Size = 0; - req.AccessSpeed = 0; - if ((err = pcmcia_request_window(link, &req, &link->win))) + link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | + WIN_ENABLE; + link->resource[2]->start = link->resource[2]->end = 0; + if ((err = pcmcia_request_window(link, link->resource[2], 0))) goto config_error; - local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; - if ((err = pcmcia_map_mem_page(link, link->win, 0))) + local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; + if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) goto config_error; /* Setup the CCRs; there are no infos in the CIS about the Ethernet @@ -988,7 +986,7 @@ xirc2ps_release(struct pcmcia_device *link) { dev_dbg(&link->dev, "release\n"); - if (link->win) { + if (link->resource[2]->end) { struct net_device *dev = link->priv; local_info_t *local = netdev_priv(dev); if (local->dingo) diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index dfbc41d..618d9b5 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -63,7 +63,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev) static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) { struct ssb_bus *ssb; - win_req_t win; int err = -ENOMEM; int res = 0; @@ -76,16 +75,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) dev->conf.Attributes = CONF_ENABLE_IRQ; dev->conf.IntType = INT_MEMORY_AND_IO; - win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | + dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | WIN_USE_WAIT; - win.Base = 0; - win.Size = SSB_CORE_SIZE; - win.AccessSpeed = 250; - res = pcmcia_request_window(dev, &win, &dev->win); + dev->resource[2]->start = 0; + dev->resource[2]->end = SSB_CORE_SIZE; + res = pcmcia_request_window(dev, dev->resource[2], 250); if (res != 0) goto err_kfree_ssb; - res = pcmcia_map_mem_page(dev, dev->win, 0); + res = pcmcia_map_mem_page(dev, dev->resource[2], 0); if (res != 0) goto err_disable; @@ -96,7 +94,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) if (res != 0) goto err_disable; - err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); + err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); if (err) goto err_disable; dev->priv = ssb; diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 88560d0..ab34cb8 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -391,7 +391,6 @@ static int ray_config(struct pcmcia_device *link) { int ret = 0; int i; - win_req_t req; struct net_device *dev = (struct net_device *)link->priv; ray_dev_t *local = netdev_priv(dev); @@ -420,46 +419,45 @@ static int ray_config(struct pcmcia_device *link) goto failed; /*** Set up 32k window for shared memory (transmit and control) ************/ - req.Attributes = - WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; - req.Base = 0; - req.Size = 0x8000; - req.AccessSpeed = ray_mem_speed; - ret = pcmcia_request_window(link, &req, &link->win); + link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; + link->resource[2]->start = 0; + link->resource[2]->end = 0x8000; + ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); if (ret) goto failed; - ret = pcmcia_map_mem_page(link, link->win, 0); + ret = pcmcia_map_mem_page(link, link->resource[2], 0); if (ret) goto failed; - local->sram = ioremap(req.Base, req.Size); + local->sram = ioremap(link->resource[2]->start, + resource_size(link->resource[2])); /*** Set up 16k window for shared memory (receive buffer) ***************/ - req.Attributes = + link->resource[3]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; - req.Base = 0; - req.Size = 0x4000; - req.AccessSpeed = ray_mem_speed; - ret = pcmcia_request_window(link, &req, &local->rmem_handle); + link->resource[3]->start = 0; + link->resource[3]->end = 0x4000; + ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); if (ret) goto failed; - ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); + ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); if (ret) goto failed; - local->rmem = ioremap(req.Base, req.Size); + local->rmem = ioremap(link->resource[3]->start, + resource_size(link->resource[3])); /*** Set up window for attribute memory ***********************************/ - req.Attributes = + link->resource[4]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; - req.Base = 0; - req.Size = 0x1000; - req.AccessSpeed = ray_mem_speed; - ret = pcmcia_request_window(link, &req, &local->amem_handle); + link->resource[4]->start = 0; + link->resource[4]->end = 0x1000; + ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); if (ret) goto failed; - ret = pcmcia_map_mem_page(link, local->amem_handle, 0); + ret = pcmcia_map_mem_page(link, link->resource[4], 0); if (ret) goto failed; - local->amem = ioremap(req.Base, req.Size); + local->amem = ioremap(link->resource[4]->start, + resource_size(link->resource[4])); dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h index 9f01ddb..e79848f 100644 --- a/drivers/net/wireless/ray_cs.h +++ b/drivers/net/wireless/ray_cs.h @@ -25,8 +25,6 @@ struct beacon_rx { typedef struct ray_dev_t { int card_status; int authentication_state; - window_handle_t amem_handle; /* handle to window for attribute memory */ - window_handle_t rmem_handle; /* handle to window for rx buffer on card */ void __iomem *sram; /* pointer to beginning of shared RAM */ void __iomem *amem; /* pointer to attribute mem window */ void __iomem *rmem; /* pointer to receive buffer window */ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 54aa1c2..3ea2e94 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -204,11 +204,10 @@ int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) EXPORT_SYMBOL(pcmcia_write_config_byte); -int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, +int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, unsigned int offset) { struct pcmcia_socket *s = p_dev->socket; - struct resource *res = wh; unsigned int w; int ret; @@ -384,7 +383,12 @@ out: return ret; } /* pcmcia_release_io */ - +/** + * pcmcia_release_window() - release reserved iomem for PCMCIA devices + * + * pcmcia_release_window() releases struct resource *res which was + * previously reserved by calling pcmcia_request_window(). + */ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) { struct pcmcia_socket *s = p_dev->socket; @@ -418,6 +422,8 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) kfree(win->res); win->res = NULL; } + res->start = res->end = 0; + res->flags = IORESOURCE_MEM; p_dev->_win &= ~CLIENT_WIN_REQ(w); mutex_unlock(&s->ops_mutex); @@ -786,17 +792,21 @@ int pcmcia_setup_irq(struct pcmcia_device *p_dev) } -/** pcmcia_request_window +/** + * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices * - * Request_window() establishes a mapping between card memory space - * and system memory space. + * pcmcia_request_window() attepts to reserve an iomem ranges specified in + * struct resource *res pointing to one of the entries in + * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the + * requested start of the IO mem resource; "end" reflects the size + * requested. */ -int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) +int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, + unsigned int speed) { struct pcmcia_socket *s = p_dev->socket; pccard_mem_map *win; u_long align; - struct resource *res; int w; if (!(s->state & SOCKET_PRESENT)) { @@ -805,19 +815,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha } /* Window size defaults to smallest available */ - if (req->Size == 0) - req->Size = s->map_size; - align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; - if (req->Size & (s->map_size-1)) { + if (res->end == 0) + res->end = s->map_size; + align = (s->features & SS_CAP_MEM_ALIGN) ? res->end : s->map_size; + if (res->end & (s->map_size-1)) { dev_dbg(&s->dev, "invalid map size\n"); return -EINVAL; } - if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || - (req->Base & (align-1))) { + if ((res->start && (s->features & SS_CAP_STATIC_MAP)) || + (res->start & (align-1))) { dev_dbg(&s->dev, "invalid base address\n"); return -EINVAL; } - if (req->Base) + if (res->start) align = 0; /* Allocate system memory window */ @@ -834,7 +844,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha win = &s->win[w]; if (!(s->features & SS_CAP_STATIC_MAP)) { - win->res = pcmcia_find_mem_region(req->Base, req->Size, align, + win->res = pcmcia_find_mem_region(res->start, res->end, align, 0, s); if (!win->res) { dev_dbg(&s->dev, "allocating mem region failed\n"); @@ -846,8 +856,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha /* Configure the socket controller */ win->map = w+1; - win->flags = req->Attributes; - win->speed = req->AccessSpeed; + win->flags = res->flags & WIN_FLAGS_MAP; + win->speed = speed; win->card_start = 0; if (s->ops->set_mem_map(s, win) != 0) { @@ -859,17 +869,14 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha /* Return window handle */ if (s->features & SS_CAP_STATIC_MAP) - req->Base = win->static_start; + res->start = win->static_start; else - req->Base = win->res->start; + res->start = win->res->start; /* convert to new-style resources */ - res = p_dev->resource[w + MAX_IO_WIN]; - res->start = req->Base; - res->end = req->Base + req->Size - 1; - res->flags &= ~IORESOURCE_BITS; - res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); - res->flags |= IORESOURCE_MEM; + res->end += res->start - 1; + res->flags &= ~WIN_FLAGS_REQ; + res->flags |= (win->map << 2) | IORESOURCE_MEM; res->parent = win->res; if (win->res) request_resource(&iomem_resource, res); @@ -877,7 +884,6 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha dev_dbg(&s->dev, "request_window results in %pR\n", res); mutex_unlock(&s->ops_mutex); - *wh = res; return 0; } /* pcmcia_request_window */ diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index dd9b403..c65ed6e 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1596,18 +1596,13 @@ static void nsp_cs_detach(struct pcmcia_device *link) ethernet device available to the system. ======================================================================*/ -struct nsp_cs_configdata { - nsp_hw_data *data; - win_req_t req; -}; - static int nsp_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, unsigned int vcc, void *priv_data) { - struct nsp_cs_configdata *cfg_mem = priv_data; + struct nsp_hw_data *data = priv_data; if (cfg->index == 0) return -ENODEV; @@ -1663,21 +1658,24 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { cistpl_mem_t *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; - cfg_mem->req.Size = mem->win[0].len; - if (cfg_mem->req.Size < 0x1000) - cfg_mem->req.Size = 0x1000; - cfg_mem->req.AccessSpeed = 0; - if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) + p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | + WIN_MEMORY_TYPE_CM | + WIN_ENABLE); + p_dev->resource[2]->start = mem->win[0].host_addr; + p_dev->resource[2]->end = mem->win[0].len; + if (p_dev->resource[2]->end < 0x1000) + p_dev->resource[2]->end = 0x1000; + if (pcmcia_request_window(p_dev, p_dev->resource[2], + 0) != 0) goto next_entry; - if (pcmcia_map_mem_page(p_dev, p_dev->win, + if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], mem->win[0].card_addr) != 0) goto next_entry; - cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); - cfg_mem->data->MmioLength = cfg_mem->req.Size; + data->MmioAddress = (unsigned long) + ioremap_nocache(p_dev->resource[2]->start, + resource_size(p_dev->resource[2])); + data->MmioLength = resource_size(p_dev->resource[2]); } /* If we got this far, we're cool! */ return 0; @@ -1693,18 +1691,12 @@ static int nsp_cs_config(struct pcmcia_device *link) { int ret; scsi_info_t *info = link->priv; - struct nsp_cs_configdata *cfg_mem; struct Scsi_Host *host; nsp_hw_data *data = &nsp_data_base; nsp_dbg(NSP_DEBUG_INIT, "in"); - cfg_mem = kzalloc(sizeof(*cfg_mem), GFP_KERNEL); - if (!cfg_mem) - return -ENOMEM; - cfg_mem->data = data; - - ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); + ret = pcmcia_loop_config(link, nsp_cs_config_check, data); if (ret) goto cs_failed; @@ -1767,18 +1759,15 @@ static int nsp_cs_config(struct pcmcia_device *link) printk(", io %pR", link->resource[0]); if (link->resource[1]) printk(" & %pR", link->resource[1]); - if (link->win) - printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, - cfg_mem->req.Base+cfg_mem->req.Size-1); + if (link->resource[1]) + printk(", mem %pR", link->resource[2]); printk("\n"); - kfree(cfg_mem); return 0; cs_failed: nsp_dbg(NSP_DEBUG_INIT, "config fail"); nsp_cs_release(link); - kfree(cfg_mem); return -ENODEV; } /* nsp_cs_config */ diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 68d8bde..63cb9bb 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -68,28 +68,4 @@ typedef struct config_req_t { #define PRESENT_IOBASE_3 0x100 #define PRESENT_IOSIZE 0x200 -/* For RequestWindow */ -typedef struct win_req_t { - u_int Attributes; - u_long Base; - u_int Size; - u_int AccessSpeed; -} win_req_t; - -/* Attributes for RequestWindow */ -#define WIN_MEMORY_TYPE_CM 0x00 /* default */ -#define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ -#define WIN_DATA_WIDTH_8 0x00 /* default */ -#define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ -#define WIN_ENABLE 0x01 /* MAP_ACTIVE */ -#define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ - -#define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | - MAP_USE_WAIT */ -#define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: - 0x04 -> 0 - 0x08 -> 1 - 0x0c -> 2 - 0x10 -> 3 */ - #endif /* _LINUX_CS_H */ diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 70c58ed..6f7cb38 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -36,8 +36,6 @@ struct pcmcia_device; struct config_t; struct net_device; -typedef struct resource *window_handle_t; - /* dynamic device IDs for PCMCIA device drivers. See * Documentation/pcmcia/driver.txt for details. */ @@ -92,7 +90,6 @@ struct pcmcia_device { /* deprecated, will be cleaned up soon */ config_req_t conf; - window_handle_t win; /* device setup */ unsigned int irq; @@ -209,10 +206,10 @@ int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req); -int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, - window_handle_t *wh); -int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); -int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, +int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, + unsigned int speed); +int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); +int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, unsigned int offset); int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); @@ -234,6 +231,23 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) return IO_DATA_PATH_WIDTH_AUTO; } +/* IO memory */ +#define WIN_MEMORY_TYPE_CM 0x00 /* default */ +#define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ +#define WIN_DATA_WIDTH_8 0x00 /* default */ +#define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ +#define WIN_ENABLE 0x01 /* MAP_ACTIVE */ +#define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ + +#define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | + MAP_USE_WAIT */ +#define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: + 0x04 -> 0 + 0x08 -> 1 + 0x0c -> 2 + 0x10 -> 3 */ + + #endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:08 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:08 +0200 Subject: [PATCH 09/15] pcmcia: Documentation update In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-9-git-send-email-linux@dominikbrodowski.net> Fill in missing descriptions and update some others for functions in pcmcia_resource.c. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pcmcia_resource.c | 93 +++++++++++++++++++++++++++++--------- 1 files changed, 71 insertions(+), 22 deletions(-) diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index f778e6c..511ae78 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -6,7 +6,7 @@ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * Copyright (C) 1999 David A. Hinds - * Copyright (C) 2004-2005 Dominik Brodowski + * Copyright (C) 2004-2010 Dominik Brodowski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -55,6 +55,10 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, } +/** + * release_io_space() - release IO ports allocated with alloc_io_space() + * + */ static void release_io_space(struct pcmcia_socket *s, struct resource *res) { resource_size_t num = resource_size(res); @@ -80,9 +84,11 @@ static void release_io_space(struct pcmcia_socket *s, struct resource *res) } } } -} /* release_io_space */ +} -/** alloc_io_space + +/** + * alloc_io_space() - allocate IO ports for use by a PCMCIA device * * Special stuff for managing IO windows, because they are scarce */ @@ -134,7 +140,7 @@ static int alloc_io_space(struct pcmcia_socket *s, struct resource *res, } dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); return ret; -} /* alloc_io_space */ +} /** @@ -174,7 +180,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, mutex_unlock(&s->ops_mutex); return ret; -} /* pcmcia_access_config */ +} /** @@ -203,6 +209,13 @@ int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) EXPORT_SYMBOL(pcmcia_write_config_byte); +/** + * pcmcia_map_mem_page() - modify IO window to point to a different offset + * + * pcmcia_map_mem_page() modifies what can be read and written by accessing + * an iomem range previously enabled by pcmcia_request_window(), by setting + * the card_offset value to @offset. + */ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, unsigned int offset) { @@ -221,7 +234,7 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, dev_warn(&s->dev, "failed to set_mem_map\n"); mutex_unlock(&s->ops_mutex); return ret; -} /* pcmcia_map_mem_page */ +} EXPORT_SYMBOL(pcmcia_map_mem_page); @@ -312,6 +325,16 @@ unlock: EXPORT_SYMBOL(pcmcia_fixup_vpp); +/** + * pcmcia_release_configuration() - physically disable a PCMCIA device + * + * pcmcia_release_configuration() is the 1:1 counterpart to + * pcmcia_enable_device(): If a PCMCIA device is no longer used by any + * driver, the Vpp voltage is set to 0, IRQs will no longer be generated, + * and I/O ranges will be disabled. As pcmcia_release_io() and + * pcmcia_release_window() still need to be called, device drivers are + * expected to call pcmcia_disable_device() instead. + */ int pcmcia_release_configuration(struct pcmcia_device *p_dev) { pccard_io_map io = { 0, 0, 0, 0, 1 }; @@ -324,7 +347,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) if (p_dev->_locked) { p_dev->_locked = 0; if (--(s->lock_count) == 0) { - s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ + s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ s->socket.Vpp = 0; s->socket.io_irq = 0; s->ops->set_socket(s, &s->socket); @@ -346,16 +369,17 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) mutex_unlock(&s->ops_mutex); return 0; -} /* pcmcia_release_configuration */ +} -/** pcmcia_release_io +/** + * pcmcia_release_io() - release I/O allocated by a PCMCIA device * - * Release_io() releases the I/O ranges allocated by a client. This - * may be invoked some time after a card ejection has already dumped - * the actual socket configuration, so if the client is "stale", we - * don't bother checking the port ranges against the current socket - * values. + * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA + * device. This may be invoked some time after a card ejection has + * already dumped the actual socket configuration, so if the client is + * "stale", we don't bother checking the port ranges against the + * current socket values. */ static int pcmcia_release_io(struct pcmcia_device *p_dev) { @@ -383,10 +407,11 @@ out: return ret; } /* pcmcia_release_io */ + /** * pcmcia_release_window() - release reserved iomem for PCMCIA devices * - * pcmcia_release_window() releases struct resource *res which was + * pcmcia_release_window() releases &struct resource *res which was * previously reserved by calling pcmcia_request_window(). */ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) @@ -431,9 +456,16 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) } /* pcmcia_release_window */ EXPORT_SYMBOL(pcmcia_release_window); + /** * pcmcia_enable_device() - set up and activate a PCMCIA device + * @p_dev - the associated PCMCIA device + * @flags - configuration options for this PCMCIA device * + * pcmcia_enable_device() physically enables a PCMCIA device. It parses + * the flags passed to in @flags and stored in @p_dev->flags and sets up + * the Vpp voltage, enables the speaker line, I/O ports and store proper + * values to configuration registers. */ int pcmcia_enable_device(struct pcmcia_device *p_dev) { @@ -565,8 +597,9 @@ EXPORT_SYMBOL(pcmcia_enable_device); /** * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices + * @p_dev - the associated PCMCIA device * - * pcmcia_request_io() attepts to reserve the IO port ranges specified in + * pcmcia_request_io() attempts to reserve the IO port ranges specified in * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The * "start" value is the requested start of the IO port resource; "end" * reflects the number of ports requested. The number of IO lines requested @@ -624,10 +657,10 @@ EXPORT_SYMBOL(pcmcia_request_io); /** * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device * - * pcmcia_request_irq() is a wrapper around request_irq which will allow + * pcmcia_request_irq() is a wrapper around request_irq() which allows * the PCMCIA core to clean up the registration in pcmcia_disable_device(). * Drivers are free to use request_irq() directly, but then they need to - * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ + * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ * handlers are allowed. */ int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, @@ -651,11 +684,11 @@ EXPORT_SYMBOL(pcmcia_request_irq); /** * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first * - * pcmcia_request_exclusive_irq() is a wrapper around request_irq which + * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which * attempts first to request an exclusive IRQ. If it fails, it also accepts * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for * IRQ sharing and either use request_irq directly (then they need to call - * free_irq themselves, too), or the pcmcia_request_irq() function. + * free_irq() themselves, too), or the pcmcia_request_irq() function. */ int __must_check __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, @@ -798,10 +831,13 @@ int pcmcia_setup_irq(struct pcmcia_device *p_dev) /** * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices + * @p_dev - the associated PCMCIA device + * @res - &struct resource pointing to p_dev->resource[2..5] + * @speed - access speed * * pcmcia_request_window() attepts to reserve an iomem ranges specified in - * struct resource *res pointing to one of the entries in - * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the + * &struct resource @res pointing to one of the entries in + * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the * requested start of the IO mem resource; "end" reflects the size * requested. */ @@ -893,6 +929,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, } /* pcmcia_request_window */ EXPORT_SYMBOL(pcmcia_request_window); + +/** + * pcmcia_disable_device() - disable and clean up a PCMCIA device + * @p_dev - the associated PCMCIA device + * + * pcmcia_disable_device() is the driver-callable counterpart to + * pcmcia_enable_device(): If a PCMCIA device is no longer used, + * drivers are expected to clean up and disable the device by calling + * this function. Any I/O ranges (iomem and ioports) will be released, + * the Vpp voltage will be set to 0, and IRQs will no longer be + * generated -- at least if there is no other card function (of + * multifunction devices) being used. + */ void pcmcia_disable_device(struct pcmcia_device *p_dev) { int i; -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:02 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:02 +0200 Subject: [PATCH 03/15] pcmcia: move Vpp setup to struct pcmcia_device In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-3-git-send-email-linux@dominikbrodowski.net> Some drivers prefer to explicitly set Vpp. Instead of passing the voltage inside config_req_t, store it in struct pcmcia_device. CC: linux-ide at vger.kernel.org CC: netdev at vger.kernel.org CC: linux-bluetooth at vger.kernel.org CC: linux-mtd at lists.infradead.org CC: linux-wireless at vger.kernel.org CC: linux-serial at vger.kernel.org CC: linux-usb at vger.kernel.org CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 4 ++-- drivers/bluetooth/bt3c_cs.c | 2 +- drivers/bluetooth/btuart_cs.c | 2 +- drivers/ide/ide-cs.c | 6 +++--- drivers/isdn/hisax/sedlbauer_cs.c | 8 ++++---- drivers/mtd/maps/pcmciamtd.c | 4 ++-- drivers/net/wireless/airo_cs.c | 8 ++++---- drivers/net/wireless/atmel_cs.c | 4 ++-- drivers/net/wireless/hostap/hostap_cs.c | 10 +++++----- drivers/net/wireless/orinoco/orinoco_cs.c | 4 ++-- drivers/net/wireless/orinoco/spectrum_cs.c | 4 ++-- drivers/pcmcia/pcmcia_resource.c | 3 ++- drivers/scsi/pcmcia/nsp_cs.c | 8 ++++---- drivers/serial/serial_cs.c | 2 +- drivers/usb/host/sl811_cs.c | 8 ++++---- include/pcmcia/cs.h | 1 - include/pcmcia/ds.h | 1 + 17 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index e944aa0..12cdc9f 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -194,9 +194,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; + pdev->vpp = cfg->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; + pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 7ab8f29..2c8d981 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -686,7 +686,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; + p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { p_dev->resource[0]->start = cf->io.win[0].base; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 1c4f5e8..7ea6fa4 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -615,7 +615,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev, p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; + p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { p_dev->resource[0]->start = cf->io.win[0].base; diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 2a4cb9c..82690e4 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -221,9 +221,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; + pdev->vpp = cfg->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; + pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; @@ -311,7 +311,7 @@ static int ide_config(struct pcmcia_device *link) info->host = host; dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 'a' + host->ports[0]->index * 2, - link->conf.Vpp / 10, link->conf.Vpp % 10); + link->vpp / 10, link->vpp % 10); kfree(stk); return 0; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index a024192..ad07d61 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -191,9 +191,9 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; else if (dflt->vpp1.present & (1<conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->conf.Attributes |= CONF_ENABLE_IRQ; @@ -257,8 +257,8 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x:", link->conf.ConfigIndex); - if (link->conf.Vpp) - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); + if (link->vpp) + printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 31ce404..ab94c8a 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -570,9 +570,9 @@ static int pcmciamtd_config(struct pcmcia_device *link) dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; link->conf.Attributes = 0; if(setvpp == 2) { - link->conf.Vpp = dev->vpp; + link->vpp = dev->vpp; } else { - link->conf.Vpp = 0; + link->vpp = 0; } link->conf.IntType = INT_MEMORY; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 9a121a5..488e7b4 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -166,9 +166,9 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; else if (dflt->vpp1.present & (1<conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->conf.Attributes |= CONF_ENABLE_IRQ; @@ -244,8 +244,8 @@ static int airo_config(struct pcmcia_device *link) /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x: ", link->conf.ConfigIndex); - if (link->conf.Vpp) - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); + if (link->vpp) + printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 3b63216..479f508 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -183,9 +183,9 @@ static int atmel_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; else if (dflt->vpp1.present & (1<conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; p_dev->conf.Attributes |= CONF_ENABLE_IRQ; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ba54d1b..3f35dd4 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -508,9 +508,9 @@ static int prism2_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; + p_dev->vpp = cfg->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; + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; @@ -605,9 +605,9 @@ static int prism2_config(struct pcmcia_device *link) /* Finally, report what we've done */ printk(KERN_INFO "%s: index 0x%02x: ", dev_info, link->conf.ConfigIndex); - if (link->conf.Vpp) - printk(", Vpp %d.%d", link->conf.Vpp / 10, - link->conf.Vpp % 10); + if (link->vpp) + printk(", Vpp %d.%d", link->vpp / 10, + link->vpp % 10); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); if (link->resource[0]) diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index ef46a2d..f7e3fa6 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -181,10 +181,10 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 873877e..1bbad10 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -243,10 +243,10 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 45c1ac4..fb28178 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -303,6 +303,7 @@ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) ret = -EIO; goto unlock; } + p_dev->vpp = new_vpp; unlock: mutex_unlock(&s->ops_mutex); @@ -458,7 +459,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, } /* Do power control. We don't allow changes in Vcc. */ - s->socket.Vpp = req->Vpp; + s->socket.Vpp = p_dev->vpp; if (s->ops->set_socket(s, &s->socket)) { mutex_unlock(&s->ops_mutex); dev_printk(KERN_WARNING, &s->dev, diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index c65ed6e..e475ec5 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1624,10 +1624,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { - p_dev->conf.Vpp = + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { - p_dev->conf.Vpp = + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; } @@ -1749,8 +1749,8 @@ static int nsp_cs_config(struct pcmcia_device *link) /* Finally, report what we've done */ printk(KERN_INFO "nsp_cs: index 0x%02x: ", link->conf.ConfigIndex); - if (link->conf.Vpp) { - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); + if (link->vpp) { + printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); } if (link->conf.Attributes & CONF_ENABLE_IRQ) { printk(", irq %d", link->irq); diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index dd0fa12..b851c1f 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -419,7 +419,7 @@ static int simple_config_check(struct pcmcia_device *p_dev, int *try = priv_data; if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = + p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; p_dev->io_lines = ((*try & 0x1) == 0) ? diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 0e13a00..8e84752 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -152,10 +152,10 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, } if (cfg->vpp1.present & (1<conf.Vpp = + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; else if (dflt->vpp1.present & (1<conf.Vpp = + p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; /* we need an interrupt */ @@ -201,8 +201,8 @@ static int sl811_cs_config(struct pcmcia_device *link) dev_info(&link->dev, "index 0x%02x: ", link->conf.ConfigIndex); - if (link->conf.Vpp) - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); + if (link->vpp) + printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); printk(", irq %d", link->irq); printk(", io %pR", link->resource[0]); printk("\n"); diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index e13d0cd..ccb8e6e 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -22,7 +22,6 @@ /* For RequestConfiguration */ typedef struct config_req_t { u_int Attributes; - u_int Vpp; /* both Vpp1 and Vpp2 */ u_int IntType; u_int ConfigBase; u_char Status, Pin, Copy, ExtStatus; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 8e307b9..6137fbc 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -94,6 +94,7 @@ struct pcmcia_device { /* device setup */ unsigned int irq; struct resource *resource[PCMCIA_NUM_RESOURCES]; + unsigned int vpp; unsigned int io_lines; /* number of I/O lines */ -- 1.7.0.4 From linux at dominikbrodowski.net Fri Sep 3 06:57:07 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 3 Sep 2010 12:57:07 +0200 Subject: [PATCH 08/15] pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <1283511434-21620-8-git-send-email-linux@dominikbrodowski.net> pcmcia_enable_device() now replaces pcmcia_request_configuration(). Instead of config_req_t, all necessary flags are either passed as a parameter to pcmcia_enable_device(), or (in rare circumstances) set in struct pcmcia_device -> flags. With the last remaining user of include/pcmcia/cs.h gone, remove all references. CC: netdev at vger.kernel.org CC: linux-wireless at vger.kernel.org CC: linux-ide at vger.kernel.org CC: linux-usb at vger.kernel.org CC: laforge at gnumonks.org CC: linux-mtd at lists.infradead.org CC: linux-bluetooth at vger.kernel.org CC: alsa-devel at alsa-project.org CC: linux-serial at vger.kernel.org CC: Jiri Kosina CC: linux-scsi at vger.kernel.org Signed-off-by: Dominik Brodowski --- Documentation/pcmcia/driver-changes.txt | 6 ++++ drivers/ata/pata_pcmcia.c | 5 +-- drivers/bluetooth/bluecard_cs.c | 5 +-- drivers/bluetooth/bt3c_cs.c | 5 +-- drivers/bluetooth/btuart_cs.c | 5 +-- drivers/bluetooth/dtl1_cs.c | 5 +-- drivers/char/pcmcia/cm4000_cs.c | 3 +- drivers/char/pcmcia/cm4040_cs.c | 5 +-- drivers/char/pcmcia/ipwireless/main.c | 6 +-- drivers/char/pcmcia/ipwireless/main.h | 1 - drivers/char/pcmcia/ipwireless/tty.h | 1 - drivers/char/pcmcia/synclink_cs.c | 10 ++---- drivers/ide/ide-cs.c | 6 ++-- drivers/isdn/hardware/avm/avm_cs.c | 5 +-- drivers/isdn/hisax/avma1_cs.c | 5 +-- drivers/isdn/hisax/elsa_cs.c | 8 +---- drivers/isdn/hisax/sedlbauer_cs.c | 12 ++----- drivers/isdn/hisax/teles_cs.c | 8 ++--- drivers/mmc/host/sdricoh_cs.c | 1 - drivers/mtd/maps/pcmciamtd.c | 6 +--- drivers/net/pcmcia/3c574_cs.c | 5 +-- drivers/net/pcmcia/3c589_cs.c | 5 +-- drivers/net/pcmcia/axnet_cs.c | 10 +++--- drivers/net/pcmcia/com20020_cs.c | 5 +-- drivers/net/pcmcia/fmvj18x_cs.c | 5 +-- drivers/net/pcmcia/ibmtr_cs.c | 5 +-- drivers/net/pcmcia/nmclan_cs.c | 5 +-- drivers/net/pcmcia/pcnet_cs.c | 8 ++-- drivers/net/pcmcia/smc91c92_cs.c | 9 ++--- drivers/net/pcmcia/xirc2ps_cs.c | 12 ++++---- drivers/net/wireless/airo_cs.c | 16 ++-------- drivers/net/wireless/atmel_cs.c | 16 ++-------- drivers/net/wireless/b43/pcmcia.c | 5 +-- drivers/net/wireless/hostap/hostap_cs.c | 10 ++---- drivers/net/wireless/libertas/if_cs.c | 10 ++---- drivers/net/wireless/orinoco/orinoco_cs.c | 12 +------ drivers/net/wireless/orinoco/spectrum_cs.c | 12 +------ drivers/net/wireless/ray_cs.c | 5 +-- drivers/net/wireless/wl3501_cs.c | 5 +-- drivers/parport/parport_cs.c | 5 +-- drivers/pcmcia/au1000_generic.h | 1 - drivers/pcmcia/au1000_pb1x00.c | 1 - drivers/pcmcia/cistpl.c | 1 - drivers/pcmcia/cs.c | 1 - drivers/pcmcia/cs_internal.h | 5 --- drivers/pcmcia/ds.c | 3 +- drivers/pcmcia/i82092.c | 1 - drivers/pcmcia/i82365.c | 1 - drivers/pcmcia/m32r_cfc.c | 1 - drivers/pcmcia/m32r_pcc.c | 1 - drivers/pcmcia/m8xx_pcmcia.c | 1 - drivers/pcmcia/pcmcia_cis.c | 1 - drivers/pcmcia/pcmcia_resource.c | 33 ++++++++++---------- drivers/pcmcia/pd6729.c | 1 - drivers/pcmcia/rsrc_iodyn.c | 1 - drivers/pcmcia/rsrc_mgr.c | 1 - drivers/pcmcia/rsrc_nonstatic.c | 1 - drivers/pcmcia/sa1100_generic.c | 1 - drivers/pcmcia/soc_common.h | 1 - drivers/pcmcia/socket_sysfs.c | 1 - drivers/pcmcia/tcic.c | 1 - drivers/pcmcia/xxs1500_ss.c | 1 - drivers/pcmcia/yenta_socket.c | 1 - drivers/scsi/pcmcia/aha152x_stub.c | 5 +-- drivers/scsi/pcmcia/fdomain_stub.c | 5 +-- drivers/scsi/pcmcia/nsp_cs.c | 13 +++----- drivers/scsi/pcmcia/qlogic_stub.c | 7 ++-- drivers/scsi/pcmcia/sym53c500_cs.c | 5 +-- drivers/serial/serial_cs.c | 9 ++--- drivers/ssb/main.c | 1 - drivers/ssb/pcmcia.c | 1 - drivers/ssb/scan.c | 1 - drivers/staging/comedi/drivers/cb_das16_cs.c | 11 ++----- drivers/staging/comedi/drivers/das08_cs.c | 17 ++--------- drivers/staging/comedi/drivers/ni_daq_700.c | 19 ++--------- drivers/staging/comedi/drivers/ni_daq_dio24.c | 19 ++--------- drivers/staging/comedi/drivers/ni_labpc_cs.c | 20 +++--------- drivers/staging/comedi/drivers/ni_mio_cs.c | 5 +-- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 17 ++--------- drivers/staging/wlags49_h2/wl_cs.c | 7 ++-- drivers/staging/wlags49_h2/wl_internal.h | 1 - drivers/telephony/ixj_pcmcia.c | 3 +- drivers/usb/host/sl811_cs.c | 7 +--- include/pcmcia/cs.h | 35 ---------------------- include/pcmcia/ds.h | 17 +++++++---- include/pcmcia/ss.h | 1 - sound/pcmcia/pdaudiocf/pdaudiocf.c | 5 ++- sound/pcmcia/pdaudiocf/pdaudiocf.h | 1 - sound/pcmcia/vx/vxpocket.c | 6 ++-- sound/pcmcia/vx/vxpocket.h | 1 - 90 files changed, 179 insertions(+), 394 deletions(-) delete mode 100644 include/pcmcia/cs.h diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 86e0f49..62a029f 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt @@ -1,4 +1,10 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: +* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36) + pcmcia_request_configuration() got renamed to pcmcia_enable_device(), + as it mirrors pcmcia_disable_device(). Configuration settings are now + stored in struct pcmcia_device, e.g. in the fields config_flags, + config_index, config_base, vpp. + * pcmcia_request_window changes (as of 2.6.36) Instead of win_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index c2679c0..76da55d 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -249,7 +248,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) /* Set up attributes in order to probe card and get resources */ pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - pdev->conf.Attributes = CONF_ENABLE_IRQ; + pdev->config_flags |= CONF_ENABLE_IRQ; /* See if we have a manufacturer identifier. Use it to set is_kme for vendor quirks */ @@ -275,7 +274,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) if (!pdev->irq) goto failed; - ret = pcmcia_request_configuration(pdev, &pdev->conf); + ret = pcmcia_enable_device(pdev); if (ret) goto failed; diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 08f4818..c9dd5b7 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include @@ -865,7 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return bluecard_config(link); } @@ -905,7 +904,7 @@ static int bluecard_config(struct pcmcia_device *link) if (i != 0) goto failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto failed; diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index fb01807..3db9588 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -660,7 +659,7 @@ static int bt3c_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 8; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return bt3c_config(link); } @@ -741,7 +740,7 @@ found_port: if (i != 0) goto failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto failed; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 897c7c7..c5c4359 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -589,7 +588,7 @@ static int btuart_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 8; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return btuart_config(link); } @@ -670,7 +669,7 @@ found_port: if (i != 0) goto failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto failed; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index b4c9a2e..38206df 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -575,7 +574,7 @@ static int dtl1_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 8; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return dtl1_config(link); } @@ -619,7 +618,7 @@ static int dtl1_config(struct pcmcia_device *link) if (i != 0) goto failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto failed; diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index d2accd6..75caa8c 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -1767,7 +1766,7 @@ static int cm4000_config(struct pcmcia_device * link, int devno) if (pcmcia_loop_config(link, cm4000_config_check, NULL)) goto cs_release; - if (pcmcia_request_configuration(link, &link->conf)) + if (pcmcia_enable_device(link)) goto cs_release; dev = link->priv; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index a32eba0..0c87b80 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -547,10 +546,10 @@ static int reader_config(struct pcmcia_device *link, int devno) if (pcmcia_loop_config(link, cm4040_config_check, NULL)) goto cs_release; - fail_rc = pcmcia_request_configuration(link, &link->conf); + fail_rc = pcmcia_enable_device(link); if (fail_rc != 0) { dev_printk(KERN_INFO, &link->dev, - "pcmcia_request_configuration failed 0x%x\n", + "pcmcia_enable_device failed 0x%x\n", fail_rc); goto cs_release; } diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 05c4e68..cd21b2b 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -32,7 +32,6 @@ #include #include #include -#include static struct pcmcia_device_id ipw_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), @@ -172,7 +171,7 @@ static int config_ipwireless(struct ipw_dev *ipw) if (ret != 0) return ret; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; INIT_WORK(&ipw->work_reboot, signalled_reboot_work); @@ -210,8 +209,7 @@ static int config_ipwireless(struct ipw_dev *ipw) * Do the RequestConfiguration last, because it enables interrupts. * Then we don't get any interrupts before we're ready for them. */ - ret = pcmcia_request_configuration(link, &link->conf); - + ret = pcmcia_enable_device(link); if (ret != 0) goto exit; diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/char/pcmcia/ipwireless/main.h index 9040219..f2cbb11 100644 --- a/drivers/char/pcmcia/ipwireless/main.h +++ b/drivers/char/pcmcia/ipwireless/main.h @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/drivers/char/pcmcia/ipwireless/tty.h b/drivers/char/pcmcia/ipwireless/tty.h index 3e163d4..747b2d6 100644 --- a/drivers/char/pcmcia/ipwireless/tty.h +++ b/drivers/char/pcmcia/ipwireless/tty.h @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 535aa08..99feaed 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -70,7 +70,6 @@ #include #include -#include #include #include #include @@ -550,8 +549,6 @@ static int mgslpc_probe(struct pcmcia_device *link) /* Initialize the struct pcmcia_device structure */ - link->conf.Attributes = 0; - ret = mgslpc_config(link); if (ret) return ret; @@ -593,14 +590,14 @@ static int mgslpc_config(struct pcmcia_device *link) if (ret != 0) goto failed; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 8; link->config_regs = PRESENT_OPTION; ret = pcmcia_request_irq(link, mgslpc_isr); if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -609,8 +606,7 @@ static int mgslpc_config(struct pcmcia_device *link) dev_info(&link->dev, "index 0x%02x:", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(", io %pR", link->resource[0]); printk("\n"); diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 07e3787..87ad049 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -99,7 +98,7 @@ static int ide_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return ide_config(link); } /* ide_attach */ @@ -284,7 +283,8 @@ static int ide_config(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 2d8bbbf..6ea5cd2 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -79,7 +78,7 @@ static int avmcs_probe(struct pcmcia_device *p_dev) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; /* General socket configuration */ - p_dev->conf.Attributes = CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; p_dev->config_index = 1; p_dev->config_regs = PRESENT_OPTION; @@ -149,7 +148,7 @@ static int avmcs_config(struct pcmcia_device *link) /* * configure the PCMCIA socket */ - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) { pcmcia_disable_device(link); break; diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index e25f6c7..5dd47ad 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "hisax_cfg.h" @@ -84,7 +83,7 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; /* General socket configuration */ - p_dev->conf.Attributes = CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; p_dev->config_index = 1; p_dev->config_regs = PRESENT_OPTION; @@ -160,7 +159,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) /* * configure the PCMCIA socket */ - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) { pcmcia_disable_device(link); break; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index f276e84..368c8a2 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -46,7 +46,6 @@ #include #include -#include #include #include #include @@ -129,8 +128,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) link->resource[0]->end = 8; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; - return elsa_cs_config(link); } /* elsa_cs_attach */ @@ -205,15 +202,14 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) if (!link->irq) goto failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x: ", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 43d0a4e..791e23a 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -46,7 +46,6 @@ #include #include -#include #include #include #include @@ -132,8 +131,6 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) link->resource[0]->end = 8; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->conf.Attributes = 0; - return sedlbauer_config(link); } /* sedlbauer_attach */ @@ -175,7 +172,7 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ @@ -192,7 +189,7 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -247,7 +244,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -256,8 +253,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) link->config_index); if (link->vpp) printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 614afc6..2ae71e3 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -109,7 +108,7 @@ static int __devinit teles_probe(struct pcmcia_device *link) link->resource[0]->end = 96; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return teles_cs_config(link); } /* teles_attach */ @@ -185,15 +184,14 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) if (!link->irq) goto cs_failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) goto cs_failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x:", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index 7aa65bb..7a7273b 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 99c7257..388db9e 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -568,7 +567,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; - link->conf.Attributes = 0; if(setvpp == 2) { link->vpp = dev->vpp; } else { @@ -577,7 +575,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) link->config_index = 0; DEBUG(2, "Setting Configuration"); - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret != 0) { if (dev->win_base) { iounmap(dev->win_base); @@ -718,8 +716,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link) dev->p_dev = link; link->priv = dev; - link->conf.Attributes = 0; - return pcmciamtd_config(link); } diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 4b670b3..8abce76 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -87,7 +87,6 @@ earlier 3Com products. #include #include -#include #include #include #include @@ -280,7 +279,7 @@ static int tc574_probe(struct pcmcia_device *link) spin_lock_init(&lp->window_lock); link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; dev->netdev_ops = &el3_netdev_ops; @@ -351,7 +350,7 @@ static int tc574_config(struct pcmcia_device *link) if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 6549e2c..34195c4 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -216,7 +215,7 @@ static int tc589_probe(struct pcmcia_device *link) link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; dev->netdev_ops = &el3_netdev_ops; @@ -293,7 +292,7 @@ static int tc589_config(struct pcmcia_device *link) if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 2c273ce..f361d28 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -39,7 +39,6 @@ #include #include "../8390.h" -#include #include #include #include @@ -166,7 +165,7 @@ static int axnet_probe(struct pcmcia_device *link) info = PRIV(dev); info->p_dev = link; link->priv = dev; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; dev->netdev_ops = &axnet_netdev_ops; @@ -332,11 +331,12 @@ static int axnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - + + link->config_flags |= CONF_ENABLE_IRQ; if (resource_size(link->resource[1]) == 8) - link->conf.Attributes |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index a58eafe..039731b 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -43,7 +43,6 @@ #include #include -#include #include #include @@ -160,7 +159,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->resource[0]->end = 16; - p_dev->conf.Attributes = CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; info->dev = dev; p_dev->priv = info; @@ -281,7 +280,7 @@ static int com20020_config(struct pcmcia_device *link) dev->irq = link->irq; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 23f5333..f6865ad 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -252,7 +251,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; /* General socket configuration */ - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; dev->netdev_ops = &fjn_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; @@ -431,7 +430,7 @@ static int fmvj18x_config(struct pcmcia_device *link) ret = pcmcia_request_irq(link, fjn_interrupt); if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index feedeeb..b298a3d 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -57,7 +57,6 @@ #include #include -#include #include #include @@ -152,7 +151,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = 4; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_regs = PRESENT_OPTION; info->dev = dev; @@ -269,7 +268,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) resource_size(link->resource[3])); ti->sram_phys = link->resource[3]->start; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 98c4a69..51bf76d 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -146,7 +146,6 @@ Include Files #include #include -#include #include #include #include @@ -460,7 +459,7 @@ static int nmclan_probe(struct pcmcia_device *link) spin_lock_init(&lp->bank_lock); link->resource[0]->end = 32; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; link->config_regs = PRESENT_OPTION; @@ -649,7 +648,7 @@ static int nmclan_config(struct pcmcia_device *link) ret = pcmcia_request_exclusive_irq(link, mace_interrupt); if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 49f463f..ddd4bd2 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -42,7 +42,6 @@ #include #include "../8390.h" -#include #include #include #include @@ -260,7 +259,7 @@ static int pcnet_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = dev; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; dev->netdev_ops = &pcnet_netdev_ops; @@ -552,14 +551,15 @@ static int pcnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; + link->config_flags = CONF_ENABLE_IRQ; if (resource_size(link->resource[1]) == 8) - link->conf.Attributes |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR; if ((link->manf_id == MANFID_IBM) && (link->card_id == PRODID_IBM_HOME_AND_AWAY)) link->config_index |= 0x10; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; dev->irq = link->irq; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 59f5034..8c16ba6 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -44,7 +44,6 @@ #include #include -#include #include #include #include @@ -326,7 +325,7 @@ static int smc91c92_probe(struct pcmcia_device *link) spin_lock_init(&smc->lock); link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; /* The SMC91c92-specific entries in the device structure. */ dev->netdev_ops = &smc_netdev_ops; @@ -444,7 +443,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) unsigned int offset; int i; - link->conf.Attributes |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->end = 8; @@ -637,7 +636,7 @@ static int osi_config(struct pcmcia_device *link) static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; int i, j; - link->conf.Attributes |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR; link->resource[0]->end = 64; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->end = 8; @@ -862,7 +861,7 @@ static int smc91c92_config(struct pcmcia_device *link) i = pcmcia_request_irq(link, smc_interrupt); if (i) goto config_failed; - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i) goto config_failed; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 1c8ebf2..7a4a99b 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -82,7 +82,6 @@ #include #include -#include #include #include #include @@ -529,7 +528,7 @@ xirc2ps_probe(struct pcmcia_device *link) link->priv = dev; /* General socket configuration */ - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; /* Fill in card specific entries */ @@ -811,9 +810,6 @@ xirc2ps_config(struct pcmcia_device * link) if (local->modem) { int pass; - if (do_sound) - link->conf.Attributes |= CONF_ENABLE_SPKR; - link->resource[1]->end = 8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; if (local->dingo) { @@ -863,7 +859,11 @@ xirc2ps_config(struct pcmcia_device * link) * This actually configures the PCMCIA socket -- setting up * the I/O windows and the interrupt mapping. */ - if ((err=pcmcia_request_configuration(link, &link->conf))) + link->config_flags |= CONF_ENABLE_IRQ; + if (do_sound) + link->config_flags |= CONF_ENABLE_SPKR; + + if ((err = pcmcia_enable_device(link))) goto config_error; if (local->dingo) { diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 40f9ed7..5939d0c 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -96,15 +95,6 @@ static int airo_probe(struct pcmcia_device *p_dev) dev_dbg(&p_dev->dev, "airo_attach()\n"); - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - p_dev->conf.Attributes = 0; - /* Allocate space for private device-specific data */ local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { @@ -158,7 +148,7 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ @@ -167,7 +157,7 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -229,7 +219,7 @@ static int airo_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; ((local_info_t *)link->priv)->eth_dev = diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 8b75158..080266e 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -42,7 +42,6 @@ #include #include -#include #include #include #include @@ -106,15 +105,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) dev_dbg(&p_dev->dev, "atmel_attach()\n"); - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - p_dev->conf.Attributes = 0; - /* Allocate space for private device-specific data */ local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { @@ -175,7 +165,7 @@ static int atmel_config_check(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ @@ -184,7 +174,7 @@ static int atmel_config_check(struct pcmcia_device *p_dev, else if (dflt->vpp1.present & (1<vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -242,7 +232,7 @@ static int atmel_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 138b26f..61abab1 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -72,7 +71,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) err = -ENODEV; - dev->conf.Attributes = CONF_ENABLE_IRQ; + dev->config_flags |= CONF_ENABLE_IRQ; dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | WIN_USE_WAIT; @@ -89,7 +88,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) if (!dev->irq) goto err_disable; - res = pcmcia_request_configuration(dev, &dev->conf); + res = pcmcia_enable_device(dev); if (res != 0) goto err_disable; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 5704d3f..5b0b582 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -484,7 +483,7 @@ static int prism2_config_check(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ @@ -510,7 +509,7 @@ static int prism2_config_check(struct pcmcia_device *p_dev, p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " @@ -590,7 +589,7 @@ static int prism2_config(struct pcmcia_device *link) * the I/O windows and the interrupt mapping, and putting the * card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed_unlock; @@ -605,8 +604,7 @@ static int prism2_config(struct pcmcia_device *link) if (link->vpp) printk(", Vpp %d.%d", link->vpp / 10, link->vpp % 10); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 814b7fa..6020c19 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -806,7 +805,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, p_dev->resource[0]->end = cfg->io.win[0].len; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ if (cfg->io.nwin != 1) { @@ -835,14 +834,11 @@ static int if_cs_probe(struct pcmcia_device *p_dev) card->p_dev = p_dev; p_dev->priv = card; - p_dev->conf.Attributes = 0; - if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { lbs_pr_err("error in pcmcia_loop_config\n"); goto out1; } - /* * Allocate an interrupt line. Note that this does not assign * a handler to the interrupt, unless the 'Handler' member of @@ -865,9 +861,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) * the I/O windows and the interrupt mapping, and putting the * card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(p_dev, &p_dev->conf); + ret = pcmcia_enable_device(p_dev); if (ret) { - lbs_pr_err("error in pcmcia_request_configuration\n"); + lbs_pr_err("error in pcmcia_enable_device\n"); goto out2; } diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 1147d6b..00316a1 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -117,13 +116,6 @@ orinoco_cs_probe(struct pcmcia_device *link) card->p_dev = link; link->priv = priv; - /* General socket configuration defaults can go here. In this - * client, we assume very little, and rely on the CIS for - * almost everything. In most clients, many details (i.e., - * number, sizes, and attributes of IO windows) are fixed by - * the nature of the device, and can be hard-wired here. */ - link->conf.Attributes = 0; - return orinoco_cs_config(link); } /* orinoco_cs_attach */ @@ -187,7 +179,7 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -266,7 +258,7 @@ orinoco_cs_config(struct pcmcia_device *link) * the I/O windows and the interrupt mapping, and putting the * card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 20b08ab..ca2c6c0 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -179,13 +178,6 @@ spectrum_cs_probe(struct pcmcia_device *link) card->p_dev = link; link->priv = priv; - /* General socket configuration defaults can go here. In this - * client, we assume very little, and rely on the CIS for - * almost everything. In most clients, many details (i.e., - * number, sizes, and attributes of IO windows) are fixed by - * the nature of the device, and can be hard-wired here. */ - link->conf.Attributes = 0; - return spectrum_cs_config(link); } /* spectrum_cs_attach */ @@ -249,7 +241,7 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -329,7 +321,7 @@ spectrum_cs_config(struct pcmcia_device *link) * the I/O windows and the interrupt mapping, and putting the * card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 7fb66cc..1457f34 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -46,7 +46,6 @@ #include #include -#include #include #include #include @@ -318,7 +317,7 @@ static int ray_probe(struct pcmcia_device *p_dev) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; /* General socket configuration */ - p_dev->conf.Attributes = CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; p_dev->config_index = 1; p_dev->priv = dev; @@ -413,7 +412,7 @@ static int ray_config(struct pcmcia_device *link) /* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3947cf8..101b6ff 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -48,7 +48,6 @@ #include -#include #include #include #include @@ -1888,7 +1887,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; /* General socket configuration */ - p_dev->conf.Attributes = CONF_ENABLE_IRQ; + p_dev->config_flags = CONF_ENABLE_IRQ; p_dev->config_index = 1; dev = alloc_etherdev(sizeof(struct wl3501_card)); @@ -1954,7 +1953,7 @@ static int wl3501_config(struct pcmcia_device *link) /* This actually configures the PCMCIA socket -- setting up the I/O * windows and the interrupt mapping. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8faf634..63b3d3c 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -48,7 +48,6 @@ #include #include -#include #include #include #include @@ -103,7 +102,7 @@ static int parport_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return parport_config(link); } /* parport_attach */ @@ -172,7 +171,7 @@ static int parport_config(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index 67530ce..5c36bda 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h @@ -23,7 +23,6 @@ /* include the world */ -#include #include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 807f2d7..b239664 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 91414a0..884a984 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 2ec8ac9..d8189d4 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 42eef43..7f1953f 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -33,14 +33,9 @@ typedef struct config_t { struct kref ref; unsigned int state; - unsigned int Attributes; struct resource io[MAX_IO_WIN]; /* io ports */ struct resource mem[MAX_WIN]; /* mem areas */ - - struct { - u_int Attributes; - } irq; } config_t; diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 00db600..dd43bd3 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -1178,7 +1177,7 @@ static int pcmcia_dev_resume(struct device *dev) if (p_dev->device_no == p_dev->func) { dev_dbg(dev, "requesting configuration\n"); - ret = pcmcia_request_configuration(p_dev, &p_dev->conf); + ret = pcmcia_enable_device(p_dev); if (ret) goto out; } diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index 05d0879..fc7906e 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -16,7 +16,6 @@ #include #include -#include #include #include diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 61746bd..72a033a 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -51,7 +51,6 @@ #include #include -#include #include diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 24de499..2adb010 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c @@ -27,7 +27,6 @@ #include #include -#include #undef MAX_IO_WIN /* FIXME */ #define MAX_IO_WIN 1 diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 8e47238..1511ff7 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c @@ -28,7 +28,6 @@ #include #include -#include /* XXX: should be moved into asm/irq.h */ #define PCC0_IRQ 24 diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index f0ecad9..99d4f23 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -59,7 +59,6 @@ #include #include -#include #include #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index ac47cc4..ce8b94a 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index ff83ab1..f778e6c 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -230,7 +229,7 @@ EXPORT_SYMBOL(pcmcia_map_mem_page); * pcmcia_fixup_iowidth() - reduce io width to 8bit * * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the - * IO width to 8bit after having called pcmcia_request_configuration() + * IO width to 8bit after having called pcmcia_enable_device() * previously. */ int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev) @@ -278,7 +277,7 @@ EXPORT_SYMBOL(pcmcia_fixup_iowidth); * pcmcia_fixup_vpp() - set Vpp to a new voltage level * * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to - * a new voltage level between calls to pcmcia_request_configuration() + * a new voltage level between calls to pcmcia_enable_device() * and pcmcia_disable_device(). */ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) @@ -432,18 +431,21 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) } /* pcmcia_release_window */ EXPORT_SYMBOL(pcmcia_release_window); - -int pcmcia_request_configuration(struct pcmcia_device *p_dev, - config_req_t *req) +/** + * pcmcia_enable_device() - set up and activate a PCMCIA device + * + */ +int pcmcia_enable_device(struct pcmcia_device *p_dev) { int i; - u_int base; + unsigned int base; struct pcmcia_socket *s = p_dev->socket; config_t *c; pccard_io_map iomap; unsigned char status = 0; unsigned char ext_status = 0; unsigned char option = 0; + unsigned int flags = p_dev->config_flags; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -466,23 +468,20 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, } /* Pick memory or I/O card, DMA mode, interrupt */ - c->Attributes = req->Attributes; if (p_dev->_io) s->socket.flags |= SS_IOCARD; - if (req->Attributes & CONF_ENABLE_DMA) - s->socket.flags |= SS_DMA_MODE; - if (req->Attributes & CONF_ENABLE_SPKR) { + if (flags & CONF_ENABLE_SPKR) { s->socket.flags |= SS_SPKR_ENA; status = CCSR_AUDIO_ENA; if (!(p_dev->config_regs & PRESENT_STATUS)) dev_warn(&p_dev->dev, "speaker requested, but " "PRESENT_STATUS not set!\n"); } - if (req->Attributes & CONF_ENABLE_IRQ) + if (flags & CONF_ENABLE_IRQ) s->socket.io_irq = s->pcmcia_irq; else s->socket.io_irq = 0; - if (req->Attributes & CONF_ENABLE_ESR) { + if (flags & CONF_ENABLE_ESR) { p_dev->config_regs |= PRESENT_EXT_STATUS; ext_status = ESR_REQ_ATTN_ENA; } @@ -510,8 +509,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, if (p_dev->config_regs & PRESENT_IOBASE_0) option |= COR_ADDR_DECODE; } - if ((req->Attributes & CONF_ENABLE_IRQ) && - !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) + if ((flags & CONF_ENABLE_IRQ) && + !(flags & CONF_ENABLE_PULSE_IRQ)) option |= COR_LEVEL_REQ; pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option); mdelay(40); @@ -560,8 +559,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, p_dev->_locked = 1; mutex_unlock(&s->ops_mutex); return 0; -} /* pcmcia_request_configuration */ -EXPORT_SYMBOL(pcmcia_request_configuration); +} /* pcmcia_enable_device */ +EXPORT_SYMBOL(pcmcia_enable_device); /** diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index b8a869a..05d6567 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -18,7 +18,6 @@ #include #include -#include #include diff --git a/drivers/pcmcia/rsrc_iodyn.c b/drivers/pcmcia/rsrc_iodyn.c index 8510c35..523eb69 100644 --- a/drivers/pcmcia/rsrc_iodyn.c +++ b/drivers/pcmcia/rsrc_iodyn.c @@ -17,7 +17,6 @@ #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index 4e80421..aa628ed 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c @@ -17,7 +17,6 @@ #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 96f348b..b187555 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -29,7 +29,6 @@ #include #include -#include #include #include "cs_internal.h" diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index e098514..945857f 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -35,7 +35,6 @@ #include #include -#include #include #include diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 3fba3a6..bbcd538 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h @@ -11,7 +11,6 @@ /* include the world */ #include -#include #include #include diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index cb0d3ac..71aeed9 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index be0d841..310160b 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -49,7 +49,6 @@ #include #include -#include #include #include "tcic.h" diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c index fa88c36..3b67a1b 100644 --- a/drivers/pcmcia/xxs1500_ss.c +++ b/drivers/pcmcia/xxs1500_ss.c @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 414d9a6..408dbaa 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -20,7 +20,6 @@ #include #include -#include #include "yenta_socket.h" #include "i82365.h" diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index c368249..e1f7485 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -49,7 +49,6 @@ #include #include "aha152x.h" -#include #include #include @@ -102,7 +101,7 @@ static int aha152x_probe(struct pcmcia_device *link) link->resource[0]->end = 0x20; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_regs = PRESENT_OPTION; return aha152x_config_cs(link); @@ -159,7 +158,7 @@ static int aha152x_config_cs(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index bb909e1..ae263b1 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -46,7 +46,6 @@ #include #include "fdomain.h" -#include #include #include @@ -85,7 +84,7 @@ static int fdomain_probe(struct pcmcia_device *link) link->priv = info; link->resource[0]->end = 0x10; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_regs = PRESENT_OPTION; return fdomain_config(link); @@ -131,7 +130,7 @@ static int fdomain_config(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index a63c460..7cb1ae6 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -47,7 +47,6 @@ #include #include -#include #include #include #include @@ -1562,7 +1561,7 @@ static int nsp_cs_probe(struct pcmcia_device *link) link->resource[0]->flags = IO_DATA_PATH_WIDTH_AUTO; /* General socket configuration */ - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; ret = nsp_cs_config(link); @@ -1608,7 +1607,7 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ @@ -1629,7 +1628,7 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, } /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -1700,7 +1699,7 @@ static int nsp_cs_config(struct pcmcia_device *link) if (pcmcia_request_irq(link, nspintr)) goto cs_failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto cs_failed; @@ -1749,9 +1748,7 @@ static int nsp_cs_config(struct pcmcia_device *link) if (link->vpp) { printk(", Vpp %d.%d", link->vpp/10, link->vpp%10); } - if (link->conf.Attributes & CONF_ENABLE_IRQ) { - printk(", irq %d", link->irq); - } + printk(", irq %d", link->irq); if (link->resource[0]) printk(", io %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 5e2cbe0..7d3f49c 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -48,7 +48,6 @@ #include #include "../qlogicfas408.h" -#include #include #include #include @@ -158,7 +157,7 @@ static int qlogic_probe(struct pcmcia_device *link) link->priv = info; link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_regs = PRESENT_OPTION; return qlogic_config(link); @@ -208,7 +207,7 @@ static int qlogic_config(struct pcmcia_device * link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -263,7 +262,7 @@ static int qlogic_resume(struct pcmcia_device *link) { scsi_info_t *info = link->priv; - pcmcia_request_configuration(link, &link->conf); + pcmcia_enable_device(link); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 9aaf974..600630e 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -71,7 +71,6 @@ #include #include -#include #include #include #include @@ -721,7 +720,7 @@ SYM53C500_config(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -861,7 +860,7 @@ SYM53C500_probe(struct pcmcia_device *link) link->priv = info; link->resource[0]->end = 16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; return SYM53C500_config(link); } /* SYM53C500_attach */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 8f25cc1..2285d5d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -184,7 +183,7 @@ static void quirk_config_socket(struct pcmcia_device *link) struct serial_info *info = link->priv; if (info->multi) - link->conf.Attributes |= CONF_ENABLE_ESR; + link->config_flags |= CONF_ENABLE_ESR; } static const struct serial_quirk quirks[] = { @@ -335,7 +334,7 @@ static int serial_probe(struct pcmcia_device *link) link->conf.Attributes = CONF_ENABLE_IRQ; if (do_sound) - link->conf.Attributes |= CONF_ENABLE_SPKR; + link->config_flags |= CONF_ENABLE_SPKR; return serial_config(link); } @@ -501,7 +500,7 @@ found_port: if (info->quirk && info->quirk->config) info->quirk->config(link); - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) return -1; return setup_serial(link, info, link->resource[0]->start, link->irq); @@ -578,7 +577,7 @@ static int multi_config(struct pcmcia_device *link) if (info->quirk && info->quirk->config) info->quirk->config(link); - i = pcmcia_request_configuration(link, &link->conf); + i = pcmcia_enable_device(link); if (i != 0) return -ENODEV; diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 7892ac1..c68b3dc 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 526682d..c7345db 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c index 9738cad..ee079ab 100644 --- a/drivers/ssb/scan.c +++ b/drivers/ssb/scan.c @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 034cbfc..ee91c89 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -37,7 +37,6 @@ Status: experimental #include #include -#include #include #include @@ -692,9 +691,6 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* Initialize the pcmcia_device structure */ - link->conf.Attributes = 0; - cur_dev = link; das16cs_pcmcia_config(link); @@ -723,7 +719,7 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, return -EINVAL; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -767,14 +763,13 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq); + printk(", irq %u", link->irq); if (link->resource[0]) printk(", io %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index e37ea79..f8f3de5 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -48,7 +48,6 @@ Command support does not exist, but could be added for this board. #include "das08.h" /* pcmcia includes */ -#include #include #include @@ -162,15 +161,6 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->conf.Attributes = 0; - cur_dev = link; das08_pcmcia_config(link); @@ -211,7 +201,7 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -263,14 +253,13 @@ static void das08_pcmcia_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq); + printk(", irq %u", link->irq); if (link->resource[0]) printk(", io %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 8107e40..803683b 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -47,7 +47,6 @@ IRQ is assigned but not used. #include -#include #include #include #include @@ -491,15 +490,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->conf.Attributes = 0; - pcmcia_cur_dev = link; dio700_config(link); @@ -550,10 +540,10 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -602,14 +592,13 @@ static void dio700_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret != 0) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(", io %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 4f9daa3..6512f7a 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -48,7 +48,6 @@ the PCMCIA interface. #include "8255.h" -#include #include #include #include @@ -243,15 +242,6 @@ static int dio24_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->conf.Attributes = 0; - pcmcia_cur_dev = link; dio24_config(link); @@ -302,10 +292,10 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -353,14 +343,13 @@ static void dio24_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 2e27a30..255cf40 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -71,7 +71,6 @@ NI manuals: #include "comedi_fc.h" #include "ni_labpc.h" -#include #include #include #include @@ -219,15 +218,6 @@ static int labpc_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->conf.Attributes = 0; - pcmcia_cur_dev = link; labpc_config(link); @@ -281,10 +271,10 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; + p_dev->config_flags |= CONF_ENABLE_SPKR; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -331,14 +321,14 @@ static void labpc_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; + ret = pcmcia_enable_device(link); if (ret) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq); + printk(", irq %d", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index be7e021..b88f52d 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -48,7 +48,6 @@ See the notes in the ni_atmio.o driver. #include "ni_stc.h" #include "8255.h" -#include #include #include @@ -265,7 +264,7 @@ static int cs_attach(struct pcmcia_device *link) { link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->resource[0]->end = 16; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; cur_dev = link; @@ -336,7 +335,7 @@ static void mio_cs_config(struct pcmcia_device *link) if (!link->irq) dev_info(&link->dev, "no IRQ available\n"); - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); } static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index a2a32de..b8940d7 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -50,7 +50,6 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include "../comedidev.h" #include -#include #include #include #include @@ -1031,15 +1030,6 @@ static int daqp_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; - /* - General socket configuration defaults can go here. In this - client, we assume very little, and rely on the CIS for almost - everything. In most clients, many details (i.e., number, sizes, - and attributes of IO windows) are fixed by the nature of the - device, and can be hard-wired here. - */ - link->conf.Attributes = 0; - daqp_cs_config(link); return 0; @@ -1088,7 +1078,7 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Do we need to allocate an interrupt? */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -1132,14 +1122,13 @@ static void daqp_cs_config(struct pcmcia_device *link) the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; /* Finally, report what we've done */ dev_info(&link->dev, "index 0x%02x", link->config_index); - if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq); + printk(", irq %u", link->irq); if (link->resource[0]) printk(" & %pR", link->resource[0]); if (link->resource[1]) diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 778800f..62a70af 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -83,7 +83,6 @@ #include #include -#include #include #include #include @@ -147,7 +146,7 @@ static int wl_adapter_attach(struct pcmcia_device *link) link->resource[0]->end = HCF_NUM_IO_PORTS; link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 5; link->config_regs = PRESENT_OPTION; @@ -301,7 +300,7 @@ void wl_adapter_insert(struct pcmcia_device *link) dev = link->priv; /* Do we need to allocate an interrupt? */ - link->conf.Attributes |= CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->io_lines = 6; ret = pcmcia_request_io(link); @@ -312,7 +311,7 @@ void wl_adapter_insert(struct pcmcia_device *link) if (ret != 0) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret != 0) goto failed; diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h index 02f0a20..cd129b3 100644 --- a/drivers/staging/wlags49_h2/wl_internal.h +++ b/drivers/staging/wlags49_h2/wl_internal.h @@ -69,7 +69,6 @@ ******************************************************************************/ #include #ifdef BUS_PCMCIA -#include #include #include #include diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 5ccc6d0..e23270d 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -8,7 +8,6 @@ #include /* error codes */ #include -#include #include #include @@ -143,7 +142,7 @@ static int ixj_config(struct pcmcia_device * link) if (pcmcia_loop_config(link, ixj_config_check, &dflt)) goto failed; - if (pcmcia_request_configuration(link, &link->conf)) + if (pcmcia_enable_device(link)) goto failed; /* diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 5904053..744c2cd 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -159,7 +158,7 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; /* we need an interrupt */ - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + p_dev->config_flags |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->resource[0]->end = p_dev->resource[1]->end = 0; @@ -195,7 +194,7 @@ static int sl811_cs_config(struct pcmcia_device *link) if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -227,8 +226,6 @@ static int sl811_cs_probe(struct pcmcia_device *link) local->p_dev = link; link->priv = local; - link->conf.Attributes = 0; - return sl811_cs_config(link); } diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h deleted file mode 100644 index 47b6092..0000000 --- a/include/pcmcia/cs.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * cs.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * The initial developer of the original code is David A. Hinds - * . Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * (C) 1999 David A. Hinds - */ - -#ifndef _LINUX_CS_H -#define _LINUX_CS_H - -#ifdef __KERNEL__ -#include -#endif - -/* For RequestConfiguration */ -typedef struct config_req_t { - u_int Attributes; -} config_req_t; - -/* Attributes for RequestConfiguration */ -#define CONF_ENABLE_IRQ 0x01 -#define CONF_ENABLE_DMA 0x02 -#define CONF_ENABLE_SPKR 0x04 -#define CONF_ENABLE_PULSE_IRQ 0x08 -#define CONF_ENABLE_ESR 0x10 -#define CONF_VALID_CLIENT 0x100 - -#endif /* _LINUX_CS_H */ diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index bc28f96..50b03fd 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -24,9 +24,11 @@ #ifdef __KERNEL__ #include +#include #include #include + /* * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus * a.k.a. PCI drivers @@ -88,18 +90,16 @@ struct pcmcia_device { struct list_head socket_device_list; - /* deprecated, will be cleaned up soon */ - config_req_t conf; - /* device setup */ unsigned int irq; struct resource *resource[PCMCIA_NUM_RESOURCES]; unsigned int vpp; - unsigned int io_lines; /* number of I/O lines */ + unsigned int config_flags; /* CONF_ENABLE_ flags below */ unsigned int config_base; unsigned int config_index; unsigned int config_regs; /* PRESENT_ flags below */ + unsigned int io_lines; /* number of I/O lines */ /* Is the device suspended? */ u16 suspended:1; @@ -207,8 +207,7 @@ pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, irq_handler_t handler); -int pcmcia_request_configuration(struct pcmcia_device *p_dev, - config_req_t *req); +int pcmcia_enable_device(struct pcmcia_device *p_dev); int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, unsigned int speed); @@ -265,6 +264,12 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) #define PRESENT_IOBASE_3 0x100 #define PRESENT_IOSIZE 0x200 +/* flags to be passed to pcmcia_enable_device() */ +#define CONF_ENABLE_IRQ 0x01 +#define CONF_ENABLE_SPKR 0x02 +#define CONF_ENABLE_PULSE_IRQ 0x04 +#define CONF_ENABLE_ESR 0x08 + #endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */ diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 626b63c..731cde0 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -19,7 +19,6 @@ #include /* task_struct, completion */ #include -#include #ifdef CONFIG_CARDBUS #include #endif diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 4df07fc..2476d5f 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -142,7 +142,7 @@ static int snd_pdacf_probe(struct pcmcia_device *link) link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[0]->end = 16; - link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; + link->config_flags = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; link->config_index = 1; link->config_regs = PRESENT_OPTION; @@ -217,6 +217,7 @@ static int pdacf_config(struct pcmcia_device *link) snd_printdd(KERN_DEBUG "pdacf_config called\n"); link->config_index = 0x5; + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; ret = pcmcia_request_io(link); if (ret) @@ -226,7 +227,7 @@ static int pdacf_config(struct pcmcia_device *link) if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index 5cc3e45..bd26e09 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.h +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 16186ad..017a8d6 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -2,7 +2,7 @@ * Driver for Digigram VXpocket V2/440 soundcards * * Copyright (c) 2002 by Takashi Iwai - * + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -162,7 +162,7 @@ static int snd_vxpocket_new(struct snd_card *card, int ibl, link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[0]->end = 16; - link->conf.Attributes = CONF_ENABLE_IRQ; + link->config_flags |= CONF_ENABLE_IRQ; link->config_index = 1; link->config_regs = PRESENT_OPTION; @@ -233,7 +233,7 @@ static int vxpocket_config(struct pcmcia_device *link) if (ret) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + ret = pcmcia_enable_device(link); if (ret) goto failed; diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h index d911066..13d658c 100644 --- a/sound/pcmcia/vx/vxpocket.h +++ b/sound/pcmcia/vx/vxpocket.h @@ -23,7 +23,6 @@ #include -#include #include #include -- 1.7.0.4 From padovan at profusion.mobi Fri Sep 3 18:32:56 2010 From: padovan at profusion.mobi (Gustavo F. Padovan) Date: Fri, 3 Sep 2010 19:32:56 -0300 Subject: [PATCH 07/15] pcmcia: move config_{base,index,regs} to struct pcmcia_device In-Reply-To: <1283511434-21620-7-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-7-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100903223256.GC16973@vigoh> * Dominik Brodowski [2010-09-03 12:57:06 +0200]: > Several drivers prefer to explicitly set config_{base,index,regs}, > formerly known as ConfigBase, ConfigIndex and Present. Instead of > passing these values inside config_req_t, store it in struct > pcmcia_device. > > CC: netdev at vger.kernel.org > CC: linux-wireless at vger.kernel.org > CC: linux-ide at vger.kernel.org > CC: linux-usb at vger.kernel.org > CC: laforge at gnumonks.org > CC: linux-mtd at lists.infradead.org > CC: linux-bluetooth at vger.kernel.org > CC: alsa-devel at alsa-project.org > CC: linux-serial at vger.kernel.org > CC: Jiri Kosina > CC: linux-scsi at vger.kernel.org > Signed-off-by: Dominik Brodowski > --- > drivers/bluetooth/bluecard_cs.c | 2 +- > drivers/char/pcmcia/ipwireless/main.c | 2 +- > drivers/char/pcmcia/synclink_cs.c | 6 ++-- > drivers/ide/ide-cs.c | 3 +- > drivers/isdn/hardware/avm/avm_cs.c | 4 +- > drivers/isdn/hisax/avma1_cs.c | 4 +- > drivers/isdn/hisax/elsa_cs.c | 2 +- > drivers/isdn/hisax/sedlbauer_cs.c | 2 +- > drivers/isdn/hisax/teles_cs.c | 2 +- > drivers/mtd/maps/pcmciamtd.c | 2 +- > drivers/net/pcmcia/3c574_cs.c | 2 +- > drivers/net/pcmcia/3c589_cs.c | 2 +- > drivers/net/pcmcia/axnet_cs.c | 6 ++-- > drivers/net/pcmcia/fmvj18x_cs.c | 22 ++++++------ > drivers/net/pcmcia/ibmtr_cs.c | 4 +- > drivers/net/pcmcia/nmclan_cs.c | 4 +- > drivers/net/pcmcia/pcnet_cs.c | 6 ++-- > drivers/net/pcmcia/smc91c92_cs.c | 10 +++--- > drivers/net/pcmcia/xirc2ps_cs.c | 2 +- > drivers/net/wireless/airo_cs.c | 2 +- > drivers/net/wireless/hostap/hostap_cs.c | 2 +- > drivers/net/wireless/ray_cs.c | 2 +- > drivers/net/wireless/wl3501_cs.c | 2 +- > drivers/parport/parport_cs.c | 2 +- > drivers/pcmcia/cs_internal.h | 3 -- > drivers/pcmcia/ds.c | 8 ++-- > drivers/pcmcia/pcmcia_cis.c | 2 +- > drivers/pcmcia/pcmcia_resource.c | 38 +++++++++++----------- > drivers/scsi/pcmcia/aha152x_stub.c | 2 +- > drivers/scsi/pcmcia/fdomain_stub.c | 2 +- > drivers/scsi/pcmcia/nsp_cs.c | 2 +- > drivers/scsi/pcmcia/qlogic_stub.c | 2 +- > drivers/serial/serial_cs.c | 6 ++-- > drivers/staging/comedi/drivers/cb_das16_cs.c | 2 +- > drivers/staging/comedi/drivers/das08_cs.c | 2 +- > drivers/staging/comedi/drivers/ni_daq_700.c | 2 +- > drivers/staging/comedi/drivers/ni_daq_dio24.c | 2 +- > drivers/staging/comedi/drivers/ni_labpc_cs.c | 2 +- > drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- > drivers/staging/wlags49_h2/wl_cs.c | 4 +- > drivers/usb/host/sl811_cs.c | 2 +- > include/pcmcia/cs.h | 15 -------- > include/pcmcia/ds.h | 14 ++++++++ > sound/pcmcia/pdaudiocf/pdaudiocf.c | 6 ++-- > sound/pcmcia/vx/vxpocket.c | 4 +- > 45 files changed, 107 insertions(+), 112 deletions(-) For drivers/bluetooth Acked-by: Gustavo F. Padovan -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi From padovan at profusion.mobi Fri Sep 3 18:34:13 2010 From: padovan at profusion.mobi (Gustavo F. Padovan) Date: Fri, 3 Sep 2010 19:34:13 -0300 Subject: [PATCH 03/15] pcmcia: move Vpp setup to struct pcmcia_device In-Reply-To: <1283511434-21620-3-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-3-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100903223413.GD16973@vigoh> * Dominik Brodowski [2010-09-03 12:57:02 +0200]: > Some drivers prefer to explicitly set Vpp. Instead of passing the > voltage inside config_req_t, store it in struct pcmcia_device. > > CC: linux-ide at vger.kernel.org > CC: netdev at vger.kernel.org > CC: linux-bluetooth at vger.kernel.org > CC: linux-mtd at lists.infradead.org > CC: linux-wireless at vger.kernel.org > CC: linux-serial at vger.kernel.org > CC: linux-usb at vger.kernel.org > CC: linux-scsi at vger.kernel.org > Signed-off-by: Dominik Brodowski > --- > drivers/ata/pata_pcmcia.c | 4 ++-- > drivers/bluetooth/bt3c_cs.c | 2 +- > drivers/bluetooth/btuart_cs.c | 2 +- > drivers/ide/ide-cs.c | 6 +++--- > drivers/isdn/hisax/sedlbauer_cs.c | 8 ++++---- > drivers/mtd/maps/pcmciamtd.c | 4 ++-- > drivers/net/wireless/airo_cs.c | 8 ++++---- > drivers/net/wireless/atmel_cs.c | 4 ++-- > drivers/net/wireless/hostap/hostap_cs.c | 10 +++++----- > drivers/net/wireless/orinoco/orinoco_cs.c | 4 ++-- > drivers/net/wireless/orinoco/spectrum_cs.c | 4 ++-- > drivers/pcmcia/pcmcia_resource.c | 3 ++- > drivers/scsi/pcmcia/nsp_cs.c | 8 ++++---- > drivers/serial/serial_cs.c | 2 +- > drivers/usb/host/sl811_cs.c | 8 ++++---- > include/pcmcia/cs.h | 1 - > include/pcmcia/ds.h | 1 + > 17 files changed, 40 insertions(+), 39 deletions(-) For drivers/bluetooth Acked-by: Gustavo F. Padovan -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi From padovan at profusion.mobi Fri Sep 3 18:35:28 2010 From: padovan at profusion.mobi (Gustavo F. Padovan) Date: Fri, 3 Sep 2010 19:35:28 -0300 Subject: [PATCH 08/15] pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device In-Reply-To: <1283511434-21620-8-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-8-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100903223528.GE16973@vigoh> * Dominik Brodowski [2010-09-03 12:57:07 +0200]: > pcmcia_enable_device() now replaces pcmcia_request_configuration(). > Instead of config_req_t, all necessary flags are either passed as > a parameter to pcmcia_enable_device(), or (in rare circumstances) > set in struct pcmcia_device -> flags. > > With the last remaining user of include/pcmcia/cs.h gone, remove > all references. > > CC: netdev at vger.kernel.org > CC: linux-wireless at vger.kernel.org > CC: linux-ide at vger.kernel.org > CC: linux-usb at vger.kernel.org > CC: laforge at gnumonks.org > CC: linux-mtd at lists.infradead.org > CC: linux-bluetooth at vger.kernel.org > CC: alsa-devel at alsa-project.org > CC: linux-serial at vger.kernel.org > CC: Jiri Kosina > CC: linux-scsi at vger.kernel.org > Signed-off-by: Dominik Brodowski > --- > Documentation/pcmcia/driver-changes.txt | 6 ++++ > drivers/ata/pata_pcmcia.c | 5 +-- > drivers/bluetooth/bluecard_cs.c | 5 +-- > drivers/bluetooth/bt3c_cs.c | 5 +-- > drivers/bluetooth/btuart_cs.c | 5 +-- > drivers/bluetooth/dtl1_cs.c | 5 +-- > drivers/char/pcmcia/cm4000_cs.c | 3 +- > drivers/char/pcmcia/cm4040_cs.c | 5 +-- > drivers/char/pcmcia/ipwireless/main.c | 6 +-- > drivers/char/pcmcia/ipwireless/main.h | 1 - > drivers/char/pcmcia/ipwireless/tty.h | 1 - > drivers/char/pcmcia/synclink_cs.c | 10 ++---- > drivers/ide/ide-cs.c | 6 ++-- > drivers/isdn/hardware/avm/avm_cs.c | 5 +-- > drivers/isdn/hisax/avma1_cs.c | 5 +-- > drivers/isdn/hisax/elsa_cs.c | 8 +---- > drivers/isdn/hisax/sedlbauer_cs.c | 12 ++----- > drivers/isdn/hisax/teles_cs.c | 8 ++--- > drivers/mmc/host/sdricoh_cs.c | 1 - > drivers/mtd/maps/pcmciamtd.c | 6 +--- > drivers/net/pcmcia/3c574_cs.c | 5 +-- > drivers/net/pcmcia/3c589_cs.c | 5 +-- > drivers/net/pcmcia/axnet_cs.c | 10 +++--- > drivers/net/pcmcia/com20020_cs.c | 5 +-- > drivers/net/pcmcia/fmvj18x_cs.c | 5 +-- > drivers/net/pcmcia/ibmtr_cs.c | 5 +-- > drivers/net/pcmcia/nmclan_cs.c | 5 +-- > drivers/net/pcmcia/pcnet_cs.c | 8 ++-- > drivers/net/pcmcia/smc91c92_cs.c | 9 ++--- > drivers/net/pcmcia/xirc2ps_cs.c | 12 ++++---- > drivers/net/wireless/airo_cs.c | 16 ++-------- > drivers/net/wireless/atmel_cs.c | 16 ++-------- > drivers/net/wireless/b43/pcmcia.c | 5 +-- > drivers/net/wireless/hostap/hostap_cs.c | 10 ++---- > drivers/net/wireless/libertas/if_cs.c | 10 ++---- > drivers/net/wireless/orinoco/orinoco_cs.c | 12 +------ > drivers/net/wireless/orinoco/spectrum_cs.c | 12 +------ > drivers/net/wireless/ray_cs.c | 5 +-- > drivers/net/wireless/wl3501_cs.c | 5 +-- > drivers/parport/parport_cs.c | 5 +-- > drivers/pcmcia/au1000_generic.h | 1 - > drivers/pcmcia/au1000_pb1x00.c | 1 - > drivers/pcmcia/cistpl.c | 1 - > drivers/pcmcia/cs.c | 1 - > drivers/pcmcia/cs_internal.h | 5 --- > drivers/pcmcia/ds.c | 3 +- > drivers/pcmcia/i82092.c | 1 - > drivers/pcmcia/i82365.c | 1 - > drivers/pcmcia/m32r_cfc.c | 1 - > drivers/pcmcia/m32r_pcc.c | 1 - > drivers/pcmcia/m8xx_pcmcia.c | 1 - > drivers/pcmcia/pcmcia_cis.c | 1 - > drivers/pcmcia/pcmcia_resource.c | 33 ++++++++++---------- > drivers/pcmcia/pd6729.c | 1 - > drivers/pcmcia/rsrc_iodyn.c | 1 - > drivers/pcmcia/rsrc_mgr.c | 1 - > drivers/pcmcia/rsrc_nonstatic.c | 1 - > drivers/pcmcia/sa1100_generic.c | 1 - > drivers/pcmcia/soc_common.h | 1 - > drivers/pcmcia/socket_sysfs.c | 1 - > drivers/pcmcia/tcic.c | 1 - > drivers/pcmcia/xxs1500_ss.c | 1 - > drivers/pcmcia/yenta_socket.c | 1 - > drivers/scsi/pcmcia/aha152x_stub.c | 5 +-- > drivers/scsi/pcmcia/fdomain_stub.c | 5 +-- > drivers/scsi/pcmcia/nsp_cs.c | 13 +++----- > drivers/scsi/pcmcia/qlogic_stub.c | 7 ++-- > drivers/scsi/pcmcia/sym53c500_cs.c | 5 +-- > drivers/serial/serial_cs.c | 9 ++--- > drivers/ssb/main.c | 1 - > drivers/ssb/pcmcia.c | 1 - > drivers/ssb/scan.c | 1 - > drivers/staging/comedi/drivers/cb_das16_cs.c | 11 ++----- > drivers/staging/comedi/drivers/das08_cs.c | 17 ++--------- > drivers/staging/comedi/drivers/ni_daq_700.c | 19 ++--------- > drivers/staging/comedi/drivers/ni_daq_dio24.c | 19 ++--------- > drivers/staging/comedi/drivers/ni_labpc_cs.c | 20 +++--------- > drivers/staging/comedi/drivers/ni_mio_cs.c | 5 +-- > drivers/staging/comedi/drivers/quatech_daqp_cs.c | 17 ++--------- > drivers/staging/wlags49_h2/wl_cs.c | 7 ++-- > drivers/staging/wlags49_h2/wl_internal.h | 1 - > drivers/telephony/ixj_pcmcia.c | 3 +- > drivers/usb/host/sl811_cs.c | 7 +--- > include/pcmcia/cs.h | 35 ---------------------- > include/pcmcia/ds.h | 17 +++++++---- > include/pcmcia/ss.h | 1 - > sound/pcmcia/pdaudiocf/pdaudiocf.c | 5 ++- > sound/pcmcia/pdaudiocf/pdaudiocf.h | 1 - > sound/pcmcia/vx/vxpocket.c | 6 ++-- > sound/pcmcia/vx/vxpocket.h | 1 - > 90 files changed, 179 insertions(+), 394 deletions(-) > delete mode 100644 include/pcmcia/cs.h For drivers/bluetooth/ Acked-by: Gustavo F. Padovan -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi From padovan at profusion.mobi Fri Sep 3 18:36:24 2010 From: padovan at profusion.mobi (Gustavo F. Padovan) Date: Fri, 3 Sep 2010 19:36:24 -0300 Subject: [PATCH 06/15] pcmcia: simplify IntType In-Reply-To: <1283511434-21620-6-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-6-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100903223624.GF16973@vigoh> * Dominik Brodowski [2010-09-03 12:57:05 +0200]: > IntType was only set to INT_MEMORY (driver pcmciamtd) or INT_MEMORY_AND_IO > (all other drivers). As this flags seems to relate to ioport access, make > it conditional to the driver having requested IO port access. There are two > drivers which do not request IO ports, but did set INT_MEMORY_AND_IO: > ray_cs and b43. For those, we consistently only set INT_MEMORY in future. > > CC: netdev at vger.kernel.org > CC: linux-wireless at vger.kernel.org > CC: linux-ide at vger.kernel.org > CC: linux-usb at vger.kernel.org > CC: laforge at gnumonks.org > CC: linux-mtd at lists.infradead.org > CC: linux-bluetooth at vger.kernel.org > CC: alsa-devel at alsa-project.org > CC: linux-serial at vger.kernel.org > CC: Jiri Kosina > CC: linux-scsi at vger.kernel.org > Signed-off-by: Dominik Brodowski > --- > drivers/ata/pata_pcmcia.c | 1 - > drivers/bluetooth/bluecard_cs.c | 1 - > drivers/bluetooth/bt3c_cs.c | 1 - > drivers/bluetooth/btuart_cs.c | 1 - > drivers/bluetooth/dtl1_cs.c | 1 - > drivers/char/pcmcia/cm4000_cs.c | 3 --- > drivers/char/pcmcia/cm4040_cs.c | 3 --- > drivers/char/pcmcia/ipwireless/main.c | 1 - > drivers/char/pcmcia/synclink_cs.c | 2 -- > drivers/ide/ide-cs.c | 1 - > drivers/isdn/hardware/avm/avm_cs.c | 1 - > drivers/isdn/hisax/avma1_cs.c | 1 - > drivers/isdn/hisax/elsa_cs.c | 1 - > drivers/isdn/hisax/sedlbauer_cs.c | 1 - > drivers/isdn/hisax/teles_cs.c | 1 - > drivers/mtd/maps/pcmciamtd.c | 2 -- > drivers/net/pcmcia/3c574_cs.c | 1 - > drivers/net/pcmcia/3c589_cs.c | 1 - > drivers/net/pcmcia/axnet_cs.c | 1 - > drivers/net/pcmcia/com20020_cs.c | 1 - > drivers/net/pcmcia/fmvj18x_cs.c | 1 - > drivers/net/pcmcia/ibmtr_cs.c | 1 - > drivers/net/pcmcia/nmclan_cs.c | 1 - > drivers/net/pcmcia/pcnet_cs.c | 1 - > drivers/net/pcmcia/smc91c92_cs.c | 1 - > drivers/net/pcmcia/xirc2ps_cs.c | 1 - > drivers/net/wireless/airo_cs.c | 1 - > drivers/net/wireless/atmel_cs.c | 1 - > drivers/net/wireless/b43/pcmcia.c | 1 - > drivers/net/wireless/hostap/hostap_cs.c | 1 - > drivers/net/wireless/libertas/if_cs.c | 1 - > drivers/net/wireless/orinoco/orinoco_cs.c | 1 - > drivers/net/wireless/orinoco/spectrum_cs.c | 1 - > drivers/net/wireless/ray_cs.c | 1 - > drivers/net/wireless/wl3501_cs.c | 1 - > drivers/parport/parport_cs.c | 1 - > drivers/pcmcia/cs_internal.h | 1 - > drivers/pcmcia/pcmcia_resource.c | 10 +--------- > drivers/scsi/pcmcia/aha152x_stub.c | 1 - > drivers/scsi/pcmcia/fdomain_stub.c | 1 - > drivers/scsi/pcmcia/nsp_cs.c | 1 - > drivers/scsi/pcmcia/qlogic_stub.c | 1 - > drivers/scsi/pcmcia/sym53c500_cs.c | 1 - > drivers/serial/serial_cs.c | 2 -- > drivers/staging/comedi/drivers/cb_das16_cs.c | 1 - > drivers/staging/comedi/drivers/das08_cs.c | 1 - > drivers/staging/comedi/drivers/ni_daq_700.c | 1 - > drivers/staging/comedi/drivers/ni_daq_dio24.c | 1 - > drivers/staging/comedi/drivers/ni_labpc_cs.c | 1 - > drivers/staging/comedi/drivers/ni_mio_cs.c | 1 - > drivers/staging/comedi/drivers/quatech_daqp_cs.c | 1 - > drivers/staging/wlags49_h2/wl_cs.c | 1 - > drivers/telephony/ixj_pcmcia.c | 1 - > drivers/usb/host/sl811_cs.c | 1 - > include/pcmcia/cs.h | 7 ------- > sound/pcmcia/pdaudiocf/pdaudiocf.c | 1 - > sound/pcmcia/vx/vxpocket.c | 1 - > 57 files changed, 1 insertions(+), 78 deletions(-) > For drivers/bluetooth Acked-by: Gustavo F. Padovan -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi From padovan at profusion.mobi Fri Sep 3 18:38:01 2010 From: padovan at profusion.mobi (Gustavo F. Padovan) Date: Fri, 3 Sep 2010 19:38:01 -0300 Subject: [PATCH 10/15] pcmcia: introduce autoconfiguration feature In-Reply-To: <1283511434-21620-10-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-10-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100903223801.GG16973@vigoh> * Dominik Brodowski [2010-09-03 12:57:09 +0200]: > Introduce an autoconfiguration feature to set certain values in > pcmcia_loop_config(), instead of copying the same code over and over > in each PCMCIA driver. At first, introduce the following options: > > CONF_AUTO_CHECK_VCC check or matching Vcc entry > CONF_AUTO_SET_VPP set Vpp > CONF_AUTO_AUDIO enable the speaker line > > CC: netdev at vger.kernel.org > CC: linux-wireless at vger.kernel.org > CC: linux-ide at vger.kernel.org > CC: linux-usb at vger.kernel.org > CC: laforge at gnumonks.org > CC: linux-mtd at lists.infradead.org > CC: linux-bluetooth at vger.kernel.org > CC: alsa-devel at alsa-project.org > CC: linux-serial at vger.kernel.org > CC: Jiri Kosina > CC: linux-scsi at vger.kernel.org > Signed-off-by: Dominik Brodowski > --- > drivers/ata/pata_pcmcia.c | 23 +---- > drivers/bluetooth/bt3c_cs.c | 7 +- > drivers/bluetooth/btuart_cs.c | 7 +- > drivers/bluetooth/dtl1_cs.c | 1 - > drivers/char/pcmcia/cm4000_cs.c | 1 - > drivers/char/pcmcia/cm4040_cs.c | 1 - > drivers/char/pcmcia/ipwireless/main.c | 1 - > drivers/char/pcmcia/synclink_cs.c | 1 - > drivers/ide/ide-cs.c | 23 +---- > drivers/isdn/hardware/avm/avm_cs.c | 1 - > drivers/isdn/hisax/avma1_cs.c | 1 - > drivers/isdn/hisax/elsa_cs.c | 1 - > drivers/isdn/hisax/sedlbauer_cs.c | 25 +----- > drivers/isdn/hisax/teles_cs.c | 1 - > drivers/net/pcmcia/axnet_cs.c | 1 - > drivers/net/pcmcia/fmvj18x_cs.c | 1 - > drivers/net/pcmcia/pcnet_cs.c | 1 - > drivers/net/pcmcia/smc91c92_cs.c | 2 - > drivers/net/pcmcia/xirc2ps_cs.c | 5 +- > drivers/net/wireless/airo_cs.c | 17 +--- > drivers/net/wireless/atmel_cs.c | 17 +--- > drivers/net/wireless/hostap/hostap_cs.c | 27 +----- > drivers/net/wireless/libertas/if_cs.c | 1 - > drivers/net/wireless/orinoco/orinoco_cs.c | 31 +------ > drivers/net/wireless/orinoco/spectrum_cs.c | 24 +---- > drivers/parport/parport_cs.c | 1 - > drivers/pcmcia/pcmcia_cis.c | 36 ++++++- > drivers/scsi/pcmcia/aha152x_stub.c | 1 - > drivers/scsi/pcmcia/fdomain_stub.c | 1 - > drivers/scsi/pcmcia/nsp_cs.c | 110 ++++++++------------- > drivers/scsi/pcmcia/qlogic_stub.c | 1 - > drivers/scsi/pcmcia/sym53c500_cs.c | 1 - > drivers/serial/serial_cs.c | 10 +-- > drivers/staging/comedi/drivers/cb_das16_cs.c | 1 - > drivers/staging/comedi/drivers/das08_cs.c | 1 - > drivers/staging/comedi/drivers/ni_daq_700.c | 10 +-- > drivers/staging/comedi/drivers/ni_daq_dio24.c | 10 +-- > drivers/staging/comedi/drivers/ni_labpc_cs.c | 11 +-- > drivers/staging/comedi/drivers/ni_mio_cs.c | 1 - > drivers/staging/comedi/drivers/quatech_daqp_cs.c | 1 - > drivers/telephony/ixj_pcmcia.c | 1 - > drivers/usb/host/sl811_cs.c | 24 +---- > include/pcmcia/ds.h | 7 +- > 43 files changed, 120 insertions(+), 329 deletions(-) For drivers/bluetooth Acked-by: Gustavo F. Padovan -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi From linux at dominikbrodowski.net Sat Sep 4 06:54:04 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 4 Sep 2010 12:54:04 +0200 Subject: [PATCH] pccardctl: fix segmentation fault on unknown long option In-Reply-To: <201008311600.06330.jklimes@redhat.com> References: <201008311600.06330.jklimes@redhat.com> Message-ID: <20100904105404.GA16589@isilmar-3.linta.de> Hello Jirka, On Tue, Aug 31, 2010 at 04:00:05PM +0200, Jirka Klimes wrote: > calling pccardctl with an unknown long option causes SIGSEGV; > e.g. pccardctl --ver > > The patch adds missing last zeroed element to options array. Thanks, nice patch. Could you add a Signed-off-by - line (as per the Linux kernel rules, see Documentation/SubmittingPatches for details), please, then I'll apply it right away? Thanks and best wishes, Dominik From linux at dominikbrodowski.net Sat Sep 4 06:54:15 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 4 Sep 2010 12:54:15 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <13928942.191731283256326809.komurojun-mbn@nifty.com> References: <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> Message-ID: <20100904105415.GC16589@isilmar-3.linta.de> Dear Komuro, On Tue, Aug 31, 2010 at 09:05:26PM +0900, Komuro wrote: > Hi, > > The serial part still does not work. > > > >does this patch help? If not, could you please enable dynamic debug by > >issuing > > I will try it later. any update on this, by chance? Thanks & best wishes, Dominik From komurojun-mbn at nifty.com Sat Sep 4 08:03:40 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sat, 4 Sep 2010 21:03:40 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100904105415.GC16589@isilmar-3.linta.de> References: <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> Message-ID: <29547163.98341283601820252.komurojun-mbn@nifty.com> Hi, > >$ echo "module pcmcia +p" > /sys/kernel/debug/dynamic_debug/control > Which kernel .config option do I need to enable dynamic_debug? My kernel does not have /sys/kernel/debug/dynamic_debug/control. From w.sang at pengutronix.de Sat Sep 4 11:41:23 2010 From: w.sang at pengutronix.de (Wolfram Sang) Date: Sat, 4 Sep 2010 17:41:23 +0200 Subject: [RFC] PCMCIA patches for 2.6.37-rc1 In-Reply-To: <20100903105628.GA21255@comet.dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> Message-ID: <20100904154123.GA1762@pengutronix.de> > As usual, I'm interested in your input to this patch series. I have access to my pcmcia-testing-laptop again! And funny things do happen when I insert a CF-card: Sep 4 17:21:09 goodluck kernel: [ 70.120069] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 Sep 4 17:21:09 goodluck kernel: [ 70.120088] pcmcia_socket pcmcia_socket0: cs: memory probe 0x0d4000-0x0dffff: clean. Sep 4 17:21:09 goodluck kernel: [ 70.134315] pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean. Sep 4 17:21:09 goodluck kernel: [ 70.173127] pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean. Sep 4 17:21:09 goodluck kernel: [ 70.211331] pcmcia_socket pcmcia_socket0: cs: memory probe 0xffd10000-0xffdeffff: clean. Sep 4 17:21:09 goodluck kernel: [ 70.251075] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 11) Sep 4 17:21:09 goodluck kernel: [ 70.253278] ide-cs 0.0: invalid write to CISREG_SCR Sep 4 17:21:09 goodluck kernel: [ 70.253385] ide-cs 0.0: invalid write to CISREG_PRR Sep 4 17:21:09 goodluck kernel: [ 70.304217] ide-cs 0.0: invalid write to CISREG_SCR Sep 4 17:21:09 goodluck kernel: [ 70.304277] ide-cs 0.0: invalid write to CISREG_PRR Sep 4 17:21:09 goodluck kernel: [ 70.397805] pata_pcmcia 0.0: invalid write to CISREG_SCR Sep 4 17:21:09 goodluck kernel: [ 70.397865] pata_pcmcia 0.0: invalid write to CISREG_PRR Sep 4 17:21:09 goodluck kernel: [ 70.438826] scsi0 : pata_pcmcia Sep 4 17:21:09 goodluck kernel: [ 70.439325] ata1: PATA max PIO0 cmd 0xc100 ctl 0xe irq 11 Sep 4 17:21:12 goodluck kernel: [ 72.703289] pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0 Sep 4 17:21:15 goodluck kernel: [ 75.703417] ata1.00: qc timeout (cmd 0xec) Sep 4 17:21:15 goodluck kernel: [ 75.703431] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x5) While the card is attached, the system is frozen (not even mouse cursor moves). I can simply eject the card and continue working, though. [1 minute later] Okay, I just noticed that I have both installed, ide-cs and pata_pcmcia. That seems to be part of the problem, although it used to work up to now. If I only install ide-cs, it looks like this: Sep 4 17:35:36 goodluck kernel: [ 55.716722] pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 Sep 4 17:35:36 goodluck kernel: [ 55.716741] pcmcia_socket pcmcia_socket0: cs: memory probe 0x0d4000-0x0dffff: clean. Sep 4 17:35:36 goodluck kernel: [ 55.731083] pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean. Sep 4 17:35:36 goodluck kernel: [ 55.770154] pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean. Sep 4 17:35:36 goodluck kernel: [ 55.808552] pcmcia_socket pcmcia_socket0: cs: memory probe 0xffd10000-0xffdeffff: clean. Sep 4 17:35:36 goodluck kernel: [ 55.848201] pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 11) Sep 4 17:35:36 goodluck kernel: [ 55.850912] ide-cs 0.0: invalid write to CISREG_SCR Sep 4 17:35:36 goodluck kernel: [ 55.850973] ide-cs 0.0: invalid write to CISREG_PRR Sep 4 17:35:36 goodluck kernel: [ 55.899012] ide-cs 0.0: invalid write to CISREG_SCR Sep 4 17:35:36 goodluck kernel: [ 55.899069] ide-cs 0.0: invalid write to CISREG_PRR Sep 4 17:35:43 goodluck kernel: [ 63.311451] pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0 But I still can't mount the card, obviously. A different question: I really like cleaning up and removing more than 2000 lines is a great thing. Out of curiosity, is my impression right that you partially remove some generic implementations (maybe as defined in the PCMCIA standard) and reduce it to what is used by current drivers (abusing the fact that there most likely won't be too much new PCMCIA cards)? Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From linux at dominikbrodowski.net Sat Sep 4 13:43:34 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 4 Sep 2010 19:43:34 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <29547163.98341283601820252.komurojun-mbn@nifty.com> References: <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> Message-ID: <20100904174334.GA955@isilmar-3.linta.de> Hey, On Sat, Sep 04, 2010 at 09:03:40PM +0900, Komuro wrote: > >$ echo "module pcmcia +p" > /sys/kernel/debug/dynamic_debug/control > > > > Which kernel .config option do I need to enable dynamic_debug? CONFIG_DYNAMIC_DEBUG=y Then mount debugfs to /sys/kernel/debug, if it isn't done automatically anyway. > My kernel does not have > /sys/kernel/debug/dynamic_debug/control. Thanks! Dominik From jklimes at redhat.com Mon Sep 6 04:44:59 2010 From: jklimes at redhat.com (Jirka Klimes) Date: Mon, 6 Sep 2010 10:44:59 +0200 Subject: [PATCH] pccardctl: fix segmentation fault on unknown long option In-Reply-To: <20100904105404.GA16589@isilmar-3.linta.de> References: <201008311600.06330.jklimes@redhat.com> <20100904105404.GA16589@isilmar-3.linta.de> Message-ID: <201009061045.00275.jklimes@redhat.com> On Saturday 04 of September 2010 12:54:04 Dominik Brodowski wrote: > Hello Jirka, > > On Tue, Aug 31, 2010 at 04:00:05PM +0200, Jirka Klimes wrote: > > calling pccardctl with an unknown long option causes SIGSEGV; > > e.g. pccardctl --ver > > > > The patch adds missing last zeroed element to options array. > > Thanks, nice patch. Could you add a Signed-off-by - line (as per the Linux > kernel rules, see Documentation/SubmittingPatches for details), please, > then I'll apply it right away? > > Thanks and best wishes, > Dominik Calling pccardctl with an unknown long option causes SIGSEGV; e.g. pccardctl --ver The patch adds missing last zeroed element to options array. Signed-off-by: Jirka Klimes --- Ok, I include the same patch, now with the sign-off. Thanks Dominik for pointing me to the rules as I'm not much familiar with process. I'm going to get to know it closely. Thanks, Jirka -------------- next part -------------- A non-text attachment was scrubbed... Name: pccardctl_SIGSEGV_fix.patch Type: text/x-patch Size: 511 bytes Desc: not available URL: From linux at dominikbrodowski.net Mon Sep 6 05:04:10 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Mon, 6 Sep 2010 11:04:10 +0200 Subject: [PATCH] pccardctl: fix segmentation fault on unknown long option In-Reply-To: <201009061045.00275.jklimes@redhat.com> References: <201008311600.06330.jklimes@redhat.com> <20100904105404.GA16589@isilmar-3.linta.de> <201009061045.00275.jklimes@redhat.com> Message-ID: <20100906090409.GA30682@comet.dominikbrodowski.net> Hello Jirka, On Mon, Sep 06, 2010 at 10:44:59AM +0200, Jirka Klimes wrote: > On Saturday 04 of September 2010 12:54:04 Dominik Brodowski wrote: > > Hello Jirka, > > > > On Tue, Aug 31, 2010 at 04:00:05PM +0200, Jirka Klimes wrote: > > > calling pccardctl with an unknown long option causes SIGSEGV; > > > e.g. pccardctl --ver > > > > > > The patch adds missing last zeroed element to options array. > > > > Thanks, nice patch. Could you add a Signed-off-by - line (as per the Linux > > kernel rules, see Documentation/SubmittingPatches for details), please, > > then I'll apply it right away? > > > > Thanks and best wishes, > > Dominik > > Calling pccardctl with an unknown long option causes SIGSEGV; > e.g. pccardctl --ver > The patch adds missing last zeroed element to options array. > > Signed-off-by: Jirka Klimes > > --- > > Ok, I include the same patch, now with the sign-off. Many thanks -- it's applied and in the git tree already. > Thanks Dominik for pointing me to the rules as I'm not much familiar with > process. I'm going to get to know it closely. You're welcome :) Best, Dominik From komurojun-mbn at nifty.com Tue Sep 7 08:24:30 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Tue, 7 Sep 2010 21:24:30 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100904174334.GA955@isilmar-3.linta.de> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> Message-ID: <8520532.194511283862270702.komurojun-mbn@nifty.com> Hi, Attached file is the output of /sys/kernel/debug/dynamic_debug/control. kernel 2.6..36-rc3. xirc2pcs_cs multi-function card. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: control.txt URL: From linux at dominikbrodowski.net Tue Sep 7 13:41:10 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Tue, 7 Sep 2010 19:41:10 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <8520532.194511283862270702.komurojun-mbn@nifty.com> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> Message-ID: <20100907174110.GA20934@comet.dominikbrodowski.net> Dear Komuro, On Tue, Sep 07, 2010 at 09:24:30PM +0900, Komuro wrote: > Attached file is the output of /sys/kernel/debug/dynamic_debug/control. Could you issue $ echo "module pcmcia +p" > /sys/kernel/debug/dynamic_debug/control and (re-)insert the card, and then send the dmesg (probably $ dmesg -s 200000 to me? Thanks! Best, Dominik From zachso at arcor.de Fri Sep 10 05:10:57 2010 From: zachso at arcor.de (Arne Zachlod) Date: Fri, 10 Sep 2010 10:10:57 +0100 Subject: dump_cis In-Reply-To: <20100907174110.GA20934@comet.dominikbrodowski.net> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <20100907174110.GA20934@comet.dominikbrodowski.net> Message-ID: <4C89F621.3040105@arcor.de> Hello, at the moment I'm developing a CardBus-Card and I would like to use the dump_$something , especially the dump_cis tool to debug my Card, but it seems like the tools are not in the pccardctl-package included anymore. Is there another way to read out the CardBus-Registers? In case it is needed: I'm running kernel 2.6.32 and PCMCIAutils 0.17 Regards, Arne From w.sang at pengutronix.de Fri Sep 10 05:55:55 2010 From: w.sang at pengutronix.de (Wolfram Sang) Date: Fri, 10 Sep 2010 11:55:55 +0200 Subject: dump_cis In-Reply-To: <4C89F621.3040105@arcor.de> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <20100907174110.GA20934@comet.dominikbrodowski.net> <4C89F621.3040105@arcor.de> Message-ID: <20100910095555.GE3865@pengutronix.de> > at the moment I'm developing a CardBus-Card and I would like to use > the dump_$something , especially the dump_cis tool to debug my Card, > but it seems like the tools are not in the pccardctl-package Get the sourcecode and run "make debugtools" -> voila! -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From w.sang at pengutronix.de Fri Sep 10 06:29:32 2010 From: w.sang at pengutronix.de (Wolfram Sang) Date: Fri, 10 Sep 2010 12:29:32 +0200 Subject: [PATCH pcmciautils] Makefile: add short help target Message-ID: <1284114572-30105-1-git-send-email-w.sang@pengutronix.de> To help people finding out about the debugtools by either running 'make help' or having a look at the top of the Makefile itself. Signed-off-by: Wolfram Sang Cc: Dominik Brodowski --- Makefile | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index a265873..240b748 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +help: + @echo "Common targets:" + @echo " all - build the standard set of utilities" + @echo " debugtools - build the debugging utilities" + # Set this to 'false' if you do not need the socket-startup script # # You don't need it if the socket driver does not select -- 1.7.1 From linux at dominikbrodowski.net Fri Sep 10 14:37:59 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 10 Sep 2010 20:37:59 +0200 Subject: [PATCH pcmciautils] Makefile: add short help target In-Reply-To: <1284114572-30105-1-git-send-email-w.sang@pengutronix.de> References: <1284114572-30105-1-git-send-email-w.sang@pengutronix.de> Message-ID: <20100910183759.GA10213@isilmar-3.linta.de> Applied, thanks! On Fri, Sep 10, 2010 at 12:29:32PM +0200, Wolfram Sang wrote: > To help people finding out about the debugtools by either running 'make > help' or having a look at the top of the Makefile itself. > > Signed-off-by: Wolfram Sang > Cc: Dominik Brodowski > --- > Makefile | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/Makefile b/Makefile > index a265873..240b748 100644 > --- a/Makefile > +++ b/Makefile > @@ -20,6 +20,11 @@ > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > # > > +help: > + @echo "Common targets:" > + @echo " all - build the standard set of utilities" > + @echo " debugtools - build the debugging utilities" > + > # Set this to 'false' if you do not need the socket-startup script > # > # You don't need it if the socket driver does not select > -- > 1.7.1 > > > _______________________________________________ > Linux PCMCIA reimplementation list > http://lists.infradead.org/mailman/listinfo/linux-pcmcia From linux at dominikbrodowski.net Mon Sep 13 15:53:53 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Mon, 13 Sep 2010 21:53:53 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <8520532.194511283862270702.komurojun-mbn@nifty.com> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> Message-ID: <20100913195353.GA6999@comet.dominikbrodowski.net> Dear Komuro, does the attached patch help with 2.6.36-rc4? Best, Dominik commit 1852d6b8c3fa2d1765f66cd7d96a8c6bf9f01997 Author: Dominik Brodowski Date: Mon Aug 30 08:18:54 2010 +0200 pcmcia serial_cs.c: fix multifunction card handling We shouldn't overwrite pre-set values, and we should also set the port address to the beginning, and not the end of the 8-port range. Reported-by: Komuro Signed-off-by: Dominik Brodowski diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 141c695..7d475b2 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -335,8 +335,6 @@ static int serial_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; link->conf.Attributes = CONF_ENABLE_IRQ; if (do_sound) { link->conf.Attributes |= CONF_ENABLE_SPKR; @@ -411,6 +409,27 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, /*====================================================================*/ +static int pfc_config(struct pcmcia_device *p_dev) +{ + unsigned int port = 0; + struct serial_info *info = p_dev->priv; + + if ((p_dev->resource[1]->end != 0) && + (resource_size(p_dev->resource[1]) == 8)) { + port = p_dev->resource[1]->start; + info->slave = 1; + } else if ((info->manfid == MANFID_OSITECH) && + (resource_size(p_dev->resource[0]) == 0x40)) { + port = p_dev->resource[0]->start + 0x28; + info->slave = 1; + } + if (info->slave) + return setup_serial(p_dev, info, port, p_dev->irq); + + dev_warn(&p_dev->dev, "no usable port range found, giving up\n"); + return -ENODEV; +} + static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, @@ -461,23 +480,8 @@ static int simple_config(struct pcmcia_device *link) struct serial_info *info = link->priv; int i = -ENODEV, try; - /* If the card is already configured, look up the port and irq */ - if (link->function_config) { - unsigned int port = 0; - if ((link->resource[1]->end != 0) && - (resource_size(link->resource[1]) == 8)) { - port = link->resource[1]->end; - info->slave = 1; - } else if ((info->manfid == MANFID_OSITECH) && - (resource_size(link->resource[0]) == 0x40)) { - port = link->resource[0]->start + 0x28; - info->slave = 1; - } - if (info->slave) { - return setup_serial(link, info, port, - link->irq); - } - } + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[0]->end = 8; /* First pass: look for a config entry that looks normal. * Two tries: without IO aliases, then with aliases */ @@ -491,8 +495,7 @@ static int simple_config(struct pcmcia_device *link) if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) goto found_port; - printk(KERN_NOTICE - "serial_cs: no usable port range found, giving up\n"); + dev_warn(&link->dev, "no usable port range found, giving up\n"); return -1; found_port: @@ -558,6 +561,7 @@ static int multi_config(struct pcmcia_device *link) int i, base2 = 0; /* First, look for a generic full-sized window */ + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = info->multi * 8; if (pcmcia_loop_config(link, multi_config_check, &base2)) { /* If that didn't work, look for two windows */ @@ -565,15 +569,14 @@ static int multi_config(struct pcmcia_device *link) info->multi = 2; if (pcmcia_loop_config(link, multi_config_check_notpicky, &base2)) { - printk(KERN_NOTICE "serial_cs: no usable port range" + dev_warn(&link->dev, "no usable port range " "found, giving up\n"); return -ENODEV; } } if (!link->irq) - dev_warn(&link->dev, - "serial_cs: no usable IRQ found, continuing...\n"); + dev_warn(&link->dev, "no usable IRQ found, continuing...\n"); /* * Apply any configuration quirks. @@ -675,6 +678,7 @@ static int serial_config(struct pcmcia_device * link) multifunction cards that ask for appropriate IO port ranges */ if ((info->multi == 0) && (link->has_func_id) && + (link->socket->pcmcia_pfc == 0) && ((link->func_id == CISTPL_FUNCID_MULTI) || (link->func_id == CISTPL_FUNCID_SERIAL))) pcmcia_loop_config(link, serial_check_for_multi, info); @@ -685,7 +689,13 @@ static int serial_config(struct pcmcia_device * link) if (info->quirk && info->quirk->multi != -1) info->multi = info->quirk->multi; - if (info->multi > 1) + dev_info(&link->dev, + "trying to set up [0x%04x:0x%04x] (pfc: %d, multi: %d, quirk: %p)\n", + link->manf_id, link->card_id, + link->socket->pcmcia_pfc, info->multi, info->quirk); + if (link->socket->pcmcia_pfc) + i = pfc_config(link); + else if (info->multi > 1) i = multi_config(link); else i = simple_config(link); @@ -704,7 +714,7 @@ static int serial_config(struct pcmcia_device * link) return 0; failed: - dev_warn(&link->dev, "serial_cs: failed to initialize\n"); + dev_warn(&link->dev, "failed to initialize\n"); serial_remove(link); return -ENODEV; } From linux at dominikbrodowski.net Wed Sep 15 12:25:55 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Wed, 15 Sep 2010 18:25:55 +0200 Subject: [PATCH 1/3] pcmcia serial_cs.c: fix multifunction card handling In-Reply-To: <20100915162503.GA15043@comet.dominikbrodowski.net> References: <20100915162503.GA15043@comet.dominikbrodowski.net> Message-ID: <1284567957-15709-1-git-send-email-linux@dominikbrodowski.net> We shouldn't overwrite pre-set values, and we should also set the port address to the beginning, and not the end of the 8-port range. CC: linux-serial at vger.kernel.org Reported-by: Komuro Hardware-supplied-by: Jochen Frieling Tested-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/serial/serial_cs.c | 62 +++++++++++++++++++++++++------------------ 1 files changed, 36 insertions(+), 26 deletions(-) diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 141c695..7d475b2 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -335,8 +335,6 @@ static int serial_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - link->resource[0]->end = 8; link->conf.Attributes = CONF_ENABLE_IRQ; if (do_sound) { link->conf.Attributes |= CONF_ENABLE_SPKR; @@ -411,6 +409,27 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, /*====================================================================*/ +static int pfc_config(struct pcmcia_device *p_dev) +{ + unsigned int port = 0; + struct serial_info *info = p_dev->priv; + + if ((p_dev->resource[1]->end != 0) && + (resource_size(p_dev->resource[1]) == 8)) { + port = p_dev->resource[1]->start; + info->slave = 1; + } else if ((info->manfid == MANFID_OSITECH) && + (resource_size(p_dev->resource[0]) == 0x40)) { + port = p_dev->resource[0]->start + 0x28; + info->slave = 1; + } + if (info->slave) + return setup_serial(p_dev, info, port, p_dev->irq); + + dev_warn(&p_dev->dev, "no usable port range found, giving up\n"); + return -ENODEV; +} + static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, @@ -461,23 +480,8 @@ static int simple_config(struct pcmcia_device *link) struct serial_info *info = link->priv; int i = -ENODEV, try; - /* If the card is already configured, look up the port and irq */ - if (link->function_config) { - unsigned int port = 0; - if ((link->resource[1]->end != 0) && - (resource_size(link->resource[1]) == 8)) { - port = link->resource[1]->end; - info->slave = 1; - } else if ((info->manfid == MANFID_OSITECH) && - (resource_size(link->resource[0]) == 0x40)) { - port = link->resource[0]->start + 0x28; - info->slave = 1; - } - if (info->slave) { - return setup_serial(link, info, port, - link->irq); - } - } + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[0]->end = 8; /* First pass: look for a config entry that looks normal. * Two tries: without IO aliases, then with aliases */ @@ -491,8 +495,7 @@ static int simple_config(struct pcmcia_device *link) if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) goto found_port; - printk(KERN_NOTICE - "serial_cs: no usable port range found, giving up\n"); + dev_warn(&link->dev, "no usable port range found, giving up\n"); return -1; found_port: @@ -558,6 +561,7 @@ static int multi_config(struct pcmcia_device *link) int i, base2 = 0; /* First, look for a generic full-sized window */ + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->end = info->multi * 8; if (pcmcia_loop_config(link, multi_config_check, &base2)) { /* If that didn't work, look for two windows */ @@ -565,15 +569,14 @@ static int multi_config(struct pcmcia_device *link) info->multi = 2; if (pcmcia_loop_config(link, multi_config_check_notpicky, &base2)) { - printk(KERN_NOTICE "serial_cs: no usable port range" + dev_warn(&link->dev, "no usable port range " "found, giving up\n"); return -ENODEV; } } if (!link->irq) - dev_warn(&link->dev, - "serial_cs: no usable IRQ found, continuing...\n"); + dev_warn(&link->dev, "no usable IRQ found, continuing...\n"); /* * Apply any configuration quirks. @@ -675,6 +678,7 @@ static int serial_config(struct pcmcia_device * link) multifunction cards that ask for appropriate IO port ranges */ if ((info->multi == 0) && (link->has_func_id) && + (link->socket->pcmcia_pfc == 0) && ((link->func_id == CISTPL_FUNCID_MULTI) || (link->func_id == CISTPL_FUNCID_SERIAL))) pcmcia_loop_config(link, serial_check_for_multi, info); @@ -685,7 +689,13 @@ static int serial_config(struct pcmcia_device * link) if (info->quirk && info->quirk->multi != -1) info->multi = info->quirk->multi; - if (info->multi > 1) + dev_info(&link->dev, + "trying to set up [0x%04x:0x%04x] (pfc: %d, multi: %d, quirk: %p)\n", + link->manf_id, link->card_id, + link->socket->pcmcia_pfc, info->multi, info->quirk); + if (link->socket->pcmcia_pfc) + i = pfc_config(link); + else if (info->multi > 1) i = multi_config(link); else i = simple_config(link); @@ -704,7 +714,7 @@ static int serial_config(struct pcmcia_device * link) return 0; failed: - dev_warn(&link->dev, "serial_cs: failed to initialize\n"); + dev_warn(&link->dev, "failed to initialize\n"); serial_remove(link); return -ENODEV; } -- 1.7.0.4 From linux at dominikbrodowski.net Wed Sep 15 12:25:57 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Wed, 15 Sep 2010 18:25:57 +0200 Subject: [PATCH 3/3] pcmcia pcnet_cs: try setting io_lines to 16 if card setup fails In-Reply-To: <20100915162503.GA15043@comet.dominikbrodowski.net> References: <20100915162503.GA15043@comet.dominikbrodowski.net> Message-ID: <1284567957-15709-3-git-send-email-linux@dominikbrodowski.net> Some pcnet_cs compatible cards require an exact 16-lines match of the ioport areas specified in CIS, but set the "iolines" value in the CIS incorrectly. We can easily work around this issue -- same as we do in serial_cs -- by first trying setting iolines to the CIS-specified value, and then trying a 16-line match. Reported-and-tested-by: Wolfram Sang Hardware-supplied-by: Jochen Frieling CC: netdev at vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/net/pcmcia/pcnet_cs.c | 139 ++++++++++++++++++++++++---------------- 1 files changed, 83 insertions(+), 56 deletions(-) diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 49279b0..f9b509a 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -508,7 +508,8 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, unsigned int vcc, void *priv_data) { - int *has_shmem = priv_data; + int *priv = priv_data; + int try = (*priv & 0x1); int i; cistpl_io_t *io = &cfg->io; @@ -525,77 +526,103 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, i = p_dev->resource[1]->end = 0; } - *has_shmem = ((cfg->mem.nwin == 1) && - (cfg->mem.win[0].len >= 0x4000)); + *priv &= ((cfg->mem.nwin == 1) && + (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; + p_dev->resource[0]->start = io->win[i].base; p_dev->resource[0]->end = io->win[i].len; - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + if (!try) + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + else + p_dev->io_lines = 16; if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) return try_io_port(p_dev); - return 0; + return -EINVAL; +} + +static hw_info_t *pcnet_try_config(struct pcmcia_device *link, + int *has_shmem, int try) +{ + struct net_device *dev = link->priv; + hw_info_t *local_hw_info; + pcnet_dev_t *info = PRIV(dev); + int priv = try; + int ret; + + ret = pcmcia_loop_config(link, pcnet_confcheck, &priv); + if (ret) { + dev_warn(&link->dev, "no useable port range found\n"); + return NULL; + } + *has_shmem = (priv & 0x10); + + if (!link->irq) + return NULL; + + if (resource_size(link->resource[1]) == 8) { + link->conf.Attributes |= CONF_ENABLE_SPKR; + link->conf.Status = CCSR_AUDIO_ENA; + } + if ((link->manf_id == MANFID_IBM) && + (link->card_id == PRODID_IBM_HOME_AND_AWAY)) + link->conf.ConfigIndex |= 0x10; + + ret = pcmcia_request_configuration(link, &link->conf); + if (ret) + return NULL; + + dev->irq = link->irq; + dev->base_addr = link->resource[0]->start; + + if (info->flags & HAS_MISC_REG) { + if ((if_port == 1) || (if_port == 2)) + dev->if_port = if_port; + else + dev_notice(&link->dev, "invalid if_port requested\n"); + } else + dev->if_port = 0; + + if ((link->conf.ConfigBase == 0x03c0) && + (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { + dev_info(&link->dev, + "this is an AX88190 card - use axnet_cs instead.\n"); + return NULL; + } + + local_hw_info = get_hwinfo(link); + if (!local_hw_info) + local_hw_info = get_prom(link); + if (!local_hw_info) + local_hw_info = get_dl10019(link); + if (!local_hw_info) + local_hw_info = get_ax88190(link); + if (!local_hw_info) + local_hw_info = get_hwired(link); + + return local_hw_info; } static int pcnet_config(struct pcmcia_device *link) { struct net_device *dev = link->priv; pcnet_dev_t *info = PRIV(dev); - int ret, start_pg, stop_pg, cm_offset; + int start_pg, stop_pg, cm_offset; int has_shmem = 0; hw_info_t *local_hw_info; dev_dbg(&link->dev, "pcnet_config\n"); - ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); - if (ret) - goto failed; - - if (!link->irq) - goto failed; - - if (resource_size(link->resource[1]) == 8) { - link->conf.Attributes |= CONF_ENABLE_SPKR; - link->conf.Status = CCSR_AUDIO_ENA; - } - if ((link->manf_id == MANFID_IBM) && - (link->card_id == PRODID_IBM_HOME_AND_AWAY)) - link->conf.ConfigIndex |= 0x10; - - ret = pcmcia_request_configuration(link, &link->conf); - if (ret) - goto failed; - dev->irq = link->irq; - dev->base_addr = link->resource[0]->start; - if (info->flags & HAS_MISC_REG) { - if ((if_port == 1) || (if_port == 2)) - dev->if_port = if_port; - else - printk(KERN_NOTICE "pcnet_cs: invalid if_port requested\n"); - } else { - dev->if_port = 0; - } - - if ((link->conf.ConfigBase == 0x03c0) && - (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { - printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); - printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); - goto failed; - } - - local_hw_info = get_hwinfo(link); - if (local_hw_info == NULL) - local_hw_info = get_prom(link); - if (local_hw_info == NULL) - local_hw_info = get_dl10019(link); - if (local_hw_info == NULL) - local_hw_info = get_ax88190(link); - if (local_hw_info == NULL) - local_hw_info = get_hwired(link); - - if (local_hw_info == NULL) { - printk(KERN_NOTICE "pcnet_cs: unable to read hardware net" - " address for io base %#3lx\n", dev->base_addr); - goto failed; + local_hw_info = pcnet_try_config(link, &has_shmem, 0); + if (!local_hw_info) { + /* check whether forcing io_lines to 16 helps... */ + pcmcia_disable_device(link); + local_hw_info = pcnet_try_config(link, &has_shmem, 1); + if (local_hw_info == NULL) { + dev_notice(&link->dev, "unable to read hardware net" + " address for io base %#3lx\n", dev->base_addr); + goto failed; + } } info->flags = local_hw_info->flags; -- 1.7.0.4 From linux at dominikbrodowski.net Wed Sep 15 12:25:03 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Wed, 15 Sep 2010 18:25:03 +0200 Subject: [RFC] PCMCIA patches for 2.6.36-rc5 Message-ID: <20100915162503.GA15043@comet.dominikbrodowski.net> Hey, in order to solve a severe bug rendering many serial PCMCIA cards unuseable, and to let pcnet_cs work on more cards, I intend to submit a pull request for three patches tomorrow. They're available at git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git urgent As usual, I'm interested in your input to this patch series. The individual patches will be sent out (at least) to the PCMCIA list in a few moments. Best, Dominik Dominik Brodowski (3): pcmcia serial_cs.c: fix multifunction card handling pcmcia: per-device, not per-socket debug messages pcmcia pcnet_cs: try setting io_lines to 16 if card setup fails drivers/net/pcmcia/pcnet_cs.c | 139 ++++++++++++++++++++++--------------- drivers/pcmcia/pcmcia_resource.c | 51 +++++++------- drivers/serial/serial_cs.c | 62 ++++++++++------- 3 files changed, 146 insertions(+), 106 deletions(-) From linux at dominikbrodowski.net Wed Sep 15 12:25:56 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Wed, 15 Sep 2010 18:25:56 +0200 Subject: [PATCH 2/3] pcmcia: per-device, not per-socket debug messages In-Reply-To: <20100915162503.GA15043@comet.dominikbrodowski.net> References: <20100915162503.GA15043@comet.dominikbrodowski.net> Message-ID: <1284567957-15709-2-git-send-email-linux@dominikbrodowski.net> As the iomem / ioport setup differs per device, it is much better to print out the device instead of the socket. Tested-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pcmcia_resource.c | 51 ++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 24 deletions(-) diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 54aa1c2..a5c1765 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -163,7 +163,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, c = p_dev->function_config; if (!(c->state & CONFIG_LOCKED)) { - dev_dbg(&s->dev, "Configuration isnt't locked\n"); + dev_dbg(&p_dev->dev, "Configuration isnt't locked\n"); mutex_unlock(&s->ops_mutex); return -EACCES; } @@ -220,7 +220,7 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, s->win[w].card_start = offset; ret = s->ops->set_mem_map(s, &s->win[w]); if (ret) - dev_warn(&s->dev, "failed to set_mem_map\n"); + dev_warn(&p_dev->dev, "failed to set_mem_map\n"); mutex_unlock(&s->ops_mutex); return ret; } /* pcmcia_map_mem_page */ @@ -244,18 +244,18 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, c = p_dev->function_config; if (!(s->state & SOCKET_PRESENT)) { - dev_dbg(&s->dev, "No card present\n"); + dev_dbg(&p_dev->dev, "No card present\n"); ret = -ENODEV; goto unlock; } if (!(c->state & CONFIG_LOCKED)) { - dev_dbg(&s->dev, "Configuration isnt't locked\n"); + dev_dbg(&p_dev->dev, "Configuration isnt't locked\n"); ret = -EACCES; goto unlock; } if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { - dev_dbg(&s->dev, + dev_dbg(&p_dev->dev, "changing Vcc or IRQ is not allowed at this time\n"); ret = -EINVAL; goto unlock; @@ -265,20 +265,22 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { if (mod->Vpp1 != mod->Vpp2) { - dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); + dev_dbg(&p_dev->dev, + "Vpp1 and Vpp2 must be the same\n"); ret = -EINVAL; goto unlock; } s->socket.Vpp = mod->Vpp1; if (s->ops->set_socket(s, &s->socket)) { - dev_printk(KERN_WARNING, &s->dev, + dev_printk(KERN_WARNING, &p_dev->dev, "Unable to set VPP\n"); ret = -EIO; goto unlock; } } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { - dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); + dev_dbg(&p_dev->dev, + "changing Vcc is not allowed at this time\n"); ret = -EINVAL; goto unlock; } @@ -401,7 +403,7 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) win = &s->win[w]; if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { - dev_dbg(&s->dev, "not releasing unknown window\n"); + dev_dbg(&p_dev->dev, "not releasing unknown window\n"); mutex_unlock(&s->ops_mutex); return -EINVAL; } @@ -439,7 +441,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, return -ENODEV; if (req->IntType & INT_CARDBUS) { - dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); + dev_dbg(&p_dev->dev, "IntType may not be INT_CARDBUS\n"); return -EINVAL; } @@ -447,7 +449,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, c = p_dev->function_config; if (c->state & CONFIG_LOCKED) { mutex_unlock(&s->ops_mutex); - dev_dbg(&s->dev, "Configuration is locked\n"); + dev_dbg(&p_dev->dev, "Configuration is locked\n"); return -EACCES; } @@ -455,7 +457,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, s->socket.Vpp = req->Vpp; if (s->ops->set_socket(s, &s->socket)) { mutex_unlock(&s->ops_mutex); - dev_printk(KERN_WARNING, &s->dev, + dev_printk(KERN_WARNING, &p_dev->dev, "Unable to set socket state\n"); return -EINVAL; } @@ -569,19 +571,20 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) int ret = -EINVAL; mutex_lock(&s->ops_mutex); - dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); + dev_dbg(&p_dev->dev, "pcmcia_request_io: %pR , %pR", + &c->io[0], &c->io[1]); if (!(s->state & SOCKET_PRESENT)) { - dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); + dev_dbg(&p_dev->dev, "pcmcia_request_io: No card present\n"); goto out; } if (c->state & CONFIG_LOCKED) { - dev_dbg(&s->dev, "Configuration is locked\n"); + dev_dbg(&p_dev->dev, "Configuration is locked\n"); goto out; } if (c->state & CONFIG_IO_REQ) { - dev_dbg(&s->dev, "IO already configured\n"); + dev_dbg(&p_dev->dev, "IO already configured\n"); goto out; } @@ -601,7 +604,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) c->state |= CONFIG_IO_REQ; p_dev->_io = 1; - dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", + dev_dbg(&p_dev->dev, "pcmcia_request_io succeeded: %pR , %pR", &c->io[0], &c->io[1]); out: mutex_unlock(&s->ops_mutex); @@ -800,7 +803,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha int w; if (!(s->state & SOCKET_PRESENT)) { - dev_dbg(&s->dev, "No card present\n"); + dev_dbg(&p_dev->dev, "No card present\n"); return -ENODEV; } @@ -809,12 +812,12 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha req->Size = s->map_size; align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; if (req->Size & (s->map_size-1)) { - dev_dbg(&s->dev, "invalid map size\n"); + dev_dbg(&p_dev->dev, "invalid map size\n"); return -EINVAL; } if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || (req->Base & (align-1))) { - dev_dbg(&s->dev, "invalid base address\n"); + dev_dbg(&p_dev->dev, "invalid base address\n"); return -EINVAL; } if (req->Base) @@ -826,7 +829,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha if (!(s->state & SOCKET_WIN_REQ(w))) break; if (w == MAX_WIN) { - dev_dbg(&s->dev, "all windows are used already\n"); + dev_dbg(&p_dev->dev, "all windows are used already\n"); mutex_unlock(&s->ops_mutex); return -EINVAL; } @@ -837,7 +840,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 0, s); if (!win->res) { - dev_dbg(&s->dev, "allocating mem region failed\n"); + dev_dbg(&p_dev->dev, "allocating mem region failed\n"); mutex_unlock(&s->ops_mutex); return -EINVAL; } @@ -851,7 +854,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha win->card_start = 0; if (s->ops->set_mem_map(s, win) != 0) { - dev_dbg(&s->dev, "failed to set memory mapping\n"); + dev_dbg(&p_dev->dev, "failed to set memory mapping\n"); mutex_unlock(&s->ops_mutex); return -EIO; } @@ -874,7 +877,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha if (win->res) request_resource(&iomem_resource, res); - dev_dbg(&s->dev, "request_window results in %pR\n", res); + dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); mutex_unlock(&s->ops_mutex); *wh = res; -- 1.7.0.4 From linux at dominikbrodowski.net Thu Sep 16 09:50:35 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Thu, 16 Sep 2010 15:50:35 +0200 Subject: [git pull] PCMCIA bugfixes for 2.6.36-rc5 Message-ID: <20100916135035.GA20989@comet.dominikbrodowski.net> Linus, in order to solve a severe bug rendering many serial PCMCIA cards unuseable, and to let pcnet_cs work on more cards, please pull from git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git urgent Thanks, Dominik Dominik Brodowski (3): pcmcia serial_cs.c: fix multifunction card handling pcmcia: per-device, not per-socket debug messages pcmcia pcnet_cs: try setting io_lines to 16 if card setup fails drivers/net/pcmcia/pcnet_cs.c | 139 ++++++++++++++++++++++--------------- drivers/pcmcia/pcmcia_resource.c | 51 +++++++------- drivers/serial/serial_cs.c | 62 ++++++++++------- 3 files changed, 146 insertions(+), 106 deletions(-) From komurojun-mbn at nifty.com Fri Sep 17 09:06:51 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Fri, 17 Sep 2010 22:06:51 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100913195353.GA6999@comet.dominikbrodowski.net> References: <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> Message-ID: <31800273.194401284728811871.komurojun-mbn@nifty.com> Hi, Xircom multi-function card still does not work. Please see the attached dmesg log. Best Regards Komuro ----- Original Message ----- >Date: Mon, 13 Sep 2010 21:53:53 +0200 >From: Dominik Brodowski >To: Komuro >Cc: linux-pcmcia at lists.infradead.org, linux-serial at vger.kernel.org >Subject: Re: Re: Re: Re: [PATCH 11/18] pcmcia: do not use io_req_t when > calling pcmcia_request_io() > > >Dear Komuro, > >does the attached patch help with 2.6.36-rc4? > >Best, > Dominik > >commit 1852d6b8c3fa2d1765f66cd7d96a8c6bf9f01997 >Author: Dominik Brodowski >Date: Mon Aug 30 08:18:54 2010 +0200 > > pcmcia serial_cs.c: fix multifunction card handling > > We shouldn't overwrite pre-set values, and we should also > set the port address to the beginning, and not the end of > the 8-port range. > > Reported-by: Komuro > Signed-off-by: Dominik Brodowski > >diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c >index 141c695..7d475b2 100644 >--- a/drivers/serial/serial_cs.c >+++ b/drivers/serial/serial_cs.c >@@ -335,8 +335,6 @@ static int serial_probe(struct pcmcia_device *link) > info->p_dev = link; > link->priv = info; > >- link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; >- link->resource[0]->end = 8; > link->conf.Attributes = CONF_ENABLE_IRQ; > if (do_sound) { > link->conf.Attributes |= CONF_ENABLE_SPKR; >@@ -411,6 +409,27 @@ static int setup_serial(struct pcmcia_device *handle, st ruct serial_info * info, > > /*====================================================================*/ > >+static int pfc_config(struct pcmcia_device *p_dev) >+{ >+ unsigned int port = 0; >+ struct serial_info *info = p_dev->priv; >+ >+ if ((p_dev->resource[1]->end != 0) && >+ (resource_size(p_dev->resource[1]) == 8)) { >+ port = p_dev->resource[1]->start; >+ info->slave = 1; >+ } else if ((info->manfid == MANFID_OSITECH) && >+ (resource_size(p_dev->resource[0]) == 0x40)) { >+ port = p_dev->resource[0]->start + 0x28; >+ info->slave = 1; >+ } >+ if (info->slave) >+ return setup_serial(p_dev, info, port, p_dev->irq); >+ >+ dev_warn(&p_dev->dev, "no usable port range found, giving up\n"); >+ return -ENODEV; >+} >+ > static int simple_config_check(struct pcmcia_device *p_dev, > cistpl_cftable_entry_t *cf, > cistpl_cftable_entry_t *dflt, >@@ -461,23 +480,8 @@ static int simple_config(struct pcmcia_device *link) > struct serial_info *info = link->priv; > int i = -ENODEV, try; > >- /* If the card is already configured, look up the port and irq */ >- if (link->function_config) { >- unsigned int port = 0; >- if ((link->resource[1]->end != 0) && >- (resource_size(link->resource[1]) == 8)) { >- port = link->resource[1]->end; >- info->slave = 1; >- } else if ((info->manfid == MANFID_OSITECH) && >- (resource_size(link->resource[0]) == 0x40)) { >- port = link->resource[0]->start + 0x28; >- info->slave = 1; >- } >- if (info->slave) { >- return setup_serial(link, info, port, >- link->irq); >- } >- } >+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; >+ link->resource[0]->end = 8; > > /* First pass: look for a config entry that looks normal. > * Two tries: without IO aliases, then with aliases */ >@@ -491,8 +495,7 @@ static int simple_config(struct pcmcia_device *link) > if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) > goto found_port; > >- printk(KERN_NOTICE >- "serial_cs: no usable port range found, giving up\n"); >+ dev_warn(&link->dev, "no usable port range found, giving up\n"); > return -1; > > found_port: >@@ -558,6 +561,7 @@ static int multi_config(struct pcmcia_device *link) > int i, base2 = 0; > > /* First, look for a generic full-sized window */ >+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; > link->resource[0]->end = info->multi * 8; > if (pcmcia_loop_config(link, multi_config_check, &base2)) { > /* If that didn't work, look for two windows */ >@@ -565,15 +569,14 @@ static int multi_config(struct pcmcia_device *link) > info->multi = 2; > if (pcmcia_loop_config(link, multi_config_check_notpicky, > &base2)) { >- printk(KERN_NOTICE "serial_cs: no usable port range" >+ dev_warn(&link->dev, "no usable port range " > "found, giving up\n"); > return -ENODEV; > } > } > > if (!link->irq) >- dev_warn(&link->dev, >- "serial_cs: no usable IRQ found, continuing...\n"); >+ dev_warn(&link->dev, "no usable IRQ found, continuing...\n"); > > /* > * Apply any configuration quirks. >@@ -675,6 +678,7 @@ static int serial_config(struct pcmcia_device * link) > multifunction cards that ask for appropriate IO port ranges */ > if ((info->multi == 0) && > (link->has_func_id) && >+ (link->socket->pcmcia_pfc == 0) && > ((link->func_id == CISTPL_FUNCID_MULTI) || > (link->func_id == CISTPL_FUNCID_SERIAL))) > pcmcia_loop_config(link, serial_check_for_multi, info); >@@ -685,7 +689,13 @@ static int serial_config(struct pcmcia_device * link) > if (info->quirk && info->quirk->multi != -1) > info->multi = info->quirk->multi; > >- if (info->multi > 1) >+ dev_info(&link->dev, >+ "trying to set up [0x%04x:0x%04x] (pfc: %d, multi: %d, quirk: %p)\n", >+ link->manf_id, link->card_id, >+ link->socket->pcmcia_pfc, info->multi, info->quirk); >+ if (link->socket->pcmcia_pfc) >+ i = pfc_config(link); >+ else if (info->multi > 1) > i = multi_config(link); > else > i = simple_config(link); >@@ -704,7 +714,7 @@ static int serial_config(struct pcmcia_device * link) > return 0; > > failed: >- dev_warn(&link->dev, "serial_cs: failed to initialize\n"); >+ dev_warn(&link->dev, "failed to initialize\n"); > serial_remove(link); > return -ENODEV; > } -------------- next part -------------- A non-text attachment was scrubbed... Name: serial_cs.log Type: application/octet-stream Size: 14661 bytes Desc: not available URL: From linux at dominikbrodowski.net Fri Sep 17 14:52:12 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Fri, 17 Sep 2010 20:52:12 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <31800273.194401284728811871.komurojun-mbn@nifty.com> References: <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> Message-ID: <20100917185212.GA26258@comet.dominikbrodowski.net> Dear Komuro, On Fri, Sep 17, 2010 at 10:06:51PM +0900, Komuro wrote: > Xircom multi-function card still does not work. Huh, that is indeed surprising, as the dmesg has all the usual config descriptions: eth0: Xircom: port 0x300, irq 18, hwaddr 00:10:a4:f3:db:02 ... 0.1: ttyS3 at I/O 0x2e8 (irq = 18) is a 16550A Are these lines different from what you see on a working kernel? Best, Dominik From randy.dunlap at oracle.com Fri Sep 17 17:06:33 2010 From: randy.dunlap at oracle.com (Randy Dunlap) Date: Fri, 17 Sep 2010 14:06:33 -0700 Subject: [PATCH 09/15] pcmcia: Documentation update In-Reply-To: <1283511434-21620-9-git-send-email-linux@dominikbrodowski.net> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-9-git-send-email-linux@dominikbrodowski.net> Message-ID: <20100917140633.7a8fa056.randy.dunlap@oracle.com> On Fri, 3 Sep 2010 12:57:08 +0200 Dominik Brodowski wrote: > Fill in missing descriptions and update some others for functions in > pcmcia_resource.c. > > Signed-off-by: Dominik Brodowski kernel-doc notation (beginning with /**) needs to have function parameters listed also, please. Otherwise it generates warnings when used in docbook. OK, I see a few of the functions have that, but they have a '-' following the parameter name instead of a ':'. Please change them to ':' (but yes, the function name itself is followed by a '-'). > --- > drivers/pcmcia/pcmcia_resource.c | 93 +++++++++++++++++++++++++++++--------- > 1 files changed, 71 insertions(+), 22 deletions(-) > > diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c > index f778e6c..511ae78 100644 > --- a/drivers/pcmcia/pcmcia_resource.c > +++ b/drivers/pcmcia/pcmcia_resource.c > @@ -55,6 +55,10 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, > } > > > +/** > + * release_io_space() - release IO ports allocated with alloc_io_space() > + * > + */ missing function params > static void release_io_space(struct pcmcia_socket *s, struct resource *res) > { > resource_size_t num = resource_size(res); > @@ -80,9 +84,11 @@ static void release_io_space(struct pcmcia_socket *s, struct resource *res) > } > } > } > -} /* release_io_space */ > +} > > -/** alloc_io_space > + > +/** > + * alloc_io_space() - allocate IO ports for use by a PCMCIA device ditto > * > * Special stuff for managing IO windows, because they are scarce > */ > @@ -134,7 +140,7 @@ static int alloc_io_space(struct pcmcia_socket *s, struct resource *res, > } > dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); > return ret; > -} /* alloc_io_space */ > +} > > > /** > @@ -203,6 +209,13 @@ int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) > EXPORT_SYMBOL(pcmcia_write_config_byte); > > > +/** > + * pcmcia_map_mem_page() - modify IO window to point to a different offset ditto > + * > + * pcmcia_map_mem_page() modifies what can be read and written by accessing > + * an iomem range previously enabled by pcmcia_request_window(), by setting > + * the card_offset value to @offset. > + */ > int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, > unsigned int offset) > { > @@ -312,6 +325,16 @@ unlock: > EXPORT_SYMBOL(pcmcia_fixup_vpp); > > > +/** > + * pcmcia_release_configuration() - physically disable a PCMCIA device ditto > + * > + * pcmcia_release_configuration() is the 1:1 counterpart to > + * pcmcia_enable_device(): If a PCMCIA device is no longer used by any > + * driver, the Vpp voltage is set to 0, IRQs will no longer be generated, > + * and I/O ranges will be disabled. As pcmcia_release_io() and > + * pcmcia_release_window() still need to be called, device drivers are > + * expected to call pcmcia_disable_device() instead. > + */ > int pcmcia_release_configuration(struct pcmcia_device *p_dev) > { > pccard_io_map io = { 0, 0, 0, 0, 1 }; > @@ -346,16 +369,17 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) > mutex_unlock(&s->ops_mutex); > > return 0; > -} /* pcmcia_release_configuration */ > +} > > > -/** pcmcia_release_io > +/** > + * pcmcia_release_io() - release I/O allocated by a PCMCIA device ditto > * > - * Release_io() releases the I/O ranges allocated by a client. This > - * may be invoked some time after a card ejection has already dumped > - * the actual socket configuration, so if the client is "stale", we > - * don't bother checking the port ranges against the current socket > - * values. > + * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA > + * device. This may be invoked some time after a card ejection has > + * already dumped the actual socket configuration, so if the client is > + * "stale", we don't bother checking the port ranges against the > + * current socket values. > */ > static int pcmcia_release_io(struct pcmcia_device *p_dev) > { > @@ -383,10 +407,11 @@ out: > return ret; > } /* pcmcia_release_io */ > > + > /** > * pcmcia_release_window() - release reserved iomem for PCMCIA devices ditto > * > - * pcmcia_release_window() releases struct resource *res which was > + * pcmcia_release_window() releases &struct resource *res which was > * previously reserved by calling pcmcia_request_window(). > */ > int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) > @@ -431,9 +456,16 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) > } /* pcmcia_release_window */ > EXPORT_SYMBOL(pcmcia_release_window); > > + > /** > * pcmcia_enable_device() - set up and activate a PCMCIA device > + * @p_dev - the associated PCMCIA device > + * @flags - configuration options for this PCMCIA device * @p_dev: ... * @flags: ... > * > + * pcmcia_enable_device() physically enables a PCMCIA device. It parses > + * the flags passed to in @flags and stored in @p_dev->flags and sets up > + * the Vpp voltage, enables the speaker line, I/O ports and store proper > + * values to configuration registers. > */ > int pcmcia_enable_device(struct pcmcia_device *p_dev) > { > @@ -565,8 +597,9 @@ EXPORT_SYMBOL(pcmcia_enable_device); > > /** > * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices > + * @p_dev - the associated PCMCIA device * @p_dev: ... > * > - * pcmcia_request_io() attepts to reserve the IO port ranges specified in > + * pcmcia_request_io() attempts to reserve the IO port ranges specified in > * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The > * "start" value is the requested start of the IO port resource; "end" > * reflects the number of ports requested. The number of IO lines requested > @@ -624,10 +657,10 @@ EXPORT_SYMBOL(pcmcia_request_io); > /** > * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device params? > * > - * pcmcia_request_irq() is a wrapper around request_irq which will allow > + * pcmcia_request_irq() is a wrapper around request_irq() which allows > * the PCMCIA core to clean up the registration in pcmcia_disable_device(). > * Drivers are free to use request_irq() directly, but then they need to > - * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ > + * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ > * handlers are allowed. > */ > int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, > @@ -651,11 +684,11 @@ EXPORT_SYMBOL(pcmcia_request_irq); > /** > * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first function params > * > - * pcmcia_request_exclusive_irq() is a wrapper around request_irq which > + * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which > * attempts first to request an exclusive IRQ. If it fails, it also accepts > * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for > * IRQ sharing and either use request_irq directly (then they need to call > - * free_irq themselves, too), or the pcmcia_request_irq() function. > + * free_irq() themselves, too), or the pcmcia_request_irq() function. > */ > int __must_check > __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, > @@ -798,10 +831,13 @@ int pcmcia_setup_irq(struct pcmcia_device *p_dev) > > /** > * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices > + * @p_dev - the associated PCMCIA device > + * @res - &struct resource pointing to p_dev->resource[2..5] > + * @speed - access speed change to * @speed: ... etc. > * > * pcmcia_request_window() attepts to reserve an iomem ranges specified in > - * struct resource *res pointing to one of the entries in > - * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the > + * &struct resource @res pointing to one of the entries in > + * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the > * requested start of the IO mem resource; "end" reflects the size > * requested. > */ > @@ -893,6 +929,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, > } /* pcmcia_request_window */ > EXPORT_SYMBOL(pcmcia_request_window); > > + > +/** > + * pcmcia_disable_device() - disable and clean up a PCMCIA device > + * @p_dev - the associated PCMCIA device * @p_dev: ... > + * > + * pcmcia_disable_device() is the driver-callable counterpart to > + * pcmcia_enable_device(): If a PCMCIA device is no longer used, > + * drivers are expected to clean up and disable the device by calling > + * this function. Any I/O ranges (iomem and ioports) will be released, > + * the Vpp voltage will be set to 0, and IRQs will no longer be > + * generated -- at least if there is no other card function (of > + * multifunction devices) being used. > + */ > void pcmcia_disable_device(struct pcmcia_device *p_dev) > { > int i; > -- --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** From komurojun-mbn at nifty.com Fri Sep 17 21:45:04 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sat, 18 Sep 2010 10:45:04 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100917185212.GA26258@comet.dominikbrodowski.net> References: <20100917185212.GA26258@comet.dominikbrodowski.net> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> Message-ID: <12823052.28741284774304299.komurojun-mbn@nifty.com> Hi, >Are these lines different from what you see on a working kernel? dmesg is same between working kernel and 2.6.36-rc3. but 2.6.36-rc3(+patch) , the serial part still does not work. ----- Original Message ----- >Date: Fri, 17 Sep 2010 20:52:12 +0200 >From: Dominik Brodowski >To: Komuro >Cc: linux-pcmcia at lists.infradead.org, linux-serial at vger.kernel.org >Subject: Re: Re: Re: Re: Re: [PATCH 11/18] pcmcia: do not use io_req_t when > calling pcmcia_request_io() > > >Dear Komuro, > >On Fri, Sep 17, 2010 at 10:06:51PM +0900, Komuro wrote: >> Xircom multi-function card still does not work. > >Huh, that is indeed surprising, as the dmesg has all the usual config >descriptions: > >eth0: Xircom: port 0x300, irq 18, hwaddr 00:10:a4:f3:db:02 >... >0.1: ttyS3 at I/O 0x2e8 (irq = 18) is a 16550A > >Are these lines different from what you see on a working kernel? > >Best, > Dominik From komurojun-mbn at nifty.com Fri Sep 17 22:48:32 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sat, 18 Sep 2010 11:48:32 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <12823052.28741284774304299.komurojun-mbn@nifty.com> References: <12823052.28741284774304299.komurojun-mbn@nifty.com> <20100917185212.GA26258@comet.dominikbrodowski.net> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> Message-ID: <22642468.38071284778112791.komurojun-mbn@nifty.com> Hi, Attached file is dmesg of another multi-function card(fmvj18x_cs) This card works with 2.6.35 but does not work with 2.6.36rc3(+patch). -------------- next part -------------- A non-text attachment was scrubbed... Name: serial2.log Type: application/octet-stream Size: 119993 bytes Desc: not available URL: From linux at dominikbrodowski.net Sat Sep 18 04:00:22 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 18 Sep 2010 10:00:22 +0200 Subject: [PATCH 09/15] pcmcia: Documentation update In-Reply-To: <20100917140633.7a8fa056.randy.dunlap@oracle.com> References: <20100903105628.GA21255@comet.dominikbrodowski.net> <1283511434-21620-9-git-send-email-linux@dominikbrodowski.net> <20100917140633.7a8fa056.randy.dunlap@oracle.com> Message-ID: <20100918080022.GA26329@comet.dominikbrodowski.net> On Fri, Sep 17, 2010 at 02:06:33PM -0700, Randy Dunlap wrote: > On Fri, 3 Sep 2010 12:57:08 +0200 Dominik Brodowski wrote: > > > Fill in missing descriptions and update some others for functions in > > pcmcia_resource.c. > > > > Signed-off-by: Dominik Brodowski > > kernel-doc notation (beginning with /**) needs to have function parameters > listed also, please. Otherwise it generates warnings when used in docbook. > > OK, I see a few of the functions have that, but they have a '-' following > the parameter name instead of a ':'. Please change them to ':' > (but yes, the function name itself is followed by a '-'). Thanks, fixed. Best, Dominik From linux at dominikbrodowski.net Sat Sep 18 04:23:21 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 18 Sep 2010 10:23:21 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <22642468.38071284778112791.komurojun-mbn@nifty.com> References: <20100917185212.GA26258@comet.dominikbrodowski.net> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> Message-ID: <20100918082321.GB26329@comet.dominikbrodowski.net> Hey, On Sat, Sep 18, 2010 at 11:48:32AM +0900, Komuro wrote: > Attached file is dmesg of another multi-function card(fmvj18x_cs) Thanks for the debug output -- this helps a lot! > This card works with 2.6.35 > but does not work with 2.6.36rc3(+patch). does this patch help (at least with the network function?)? Best, Dominik commit 9e7d4841d766f96a4e28a51c434485695d6a60ca Author: Dominik Brodowski Date: Sat Sep 18 10:19:13 2010 +0200 pcmcia: preserve configuration information if request_io fails partly If pcmcia_request_io() only fails partly -- for the second of two requested resources -- preserve the configuration settings for the first one. Signed-off-by: Dominik Brodowski diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index a5c1765..9ba4dad 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -595,7 +595,13 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) if (c->io[1].end) { ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); if (ret) { + struct resource tmp = c->io[0]; + /* release the previously allocated resource */ release_io_space(s, &c->io[0]); + /* but preserve the settings, for they worked... */ + c->io[0].end = resource_size(&tmp); + c->io[0].start = tmp.start; + c->io[0].flags = tmp.flags; goto out; } } else From linux at dominikbrodowski.net Sat Sep 18 05:58:03 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 18 Sep 2010 11:58:03 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <12823052.28741284774304299.komurojun-mbn@nifty.com> References: <20100917185212.GA26258@comet.dominikbrodowski.net> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <12823052.28741284774304299.komurojun-mbn@nifty.com> Message-ID: <20100918095803.GA6415@comet.dominikbrodowski.net> Hey, with 2.6.36-rc4+ (as of today), I see a (similar?) issue: When inserting a multifunction card after reboot for the first time, the serial part does not work. After re-inserting the card, it works. Re-loading the PCMCIA modules does not make the bug re-appear, so I presume the issue to be related to the serial layer. Could you verify whether it also works on 2.6.36-rc4+ for you, at least if you re-insert the card? Will try to investigate further as to the cause(s) of this bug. Best, Dominik From komurojun-mbn at nifty.com Sat Sep 18 06:20:31 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sat, 18 Sep 2010 19:20:31 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100918082321.GB26329@comet.dominikbrodowski.net> References: <20100918082321.GB26329@comet.dominikbrodowski.net> <20100917185212.GA26258@comet.dominikbrodowski.net> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> Message-ID: <6075501.91281284805231417.komurojun-mbn@nifty.com> Hi, With this patch, fmvj18x_cs based card works (both network and serial). but Serial part of Xircom card still does not work. I think the reason is irq or io_width or io_lines is not setuped properly for Xircom-card by pcmcia_core. > > >Hey, > >On Sat, Sep 18, 2010 at 11:48:32AM +0900, Komuro wrote: >> Attached file is dmesg of another multi-function card(fmvj18x_cs) > >Thanks for the debug output -- this helps a lot! > >> This card works with 2.6.35 >> but does not work with 2.6.36rc3(+patch). > >does this patch help (at least with the network function?)? > >Best, > Dominik > > >commit 9e7d4841d766f96a4e28a51c434485695d6a60ca >Author: Dominik Brodowski >Date: Sat Sep 18 10:19:13 2010 +0200 > > pcmcia: preserve configuration information if request_io fails partly > > If pcmcia_request_io() only fails partly -- for the second of two > requested resources -- preserve the configuration settings for the > first one. > > Signed-off-by: Dominik Brodowski > >diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resourc e.c >index a5c1765..9ba4dad 100644 >--- a/drivers/pcmcia/pcmcia_resource.c >+++ b/drivers/pcmcia/pcmcia_resource.c >@@ -595,7 +595,13 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) > if (c->io[1].end) { > ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); > if (ret) { >+ struct resource tmp = c->io[0]; >+ /* release the previously allocated resource */ > release_io_space(s, &c->io[0]); >+ /* but preserve the settings, for they worked... */ >+ c->io[0].end = resource_size(&tmp); >+ c->io[0].start = tmp.start; >+ c->io[0].flags = tmp.flags; > goto out; > } > } else From linux at dominikbrodowski.net Sat Sep 18 07:13:53 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 18 Sep 2010 13:13:53 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <6075501.91281284805231417.komurojun-mbn@nifty.com> References: <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> Message-ID: <20100918111353.GA5533@isilmar-3.linta.de> Hey, On Sat, Sep 18, 2010 at 07:20:31PM +0900, Komuro wrote: > With this patch, fmvj18x_cs based card works (both network and serial). good. Will push the patch upstream, then. > but Serial part of Xircom card still does not work. Also on re-inserting the card (with 2.6.36-rc4+ as of today)? > I think the reason is irq or io_width or io_lines is not setuped properly > for Xircom-card by pcmcia_core. But those values are the same for 2.6.35 and 2.6.36-rc4+, else we wouldn't see the same eth0: Xircom: port 0x300, irq 18, hwaddr 00:10:a4:f3:db:02 0.1: ttyS3 at I/O 0x2e8 (irq = 18) is a 16550A messages. Furthermore, at least some access to the serial part does work, elese we wouldn't see the "is a 16550A" message, right? Best, Dominik From komurojun-mbn at nifty.com Sat Sep 18 08:50:31 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sat, 18 Sep 2010 21:50:31 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100918111353.GA5533@isilmar-3.linta.de> References: <20100918111353.GA5533@isilmar-3.linta.de> <20100913195353.GA6999@comet.dominikbrodowski.net> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> Message-ID: <14067525.113201284814231692.komurojun-mbn@nifty.com> Hi, >Also on re-inserting the card (with 2.6.36-rc4+ as of today)? I tried the 2.6.36-rc4-git4. The serial part still does not work, before and after re-inserting the card. >elese we wouldn't see the "is a 16550A" message, right? Even if the COR(Configuration Option Register) of irq is not properly setup, we can see the above message... >Hey, > >On Sat, Sep 18, 2010 at 07:20:31PM +0900, Komuro wrote: >> With this patch, fmvj18x_cs based card works (both network and serial). > >good. Will push the patch upstream, then. > >> but Serial part of Xircom card still does not work. > >Also on re-inserting the card (with 2.6.36-rc4+ as of today)? > >> I think the reason is irq or io_width or io_lines is not setuped properly >> for Xircom-card by pcmcia_core. > >But those values are the same for 2.6.35 and 2.6.36-rc4+, else we wouldn't >see the same > >eth0: Xircom: port 0x300, irq 18, hwaddr 00:10:a4:f3:db:02 >0.1: ttyS3 at I/O 0x2e8 (irq = 18) is a 16550A > >messages. Furthermore, at least some access to the serial part does work, >elese we wouldn't see the "is a 16550A" message, right? > >Best, > Dominik From linux at dominikbrodowski.net Sat Sep 18 09:32:12 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 18 Sep 2010 15:32:12 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <14067525.113201284814231692.komurojun-mbn@nifty.com> References: <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> <14067525.113201284814231692.komurojun-mbn@nifty.com> Message-ID: <20100918133212.GA9688@isilmar-3.linta.de> Hey, On Sat, Sep 18, 2010 at 09:50:31PM +0900, Komuro wrote: > >Also on re-inserting the card (with 2.6.36-rc4+ as of today)? > > I tried the 2.6.36-rc4-git4. Thanks for testing! > >elese we wouldn't see the "is a 16550A" message, right? > > Even if the COR(Configuration Option Register) of irq is not properly setup, > we can see the above message... Nothing relating to setting CISREG_COR (at least on pcnet_cs) changed, and serial_cs does not modify CISREG_COR on such pseudo-multifunction devices. Would it be possible for you to re-check plain 2.6.35 and 2.6.35 with the pcmcia patchset availble at http://userweb.kernel.org/~brodo/pcmcia-2.6.35.diff ? If this works, we know that it's a serial/tty core issue, else it's indeed a PCMCIA issue. Pavel: has the bt / pcmcia issue you were seeing with -rc1 been solved? If not, could you try out 2.6.35 with this bigdiff as well, please? Thanks & best, Dominik From komurojun-mbn at nifty.com Sun Sep 19 03:39:23 2010 From: komurojun-mbn at nifty.com (Komuro) Date: Sun, 19 Sep 2010 16:39:23 +0900 (JST) Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100918133212.GA9688@isilmar-3.linta.de> References: <20100918133212.GA9688@isilmar-3.linta.de> <20100904174334.GA955@isilmar-3.linta.de> <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> <14067525.113201284814231692.komurojun-mbn@nifty.com> Message-ID: <32784617.54791284881963911.komurojun-mbn@nifty.com> Hi, > http://userweb.kernel.org/~brodo/pcmcia-2.6.35.diff Serial part of Xircom card works with pcmcia-2.6.35.diff. ----- Original Message ----- >Date: Sat, 18 Sep 2010 15:32:12 +0200 >From: Dominik Brodowski >To: Komuro , pavel at ucw.cz >Cc: linux-pcmcia at lists.infradead.org >Subject: Re: Re: Re: Re: Re: Re: Re: Re: Re: [PATCH 11/18] pcmcia: do not > use io_req_t when calling pcmcia_request_io() > > >Hey, > >On Sat, Sep 18, 2010 at 09:50:31PM +0900, Komuro wrote: >> >Also on re-inserting the card (with 2.6.36-rc4+ as of today)? >> >> I tried the 2.6.36-rc4-git4. > >Thanks for testing! > >> >elese we wouldn't see the "is a 16550A" message, right? >> >> Even if the COR(Configuration Option Register) of irq is not properly setup , >> we can see the above message... > >Nothing relating to setting CISREG_COR (at least on pcnet_cs) changed, and >serial_cs does not modify CISREG_COR on such pseudo-multifunction devices. > >Would it be possible for you to re-check plain 2.6.35 and 2.6.35 with the >pcmcia patchset availble at > http://userweb.kernel.org/~brodo/pcmcia-2.6.35.diff >? > >If this works, we know that it's a serial/tty core issue, else it's indeed a >PCMCIA issue. > >Pavel: has the bt / pcmcia issue you were seeing with -rc1 been solved? If >not, could you try out 2.6.35 with this bigdiff as well, please? > >Thanks & best, > Dominik From linux at dominikbrodowski.net Sun Sep 19 04:54:50 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 19 Sep 2010 10:54:50 +0200 Subject: serial_cs bug (serial subsystem, not pcmcia subsystem) In-Reply-To: <32784617.54791284881963911.komurojun-mbn@nifty.com> References: <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> <14067525.113201284814231692.komurojun-mbn@nifty.com> <32784617.54791284881963911.komurojun-mbn@nifty.com> Message-ID: <20100919085450.GA24278@isilmar-3.linta.de> Hey, On Sun, Sep 19, 2010 at 04:39:23PM +0900, Komuro wrote: > Hi, > > > http://userweb.kernel.org/~brodo/pcmcia-2.6.35.diff > > Serial part of Xircom card works with pcmcia-2.6.35.diff. thanks for testing. This means that some non-PCMCIA change since 2.6.35 broke the serial part of Xircom cards -- using serial_cs... To the linux-serial list: any idea of what might have changed? Pavel: any news from your side? Best, Dominik From pavel at ucw.cz Sun Sep 19 06:04:36 2010 From: pavel at ucw.cz (Pavel Machek) Date: Sun, 19 Sep 2010 12:04:36 +0200 Subject: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io() In-Reply-To: <20100918133212.GA9688@isilmar-3.linta.de> References: <20100904105415.GC16589@isilmar-3.linta.de> <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> <14067525.113201284814231692.komurojun-mbn@nifty.com> <20100918133212.GA9688@isilmar-3.linta.de> Message-ID: <20100919100435.GA1637@ucw.cz> Hi! > > Nothing relating to setting CISREG_COR (at least on pcnet_cs) changed, and > serial_cs does not modify CISREG_COR on such pseudo-multifunction devices. > > Would it be possible for you to re-check plain 2.6.35 and 2.6.35 with the > pcmcia patchset availble at > http://userweb.kernel.org/~brodo/pcmcia-2.6.35.diff > ? > > If this works, we know that it's a serial/tty core issue, else it's indeed a > PCMCIA issue. > > Pavel: has the bt / pcmcia issue you were seeing with -rc1 been solved? If > not, could you try out 2.6.35 with this bigdiff as well, please? No, I still have the problem in -rc4. I did a quick test, and 2.6.35+your bigdiff works ok. (did not run make clean, that would be slow) Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html From segooon at gmail.com Sun Sep 19 08:54:55 2010 From: segooon at gmail.com (Vasiliy Kulikov) Date: Sun, 19 Sep 2010 16:54:55 +0400 Subject: [PATCH 06/14] pcmcia: cs: fix device_register() error handling Message-ID: <1284900895-24453-1-git-send-email-segooon@gmail.com> If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov --- compile tested. drivers/pcmcia/cs.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index d8189d4..9e8ab51 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -592,6 +592,7 @@ static int pccardd(void *__skt) if (ret) { dev_printk(KERN_WARNING, &skt->dev, "PCMCIA: unable to register socket\n"); + put_device(&skt->dev); skt->thread = NULL; complete(&skt->thread_done); return 0; -- 1.7.0.4 From segooon at gmail.com Sun Sep 19 08:54:58 2010 From: segooon at gmail.com (Vasiliy Kulikov) Date: Sun, 19 Sep 2010 16:54:58 +0400 Subject: [PATCH 07/14] pcmcia: ds: fix device_register() error handling Message-ID: <1284900898-24495-1-git-send-email-segooon@gmail.com> If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov --- compile tested. drivers/pcmcia/ds.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 100c441..b56f5a6 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -582,10 +582,12 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, pcmcia_device_query(p_dev); if (device_register(&p_dev->dev)) - goto err_unreg; + goto err_put_device; return p_dev; + err_put_device: + put_device(&p_dev->dev); err_unreg: mutex_lock(&s->ops_mutex); list_del(&p_dev->socket_device_list); -- 1.7.0.4 From linux at dominikbrodowski.net Sun Sep 19 09:23:20 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 19 Sep 2010 15:23:20 +0200 Subject: [PATCH 06/14] pcmcia: cs: fix device_register() error handling In-Reply-To: <1284900895-24453-1-git-send-email-segooon@gmail.com> References: <1284900895-24453-1-git-send-email-segooon@gmail.com> Message-ID: <20100919132320.GB5569@isilmar-3.linta.de> On Sun, Sep 19, 2010 at 04:54:55PM +0400, Vasiliy Kulikov wrote: > If device_register() fails then call put_device(). > See comment to device_register. > > Signed-off-by: Vasiliy Kulikov Acked-by: Dominik Brodowski Thanks, Dominik From linux at dominikbrodowski.net Sun Sep 19 09:23:47 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 19 Sep 2010 15:23:47 +0200 Subject: [PATCH 07/14] pcmcia: ds: fix device_register() error handling In-Reply-To: <1284900898-24495-1-git-send-email-segooon@gmail.com> References: <1284900898-24495-1-git-send-email-segooon@gmail.com> Message-ID: <20100919132347.GC5569@isilmar-3.linta.de> On Sun, Sep 19, 2010 at 04:54:58PM +0400, Vasiliy Kulikov wrote: > If device_register() fails then call put_device(). > See comment to device_register. > > Signed-off-by: Vasiliy Kulikov Acked-by: Dominik Brodowski Thanks, Dominik From linux at dominikbrodowski.net Sun Sep 19 15:11:29 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 19 Sep 2010 21:11:29 +0200 Subject: serial_cs bug (serial subsystem, not pcmcia subsystem) In-Reply-To: <20100919100435.GA1637@ucw.cz> References: <20100830062724.GA2387@comet.dominikbrodowski.net> <13928942.191731283256326809.komurojun-mbn@nifty.com> <29547163.98341283601820252.komurojun-mbn@nifty.com> <8520532.194511283862270702.komurojun-mbn@nifty.com> <31800273.194401284728811871.komurojun-mbn@nifty.com> <22642468.38071284778112791.komurojun-mbn@nifty.com> <6075501.91281284805231417.komurojun-mbn@nifty.com> <14067525.113201284814231692.komurojun-mbn@nifty.com> <20100918133212.GA9688@isilmar-3.linta.de> <20100919100435.GA1637@ucw.cz> Message-ID: <20100919191129.GA2799@isilmar-3.linta.de> Hey Pavel, thanks for testing! On Sun, Sep 19, 2010 at 12:04:36PM +0200, Pavel Machek wrote: > No, I still have the problem in -rc4. > > I did a quick test, and 2.6.35+your bigdiff works ok. so we now have two indepenent indications something is broken in the serial subsystem -- the other being Komuro's xircom multifunction card having stopped working. Best, Dominik From randy.dunlap at oracle.com Mon Sep 20 12:18:11 2010 From: randy.dunlap at oracle.com (Randy Dunlap) Date: Mon, 20 Sep 2010 09:18:11 -0700 Subject: linux-next: Tree for September 20 (scsi/pcmcia/nsp_cs.c) In-Reply-To: <20100920161239.f204a507.sfr@canb.auug.org.au> References: <20100920161239.f204a507.sfr@canb.auug.org.au> Message-ID: <20100920091811.551ee35a.randy.dunlap@oracle.com> On Mon, 20 Sep 2010 16:12:39 +1000 Stephen Rothwell wrote: > Hi all, > > Changes since 20100917: drivers/scsi/pcmcia/nsp_cs.c:1573: error: 'cfg' undeclared (first use in this function) drivers/scsi/pcmcia/nsp_cs.c:1592: error: dereferencing pointer to incomplete type drivers/scsi/pcmcia/nsp_cs.c:1595: error: dereferencing pointer to incomplete type drivers/scsi/pcmcia/nsp_cs.c:1697: error: 'struct pcmcia_device' has no member named 'win' (rand)config is attached. --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -------------- next part -------------- A non-text attachment was scrubbed... Name: config-r6808 Type: application/octet-stream Size: 44305 bytes Desc: not available URL: From linux at dominikbrodowski.net Mon Sep 20 13:42:55 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Mon, 20 Sep 2010 19:42:55 +0200 Subject: linux-next: Tree for September 20 (scsi/pcmcia/nsp_cs.c) In-Reply-To: <20100920091811.551ee35a.randy.dunlap@oracle.com> References: <20100920161239.f204a507.sfr@canb.auug.org.au> <20100920091811.551ee35a.randy.dunlap@oracle.com> Message-ID: <20100920174255.GA16938@isilmar-3.linta.de> Thanks for testing, should be fixed for tomorrow. On Mon, Sep 20, 2010 at 09:18:11AM -0700, Randy Dunlap wrote: > On Mon, 20 Sep 2010 16:12:39 +1000 Stephen Rothwell wrote: > > > Hi all, > > > > Changes since 20100917: > > > drivers/scsi/pcmcia/nsp_cs.c:1573: error: 'cfg' undeclared (first use in this function) > drivers/scsi/pcmcia/nsp_cs.c:1592: error: dereferencing pointer to incomplete type > drivers/scsi/pcmcia/nsp_cs.c:1595: error: dereferencing pointer to incomplete type > drivers/scsi/pcmcia/nsp_cs.c:1697: error: 'struct pcmcia_device' has no member named 'win' > > > (rand)config is attached. > > --- > ~Randy > *** Remember to use Documentation/SubmitChecklist when testing your code *** From dbaryshkov at gmail.com Thu Sep 23 11:19:53 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:19:53 +0400 Subject: [PATCH 1/5] Makefile.fwinst: include Makefile.lib Message-ID: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Include Makefile.lib into Makefile.fwinst to enable _shipped processing. Signed-off-by: Dmitry Eremin-Solenikov --- scripts/Makefile.fwinst | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst index 6bf8e87..fd34b74 100644 --- a/scripts/Makefile.fwinst +++ b/scripts/Makefile.fwinst @@ -16,6 +16,7 @@ include scripts/Kbuild.include include $(srctree)/$(obj)/Makefile include scripts/Makefile.host +include scripts/Makefile.lib mod-fw := $(fw-shipped-m) # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the -- 1.5.6.5 From dbaryshkov at gmail.com Thu Sep 23 11:19:54 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:19:54 +0400 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> For CIS files (describing hardware on PCMCIA and some other busses) binary file isn't the 'preferred for for modification' in most cases. pcmcia-cs project have developed pack_cis program which can be used (and was used most probably) to generate .cis files from simple text descriptions. Import this code to the kernel under the name of mkcis. Signed-off-by: Dmitry Eremin-Solenikov --- firmware/mkcis-lexer.l | 228 ++++ firmware/mkcis-lexer.lex.c_shipped | 2547 +++++++++++++++++++++++++++++++++++ firmware/mkcis-parser.tab.c_shipped | 2259 +++++++++++++++++++++++++++++++ firmware/mkcis-parser.tab.h_shipped | 177 +++ firmware/mkcis-parser.y | 383 ++++++ firmware/mkcis.c | 471 +++++++ firmware/mkcis.h | 49 + 7 files changed, 6114 insertions(+), 0 deletions(-) create mode 100644 firmware/mkcis-lexer.l create mode 100644 firmware/mkcis-lexer.lex.c_shipped create mode 100644 firmware/mkcis-parser.tab.c_shipped create mode 100644 firmware/mkcis-parser.tab.h_shipped create mode 100644 firmware/mkcis-parser.y create mode 100644 firmware/mkcis.c create mode 100644 firmware/mkcis.h diff --git a/firmware/mkcis-lexer.l b/firmware/mkcis-lexer.l new file mode 100644 index 0000000..d802e3e --- /dev/null +++ b/firmware/mkcis-lexer.l @@ -0,0 +1,228 @@ +%{ +/* + * lex_cis.l 1.13 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +#define YY_NO_INPUT +#include "mkcis-parser.tab.h" + +/* For assembling nice error messages */ +int current_lineno; + +static int lex_number(char *); +static int lex_units(char *, int, int); +static int lex_float(char *); +static int lex_string(char *); + +%} +%option nounput + + +int [0-9]+ +hex 0x[0-9a-fA-F]+ +flt [0-9]+\.[0-9]* +str \"([^"]|\\.)*\" + +%% + +\n current_lineno++; +[ \t]* /* skip */ ; +[ ]*[#;].* /* skip */ ; + +funcid return FUNCID; +mfc return MFC; +manfid return MANFID; +vers_1 return VERS_1; +checksum return CHECKSUM; + +dev_info return DEV_INFO; +attr_dev_info return ATTR_DEV_INFO; +no_info return NO_INFO; +NULL return lex_number("0"); +ROM return lex_number("1"); +EPROM return lex_number("3"); +EEPROM return lex_number("4"); +FLASH return lex_number("5"); +SRAM return lex_number("6"); +DRAM return lex_number("7"); +fn_specific return lex_number("13"); + +config return CONFIG; +base return BASE; +mask return MASK; +last_index return LAST_INDEX; +\[post\] return POST; +\[rom\] return ROM; + +cftable_entry return CFTABLE; +\[default\] return DEFAULT; +\[bvd\] return BVD; +\[wp\] return WP; +\[rdybsy\] return RDYBSY; +\[mwait\] return MWAIT; +\[audio\] return AUDIO; +\[readonly\] return READONLY; +\[pwrdown\] return PWRDOWN; + +Vcc return VCC; +Vpp1 return VPP1; +Vpp2 return VPP2; +Vnom return VNOM; +Vmin return VMIN; +Vmax return VMAX; +Istatic return ISTATIC; +Iavg return IAVG; +Ipeak return IPEAK; +Idown return IDOWN; + +io return IO; +memory return MEM; +\[8bit\] return BIT8; +\[16bit\] return BIT16; +\[lines return LINES; +\[range\] return RANGE; + +irq return IRQ_NO; +\[level\] return LEVEL; +\[pulse\] return PULSE; +\[shared\] return SHARED; + +timing return TIMING; +wait return WAIT; +ready return READY; +reserved return RESERVED; + +multi_function return lex_number("0"); +memory_card return lex_number("1"); +serial_port return lex_number("2"); +parallel_port return lex_number("3"); +fixed_disk return lex_number("4"); +video_adapter return lex_number("5"); +network_adapter return lex_number("6"); +aims_card return lex_number("7"); +scsi_adapter return lex_number("8"); + +{int} return lex_number(yytext); +{hex} return lex_number(yytext); + +{int}b return lex_units(yytext, 1, SIZE); +{int}kb return lex_units(yytext, 1024, SIZE); +{int}mb return lex_units(yytext, 1024*1024, SIZE); + +{flt}s return lex_units(yytext, 1000000000, TIME); +{flt}ms return lex_units(yytext, 1000000, TIME); +{flt}us return lex_units(yytext, 1000, TIME); +{flt}ns return lex_units(yytext, 1, TIME); +{int}s return lex_units(yytext, 1000000000, TIME); +{int}ms return lex_units(yytext, 1000000, TIME); +{int}us return lex_units(yytext, 1000, TIME); +{int}ns return lex_units(yytext, 1, TIME); + +{flt}V return lex_units(yytext, 100000, VOLTAGE); +{flt}mV return lex_units(yytext, 100, VOLTAGE); +{flt}uV return lex_units(yytext, 0.1, VOLTAGE); +{int}V return lex_units(yytext, 100000, VOLTAGE); +{int}mV return lex_units(yytext, 100, VOLTAGE); +{int}uV return lex_units(yytext, 0.1, VOLTAGE); + +{flt}A return lex_units(yytext, 10000000, CURRENT); +{flt}mA return lex_units(yytext, 10000, CURRENT); +{flt}uA return lex_units(yytext, 10, CURRENT); +{int}A return lex_units(yytext, 10000000, CURRENT); +{int}mA return lex_units(yytext, 10000, CURRENT); +{int}uA return lex_units(yytext, 10, CURRENT); + +{flt} return lex_float(yytext); + +{str} return lex_string(yytext); + +. return yytext[0]; + +%% + +#ifndef yywrap +int yywrap() { return 1; } +#endif + +/*====================================================================== + + Stuff to parse basic data types + +======================================================================*/ + +static int lex_number(char *s) +{ + yylval.num = strtoul(s, NULL, 0); + return NUMBER; +} + +static int lex_float(char *s) +{ + yylval.flt = strtod(s, NULL); + return FLOAT; +} + +static int lex_units(char *s, int scale, int token) +{ + float f; + sscanf(s, "%f", &f); + yylval.num = scale*f + 0.5; + return token; +} + +static int lex_string(char *s) +{ + int n = strlen(s); + yylval.str = malloc(n-1); + strncpy(yylval.str, s+1, n-2); + yylval.str[n-2] = '\0'; + return STRING; +} + +/*====================================================================== + + The main parser entry point + +======================================================================*/ + +void parse_cis(FILE *f) +{ + current_lineno = 1; + yyrestart(f); + yyparse(); +} + diff --git a/firmware/mkcis-lexer.lex.c_shipped b/firmware/mkcis-lexer.lex.c_shipped new file mode 100644 index 0000000..aa3da20 --- /dev/null +++ b/firmware/mkcis-lexer.lex.c_shipped @@ -0,0 +1,2547 @@ +#line 2 "firmware/mkcis-lexer.lex.c" + +#line 4 "firmware/mkcis-lexer.lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 96 +#define YY_END_OF_BUFFER 97 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[442] = + { 0, + 2, 2, 97, 95, 2, 1, 2, 95, 3, 68, + 68, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 2, 2, 3, 0, 94, + 0, 3, 93, 68, 90, 84, 70, 0, 0, 0, + 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 94, 0, 93, + 87, 81, 0, 0, 73, 0, 71, 91, 85, 72, + 78, 80, 92, 86, 79, 69, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 13, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 88, 82, 74, + 76, 89, 83, 75, 18, 0, 0, 0, 42, 0, + + 0, 0, 12, 17, 40, 39, 38, 36, 37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 29, 0, 0, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 56, 0, 14, 16, 44, 43, 0, 0, 0, + 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 57, 0, 0, 0, 0, 0, 0, 15, 0, 0, + + 47, 0, 0, 0, 49, 0, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 4, 0, 6, 46, 0, 0, 0, 0, 0, + 0, 0, 55, 7, 0, 41, 48, 32, 0, 52, + 31, 53, 0, 50, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 54, 0, + 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, + 0, 58, 0, 0, 0, 27, 34, 0, 66, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 33, 0, 0, 63, 0, 23, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 60, 0, 0, + 0, 0, 61, 0, 0, 0, 0, 0, 0, 67, + 0, 10, 26, 0, 0, 62, 64, 59, 0, 65, + 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 7, 1, 8, 9, 10, + 11, 11, 11, 12, 11, 13, 11, 1, 6, 1, + 1, 1, 1, 1, 14, 15, 15, 16, 17, 18, + 1, 19, 20, 1, 1, 21, 22, 23, 24, 25, + 1, 26, 27, 1, 28, 29, 1, 1, 1, 1, + 30, 31, 32, 1, 33, 1, 34, 35, 36, 37, + + 38, 39, 40, 41, 42, 1, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[58] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[446] = + { 0, + 0, 0, 497, 498, 56, 498, 57, 57, 0, 82, + 440, 469, 47, 473, 31, 465, 468, 465, 30, 130, + 25, 456, 58, 451, 27, 24, 454, 47, 60, 453, + 448, 65, 443, 45, 450, 100, 104, 0, 109, 498, + 110, 0, 178, 427, 498, 498, 498, 447, 95, 430, + 498, 102, 0, 466, 454, 452, 463, 422, 428, 436, + 421, 451, 449, 456, 433, 78, 421, 419, 454, 430, + 411, 409, 424, 80, 406, 79, 110, 419, 411, 413, + 405, 405, 403, 416, 407, 398, 395, 417, 403, 498, + 399, 396, 91, 401, 409, 400, 391, 409, 391, 85, + + 389, 389, 393, 387, 399, 393, 118, 124, 151, 0, + 498, 498, 144, 383, 498, 147, 498, 498, 498, 498, + 498, 498, 498, 498, 498, 0, 411, 406, 407, 403, + 389, 373, 393, 392, 404, 498, 402, 498, 367, 376, + 376, 141, 385, 377, 381, 380, 377, 361, 368, 379, + 361, 367, 360, 363, 351, 373, 361, 371, 372, 352, + 352, 363, 366, 363, 359, 364, 358, 344, 358, 498, + 341, 353, 348, 343, 498, 337, 333, 345, 352, 348, + 346, 341, 340, 339, 329, 341, 326, 498, 498, 498, + 498, 498, 498, 498, 498, 353, 354, 356, 498, 328, + + 330, 320, 498, 498, 498, 498, 498, 498, 498, 329, + 318, 327, 336, 333, 328, 327, 322, 311, 311, 324, + 320, 324, 321, 325, 306, 498, 322, 321, 498, 318, + 309, 309, 308, 312, 300, 305, 313, 303, 498, 294, + 301, 295, 295, 296, 282, 288, 304, 302, 289, 301, + 286, 498, 310, 498, 498, 498, 498, 289, 278, 297, + 281, 498, 274, 282, 274, 272, 291, 284, 274, 282, + 268, 271, 498, 279, 280, 278, 270, 262, 272, 265, + 277, 271, 271, 265, 269, 248, 271, 253, 263, 257, + 498, 246, 265, 254, 257, 287, 262, 498, 258, 261, + + 498, 260, 247, 258, 498, 257, 498, 256, 232, 254, + 228, 238, 246, 248, 243, 242, 226, 498, 239, 240, + 240, 498, 229, 498, 241, 234, 229, 224, 232, 231, + 231, 234, 498, 498, 232, 498, 498, 498, 213, 498, + 498, 498, 218, 498, 231, 218, 229, 210, 205, 225, + 212, 209, 213, 212, 216, 216, 198, 217, 498, 205, + 211, 213, 198, 208, 212, 211, 498, 185, 498, 204, + 203, 192, 498, 498, 177, 188, 188, 191, 176, 187, + 187, 498, 171, 171, 183, 498, 498, 184, 498, 173, + 168, 170, 170, 155, 160, 173, 171, 158, 153, 154, + + 155, 498, 156, 149, 498, 164, 498, 162, 145, 162, + 147, 155, 132, 131, 140, 127, 498, 498, 130, 123, + 120, 119, 498, 130, 119, 106, 115, 108, 107, 498, + 102, 498, 498, 99, 83, 498, 498, 498, 34, 498, + 498, 231, 234, 237, 67 + } ; + +static yyconst flex_int16_t yy_def[446] = + { 0, + 441, 1, 441, 441, 441, 441, 441, 442, 443, 441, + 10, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 443, 442, 441, + 444, 443, 441, 10, 441, 441, 441, 441, 441, 441, + 441, 441, 445, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 442, 442, 444, 43, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 445, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 0, 441, 441, 441, 441 + } ; + +static yyconst flex_int16_t yy_nxt[556] = + { 0, + 4, 5, 6, 7, 8, 9, 4, 10, 11, 11, + 11, 11, 11, 4, 4, 12, 13, 14, 4, 15, + 4, 4, 16, 4, 4, 17, 18, 4, 19, 20, + 4, 4, 4, 21, 22, 23, 24, 4, 25, 4, + 4, 26, 4, 27, 28, 29, 4, 30, 4, 31, + 32, 33, 4, 34, 35, 4, 4, 36, 36, 36, + 37, 40, 38, 55, 58, 65, 80, 59, 87, 126, + 90, 56, 88, 91, 66, 67, 81, 68, 60, 89, + 93, 61, 104, 440, 94, 95, 105, 41, 43, 44, + 44, 44, 44, 44, 44, 45, 83, 97, 84, 96, + + 101, 36, 102, 36, 85, 36, 98, 37, 118, 38, + 46, 139, 39, 40, 108, 123, 47, 148, 180, 140, + 439, 149, 40, 119, 48, 151, 49, 50, 40, 120, + 124, 152, 51, 153, 52, 181, 172, 53, 69, 41, + 109, 173, 70, 154, 438, 121, 155, 156, 41, 208, + 209, 437, 125, 39, 41, 108, 157, 188, 436, 435, + 192, 434, 433, 71, 72, 432, 73, 431, 430, 429, + 428, 427, 189, 74, 75, 193, 426, 76, 425, 77, + 78, 109, 424, 423, 79, 110, 110, 110, 110, 110, + 110, 111, 422, 421, 190, 420, 419, 194, 418, 417, + + 416, 415, 414, 413, 412, 411, 112, 410, 409, 408, + 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, + 397, 396, 113, 114, 395, 394, 393, 392, 115, 391, + 116, 39, 39, 39, 42, 390, 42, 107, 107, 107, + 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, + 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, + 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, + 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, + 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, + 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, + + 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, + 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, + 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, + 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, + 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, + 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, + 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, + 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, + 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, + 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, + + 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, + 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, + 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, + 197, 196, 195, 191, 187, 186, 185, 184, 183, 182, + 179, 178, 177, 176, 175, 174, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, + 150, 147, 146, 145, 144, 143, 142, 141, 138, 137, + 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, + 122, 117, 441, 106, 103, 100, 99, 92, 86, 82, + 64, 63, 62, 57, 54, 441, 441, 3, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441 + } ; + +static yyconst flex_int16_t yy_chk[556] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 7, 5, + 7, 8, 7, 13, 15, 19, 21, 15, 25, 445, + 26, 13, 25, 26, 19, 19, 21, 19, 15, 25, + 28, 15, 34, 439, 28, 28, 34, 8, 10, 10, + 10, 10, 10, 10, 10, 10, 23, 29, 23, 28, + + 32, 36, 32, 36, 23, 37, 29, 37, 49, 37, + 10, 66, 41, 39, 41, 52, 10, 74, 100, 66, + 435, 74, 107, 49, 10, 76, 10, 10, 108, 49, + 52, 76, 10, 76, 10, 100, 93, 10, 20, 39, + 41, 93, 20, 77, 434, 49, 77, 77, 107, 142, + 142, 431, 52, 109, 108, 109, 77, 113, 429, 428, + 116, 427, 426, 20, 20, 425, 20, 424, 422, 421, + 420, 419, 113, 20, 20, 116, 416, 20, 415, 20, + 20, 109, 414, 413, 20, 43, 43, 43, 43, 43, + 43, 43, 412, 411, 113, 410, 409, 116, 408, 406, + + 404, 403, 401, 400, 399, 398, 43, 397, 396, 395, + 394, 393, 392, 391, 390, 388, 385, 384, 383, 381, + 380, 379, 43, 43, 378, 377, 376, 375, 43, 372, + 43, 442, 442, 442, 443, 371, 443, 444, 444, 444, + 370, 368, 366, 365, 364, 363, 362, 361, 360, 358, + 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, + 347, 346, 345, 343, 339, 335, 332, 331, 330, 329, + 328, 327, 326, 325, 323, 321, 320, 319, 317, 316, + 315, 314, 313, 312, 311, 310, 309, 308, 306, 304, + 303, 302, 300, 299, 297, 296, 295, 294, 293, 292, + + 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, + 280, 279, 278, 277, 276, 275, 274, 272, 271, 270, + 269, 268, 267, 266, 265, 264, 263, 261, 260, 259, + 258, 253, 251, 250, 249, 248, 247, 246, 245, 244, + 243, 242, 241, 240, 238, 237, 236, 235, 234, 233, + 232, 231, 230, 228, 227, 225, 224, 223, 222, 221, + 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, + 210, 202, 201, 200, 198, 197, 196, 187, 186, 185, + 184, 183, 182, 181, 180, 179, 178, 177, 176, 174, + 173, 172, 171, 169, 168, 167, 166, 165, 164, 163, + + 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, + 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, + 141, 140, 139, 137, 135, 134, 133, 132, 131, 130, + 129, 128, 127, 114, 106, 105, 104, 103, 102, 101, + 99, 98, 97, 96, 95, 94, 92, 91, 89, 88, + 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, + 75, 73, 72, 71, 70, 69, 68, 67, 65, 64, + 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, + 50, 48, 44, 35, 33, 31, 30, 27, 24, 22, + 18, 17, 16, 14, 12, 11, 3, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "firmware/mkcis-lexer.l" +#line 2 "firmware/mkcis-lexer.l" +/* + * lex_cis.l 1.13 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +#define YY_NO_INPUT +#include "mkcis-parser.tab.h" + +/* For assembling nice error messages */ +int current_lineno; + +static int lex_number(char *); +static int lex_units(char *, int, int); +static int lex_float(char *); +static int lex_string(char *); + +#line 778 "firmware/mkcis-lexer.lex.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 60 "firmware/mkcis-lexer.l" + + +#line 966 "firmware/mkcis-lexer.lex.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 498 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 62 "firmware/mkcis-lexer.l" +current_lineno++; + YY_BREAK +case 2: +YY_RULE_SETUP +#line 63 "firmware/mkcis-lexer.l" +/* skip */ ; + YY_BREAK +case 3: +YY_RULE_SETUP +#line 64 "firmware/mkcis-lexer.l" +/* skip */ ; + YY_BREAK +case 4: +YY_RULE_SETUP +#line 66 "firmware/mkcis-lexer.l" +return FUNCID; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 67 "firmware/mkcis-lexer.l" +return MFC; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 68 "firmware/mkcis-lexer.l" +return MANFID; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 69 "firmware/mkcis-lexer.l" +return VERS_1; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 70 "firmware/mkcis-lexer.l" +return CHECKSUM; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 72 "firmware/mkcis-lexer.l" +return DEV_INFO; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 73 "firmware/mkcis-lexer.l" +return ATTR_DEV_INFO; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 74 "firmware/mkcis-lexer.l" +return NO_INFO; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 75 "firmware/mkcis-lexer.l" +return lex_number("0"); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 76 "firmware/mkcis-lexer.l" +return lex_number("1"); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 77 "firmware/mkcis-lexer.l" +return lex_number("3"); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 78 "firmware/mkcis-lexer.l" +return lex_number("4"); + YY_BREAK +case 16: +YY_RULE_SETUP +#line 79 "firmware/mkcis-lexer.l" +return lex_number("5"); + YY_BREAK +case 17: +YY_RULE_SETUP +#line 80 "firmware/mkcis-lexer.l" +return lex_number("6"); + YY_BREAK +case 18: +YY_RULE_SETUP +#line 81 "firmware/mkcis-lexer.l" +return lex_number("7"); + YY_BREAK +case 19: +YY_RULE_SETUP +#line 82 "firmware/mkcis-lexer.l" +return lex_number("13"); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 84 "firmware/mkcis-lexer.l" +return CONFIG; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 85 "firmware/mkcis-lexer.l" +return BASE; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 86 "firmware/mkcis-lexer.l" +return MASK; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 87 "firmware/mkcis-lexer.l" +return LAST_INDEX; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 88 "firmware/mkcis-lexer.l" +return POST; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 89 "firmware/mkcis-lexer.l" +return ROM; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 91 "firmware/mkcis-lexer.l" +return CFTABLE; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 92 "firmware/mkcis-lexer.l" +return DEFAULT; + YY_BREAK +case 28: +YY_RULE_SETUP +#line 93 "firmware/mkcis-lexer.l" +return BVD; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 94 "firmware/mkcis-lexer.l" +return WP; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 95 "firmware/mkcis-lexer.l" +return RDYBSY; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 96 "firmware/mkcis-lexer.l" +return MWAIT; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 97 "firmware/mkcis-lexer.l" +return AUDIO; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 98 "firmware/mkcis-lexer.l" +return READONLY; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 99 "firmware/mkcis-lexer.l" +return PWRDOWN; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 101 "firmware/mkcis-lexer.l" +return VCC; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 102 "firmware/mkcis-lexer.l" +return VPP1; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 103 "firmware/mkcis-lexer.l" +return VPP2; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 104 "firmware/mkcis-lexer.l" +return VNOM; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 105 "firmware/mkcis-lexer.l" +return VMIN; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 106 "firmware/mkcis-lexer.l" +return VMAX; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 107 "firmware/mkcis-lexer.l" +return ISTATIC; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 108 "firmware/mkcis-lexer.l" +return IAVG; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 109 "firmware/mkcis-lexer.l" +return IPEAK; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 110 "firmware/mkcis-lexer.l" +return IDOWN; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 112 "firmware/mkcis-lexer.l" +return IO; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 113 "firmware/mkcis-lexer.l" +return MEM; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 114 "firmware/mkcis-lexer.l" +return BIT8; + YY_BREAK +case 48: +YY_RULE_SETUP +#line 115 "firmware/mkcis-lexer.l" +return BIT16; + YY_BREAK +case 49: +YY_RULE_SETUP +#line 116 "firmware/mkcis-lexer.l" +return LINES; + YY_BREAK +case 50: +YY_RULE_SETUP +#line 117 "firmware/mkcis-lexer.l" +return RANGE; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 119 "firmware/mkcis-lexer.l" +return IRQ_NO; + YY_BREAK +case 52: +YY_RULE_SETUP +#line 120 "firmware/mkcis-lexer.l" +return LEVEL; + YY_BREAK +case 53: +YY_RULE_SETUP +#line 121 "firmware/mkcis-lexer.l" +return PULSE; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 122 "firmware/mkcis-lexer.l" +return SHARED; + YY_BREAK +case 55: +YY_RULE_SETUP +#line 124 "firmware/mkcis-lexer.l" +return TIMING; + YY_BREAK +case 56: +YY_RULE_SETUP +#line 125 "firmware/mkcis-lexer.l" +return WAIT; + YY_BREAK +case 57: +YY_RULE_SETUP +#line 126 "firmware/mkcis-lexer.l" +return READY; + YY_BREAK +case 58: +YY_RULE_SETUP +#line 127 "firmware/mkcis-lexer.l" +return RESERVED; + YY_BREAK +case 59: +YY_RULE_SETUP +#line 129 "firmware/mkcis-lexer.l" +return lex_number("0"); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 130 "firmware/mkcis-lexer.l" +return lex_number("1"); + YY_BREAK +case 61: +YY_RULE_SETUP +#line 131 "firmware/mkcis-lexer.l" +return lex_number("2"); + YY_BREAK +case 62: +YY_RULE_SETUP +#line 132 "firmware/mkcis-lexer.l" +return lex_number("3"); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 133 "firmware/mkcis-lexer.l" +return lex_number("4"); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 134 "firmware/mkcis-lexer.l" +return lex_number("5"); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 135 "firmware/mkcis-lexer.l" +return lex_number("6"); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 136 "firmware/mkcis-lexer.l" +return lex_number("7"); + YY_BREAK +case 67: +YY_RULE_SETUP +#line 137 "firmware/mkcis-lexer.l" +return lex_number("8"); + YY_BREAK +case 68: +YY_RULE_SETUP +#line 139 "firmware/mkcis-lexer.l" +return lex_number(yytext); + YY_BREAK +case 69: +YY_RULE_SETUP +#line 140 "firmware/mkcis-lexer.l" +return lex_number(yytext); + YY_BREAK +case 70: +YY_RULE_SETUP +#line 142 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, SIZE); + YY_BREAK +case 71: +YY_RULE_SETUP +#line 143 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1024, SIZE); + YY_BREAK +case 72: +YY_RULE_SETUP +#line 144 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1024*1024, SIZE); + YY_BREAK +case 73: +YY_RULE_SETUP +#line 146 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000000, TIME); + YY_BREAK +case 74: +YY_RULE_SETUP +#line 147 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000, TIME); + YY_BREAK +case 75: +YY_RULE_SETUP +#line 148 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000, TIME); + YY_BREAK +case 76: +YY_RULE_SETUP +#line 149 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, TIME); + YY_BREAK +case 77: +YY_RULE_SETUP +#line 150 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000000, TIME); + YY_BREAK +case 78: +YY_RULE_SETUP +#line 151 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000, TIME); + YY_BREAK +case 79: +YY_RULE_SETUP +#line 152 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000, TIME); + YY_BREAK +case 80: +YY_RULE_SETUP +#line 153 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, TIME); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 155 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100000, VOLTAGE); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 156 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100, VOLTAGE); + YY_BREAK +case 83: +YY_RULE_SETUP +#line 157 "firmware/mkcis-lexer.l" +return lex_units(yytext, 0.1, VOLTAGE); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 158 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100000, VOLTAGE); + YY_BREAK +case 85: +YY_RULE_SETUP +#line 159 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100, VOLTAGE); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 160 "firmware/mkcis-lexer.l" +return lex_units(yytext, 0.1, VOLTAGE); + YY_BREAK +case 87: +YY_RULE_SETUP +#line 162 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000000, CURRENT); + YY_BREAK +case 88: +YY_RULE_SETUP +#line 163 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000, CURRENT); + YY_BREAK +case 89: +YY_RULE_SETUP +#line 164 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10, CURRENT); + YY_BREAK +case 90: +YY_RULE_SETUP +#line 165 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000000, CURRENT); + YY_BREAK +case 91: +YY_RULE_SETUP +#line 166 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000, CURRENT); + YY_BREAK +case 92: +YY_RULE_SETUP +#line 167 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10, CURRENT); + YY_BREAK +case 93: +YY_RULE_SETUP +#line 169 "firmware/mkcis-lexer.l" +return lex_float(yytext); + YY_BREAK +case 94: +/* rule 94 can match eol */ +YY_RULE_SETUP +#line 171 "firmware/mkcis-lexer.l" +return lex_string(yytext); + YY_BREAK +case 95: +YY_RULE_SETUP +#line 173 "firmware/mkcis-lexer.l" +return yytext[0]; + YY_BREAK +case 96: +YY_RULE_SETUP +#line 175 "firmware/mkcis-lexer.l" +ECHO; + YY_BREAK +#line 1531 "firmware/mkcis-lexer.lex.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 441); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 175 "firmware/mkcis-lexer.l" + + + +#ifndef yywrap +int yywrap() { return 1; } +#endif + +/*====================================================================== + + Stuff to parse basic data types + +======================================================================*/ + +static int lex_number(char *s) +{ + yylval.num = strtoul(s, NULL, 0); + return NUMBER; +} + +static int lex_float(char *s) +{ + yylval.flt = strtod(s, NULL); + return FLOAT; +} + +static int lex_units(char *s, int scale, int token) +{ + float f; + sscanf(s, "%f", &f); + yylval.num = scale*f + 0.5; + return token; +} + +static int lex_string(char *s) +{ + int n = strlen(s); + yylval.str = malloc(n-1); + strncpy(yylval.str, s+1, n-2); + yylval.str[n-2] = '\0'; + return STRING; +} + +/*====================================================================== + + The main parser entry point + +======================================================================*/ + +void parse_cis(FILE *f) +{ + current_lineno = 1; + yyrestart(f); + yyparse(); +} + + diff --git a/firmware/mkcis-parser.tab.c_shipped b/firmware/mkcis-parser.tab.c_shipped new file mode 100644 index 0000000..c06766e --- /dev/null +++ b/firmware/mkcis-parser.tab.c_shipped @@ -0,0 +1,2259 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + STRING = 258, + NUMBER = 259, + FLOAT = 260, + VOLTAGE = 261, + CURRENT = 262, + SIZE = 263, + VERS_1 = 264, + MANFID = 265, + FUNCID = 266, + CONFIG = 267, + CFTABLE = 268, + MFC = 269, + CHECKSUM = 270, + POST = 271, + ROM = 272, + BASE = 273, + LAST_INDEX = 274, + DEV_INFO = 275, + ATTR_DEV_INFO = 276, + NO_INFO = 277, + TIME = 278, + TIMING = 279, + WAIT = 280, + READY = 281, + RESERVED = 282, + VNOM = 283, + VMIN = 284, + VMAX = 285, + ISTATIC = 286, + IAVG = 287, + IPEAK = 288, + IDOWN = 289, + VCC = 290, + VPP1 = 291, + VPP2 = 292, + IO = 293, + MEM = 294, + DEFAULT = 295, + BVD = 296, + WP = 297, + RDYBSY = 298, + MWAIT = 299, + AUDIO = 300, + READONLY = 301, + PWRDOWN = 302, + BIT8 = 303, + BIT16 = 304, + LINES = 305, + RANGE = 306, + IRQ_NO = 307, + MASK = 308, + LEVEL = 309, + PULSE = 310, + SHARED = 311 + }; +#endif +/* Tokens. */ +#define STRING 258 +#define NUMBER 259 +#define FLOAT 260 +#define VOLTAGE 261 +#define CURRENT 262 +#define SIZE 263 +#define VERS_1 264 +#define MANFID 265 +#define FUNCID 266 +#define CONFIG 267 +#define CFTABLE 268 +#define MFC 269 +#define CHECKSUM 270 +#define POST 271 +#define ROM 272 +#define BASE 273 +#define LAST_INDEX 274 +#define DEV_INFO 275 +#define ATTR_DEV_INFO 276 +#define NO_INFO 277 +#define TIME 278 +#define TIMING 279 +#define WAIT 280 +#define READY 281 +#define RESERVED 282 +#define VNOM 283 +#define VMIN 284 +#define VMAX 285 +#define ISTATIC 286 +#define IAVG 287 +#define IPEAK 288 +#define IDOWN 289 +#define VCC 290 +#define VPP1 291 +#define VPP2 292 +#define IO 293 +#define MEM 294 +#define DEFAULT 295 +#define BVD 296 +#define WP 297 +#define RDYBSY 298 +#define MWAIT 299 +#define AUDIO 300 +#define READONLY 301 +#define PWRDOWN 302 +#define BIT8 303 +#define BIT16 304 +#define LINES 305 +#define RANGE 306 +#define IRQ_NO 307 +#define MASK 308 +#define LEVEL 309 +#define PULSE 310 +#define SHARED 311 + + + + +/* Copy the first part of user declarations. */ +#line 1 "firmware/mkcis-parser.y" + +/* + * yacc_cis.y 1.11 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +/* If bison: generate nicer error messages */ +#define YYERROR_VERBOSE 1 + +void yyerror(char *msg, ...); +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse); + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 61 "firmware/mkcis-parser.y" +{ + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; +} +/* Line 187 of yacc.c. */ +#line 266 "firmware/mkcis-parser.tab.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 216 of yacc.c. */ +#line 279 "firmware/mkcis-parser.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 137 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 64 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 19 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 74 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 138 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 311 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 59, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 57, 2, 58, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 8, 9, 12, 17, 23, 25, + 27, 29, 31, 33, 35, 37, 39, 41, 43, 49, + 52, 54, 60, 63, 66, 70, 75, 78, 81, 84, + 92, 95, 98, 101, 104, 107, 110, 113, 114, 117, + 120, 124, 128, 132, 138, 144, 147, 150, 156, 159, + 167, 175, 178, 181, 185, 190, 193, 196, 199, 202, + 205, 208, 211, 214, 217, 220, 223, 226, 230, 234, + 238, 240, 242, 244, 246 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 65, 0, -1, 66, -1, 66, 67, -1, -1, 66, + 68, -1, 14, 57, 66, 58, -1, 67, 59, 57, + 66, 58, -1, 69, -1, 70, -1, 71, -1, 72, + -1, 73, -1, 74, -1, 81, -1, 82, -1, 1, + -1, 20, -1, 69, 4, 23, 59, 8, -1, 69, + 22, -1, 21, -1, 70, 4, 23, 59, 8, -1, + 70, 22, -1, 9, 5, -1, 71, 59, 3, -1, + 10, 4, 59, 4, -1, 11, 4, -1, 73, 16, + -1, 73, 17, -1, 12, 18, 4, 53, 4, 19, + 4, -1, 28, 6, -1, 29, 6, -1, 30, 6, + -1, 31, 7, -1, 32, 7, -1, 33, 7, -1, + 34, 7, -1, -1, 76, 75, -1, 81, 24, -1, + 77, 25, 23, -1, 77, 26, 23, -1, 77, 27, + 23, -1, 81, 38, 4, 60, 4, -1, 78, 59, + 4, 60, 4, -1, 78, 48, -1, 78, 49, -1, + 78, 50, 61, 4, 62, -1, 78, 51, -1, 81, + 39, 4, 60, 4, 63, 4, -1, 79, 59, 4, + 60, 4, 63, 4, -1, 79, 48, -1, 79, 49, + -1, 81, 52, 4, -1, 81, 52, 53, 4, -1, + 80, 55, -1, 80, 54, -1, 80, 56, -1, 13, + 4, -1, 81, 40, -1, 81, 41, -1, 81, 42, + -1, 81, 43, -1, 81, 44, -1, 81, 45, -1, + 81, 46, -1, 81, 47, -1, 81, 35, 76, -1, + 81, 36, 76, -1, 81, 37, 76, -1, 78, -1, + 79, -1, 80, -1, 77, -1, 15, 4, 60, 4, + 61, 4, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 79, 79, 81, 86, 87, 102, 104, 108, 110, + 112, 114, 116, 118, 120, 122, 124, 128, 130, 137, + 140, 142, 149, 152, 162, 176, 184, 189, 191, 195, + 204, 209, 214, 219, 224, 229, 234, 242, 245, 252, + 253, 254, 255, 258, 265, 272, 274, 276, 278, 281, + 289, 297, 299, 303, 305, 310, 312, 314, 318, 323, + 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, + 345, 346, 347, 348, 351 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "STRING", "NUMBER", "FLOAT", "VOLTAGE", + "CURRENT", "SIZE", "VERS_1", "MANFID", "FUNCID", "CONFIG", "CFTABLE", + "MFC", "CHECKSUM", "POST", "ROM", "BASE", "LAST_INDEX", "DEV_INFO", + "ATTR_DEV_INFO", "NO_INFO", "TIME", "TIMING", "WAIT", "READY", + "RESERVED", "VNOM", "VMIN", "VMAX", "ISTATIC", "IAVG", "IPEAK", "IDOWN", + "VCC", "VPP1", "VPP2", "IO", "MEM", "DEFAULT", "BVD", "WP", "RDYBSY", + "MWAIT", "AUDIO", "READONLY", "PWRDOWN", "BIT8", "BIT16", "LINES", + "RANGE", "IRQ_NO", "MASK", "LEVEL", "PULSE", "SHARED", "'{'", "'}'", + "','", "'-'", "'='", "']'", "'@'", "$accept", "cis", "chain", "mfc", + "tuple", "dev_info", "attr_dev_info", "vers_1", "manfid", "funcid", + "config", "pwr", "pwrlist", "timing", "io", "mem", "irq", "cftab", + "checksum", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 123, 125, 44, + 45, 61, 93, 64 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 64, 65, 65, 66, 66, 67, 67, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, + 70, 70, 70, 71, 71, 72, 73, 73, 73, 74, + 75, 75, 75, 75, 75, 75, 75, 76, 76, 77, + 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, + 79, 79, 79, 80, 80, 80, 80, 80, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 82 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 2, 0, 2, 4, 5, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 5, 2, + 1, 5, 2, 2, 3, 4, 2, 2, 2, 7, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 3, 3, 3, 5, 5, 2, 2, 5, 2, 7, + 7, 2, 2, 3, 4, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, + 1, 1, 1, 1, 6 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 4, 0, 0, 1, 16, 0, 0, 0, 0, 0, + 0, 0, 17, 20, 3, 5, 8, 9, 10, 11, + 12, 13, 73, 70, 71, 72, 14, 15, 23, 0, + 26, 0, 58, 4, 0, 0, 0, 19, 0, 22, + 0, 27, 28, 0, 0, 0, 45, 46, 0, 48, + 0, 51, 52, 0, 56, 55, 57, 39, 37, 37, + 37, 0, 0, 59, 60, 61, 62, 63, 64, 65, + 66, 0, 0, 0, 0, 0, 4, 0, 0, 24, + 40, 41, 42, 0, 0, 0, 67, 68, 69, 0, + 0, 53, 0, 25, 0, 6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 0, 0, 54, 0, 0, 7, 18, 21, 47, + 44, 0, 30, 31, 32, 33, 34, 35, 36, 43, + 0, 0, 74, 0, 0, 29, 50, 49 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 2, 14, 15, 16, 17, 18, 19, 20, + 21, 110, 86, 22, 23, 24, 25, 26, 27 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -45 +static const yytype_int16 yypact[] = +{ + -45, 16, 28, -45, -45, -2, 22, 40, 43, 49, + -23, 83, -45, -45, -13, -45, 13, 14, -12, -45, + 42, -45, 29, -44, 3, 30, 36, -45, -45, 31, + -45, 85, -45, -45, 32, 34, 70, -45, 71, -45, + 92, -45, -45, 73, 74, 75, -45, -45, 38, -45, + 96, -45, -45, 97, -45, -45, -45, -45, -45, -45, + -45, 98, 99, -45, -45, -45, -45, -45, -45, -45, + -45, -3, 100, 52, -1, 102, -45, 48, 50, -45, + -45, -45, -45, 104, 51, 53, 35, 35, 35, 54, + 55, -45, 106, -45, 108, -45, 56, 12, 110, 111, + 58, 112, 117, 116, 118, 119, 120, 121, 122, 123, + -45, 127, 128, -45, 107, 129, -45, -45, -45, -45, + -45, 60, -45, -45, -45, -45, -45, -45, -45, -45, + 72, 130, -45, 132, 133, -45, -45, -45 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -45, -45, -31, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -29, -45, -45, -45, -45, -45, -45 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -3 +static const yytype_int16 yytable[] = +{ + 4, 91, 74, 28, 46, 47, 48, 49, 5, 6, + 7, 8, 9, 4, 11, 50, 3, 36, 38, 12, + 13, 5, 6, 7, 8, 9, 29, 11, -2, 4, + 87, 88, 12, 13, 33, 37, 39, 5, 6, 7, + 8, 9, 10, 11, 30, 97, 35, 40, 12, 13, + 92, 51, 52, 32, 43, 44, 45, 95, 41, 42, + 57, 31, 53, 103, 104, 105, 106, 107, 108, 109, + 116, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 54, 55, 56, 34, 71, 73, + 72, 76, 75, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 89, 90, 93, 94, 96, 98, 100, 99, + 113, 101, 114, 102, 111, 112, 120, 115, 117, 118, + 119, 121, 122, 133, 123, 124, 131, 125, 126, 127, + 128, 129, 130, 132, 135, 134, 136, 137 +}; + +static const yytype_uint8 yycheck[] = +{ + 1, 4, 33, 5, 48, 49, 50, 51, 9, 10, + 11, 12, 13, 1, 15, 59, 0, 4, 4, 20, + 21, 9, 10, 11, 12, 13, 4, 15, 0, 1, + 59, 60, 20, 21, 57, 22, 22, 9, 10, 11, + 12, 13, 14, 15, 4, 76, 59, 59, 20, 21, + 53, 48, 49, 4, 25, 26, 27, 58, 16, 17, + 24, 18, 59, 28, 29, 30, 31, 32, 33, 34, + 58, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 54, 55, 56, 4, 52, 4, + 59, 57, 60, 23, 23, 3, 23, 23, 23, 61, + 4, 4, 4, 4, 4, 53, 4, 59, 4, 59, + 4, 60, 4, 60, 60, 60, 4, 61, 8, 8, + 62, 4, 6, 63, 6, 6, 19, 7, 7, 7, + 7, 4, 4, 4, 4, 63, 4, 4 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 65, 66, 0, 1, 9, 10, 11, 12, 13, + 14, 15, 20, 21, 67, 68, 69, 70, 71, 72, + 73, 74, 77, 78, 79, 80, 81, 82, 5, 4, + 4, 18, 4, 57, 4, 59, 4, 22, 4, 22, + 59, 16, 17, 25, 26, 27, 48, 49, 50, 51, + 59, 48, 49, 59, 54, 55, 56, 24, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 52, 59, 4, 66, 60, 57, 23, 23, 3, + 23, 23, 23, 61, 4, 4, 76, 76, 76, 4, + 4, 4, 53, 4, 53, 58, 4, 66, 59, 59, + 4, 60, 60, 28, 29, 30, 31, 32, 33, 34, + 75, 60, 60, 4, 4, 61, 58, 8, 8, 62, + 4, 4, 6, 6, 6, 7, 7, 7, 7, 4, + 4, 19, 4, 63, 63, 4, 4, 4 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 80 "firmware/mkcis-parser.y" + { cis_root = (yyvsp[(1) - (1)].tuple); ;} + break; + + case 3: +#line 82 "firmware/mkcis-parser.y" + { cis_root = (yyvsp[(1) - (2)].tuple); ;} + break; + + case 4: +#line 86 "firmware/mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 5: +#line 88 "firmware/mkcis-parser.y" + { + if ((yyvsp[(1) - (2)].tuple) == NULL) { + (yyval.tuple) = (yyvsp[(2) - (2)].tuple); + } else if ((yyvsp[(2) - (2)].tuple) == NULL) { + (yyval.tuple) = (yyvsp[(1) - (2)].tuple); + } else { + tuple_info_t *tail = (yyvsp[(1) - (2)].tuple); + while (tail->next != NULL) tail = tail->next; + tail->next = (yyvsp[(2) - (2)].tuple); + (yyval.tuple) = (yyvsp[(1) - (2)].tuple); + } + ;} + break; + + case 6: +#line 103 "firmware/mkcis-parser.y" + { mfc[nf++] = (yyvsp[(3) - (4)].tuple); ;} + break; + + case 7: +#line 105 "firmware/mkcis-parser.y" + { mfc[nf++] = (yyvsp[(4) - (5)].tuple); ;} + break; + + case 8: +#line 109 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_DEVICE, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 9: +#line 111 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_DEVICE_A, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 10: +#line 113 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_VERS_1, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 11: +#line 115 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_MANFID, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 12: +#line 117 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_FUNCID, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 13: +#line 119 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_CONFIG, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 14: +#line 121 "firmware/mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_CFTABLE_ENTRY, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 15: +#line 123 "firmware/mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 16: +#line 125 "firmware/mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 17: +#line 129 "firmware/mkcis-parser.y" + { (yyval.parse) = calloc(1, sizeof(cisparse_t)); ;} + break; + + case 18: +#line 131 "firmware/mkcis-parser.y" + { + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].type = (yyvsp[(2) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].speed = (yyvsp[(3) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].size = (yyvsp[(5) - (5)].num); + (yyval.parse)->device.ndev++; + ;} + break; + + case 20: +#line 141 "firmware/mkcis-parser.y" + { (yyval.parse) = calloc(1, sizeof(cisparse_t)); ;} + break; + + case 21: +#line 143 "firmware/mkcis-parser.y" + { + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].type = (yyvsp[(2) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].speed = (yyvsp[(3) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].size = (yyvsp[(5) - (5)].num); + (yyval.parse)->device.ndev++; + ;} + break; + + case 23: +#line 153 "firmware/mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->version_1.major = (yyvsp[(2) - (2)].flt); + (yyvsp[(2) - (2)].flt) -= floor((yyvsp[(2) - (2)].flt)+0.01); + while (fabs((yyvsp[(2) - (2)].flt) - floor((yyvsp[(2) - (2)].flt)+0.5)) > 0.01) { + (yyvsp[(2) - (2)].flt) *= 10; + } + (yyval.parse)->version_1.minor = (yyvsp[(2) - (2)].flt)+0.01; + ;} + break; + + case 24: +#line 163 "firmware/mkcis-parser.y" + { + cistpl_vers_1_t *v = &(yyval.parse)->version_1; + u_int pos = 0; + if (v->ns) { + pos = v->ofs[v->ns-1]; + pos += strlen(v->str+pos)+1; + } + v->ofs[v->ns] = pos; + strcpy(v->str+pos, (yyvsp[(3) - (3)].str)); + v->ns++; + ;} + break; + + case 25: +#line 177 "firmware/mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->manfid.manf = (yyvsp[(2) - (4)].num); + (yyval.parse)->manfid.card = (yyvsp[(4) - (4)].num); + ;} + break; + + case 26: +#line 185 "firmware/mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->funcid.func = (yyvsp[(2) - (2)].num); + ;} + break; + + case 27: +#line 190 "firmware/mkcis-parser.y" + { (yyval.parse)->funcid.sysinit |= CISTPL_SYSINIT_POST; ;} + break; + + case 28: +#line 192 "firmware/mkcis-parser.y" + { (yyval.parse)->funcid.sysinit |= CISTPL_SYSINIT_ROM; ;} + break; + + case 29: +#line 196 "firmware/mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->config.base = (yyvsp[(3) - (7)].num); + (yyval.parse)->config.rmask[0] = (yyvsp[(5) - (7)].num); + (yyval.parse)->config.last_idx = (yyvsp[(7) - (7)].num); + ;} + break; + + case 30: +#line 205 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VNOM; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 31: +#line 210 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VMIN; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 32: +#line 215 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VMAX; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 33: +#line 220 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_ISTATIC; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 34: +#line 225 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IAVG; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 35: +#line 230 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IPEAK; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 36: +#line 235 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IDOWN; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 37: +#line 242 "firmware/mkcis-parser.y" + { + (yyval.pwr).present = 0; + ;} + break; + + case 38: +#line 246 "firmware/mkcis-parser.y" + { + (yyval.pwr).present |= 1<<((yyvsp[(2) - (2)].pwr).present); + (yyval.pwr).param[(yyvsp[(2) - (2)].pwr).present] = (yyvsp[(2) - (2)].pwr).param[0]; + ;} + break; + + case 43: +#line 259 "firmware/mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.io.nwin; + (yyval.parse)->cftable_entry.io.win[n].base = (yyvsp[(3) - (5)].num); + (yyval.parse)->cftable_entry.io.win[n].len = (yyvsp[(5) - (5)].num)-(yyvsp[(3) - (5)].num)+1; + (yyval.parse)->cftable_entry.io.nwin++; + ;} + break; + + case 44: +#line 266 "firmware/mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.io.nwin; + (yyval.parse)->cftable_entry.io.win[n].base = (yyvsp[(3) - (5)].num); + (yyval.parse)->cftable_entry.io.win[n].len = (yyvsp[(5) - (5)].num)-(yyvsp[(3) - (5)].num)+1; + (yyval.parse)->cftable_entry.io.nwin++; + ;} + break; + + case 45: +#line 273 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_8BIT; ;} + break; + + case 46: +#line 275 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_16BIT; ;} + break; + + case 47: +#line 277 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= (yyvsp[(4) - (5)].num); ;} + break; + + case 49: +#line 282 "firmware/mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.mem.nwin; + (yyval.parse)->cftable_entry.mem.win[n].card_addr = (yyvsp[(3) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].host_addr = (yyvsp[(7) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].len = (yyvsp[(5) - (7)].num)-(yyvsp[(3) - (7)].num)+1; + (yyval.parse)->cftable_entry.mem.nwin++; + ;} + break; + + case 50: +#line 290 "firmware/mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.mem.nwin; + (yyval.parse)->cftable_entry.mem.win[n].card_addr = (yyvsp[(3) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].host_addr = (yyvsp[(7) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].len = (yyvsp[(5) - (7)].num)-(yyvsp[(3) - (7)].num)+1; + (yyval.parse)->cftable_entry.mem.nwin++; + ;} + break; + + case 51: +#line 298 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_8BIT; ;} + break; + + case 52: +#line 300 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_16BIT; ;} + break; + + case 53: +#line 304 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 = ((yyvsp[(3) - (3)].num) & 0x0f); ;} + break; + + case 54: +#line 306 "firmware/mkcis-parser.y" + { + (yyval.parse)->cftable_entry.irq.IRQInfo1 = IRQ_INFO2_VALID; + (yyval.parse)->cftable_entry.irq.IRQInfo2 = (yyvsp[(4) - (4)].num); + ;} + break; + + case 55: +#line 311 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_PULSE_ID; ;} + break; + + case 56: +#line 313 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_LEVEL_ID; ;} + break; + + case 57: +#line 315 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_SHARE_ID; ;} + break; + + case 58: +#line 319 "firmware/mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->cftable_entry.index = (yyvsp[(2) - (2)].num); + ;} + break; + + case 59: +#line 324 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_DEFAULT; ;} + break; + + case 60: +#line 326 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_BVDS; ;} + break; + + case 61: +#line 328 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_WP; ;} + break; + + case 62: +#line 330 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_RDYBSY; ;} + break; + + case 63: +#line 332 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_MWAIT; ;} + break; + + case 64: +#line 334 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_AUDIO; ;} + break; + + case 65: +#line 336 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_READONLY; ;} + break; + + case 66: +#line 338 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_PWRDOWN; ;} + break; + + case 67: +#line 340 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.vcc = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 68: +#line 342 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.vpp1 = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 69: +#line 344 "firmware/mkcis-parser.y" + { (yyval.parse)->cftable_entry.vpp2 = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 74: +#line 352 "firmware/mkcis-parser.y" + { (yyval.parse) = NULL; ;} + break; + + +/* Line 1267 of yacc.c. */ +#line 2015 "firmware/mkcis-parser.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + +#line 354 "firmware/mkcis-parser.y" + + +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse) +{ + tuple_info_t *t = calloc(1, sizeof(tuple_info_t)); + t->type = type; + t->parse = parse; + t->next = NULL; + return t; +} + +void yyerror(char *msg, ...) +{ + va_list ap; + char str[256]; + + va_start(ap, msg); + sprintf(str, "error at line %d: ", current_lineno); + vsprintf(str+strlen(str), msg, ap); + fprintf(stderr, "%s\n", str); + va_end(ap); +} + +#ifdef DEBUG +void main(int argc, char *argv[]) +{ + if (argc > 1) + parse_cis(argv[1]); +} +#endif + diff --git a/firmware/mkcis-parser.tab.h_shipped b/firmware/mkcis-parser.tab.h_shipped new file mode 100644 index 0000000..4a6a48b --- /dev/null +++ b/firmware/mkcis-parser.tab.h_shipped @@ -0,0 +1,177 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + STRING = 258, + NUMBER = 259, + FLOAT = 260, + VOLTAGE = 261, + CURRENT = 262, + SIZE = 263, + VERS_1 = 264, + MANFID = 265, + FUNCID = 266, + CONFIG = 267, + CFTABLE = 268, + MFC = 269, + CHECKSUM = 270, + POST = 271, + ROM = 272, + BASE = 273, + LAST_INDEX = 274, + DEV_INFO = 275, + ATTR_DEV_INFO = 276, + NO_INFO = 277, + TIME = 278, + TIMING = 279, + WAIT = 280, + READY = 281, + RESERVED = 282, + VNOM = 283, + VMIN = 284, + VMAX = 285, + ISTATIC = 286, + IAVG = 287, + IPEAK = 288, + IDOWN = 289, + VCC = 290, + VPP1 = 291, + VPP2 = 292, + IO = 293, + MEM = 294, + DEFAULT = 295, + BVD = 296, + WP = 297, + RDYBSY = 298, + MWAIT = 299, + AUDIO = 300, + READONLY = 301, + PWRDOWN = 302, + BIT8 = 303, + BIT16 = 304, + LINES = 305, + RANGE = 306, + IRQ_NO = 307, + MASK = 308, + LEVEL = 309, + PULSE = 310, + SHARED = 311 + }; +#endif +/* Tokens. */ +#define STRING 258 +#define NUMBER 259 +#define FLOAT 260 +#define VOLTAGE 261 +#define CURRENT 262 +#define SIZE 263 +#define VERS_1 264 +#define MANFID 265 +#define FUNCID 266 +#define CONFIG 267 +#define CFTABLE 268 +#define MFC 269 +#define CHECKSUM 270 +#define POST 271 +#define ROM 272 +#define BASE 273 +#define LAST_INDEX 274 +#define DEV_INFO 275 +#define ATTR_DEV_INFO 276 +#define NO_INFO 277 +#define TIME 278 +#define TIMING 279 +#define WAIT 280 +#define READY 281 +#define RESERVED 282 +#define VNOM 283 +#define VMIN 284 +#define VMAX 285 +#define ISTATIC 286 +#define IAVG 287 +#define IPEAK 288 +#define IDOWN 289 +#define VCC 290 +#define VPP1 291 +#define VPP2 292 +#define IO 293 +#define MEM 294 +#define DEFAULT 295 +#define BVD 296 +#define WP 297 +#define RDYBSY 298 +#define MWAIT 299 +#define AUDIO 300 +#define READONLY 301 +#define PWRDOWN 302 +#define BIT8 303 +#define BIT16 304 +#define LINES 305 +#define RANGE 306 +#define IRQ_NO 307 +#define MASK 308 +#define LEVEL 309 +#define PULSE 310 +#define SHARED 311 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 61 "firmware/mkcis-parser.y" +{ + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; +} +/* Line 1489 of yacc.c. */ +#line 170 "firmware/mkcis-parser.tab.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE yylval; + diff --git a/firmware/mkcis-parser.y b/firmware/mkcis-parser.y new file mode 100644 index 0000000..c565e0e --- /dev/null +++ b/firmware/mkcis-parser.y @@ -0,0 +1,383 @@ +%{ +/* + * yacc_cis.y 1.11 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +/* If bison: generate nicer error messages */ +#define YYERROR_VERBOSE 1 + +void yyerror(char *msg, ...); +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse); + +%} + +%token STRING NUMBER FLOAT VOLTAGE CURRENT SIZE +%token VERS_1 MANFID FUNCID CONFIG CFTABLE MFC CHECKSUM +%token POST ROM BASE LAST_INDEX +%token DEV_INFO ATTR_DEV_INFO NO_INFO +%token TIME TIMING WAIT READY RESERVED +%token VNOM VMIN VMAX ISTATIC IAVG IPEAK IDOWN +%token VCC VPP1 VPP2 IO MEM +%token DEFAULT BVD WP RDYBSY MWAIT AUDIO READONLY PWRDOWN +%token BIT8 BIT16 LINES RANGE +%token IRQ_NO MASK LEVEL PULSE SHARED + +%union { + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; +} + +%type STRING +%type NUMBER SIZE VOLTAGE CURRENT TIME +%type FLOAT +%type pwr pwrlist +%type vers_1 manfid funcid config cftab io mem irq timing +%type dev_info attr_dev_info checksum +%type tuple chain cis; +%% + +cis: chain + { cis_root = $1; } + | chain mfc + { cis_root = $1; } + ; + +chain: /* nothing */ + { $$ = NULL; } + | chain tuple + { + if ($1 == NULL) { + $$ = $2; + } else if ($2 == NULL) { + $$ = $1; + } else { + tuple_info_t *tail = $1; + while (tail->next != NULL) tail = tail->next; + tail->next = $2; + $$ = $1; + } + } + ; + +mfc: MFC '{' chain '}' + { mfc[nf++] = $3; } + | mfc ',' '{' chain '}' + { mfc[nf++] = $4; } + ; + +tuple: dev_info + { $$ = new_tuple(CISTPL_DEVICE, $1); } + | attr_dev_info + { $$ = new_tuple(CISTPL_DEVICE_A, $1); } + | vers_1 + { $$ = new_tuple(CISTPL_VERS_1, $1); } + | manfid + { $$ = new_tuple(CISTPL_MANFID, $1); } + | funcid + { $$ = new_tuple(CISTPL_FUNCID, $1); } + | config + { $$ = new_tuple(CISTPL_CONFIG, $1); } + | cftab + { $$ = new_tuple(CISTPL_CFTABLE_ENTRY, $1); } + | checksum + { $$ = NULL; } + | error + { $$ = NULL; } + ; + +dev_info: DEV_INFO + { $$ = calloc(1, sizeof(cisparse_t)); } + | dev_info NUMBER TIME ',' SIZE + { + $$->device.dev[$$->device.ndev].type = $2; + $$->device.dev[$$->device.ndev].speed = $3; + $$->device.dev[$$->device.ndev].size = $5; + $$->device.ndev++; + } + | dev_info NO_INFO + ; + +attr_dev_info: ATTR_DEV_INFO + { $$ = calloc(1, sizeof(cisparse_t)); } + | attr_dev_info NUMBER TIME ',' SIZE + { + $$->device.dev[$$->device.ndev].type = $2; + $$->device.dev[$$->device.ndev].speed = $3; + $$->device.dev[$$->device.ndev].size = $5; + $$->device.ndev++; + } + | attr_dev_info NO_INFO + ; + +vers_1: VERS_1 FLOAT + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->version_1.major = $2; + $2 -= floor($2+0.01); + while (fabs($2 - floor($2+0.5)) > 0.01) { + $2 *= 10; + } + $$->version_1.minor = $2+0.01; + } + | vers_1 ',' STRING + { + cistpl_vers_1_t *v = &$$->version_1; + u_int pos = 0; + if (v->ns) { + pos = v->ofs[v->ns-1]; + pos += strlen(v->str+pos)+1; + } + v->ofs[v->ns] = pos; + strcpy(v->str+pos, $3); + v->ns++; + } + ; + +manfid: MANFID NUMBER ',' NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->manfid.manf = $2; + $$->manfid.card = $4; + } + ; + +funcid: FUNCID NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->funcid.func = $2; + } + | funcid POST + { $$->funcid.sysinit |= CISTPL_SYSINIT_POST; } + | funcid ROM + { $$->funcid.sysinit |= CISTPL_SYSINIT_ROM; } + ; + +config: CONFIG BASE NUMBER MASK NUMBER LAST_INDEX NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->config.base = $3; + $$->config.rmask[0] = $5; + $$->config.last_idx = $7; + } + ; + +pwr: VNOM VOLTAGE + { + $$.present = CISTPL_POWER_VNOM; + $$.param[0] = $2; + } + | VMIN VOLTAGE + { + $$.present = CISTPL_POWER_VMIN; + $$.param[0] = $2; + } + | VMAX VOLTAGE + { + $$.present = CISTPL_POWER_VMAX; + $$.param[0] = $2; + } + | ISTATIC CURRENT + { + $$.present = CISTPL_POWER_ISTATIC; + $$.param[0] = $2; + } + | IAVG CURRENT + { + $$.present = CISTPL_POWER_IAVG; + $$.param[0] = $2; + } + | IPEAK CURRENT + { + $$.present = CISTPL_POWER_IPEAK; + $$.param[0] = $2; + } + | IDOWN CURRENT + { + $$.present = CISTPL_POWER_IDOWN; + $$.param[0] = $2; + } + ; + +pwrlist: /* nothing */ + { + $$.present = 0; + } + | pwrlist pwr + { + $$.present |= 1<<($2.present); + $$.param[$2.present] = $2.param[0]; + } + ; + +timing: cftab TIMING + | timing WAIT TIME + | timing READY TIME + | timing RESERVED TIME + ; + +io: cftab IO NUMBER '-' NUMBER + { + int n = $$->cftable_entry.io.nwin; + $$->cftable_entry.io.win[n].base = $3; + $$->cftable_entry.io.win[n].len = $5-$3+1; + $$->cftable_entry.io.nwin++; + } + | io ',' NUMBER '-' NUMBER + { + int n = $$->cftable_entry.io.nwin; + $$->cftable_entry.io.win[n].base = $3; + $$->cftable_entry.io.win[n].len = $5-$3+1; + $$->cftable_entry.io.nwin++; + } + | io BIT8 + { $$->cftable_entry.io.flags |= CISTPL_IO_8BIT; } + | io BIT16 + { $$->cftable_entry.io.flags |= CISTPL_IO_16BIT; } + | io LINES '=' NUMBER ']' + { $$->cftable_entry.io.flags |= $4; } + | io RANGE + ; + +mem: cftab MEM NUMBER '-' NUMBER '@' NUMBER + { + int n = $$->cftable_entry.mem.nwin; + $$->cftable_entry.mem.win[n].card_addr = $3; + $$->cftable_entry.mem.win[n].host_addr = $7; + $$->cftable_entry.mem.win[n].len = $5-$3+1; + $$->cftable_entry.mem.nwin++; + } + | mem ',' NUMBER '-' NUMBER '@' NUMBER + { + int n = $$->cftable_entry.mem.nwin; + $$->cftable_entry.mem.win[n].card_addr = $3; + $$->cftable_entry.mem.win[n].host_addr = $7; + $$->cftable_entry.mem.win[n].len = $5-$3+1; + $$->cftable_entry.mem.nwin++; + } + | mem BIT8 + { $$->cftable_entry.io.flags |= CISTPL_IO_8BIT; } + | mem BIT16 + { $$->cftable_entry.io.flags |= CISTPL_IO_16BIT; } + ; + +irq: cftab IRQ_NO NUMBER + { $$->cftable_entry.irq.IRQInfo1 = ($3 & 0x0f); } + | cftab IRQ_NO MASK NUMBER + { + $$->cftable_entry.irq.IRQInfo1 = IRQ_INFO2_VALID; + $$->cftable_entry.irq.IRQInfo2 = $4; + } + | irq PULSE + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_PULSE_ID; } + | irq LEVEL + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_LEVEL_ID; } + | irq SHARED + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_SHARE_ID; } + ; + +cftab: CFTABLE NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->cftable_entry.index = $2; + } + | cftab DEFAULT + { $$->cftable_entry.flags |= CISTPL_CFTABLE_DEFAULT; } + | cftab BVD + { $$->cftable_entry.flags |= CISTPL_CFTABLE_BVDS; } + | cftab WP + { $$->cftable_entry.flags |= CISTPL_CFTABLE_WP; } + | cftab RDYBSY + { $$->cftable_entry.flags |= CISTPL_CFTABLE_RDYBSY; } + | cftab MWAIT + { $$->cftable_entry.flags |= CISTPL_CFTABLE_MWAIT; } + | cftab AUDIO + { $$->cftable_entry.flags |= CISTPL_CFTABLE_AUDIO; } + | cftab READONLY + { $$->cftable_entry.flags |= CISTPL_CFTABLE_READONLY; } + | cftab PWRDOWN + { $$->cftable_entry.flags |= CISTPL_CFTABLE_PWRDOWN; } + | cftab VCC pwrlist + { $$->cftable_entry.vcc = $3; } + | cftab VPP1 pwrlist + { $$->cftable_entry.vpp1 = $3; } + | cftab VPP2 pwrlist + { $$->cftable_entry.vpp2 = $3; } + | io + | mem + | irq + | timing + ; + +checksum: CHECKSUM NUMBER '-' NUMBER '=' NUMBER + { $$ = NULL; } + +%% + +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse) +{ + tuple_info_t *t = calloc(1, sizeof(tuple_info_t)); + t->type = type; + t->parse = parse; + t->next = NULL; + return t; +} + +void yyerror(char *msg, ...) +{ + va_list ap; + char str[256]; + + va_start(ap, msg); + sprintf(str, "error at line %d: ", current_lineno); + vsprintf(str+strlen(str), msg, ap); + fprintf(stderr, "%s\n", str); + va_end(ap); +} + +#ifdef DEBUG +void main(int argc, char *argv[]) +{ + if (argc > 1) + parse_cis(argv[1]); +} +#endif diff --git a/firmware/mkcis.c b/firmware/mkcis.c new file mode 100644 index 0000000..b1fc5c6 --- /dev/null +++ b/firmware/mkcis.c @@ -0,0 +1,471 @@ +/*====================================================================== + + A utility to convert a plain text description of a Card + Information Structure into its packed binary representation. + + The contents of this file are subject to the Mozilla Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + + Alternatively, the contents of this file may be used under the + terms of the GNU Public License version 2 (the "GPL"), in which + case the provisions of the GPL are applicable instead of the + above. If you wish to allow the use of your version of this file + only under the terms of the GPL and not to allow others to use + your version of this file under the MPL, indicate your decision + by deleting the provisions above and replace them with the notice + and other provisions required by the GPL. If you do not delete + the provisions above, a recipient may use your version of this + file under either the MPL or the GPL. + + Usage: + + mkcis [-o outfile] [infile] + + [infile] defaults to stdin, and [outfile] defaults to stdout. + +======================================================================*/ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +tuple_info_t *cis_root, *mfc[8] = { NULL }; +int nf; + +/*====================================================================== + + Support routines for packing parts of configuration table entries + +======================================================================*/ + +static u_int mantissa[] = { + 10, 12, 13, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 70, 80, 90 +}; +static int pack_power(cistpl_power_t *pwr, u_char *b) +{ + u_int tmp, i; + u_char m = 0 , e, x = 0, *c = b; + *c = pwr->present; c++; + for (i = 0; i < 7; i++) { + if (!(pwr->present & (1<param[i]; + for (e = 1; ((tmp % 10) == 0) || (tmp > 999); e++) + tmp /= 10; + if (tmp < 100) { + if (tmp < 10) { + tmp *= 10; + e--; + } + for (m = 0; m < 16; m++) + if (mantissa[m] == tmp) + break; + if (m == 16) { + tmp *= 10; + e--; + } + x = 0; + } + if (tmp >= 100) { + e++; + x = (tmp/10) - ((tmp/10) % 10); + for (m = 0; m < 16; m++) + if (mantissa[m] == x) + break; + x = (u_char)(tmp - 10*(u_int)x); + } + *c = (m<<3) | e | (x ? 0x80 : 0); c++; + if (x) { + *c = x; + c++; + } + } + return c-b; +} + +static int pack_io(cistpl_io_t *p, u_char *b) +{ + u_char *c = b; + u_int i, j, ml, ma; + *c = p->flags & (CISTPL_IO_8BIT|CISTPL_IO_16BIT); + if ((p->nwin == 1) && (p->win[0].base == 0)) { + for (i = 1, j = 0; i < p->win[0].len; i *= 2, j++) + ; + *c |= j; c++; + } else { + for (i = ma = ml = 0; i < p->nwin; i++) { + ma |= p->win[i].base; + ml |= p->win[i].len-1; + } + ma = (ma > 0xffff) ? 3 : ((ma > 0xff) ? 2 : 1); + ml = (ml > 0xffff) ? 3 : ((ml > 0xff) ? 2 : 1); + *c |= 0x80 | (p->flags & CISTPL_IO_LINES_MASK); c++; + *c = (p->nwin-1) | (ma<<4) | (ml<<6); c++; + if (ma == 3) + ma++; + if (ml == 3) + ml++; + for (i = 0; i < p->nwin; i++) { + for (j = 0; j < ma; j++) { + *c = (p->win[i].base >> (8*j)) & 0xff; c++; + } + for (j = 0; j < ml; j++) { + *c = ((p->win[i].len-1) >> (8*j)) & 0xff; c++; + } + } + } + return c-b; +} + +static int pack_mem(cistpl_mem_t *p, u_char *b) +{ + u_char *c = b; + u_int i, j, ml, ma, ha; + for (i = ma = ml = ha = 0; i < p->nwin; i++) { + ma |= p->win[i].card_addr; + ml |= p->win[i].len; + ha |= p->win[i].host_addr; + } + ma = (ma|ha) >> 8; ml >>= 8; + ma = (ma > 0xffff) ? 3 : ((ma > 0xff) ? 2 : 1); + ml = (ml > 0xffff) ? 3 : ((ml > 0xff) ? 2 : 1); + *c = (p->nwin-1) | (ma<<5) | (ml<<3) | (ha ? 0x80 : 0); c++; + for (i = 0; i < p->nwin; i++) { + for (j = 1; j <= ml; j++) { + *c = (p->win[i].len >> (8*j)) & 0xff; c++; + } + for (j = 1; j <= ma; j++) { + *c = (p->win[i].card_addr >> (8*j)) & 0xff; c++; + } + if (ha) + for (j = 1; j <= ma; j++) { + *c = (p->win[i].host_addr >> (8*j)) & 0xff; c++; + } + } + return c-b; +} + +static int pack_irq(cistpl_irq_t *p, u_char *b) +{ + b[0] = p->IRQInfo1; + if (p->IRQInfo1 & IRQ_INFO2_VALID) { + b[1] = p->IRQInfo2 & 0xff; + b[2] = (p->IRQInfo2 >> 8) & 0xff; + return 3; + } + return 1; +} + +static void pack_cftable(cistpl_cftable_entry_t *p, u_char *b) +{ + u_char *c; + b[2] = p->index | 0x80; + if (p->flags & CISTPL_CFTABLE_DEFAULT) + b[2] |= 0x40; + b[3] = 0x01; + b[3] |= (p->flags & CISTPL_CFTABLE_BVDS) ? 0x10 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_WP) ? 0x20 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_RDYBSY) ? 0x40 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_MWAIT) ? 0x80 : 0; + b[4] = 0; + c = b+5; + if (p->vcc.present) { + b[4]++; c += pack_power(&p->vcc, c); + if (p->vpp1.present) { + b[4]++; c += pack_power(&p->vpp1, c); + if (p->vpp2.present) { + b[4]++; c += pack_power(&p->vpp2, c); + } + } + } + if (p->io.nwin > 0) { + b[4] |= 0x08; + c += pack_io(&p->io, c); + } + if (p->irq.IRQInfo1 > 0) { + b[4] |= 0x10; + c += pack_irq(&p->irq, c); + } + if (p->mem.nwin > 0) { + b[4] |= 0x60; + c += pack_mem(&p->mem, c); + } + if (p->flags >> 8) { + b[4] |= 0x80; + *c++ = p->flags >> 8; + } + b[1] = c-b-2; +} + +/*====================================================================== + + Routines for packing device info tuples + +======================================================================*/ + +static int pack_speed(u_int speed, u_char *b) +{ + u_char e, m, *c = b; + switch (speed) { + case 0: + *c |= 0; + c++; + break; + case 250: + *c |= 1; + c++; + break; + case 200: + *c |= 2; + c++; + break; + case 150: + *c |= 3; + c++; + break; + case 100: + *c |= 4; + c++; + break; + default: + *c |= 7; + c++; + for (e = 1; speed > 80; e++) + speed /= 10; + for (m = 0; m < 15; m++) + if (mantissa[m] >= speed) + break; + *c = ((m+1)<<3) | e; + c++; + } + return c-b; +} + +static void pack_device(cistpl_device_t *d, u_char *b) +{ + u_int i, sz; + u_char e, *c = b+2; + for (i = 0; i < d->ndev; i++) { + *c = (d->dev[i].type<<4); + c += pack_speed(d->dev[i].speed, c); + sz = d->dev[i].size/512; + for (e = 0; sz > 32; e++) + sz /= 4; + *c = (e & 7) | ((sz-1) << 3); c++; + } + *c = 0xff; c++; + b[1] = c-b-2; +} + +/*====================================================================== + + For now, I only implement a subset of tuples types, intended to be + enough to handle most IO-oriented cards. + +======================================================================*/ + +static int pack_tuple(tuple_info_t *t, u_char *b) +{ + cisparse_t *p = t->parse; + u_int i, m; + u_char *c; + + *b = t->type; + switch (t->type) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + if (p) { + pack_device(&p->device, b); + } else { + /* Fake null device tuple */ + b[1] = 3; b[2] = 0; b[3] = 0; b[4] = 0xff; + } + break; + case CISTPL_MANFID: + b[1] = 4; + b[2] = p->manfid.manf & 0xff; + b[3] = p->manfid.manf >> 8; + b[4] = p->manfid.card & 0xff; + b[5] = p->manfid.card >> 8; + break; + case CISTPL_FUNCID: + b[1] = 2; + b[2] = p->funcid.func; + b[3] = p->funcid.sysinit; + break; + case CISTPL_CONFIG: + b[3] = p->config.last_idx; + i = p->config.base; + for (c = b+4, m = 0; (i > 0) || !m; i >>= 8, m++) + c[m] = i & 0xff; + b[2] = m-1; + i = p->config.rmask[0]; + for (c = c+m, m = 0; (i > 0) || !m; i >>= 8, m++) + c[m] = i & 0xff; + b[2] |= ((m-1) << 2); + b[1] = c+m-b-2; + break; + case CISTPL_VERS_1: + b[2] = p->version_1.major; + b[3] = p->version_1.minor; + c = b+4; + for (i = 0; i < p->version_1.ns; i++) { + strcpy((char *)c, p->version_1.str+p->version_1.ofs[i]); + c += strlen((char *)c) + 1; + } + for (; i < 4; i++) { + *c = 0; + c++; + } + *c = 0xff; c++; + b[1] = c-b-2; + break; + case CISTPL_CFTABLE_ENTRY: + pack_cftable(&p->cftable_entry, b); + break; + case CISTPL_LINKTARGET: + b[1] = 3; b[2] = 'C'; b[3] = 'I'; b[4] = 'S'; + break; + case CISTPL_NO_LINK: + case CISTPL_END: + b[1] = 0; + break; + } + return b[1]+2; +} + +/*====================================================================== + + The following routines handle parsing of aggregates of tuples. + pack_chain() is the simplest: just return a string of tuples and + terminate with an END tuple. pack_mfc() is used to tie the + function-specific tuple chains for a multifunction card together + using a LONGLINK_MFC tuple. And pack_cis() handles a complete + CIS, whether it is multifunction or not. + +======================================================================*/ + +static int pack_chain(tuple_info_t *t, u_char *b) +{ + int n = 0; + tuple_info_t end = { CISTPL_END, NULL, NULL }; + while (t) { + n += pack_tuple(t, b+n); + t = t->next; + } + n += pack_tuple(&end, b+n); + return n; +} + +static int pack_mfc(u_int ofs, u_char *b) +{ + u_int i, j, pos; + tuple_info_t target = { CISTPL_LINKTARGET, NULL, NULL }; + + b[0] = CISTPL_LONGLINK_MFC; + b[1] = 5*nf + 1; + b[2] = nf; + b[5*nf+3] = CISTPL_END; + b[5*nf+4] = 0; + /* Leave space for this tuple and the CISTPL_END tuple */ + pos = 5*nf+5; + for (i = 0; i < nf; i++) { + b[3+i*5] = 0; + for (j = 0; j < 4; j++) + b[4+i*5+j] = ((ofs+pos) >> (8*j)) & 0xff; + pos += pack_tuple(&target, b+pos); + pos += pack_chain(mfc[i], b+pos); + } + return ofs+pos; +} + +static int pack_cis(tuple_info_t *t, u_char *b) +{ + int n = 0; + tuple_info_t device = { CISTPL_DEVICE, NULL, NULL }; + tuple_info_t nolink = { CISTPL_NO_LINK, NULL, NULL }; + tuple_info_t end = { CISTPL_END, NULL, NULL }; + if (t->type != CISTPL_DEVICE) + n = pack_tuple(&device, b); + while (t) { + n += pack_tuple(t, b+n); + t = t->next; + } + if (nf > 0) { + n = pack_mfc(n, b+n); + } else { + n += pack_tuple(&nolink, b+n); + n += pack_tuple(&end, b+n); + } + return n; +} + +/*====================================================================*/ + +int main(int argc, char *argv[]) +{ + int optch, errflg = 0; + char *out = NULL; + u_char buf[1024]; + int n; + FILE *f; + + while ((optch = getopt(argc, argv, "o:")) != -1) { + switch (optch) { + case 'o': + out = strdup(optarg); break; + default: + errflg = 1; break; + } + } + if (errflg || (optind < argc-1)) { + fprintf(stderr, "usage: %s [-o outfile] [infile]\n", + argv[0]); + exit(EXIT_FAILURE); + } + if (optind < argc) { + f = fopen(argv[optind], "r"); + if (!f) { + fprintf(stderr, "could not open '%s': %s\n", + argv[optind], + strerror(errno)); + return -1; + } + } else + f = stdin; + parse_cis(f); + fclose(f); + n = pack_cis(cis_root, buf); + if (out) { + f = fopen(out, "w"); + if (!f) { + fprintf(stderr, "could not open '%s': %s\n", out, + strerror(errno)); + return -1; + } + } else + f = stdout; + fwrite(buf, n, 1, f); + fclose(f); + + return 0; +} diff --git a/firmware/mkcis.h b/firmware/mkcis.h new file mode 100644 index 0000000..bf06f9b --- /dev/null +++ b/firmware/mkcis.h @@ -0,0 +1,49 @@ +/* + * pack_cis.h 1.6 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ +typedef struct tuple_info_t { + u_char type; + cisparse_t *parse; + struct tuple_info_t *next; +} tuple_info_t; + +extern tuple_info_t *cis_root, *mfc[8]; +extern int nf; + +void parse_cis(FILE *f); + +/* removed from pcmcia/cs.h */ +#define IRQ_INFO2_VALID 0x10 +#define IRQ_LEVEL_ID 0x20 +#define IRQ_PULSE_ID 0x40 +#define IRQ_SHARE_ID 0x80 + +/* lex-yacc interface */ +extern int current_lineno; +extern int yylex(void); +extern int yyparse(void); -- 1.5.6.5 From dbaryshkov at gmail.com Thu Sep 23 11:19:55 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:19:55 +0400 Subject: [PATCH 3/5] firmware: enable usage of mkcis In-Reply-To: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285255197-9262-3-git-send-email-dbaryshkov@gmail.com> Enable usage of mkcis for generation of cis files Signed-off-by: Dmitry Eremin-Solenikov --- firmware/Makefile | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index 9c2d194..04ecf8c 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -156,6 +156,9 @@ quiet_cmd_ihex2fw = IHEX2FW $@ quiet_cmd_h16tofw = H16TOFW $@ cmd_h16tofw = $(objtree)/$(obj)/ihex2fw -w $< $@ +quiet_cmd_mkcis = MKCIS $@ + cmd_mkcis = $(objtree)/$(obj)/mkcis -o $@ $< + quiet_cmd_fwbin = MK_FW $@ cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \ FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \ @@ -224,6 +227,11 @@ ihex2fw_dep := else ihex2fw_dep := $(obj)/ihex2fw endif +ifeq ($(INSTALL):$(wildcard $(obj)/mkcis),install:$(obj)/mkcis) +mkcis_dep := +else +mkcis_dep := $(obj)/mkcis +endif # .HEX is also Intel HEX, but where the offset and length in each record # is actually meaningful, because the firmware has to be loaded in a certain @@ -236,6 +244,10 @@ $(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) $(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) $(call cmd,h16tofw) +# .ct is a text representation of CIS files, as originally developed by pcmcia-cs +$(obj)/%.cis: $(obj)/%.ct $(mkcis_dep) | $(objtree)/$(obj)/$$(dir %) + $(call cmd,mkcis) + $(firmware-dirs): $(call cmd,mkdir) @@ -251,4 +263,34 @@ targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \ # final vmlinux link will fail. obj-n := dummy -hostprogs-y := ihex2fw +hostprogs-y := ihex2fw mkcis + +mkcis-objs := mkcis.o mkcis-lexer.lex.o mkcis-parser.tab.o +$(obj)/mkcis-parser.tab.o: $(obj)/mkcis-parser.tab.c $(obj)/mkcis-parser.tab.h +$(obj)/mkcis-lexer.lex.o: $(obj)/mkcis-lexer.lex.c $(obj)/mkcis-parser.tab.h +HOSTCFLAGS_mkcis.o += -Iinclude/pcmcia +HOSTCFLAGS_mkcis-lexer.lex.o += -Iinclude/pcmcia -Ifirmware/ +HOSTCFLAGS_mkcis-parser.tab.o += -Iinclude/pcmcia -Ifirmware/ +HOSTLOADLIBES_mkcis := -lm + +# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output + +ifdef GENERATE_PARSER + +BISON = bison +FLEX = flex + +quiet_cmd_bison = BISON $@ + cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped +quiet_cmd_flex = FLEX $@ + cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped + +$(obj)/mkcis-parser.tab.c: $(src)/mkcis-parser.y FORCE + $(call if_changed,bison) + +$(obj)/mkcis-parser.tab.h: $(obj)/mkcis-parser.tab.c + +$(obj)/mkcis-lexer.lex.c: $(src)/mkcis-lexer.l FORCE + $(call if_changed,flex) + +endif -- 1.5.6.5 From dbaryshkov at gmail.com Thu Sep 23 11:19:56 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:19:56 +0400 Subject: [PATCH 4/5] firmware: replace ihex files with text descriptions for CIS files In-Reply-To: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285255197-9262-4-git-send-email-dbaryshkov@gmail.com> Now as we support generation of cis files from .ct, drop old ihex files and import new .ct from original pcmcia-cs project. This brings no actual changes in the binary firmware files. Signed-off-by: Dmitry Eremin-Solenikov --- firmware/cis/3CCFEM556.cis.ihex | 13 ----------- firmware/cis/3CCFEM556.ct | 22 +++++++++++++++++++ firmware/cis/3CXEM556.cis.ihex | 13 ----------- firmware/cis/3CXEM556.ct | 22 +++++++++++++++++++ firmware/cis/COMpad2.cis.ihex | 11 --------- firmware/cis/COMpad2.ct | 20 +++++++++++++++++ firmware/cis/COMpad4.cis.ihex | 9 ------- firmware/cis/COMpad4.ct | 14 ++++++++++++ firmware/cis/DP83903.cis.ihex | 14 ------------ firmware/cis/DP83903.ct | 24 ++++++++++++++++++++ firmware/cis/E-CARD.ct | 9 +++++++ firmware/cis/LA-PCM.cis.ihex | 20 ----------------- firmware/cis/LA-PCM.ct | 44 ++++++++++++++++++++++++++++++++++++++ firmware/cis/MT5634ZLX.cis.ihex | 11 --------- firmware/cis/MT5634ZLX.ct | 18 +++++++++++++++ firmware/cis/NE2K.cis.ihex | 8 ------- firmware/cis/NE2K.ct | 10 ++++++++ firmware/cis/PCMLM28.cis.ihex | 18 --------------- firmware/cis/PCMLM28.ct | 37 +++++++++++++++++++++++++++++++ firmware/cis/PE-200.cis.ihex | 9 ------- firmware/cis/PE-200.ct | 11 +++++++++ firmware/cis/PE520.cis.ihex | 9 ------- firmware/cis/PE520.ct | 11 +++++++++ firmware/cis/RS-COM-2P.cis.ihex | 10 -------- firmware/cis/RS-COM-2P.ct | 14 ++++++++++++ firmware/cis/SW_555_SER.cis.ihex | 12 ---------- firmware/cis/SW_555_SER.ct | 19 ++++++++++++++++ firmware/cis/SW_7xx_SER.cis.ihex | 13 ----------- firmware/cis/SW_7xx_SER.ct | 21 ++++++++++++++++++ firmware/cis/SW_8xx_SER.cis.ihex | 13 ----------- firmware/cis/SW_8xx_SER.ct | 20 +++++++++++++++++ firmware/cis/tamarack.cis.ihex | 10 -------- firmware/cis/tamarack.ct | 17 ++++++++++++++ 33 files changed, 333 insertions(+), 193 deletions(-) delete mode 100644 firmware/cis/3CCFEM556.cis.ihex create mode 100644 firmware/cis/3CCFEM556.ct delete mode 100644 firmware/cis/3CXEM556.cis.ihex create mode 100644 firmware/cis/3CXEM556.ct delete mode 100644 firmware/cis/COMpad2.cis.ihex create mode 100644 firmware/cis/COMpad2.ct delete mode 100644 firmware/cis/COMpad4.cis.ihex create mode 100644 firmware/cis/COMpad4.ct delete mode 100644 firmware/cis/DP83903.cis.ihex create mode 100644 firmware/cis/DP83903.ct create mode 100644 firmware/cis/E-CARD.ct delete mode 100644 firmware/cis/LA-PCM.cis.ihex create mode 100644 firmware/cis/LA-PCM.ct delete mode 100644 firmware/cis/MT5634ZLX.cis.ihex create mode 100644 firmware/cis/MT5634ZLX.ct delete mode 100644 firmware/cis/NE2K.cis.ihex create mode 100644 firmware/cis/NE2K.ct delete mode 100644 firmware/cis/PCMLM28.cis.ihex create mode 100644 firmware/cis/PCMLM28.ct delete mode 100644 firmware/cis/PE-200.cis.ihex create mode 100644 firmware/cis/PE-200.ct delete mode 100644 firmware/cis/PE520.cis.ihex create mode 100644 firmware/cis/PE520.ct delete mode 100644 firmware/cis/RS-COM-2P.cis.ihex create mode 100644 firmware/cis/RS-COM-2P.ct delete mode 100644 firmware/cis/SW_555_SER.cis.ihex create mode 100644 firmware/cis/SW_555_SER.ct delete mode 100644 firmware/cis/SW_7xx_SER.cis.ihex create mode 100644 firmware/cis/SW_7xx_SER.ct delete mode 100644 firmware/cis/SW_8xx_SER.cis.ihex create mode 100644 firmware/cis/SW_8xx_SER.ct delete mode 100644 firmware/cis/tamarack.cis.ihex create mode 100644 firmware/cis/tamarack.ct diff --git a/firmware/cis/3CCFEM556.cis.ihex b/firmware/cis/3CCFEM556.cis.ihex deleted file mode 100644 index e4d92b1..0000000 --- a/firmware/cis/3CCFEM556.cis.ihex +++ /dev/null @@ -1,13 +0,0 @@ -:1000000001030000FF152D050033436F6D004D65A2 -:100010006761686572747A2033434346454D3535D0 -:1000200036004C414E202B2035366B204D6F6465D9 -:100030006D0000FF20040101560521020000060B9F -:1000400002004D000000006B000000FF001303439E -:100050004953210206001A060507001067021B0912 -:1000600087011901556430FFFFFF00130343495313 -:10007000210202001A060527001177021B09A701B9 -:090080001901552330FFFFFF00B8 -:00000001FF -# -# This card is MFC-compliant, but identifies itself as single function -# diff --git a/firmware/cis/3CCFEM556.ct b/firmware/cis/3CCFEM556.ct new file mode 100644 index 0000000..be627d0 --- /dev/null +++ b/firmware/cis/3CCFEM556.ct @@ -0,0 +1,22 @@ +# +# This card is MFC-compliant, but identifies itself as single function +# +vers_1 5.0, "3Com", "Megahertz 3CCFEM556", "LAN + 56k Modem" +manfid 0x0101, 0x0556 +funcid 0 + +mfc { + funcid network_adapter + config base 0x1000 mask 0x267 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f [8bit] [16bit] +}, { + funcid serial_port + config base 0x1100 mask 0x277 last_index 0x27 + cftable_entry 0x27 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/firmware/cis/3CXEM556.cis.ihex b/firmware/cis/3CXEM556.cis.ihex deleted file mode 100644 index 895010b..0000000 --- a/firmware/cis/3CXEM556.cis.ihex +++ /dev/null @@ -1,13 +0,0 @@ -:1000000001030000FF152C050033436F6D004D65A3 -:100010006761686572747A20334358454D353536CB -:10002000004C414E202B2035366B204D6F64656DA2 -:100030000000FF20040101350021020000060B0230 -:10004000004C0000000069000000FF00130343495A -:1000500053210206001A0501070008631B098701E6 -:100060001901556430FFFFFF001303434953210278 -:1000700002001A0501270009631B09A70119015590 -:060080002330FFFFFF002A -:00000001FF -# -# This card is MFC-compliant, but identifies itself as single function -# diff --git a/firmware/cis/3CXEM556.ct b/firmware/cis/3CXEM556.ct new file mode 100644 index 0000000..819f08f --- /dev/null +++ b/firmware/cis/3CXEM556.ct @@ -0,0 +1,22 @@ +# +# This card is MFC-compliant, but identifies itself as single function +# +vers_1 5.0, "3Com", "Megahertz 3CXEM556", "LAN + 56k Modem" +manfid 0x0101, 0x0035 +funcid 0 + +mfc { + funcid network_adapter + config base 0x0800 mask 0x63 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f [8bit] [16bit] +}, { + funcid serial_port + config base 0x900 mask 0x63 last_index 0x27 + cftable_entry 0x27 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/firmware/cis/COMpad2.cis.ihex b/firmware/cis/COMpad2.cis.ihex deleted file mode 100644 index 1671c5e..0000000 --- a/firmware/cis/COMpad2.cis.ihex +++ /dev/null @@ -1,11 +0,0 @@ -:1000000001030000FF151F0401414456414E5445B1 -:10001000434800434F4D7061642D33322F38350013 -:10002000312E300000FF210202011A0501050001F6 -:10003000031B0EC18118AA61E80207E8030730B864 -:100040009E1B08820108AA6030030F1B0883010869 -:10005000AA6040030F1B08840108AA6050030F1B0D -:0D00600008850108AA6060030F1400FF006E -:00000001FF -# -# Replacement CIS for Advantech COMpad-32/85 -# diff --git a/firmware/cis/COMpad2.ct b/firmware/cis/COMpad2.ct new file mode 100644 index 0000000..bfc2374 --- /dev/null +++ b/firmware/cis/COMpad2.ct @@ -0,0 +1,20 @@ +# +# Replacement CIS for Advantech COMpad-32/85 +# +dev_info + NULL 0ns, 512b +vers_1 4.1, "ADVANTECH", "COMpad-32/85", "1.0" +funcid serial_port [post] +config base 0x0100 mask 0x0003 last_index 0x05 +cftable_entry 0x01 [default] + [mwait] + io 0x02e8-0x02ef, 0x03e8-0x03ef [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0330-0x033f [lines=10] [8bit] [range] +cftable_entry 0x03 + io 0x0340-0x034f [lines=10] [8bit] [range] +cftable_entry 0x04 + io 0x0350-0x035f [lines=10] [8bit] [range] +cftable_entry 0x05 + io 0x0360-0x036f [lines=10] [8bit] [range] diff --git a/firmware/cis/COMpad4.cis.ihex b/firmware/cis/COMpad4.cis.ihex deleted file mode 100644 index 27bbec1..0000000 --- a/firmware/cis/COMpad4.cis.ihex +++ /dev/null @@ -1,9 +0,0 @@ -:1000000001030000FF151F0401414456414E5445B1 -:10001000434800434F4D7061642D33322F383542D1 -:100020002D34000000FF210202011A050102000127 -:10003000011B0BC18118AA6040021F30B89E1B082B -:0C004000820108AA6040031F1400FF00AA -:00000001FF -# -# Replacement CIS for Advantech COMpad-32/85B-4 -# diff --git a/firmware/cis/COMpad4.ct b/firmware/cis/COMpad4.ct new file mode 100644 index 0000000..325991c --- /dev/null +++ b/firmware/cis/COMpad4.ct @@ -0,0 +1,14 @@ +# +# Replacement CIS for Advantech COMpad-32/85B-4 +# +dev_info + NULL 0ns, 512b +vers_1 4.1, "ADVANTECH", "COMpad-32/85B-4" +funcid serial_port [post] +config base 0x0100 mask 0x0001 last_index 0x02 +cftable_entry 0x01 [default] + [mwait] + io 0x0240-0x025f [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0340-0x035f [lines=10] [8bit] [range] diff --git a/firmware/cis/DP83903.cis.ihex b/firmware/cis/DP83903.cis.ihex deleted file mode 100644 index 6d73ea3..0000000 --- a/firmware/cis/DP83903.cis.ihex +++ /dev/null @@ -1,14 +0,0 @@ -:1000000001030000FF152904014D756C74696675C4 -:100010006E6374696F6E20436172640000004E531A -:1000200043204D46204C414E2F4D6F64656D00FFBF -:1000300020047501000021020000060B02004900A7 -:100040000000006A000000FF00130343495321022F -:1000500006001A060517201077021B0C970179017C -:10006000556530FFFF284000FF001303434953212B -:100070000202001A060507401077021B09870119C2 -:0800800001552330FFFFFF00D2 -:00000001FF -# -# This CIS is for cards based on the National Semiconductor -# DP83903 Multiple Function Interface Chip -# diff --git a/firmware/cis/DP83903.ct b/firmware/cis/DP83903.ct new file mode 100644 index 0000000..ce86f45 --- /dev/null +++ b/firmware/cis/DP83903.ct @@ -0,0 +1,24 @@ +# +# This CIS is for cards based on the National Semiconductor +# DP83903 Multiple Function Interface Chip +# +vers_1 4.1, "Multifunction Card", "", "", "NSC MF LAN/Modem" +manfid 0x0175, 0x0000 +funcid 0 + +mfc { + funcid network_adapter + config base 0x1020 mask 0x277 last_index 0x17 + cftable_entry 0x17 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] + memory 0x0000-0x3fff @ 0x0000 +}, { + funcid serial_port + config base 0x1040 mask 0x0277 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/firmware/cis/E-CARD.ct b/firmware/cis/E-CARD.ct new file mode 100644 index 0000000..fb09b71 --- /dev/null +++ b/firmware/cis/E-CARD.ct @@ -0,0 +1,9 @@ +# +# Replacement CIS for old, broken Linksys cards +# +vers_1 4.1, "LINKSYS", "E-CARD" +config base 0x0008 mask 0x000b last_index 0x00 +cftable_entry 0x1 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f, 0x0010-0x001f [8bit] [16bit] diff --git a/firmware/cis/LA-PCM.cis.ihex b/firmware/cis/LA-PCM.cis.ihex deleted file mode 100644 index a0ff0c7..0000000 --- a/firmware/cis/LA-PCM.cis.ihex +++ /dev/null @@ -1,20 +0,0 @@ -:100000000105D4F953E9FF17035338FF20040FC04B -:1000100002002102060315390401416C6C69656414 -:100020002054656C657369732C4B2E4B00457468C6 -:1000300065726E6574204C414E20436172640043CA -:10004000656E747265434F4D004C412D50434D0019 -:10005000FF1A0602100000020B1B08810108E06075 -:1000600000021F1B08820108E06020021F1B08839A -:100070000108E06040021F1B08840108E060600284 -:100080001F1B08850108E06080021F1B088601080D -:10009000E060A0021F1B08870108E060C0021F1B70 -:1000A00008880108E060E0021F1B08890108E06081 -:1000B00000031F1B088A0108E06020031F1B088B38 -:1000C0000108E06040031F1B088C0108E06060032A -:1000D0001F1B088D0108E06080031F1B088E0108AC -:1000E000E060A0031F1B088F0108E060C0031F1B16 -:0D00F00008900108E060E0031F1400FF000D -:00000001FF -# -# Replacement CIS for Allied Telesis LA-PCM -# diff --git a/firmware/cis/LA-PCM.ct b/firmware/cis/LA-PCM.ct new file mode 100644 index 0000000..5c427bd --- /dev/null +++ b/firmware/cis/LA-PCM.ct @@ -0,0 +1,44 @@ +# +# Replacement CIS for Allied Telesis LA-PCM +# +dev_info + fn_specific 100ns, 64kb + FLASH 150ns, 60kb +attr_dev_info + FLASH 150ns, 4kb +manfid 0xc00f, 0x0002 +funcid network_adapter [post] [rom] +vers_1 4.1, "Allied Telesis,K.K", "Ethernet LAN Card", "CentreCOM", "LA-PCM" +config base 0x20000 mask 0x000b last_index 0x10 +cftable_entry 0x01 + io 0x0200-0x021f [8bit] [16bit] +cftable_entry 0x02 + io 0x0220-0x023f [8bit] [16bit] +cftable_entry 0x03 + io 0x0240-0x025f [8bit] [16bit] +cftable_entry 0x04 + io 0x0260-0x027f [8bit] [16bit] +cftable_entry 0x05 + io 0x0280-0x029f [8bit] [16bit] +cftable_entry 0x06 + io 0x02a0-0x02bf [8bit] [16bit] +cftable_entry 0x07 + io 0x02c0-0x02df [8bit] [16bit] +cftable_entry 0x08 + io 0x02e0-0x02ff [8bit] [16bit] +cftable_entry 0x09 + io 0x0300-0x031f [8bit] [16bit] +cftable_entry 0x0a + io 0x0320-0x033f [8bit] [16bit] +cftable_entry 0x0b + io 0x0340-0x035f [8bit] [16bit] +cftable_entry 0x0c + io 0x0360-0x037f [8bit] [16bit] +cftable_entry 0x0d + io 0x0380-0x039f [8bit] [16bit] +cftable_entry 0x0e + io 0x03a0-0x03bf [8bit] [16bit] +cftable_entry 0x0f + io 0x03c0-0x03df [8bit] [16bit] +cftable_entry 0x10 + io 0x03e0-0x03ff [8bit] [16bit] diff --git a/firmware/cis/MT5634ZLX.cis.ihex b/firmware/cis/MT5634ZLX.cis.ihex deleted file mode 100644 index 72500b9..0000000 --- a/firmware/cis/MT5634ZLX.cis.ihex +++ /dev/null @@ -1,11 +0,0 @@ -:100000000101FF152204014D756C74695465636824 -:100010000050434D4349412035364B2044617461C3 -:10002000466178000000FF20040002010021020266 -:10003000001A05012780FF671B0FCF418B01550177 -:10004000550155AA60F80307281B08970108AA6004 -:10005000F802071B089F0108AA60E803071B08A70E -:0B0060000108AA60E802071400FF007E -:00000001FF -# -# Replacement CIS for Multitech MT5634ZLX modems -# diff --git a/firmware/cis/MT5634ZLX.ct b/firmware/cis/MT5634ZLX.ct new file mode 100644 index 0000000..52249b3 --- /dev/null +++ b/firmware/cis/MT5634ZLX.ct @@ -0,0 +1,18 @@ +# +# Replacement CIS for Multitech MT5634ZLX modems +# +dev_info no_info +vers_1 4.1, "MultiTech", "PCMCIA 56K DataFax" +manfid 0x0200, 0x0001 +funcid serial_port +config base 0xff80 mask 0x0067 last_index 0x27 +cftable_entry 0x0f [default] + [rdybsy] [audio] [pwrdown] + Vcc Vnom 5V Vpp1 Vnom 5V Vpp2 Vnom 5V + io 0x03f8-0x03ff [lines=10] [8bit] +cftable_entry 0x17 + io 0x02f8-0x02ff [lines=10] [8bit] +cftable_entry 0x1f + io 0x03e8-0x03ef [lines=10] [8bit] +cftable_entry 0x27 + io 0x02e8-0x02ef [lines=10] [8bit] diff --git a/firmware/cis/NE2K.cis.ihex b/firmware/cis/NE2K.cis.ihex deleted file mode 100644 index 1bb40fc..0000000 --- a/firmware/cis/NE2K.cis.ihex +++ /dev/null @@ -1,8 +0,0 @@ -:1000000001030000FF1515040150434D4349410011 -:1000100045746865726E6574000000FF2102060079 -:100020001A050120F803031B09E001190155653089 -:06003000FFFF1400FF00B9 -:00000001FF -# -# Replacement CIS for various busted NE2000-compatible cards -# diff --git a/firmware/cis/NE2K.ct b/firmware/cis/NE2K.ct new file mode 100644 index 0000000..d1d47f3 --- /dev/null +++ b/firmware/cis/NE2K.ct @@ -0,0 +1,10 @@ +# +# Replacement CIS for various busted NE2000-compatible cards +# +vers_1 4.1, "PCMCIA", "Ethernet" +funcid network_adapter +config base 0x03f8 mask 0x03 last_index 0x20 +cftable_entry 0x20 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] diff --git a/firmware/cis/PCMLM28.cis.ihex b/firmware/cis/PCMLM28.cis.ihex deleted file mode 100644 index ffdfe85..0000000 --- a/firmware/cis/PCMLM28.cis.ihex +++ /dev/null @@ -1,18 +0,0 @@ -:1000000001030000FF151504014C494E4B53595391 -:100010000050434D4C4D3238000000FF2004430196 -:10002000ABC0210200001A05012FF803031B10E4E6 -:1000300001190155E06100031FF8020730FFFF1BA3 -:100040000BA50108E06120031FF802071B0BA601A6 -:1000500008E06140031FF802071B0BA70108E061DD -:1000600060031FF802071B0BA80108E06100031FD3 -:10007000E803071B0BA90108E06120031FE8030741 -:100080001B0BAA0108E06140031FE803071B0BAB31 -:100090000108E06160031FE803071B0BAC0108E0E7 -:1000A0006100031FE802071B0BAD0108E06120039C -:1000B0001FE802071B0BAE0108E06140031FE802C6 -:1000C000071B0BAF0108E06160031FE80207140083 -:0200D000FF002F -:00000001FF -# -# The on-card CIS says it is MFC-compliant, but it is not -# diff --git a/firmware/cis/PCMLM28.ct b/firmware/cis/PCMLM28.ct new file mode 100644 index 0000000..39c6d16 --- /dev/null +++ b/firmware/cis/PCMLM28.ct @@ -0,0 +1,37 @@ +# +# The on-card CIS says it is MFC-compliant, but it is not +# +vers_1 4.1, "LINKSYS", "PCMLM28" +manfid 0x0143, 0xc0ab +funcid 0 +config base 0x03f8 mask 0x03 last_index 0x2f + +cftable_entry 0x24 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0300-0x031f, 0x02f8-0x02ff [8bit] [16bit] + +cftable_entry 0x25 + io 0x0320-0x033f, 0x02f8-0x02ff [8bit] [16bit] +cftable_entry 0x26 + io 0x0340-0x035f, 0x02f8-0x02ff [8bit] [16bit] +cftable_entry 0x27 + io 0x0360-0x037f, 0x02f8-0x02ff [8bit] [16bit] + +cftable_entry 0x28 + io 0x0300-0x031f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x29 + io 0x0320-0x033f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x2a + io 0x0340-0x035f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x2b + io 0x0360-0x037f, 0x03e8-0x03ef [8bit] [16bit] + +cftable_entry 0x2c + io 0x0300-0x031f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2d + io 0x0320-0x033f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2e + io 0x0340-0x035f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2f + io 0x0360-0x037f, 0x02e8-0x02ef [8bit] [16bit] diff --git a/firmware/cis/PE-200.cis.ihex b/firmware/cis/PE-200.cis.ihex deleted file mode 100644 index e6dbdab..0000000 --- a/firmware/cis/PE-200.cis.ihex +++ /dev/null @@ -1,9 +0,0 @@ -:1000000001030000FF151E0401504D582020200060 -:1000100050452D3230300045544845524E4554002D -:1000200052303100FF210206031A050101000101CF -:100030001B0EC181190155E051000F100F30FFFF59 -:040040001400FF00A9 -:00000001FF -# -# Replacement CIS for PE-200 ethernet card -# diff --git a/firmware/cis/PE-200.ct b/firmware/cis/PE-200.ct new file mode 100644 index 0000000..7db7494 --- /dev/null +++ b/firmware/cis/PE-200.ct @@ -0,0 +1,11 @@ +# +# Replacement CIS for PE-200 ethernet card +# +vers_1 4.1, "PMX ", "PE-200", "ETHERNET", "R01" +funcid network_adapter [post] [rom] +config base 0x0100 mask 0x0001 last_index 0x01 +cftable_entry 0x1 [default] + [mwait] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f, 0x0010-0x001f [8bit] [16bit] diff --git a/firmware/cis/PE520.cis.ihex b/firmware/cis/PE520.cis.ihex deleted file mode 100644 index 97a745b..0000000 --- a/firmware/cis/PE520.cis.ihex +++ /dev/null @@ -1,9 +0,0 @@ -:1000000001030000FF152304014B544900504535FE -:10001000323020504C55530050434D434941204508 -:10002000746865726E65740000FF20046101100041 -:10003000210206001A050101D00F0B1B09C101198D -:0A00400001556530FFFF1400FF00BA -:00000001FF -# -# Replacement CIS for PE520 ethernet card -# diff --git a/firmware/cis/PE520.ct b/firmware/cis/PE520.ct new file mode 100644 index 0000000..fb411ab --- /dev/null +++ b/firmware/cis/PE520.ct @@ -0,0 +1,11 @@ +# +# Replacement CIS for LanPro EP-4000A ethernet card +# +vers_1 4.1, "KTI", "PE520 PLUS", "PCMCIA Ethernet" +manfid 0x0161, 0x0010 +funcid network_adapter +config base 0x0fd0 mask 0x0b last_index 0x01 +cftable_entry 0x01 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] diff --git a/firmware/cis/RS-COM-2P.cis.ihex b/firmware/cis/RS-COM-2P.cis.ihex deleted file mode 100644 index 0801ca5..0000000 --- a/firmware/cis/RS-COM-2P.cis.ihex +++ /dev/null @@ -1,10 +0,0 @@ -:1000000001030000FF1516040150434D4349410010 -:1000100052532D434F4D203250000000FF21020269 -:10002000011A0501030001011B0EC18118AA61E834 -:100030000307E8020730B89E1B0B820108AA615033 -:1000400002075802071B0B830108AA6160020768B8 -:0600500002071400FF008E -:00000001FF -# -# Replacement CIS for dual-serial-port IO card -# diff --git a/firmware/cis/RS-COM-2P.ct b/firmware/cis/RS-COM-2P.ct new file mode 100644 index 0000000..2e385cb --- /dev/null +++ b/firmware/cis/RS-COM-2P.ct @@ -0,0 +1,14 @@ +# +# Replacement CIS for dual-serial-port IO card +# +vers_1 4.1, "PCMCIA", "RS-COM 2P" +funcid serial_port [post] +config base 0x0100 mask 0x0001 last_index 0x03 +cftable_entry 0x01 [default] + [mwait] + io 0x03e8-0x03ef, 0x02e8-0x02ef [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0250-0x0257, 0x0258-0x025f [lines=10] [8bit] [range] +cftable_entry 0x03 + io 0x0260-0x0267, 0x0268-0x026f [lines=10] [8bit] [range] diff --git a/firmware/cis/SW_555_SER.cis.ihex b/firmware/cis/SW_555_SER.cis.ihex deleted file mode 100644 index 9b9348a..0000000 --- a/firmware/cis/SW_555_SER.cis.ihex +++ /dev/null @@ -1,12 +0,0 @@ -:100000000101FF17034100FF20043F0110072102F7 -:100010000200152A070053696572726120576972E0 -:10002000656C657373004169724361726420353594 -:1000300035004135353500526576203100FF1A050F -:1000400001030007731B0BE00118A360F8030730DE -:10005000BC3F1B08A10108A360F802071B08A2010E -:1000600008A360E803071B08A30108A360E80207D0 -:0A0070001B04A40108231400FF0084 -:00000001FF -# -# Replacement CIS for AC555 provided by Sierra Wireless -# diff --git a/firmware/cis/SW_555_SER.ct b/firmware/cis/SW_555_SER.ct new file mode 100644 index 0000000..7519505 --- /dev/null +++ b/firmware/cis/SW_555_SER.ct @@ -0,0 +1,19 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x013f, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AirCard 555", "A555", "Rev 1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + io 0x03f8-0x03ff [lines=3] [8bit] [range] + irq mask 0x3fbc [level] +cftable_entry 0x21 + io 0x02f8-0x02ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x03e8-0x03ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x02e8-0x02ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/firmware/cis/SW_7xx_SER.cis.ihex b/firmware/cis/SW_7xx_SER.cis.ihex deleted file mode 100644 index 11e44ad..0000000 --- a/firmware/cis/SW_7xx_SER.cis.ihex +++ /dev/null @@ -1,13 +0,0 @@ -:100000000101FF17034100FF2004920110072102A4 -:1000100002001537070053696572726120576972D3 -:10002000656C6573730041433731302F4143373579 -:10003000300047505253204E6574776F726B2041E9 -:1000400064617074657200523100FF1A050103008B -:1000500007731B10E00119784D555D25A360F80367 -:100060000730BC861B08A10108A360F802071B0823 -:10007000A20108A360E803071B08A30108A360E826 -:0C00800002071B04A40108231400FF0069 -:00000001FF -# -# Replacement CIS for AC7xx provided by Sierra Wireless -# diff --git a/firmware/cis/SW_7xx_SER.ct b/firmware/cis/SW_7xx_SER.ct new file mode 100644 index 0000000..2991617 --- /dev/null +++ b/firmware/cis/SW_7xx_SER.ct @@ -0,0 +1,21 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x0192, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AC710/AC750", "GPRS Network Adapter", + "R1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + Vcc Istatic 45mA Iavg 50mA Ipeak 55mA Idown 20mA + io 0x03f8-0x03ff [lines=3] [8bit] [range] + irq mask 0x86bc [level] +cftable_entry 0x21 + io 0x02f8-0x02ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x03e8-0x03ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x02e8-0x02ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/firmware/cis/SW_8xx_SER.cis.ihex b/firmware/cis/SW_8xx_SER.cis.ihex deleted file mode 100644 index bbcfe63..0000000 --- a/firmware/cis/SW_8xx_SER.cis.ihex +++ /dev/null @@ -1,13 +0,0 @@ -:100000000101FF17034100FF2004920110072102A4 -:100010000200152F070053696572726120576972DB -:10002000656C657373004143383530003347204EAB -:100030006574776F726B20416461707465720052F1 -:100040003100FF1A0501030007731B10E001197846 -:100050004D555D25A360F8480730BC861B08A101FB -:1000600008A360F847071B08A20108A360E8480737 -:100070001B08A30108A360E847071B04A401082389 -:040080001400FF0069 -:00000001FF -# -# Replacement CIS for AC8xx provided by Sierra Wireless -# diff --git a/firmware/cis/SW_8xx_SER.ct b/firmware/cis/SW_8xx_SER.ct new file mode 100644 index 0000000..7dbdd57 --- /dev/null +++ b/firmware/cis/SW_8xx_SER.ct @@ -0,0 +1,20 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x0192, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AC850", "3G Network Adapter", "R1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + Vcc Istatic 45mA Iavg 50mA Ipeak 55mA Idown 20mA + io 0x48f8-0x48ff [lines=3] [8bit] [range] + irq mask 0x86bc [level] +cftable_entry 0x21 + io 0x47f8-0x47ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x48e8-0x48ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x47e8-0x47ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/firmware/cis/tamarack.cis.ihex b/firmware/cis/tamarack.cis.ihex deleted file mode 100644 index 1e86547..0000000 --- a/firmware/cis/tamarack.cis.ihex +++ /dev/null @@ -1,10 +0,0 @@ -:100000000103D400FF17034100FF152404015441EC -:100010004D415241434B0045746865726E657400F2 -:10002000410030303437343331313830303100FF33 -:10003000210206001A050120F803031B14E08119B0 -:100040003F554D5D06864626E551000F100F30FFE7 -:05005000FF1400FF0099 -:00000001FF -# -# Replacement CIS for Surecom, Tamarack NE2000 cards -# diff --git a/firmware/cis/tamarack.ct b/firmware/cis/tamarack.ct new file mode 100644 index 0000000..8802694 --- /dev/null +++ b/firmware/cis/tamarack.ct @@ -0,0 +1,17 @@ +# +# Replacement CIS for Surecom, Tamarack NE2000 cards +# +dev_info + fn_specific 100ns, 512b +attr_dev_info + EEPROM 250ns, 512b +vers_1 4.1, "TAMARACK", "Ethernet", "A", "004743118001" +funcid network_adapter +config base 0x03f8 mask 0x0003 last_index 0x20 +cftable_entry 0x20 [default] + [mwait] + Vcc Vnom 5V Vmin 4500mV Vmax 5500mV Istatic 100mA + Iavg 170mA Ipeak 200mA + timing wait 15us + io 0x0000-0x000f, 0x0010-0x001f [lines=5] [8bit] [16bit] + irq mask 0xffff [level] -- 1.5.6.5 From dbaryshkov at gmail.com Thu Sep 23 11:19:57 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:19:57 +0400 Subject: [PATCH 5/5] Documentation: add an utility to parse CIS files to readable form In-Reply-To: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285255197-9262-5-git-send-email-dbaryshkov@gmail.com> Import from pcmcia-cs project a dump_cis utility. It reads machine-readable CIS file and output text representation (which can be processed by firmware/mkcis utility). Signed-off-by: Dmitry Eremin-Solenikov --- Documentation/pcmcia/Makefile | 3 +- Documentation/pcmcia/dump_cis.c | 1992 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1994 insertions(+), 1 deletions(-) create mode 100644 Documentation/pcmcia/dump_cis.c diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile index accde87..d3a4b40 100644 --- a/Documentation/pcmcia/Makefile +++ b/Documentation/pcmcia/Makefile @@ -2,9 +2,10 @@ obj- := dummy.o # List of programs to build -hostprogs-y := crc32hash +hostprogs-y := crc32hash dump_cis # Tell kbuild to always build the programs always := $(hostprogs-y) HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include +HOSTCFLAGS_dump_cis.o += -Iinclude/pcmcia diff --git a/Documentation/pcmcia/dump_cis.c b/Documentation/pcmcia/dump_cis.c new file mode 100644 index 0000000..4de8641 --- /dev/null +++ b/Documentation/pcmcia/dump_cis.c @@ -0,0 +1,1992 @@ +/*********************************************************************** + * PC Card CIS dump utility + * + * dump_cis.c from pcmcia-cs + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete + * the provisions above, a recipient may use your version of this + * file under either the MPL or the GPL. + ***********************************************************************/ + +#include +#include +#include +#include + +#ifndef le16toh +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define le16toh(x) (x) +# define le32toh(x) (x) +# else +# define le16toh(x) bswap_16(x) +# define le32toh(x) bswap_32(x) +# endif +#endif + +#include +#include +#include + +#include + +/* Bits in IRQInfo1 field */ +#define IRQ_MASK 0x0f +#define IRQ_NMI_ID 0x01 +#define IRQ_IOCK_ID 0x02 +#define IRQ_BERR_ID 0x04 +#define IRQ_VEND_ID 0x08 +#define IRQ_INFO2_VALID 0x10 +#define IRQ_LEVEL_ID 0x20 +#define IRQ_PULSE_ID 0x40 +#define IRQ_SHARE_ID 0x80 + +typedef struct tuple_parse_t { + tuple_t tuple; + cisdata_t data[255]; + cisparse_t parse; +} tuple_parse_t; + +static int get_tuple_buf(int fd, tuple_t * tuple, int first); +static int parse_tuple(tuple_t * tuple, cisparse_t * parse); + +static int verbose; +static char indent[10] = " "; + +/*====================================================================*/ + +static void print_tuple(tuple_parse_t * tup) +{ + int i; + printf("%soffset 0x%2.2x, tuple 0x%2.2x, link 0x%2.2x\n", + indent, tup->tuple.CISOffset, tup->tuple.TupleCode, + tup->tuple.TupleLink); + for (i = 0; i < tup->tuple.TupleDataLen; i++) { + if ((i % 16) == 0) + printf("%s ", indent); + printf("%2.2x ", (u_char) tup->data[i]); + if ((i % 16) == 15) + putchar('\n'); + } + if ((i % 16) != 0) + putchar('\n'); +} + +/*====================================================================*/ + +static void print_funcid(cistpl_funcid_t * fn) +{ + printf("%sfuncid ", indent); + switch (fn->func) { + case CISTPL_FUNCID_MULTI: + printf("multi_function"); + break; + case CISTPL_FUNCID_MEMORY: + printf("memory_card"); + break; + case CISTPL_FUNCID_SERIAL: + printf("serial_port"); + break; + case CISTPL_FUNCID_PARALLEL: + printf("parallel_port"); + break; + case CISTPL_FUNCID_FIXED: + printf("fixed_disk"); + break; + case CISTPL_FUNCID_VIDEO: + printf("video_adapter"); + break; + case CISTPL_FUNCID_NETWORK: + printf("network_adapter"); + break; + case CISTPL_FUNCID_AIMS: + printf("aims_card"); + break; + case CISTPL_FUNCID_SCSI: + printf("scsi_adapter"); + break; + default: + printf("unknown"); + break; + } + if (fn->sysinit & CISTPL_SYSINIT_POST) + printf(" [post]"); + if (fn->sysinit & CISTPL_SYSINIT_ROM) + printf(" [rom]"); + putchar('\n'); +} + +/*====================================================================*/ + +static void print_size(u_int size) +{ + if (size < 1024) + printf("%ub", size); + else if (size < 1024 * 1024) + printf("%ukb", size / 1024); + else + printf("%umb", size / (1024 * 1024)); +} + +static void print_unit(u_int v, char *unit, char tag) +{ + int n; + for (n = 0; (v % 1000) == 0; n++) + v /= 1000; + printf("%u", v); + if (n < strlen(unit)) + putchar(unit[n]); + putchar(tag); +} + +static void print_time(u_int tm, u_long scale) +{ + print_unit(tm * scale, "num", 's'); +} + +static void print_volt(u_int vi) +{ + print_unit(vi * 10, "um", 'V'); +} + +static void print_current(u_int ii) +{ + print_unit(ii / 10, "um", 'A'); +} + +static void print_speed(u_int b) +{ + if (b < 1000) + printf("%u bits/sec", b); + else if (b < 1000000) + printf("%u kb/sec", b / 1000); + else + printf("%u mb/sec", b / 1000000); +} + +/*====================================================================*/ + +static const char *dtype[] = { + "NULL", "ROM", "OTPROM", "EPROM", "EEPROM", "FLASH", "SRAM", + "DRAM", "rsvd", "rsvd", "rsvd", "rsvd", "rsvd", "fn_specific", + "extended", "rsvd" +}; + +static void print_device(cistpl_device_t * dev) +{ + int i; + for (i = 0; i < dev->ndev; i++) { + printf("%s %s ", indent, dtype[dev->dev[i].type]); + printf("%uns, ", dev->dev[i].speed); + print_size(dev->dev[i].size); + putchar('\n'); + } + if (dev->ndev == 0) + printf("%s no_info\n", indent); +} + +/*====================================================================*/ + +static void print_power(char *tag, cistpl_power_t * power) +{ + int i, n; + for (i = n = 0; i < 8; i++) + if (power->present & (1 << i)) + n++; + i = 0; + printf("%s %s", indent, tag); + if (power->present & (1 << CISTPL_POWER_VNOM)) { + printf(" Vnom "); + i++; + print_volt(power->param[CISTPL_POWER_VNOM]); + } + if (power->present & (1 << CISTPL_POWER_VMIN)) { + printf(" Vmin "); + i++; + print_volt(power->param[CISTPL_POWER_VMIN]); + } + if (power->present & (1 << CISTPL_POWER_VMAX)) { + printf(" Vmax "); + i++; + print_volt(power->param[CISTPL_POWER_VMAX]); + } + if (power->present & (1 << CISTPL_POWER_ISTATIC)) { + printf(" Istatic "); + i++; + print_current(power->param[CISTPL_POWER_ISTATIC]); + } + if (power->present & (1 << CISTPL_POWER_IAVG)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Iavg "); + print_current(power->param[CISTPL_POWER_IAVG]); + } + if (power->present & (1 << CISTPL_POWER_IPEAK)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Ipeak "); + print_current(power->param[CISTPL_POWER_IPEAK]); + } + if (power->present & (1 << CISTPL_POWER_IDOWN)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Idown "); + print_current(power->param[CISTPL_POWER_IDOWN]); + } + if (power->flags & CISTPL_POWER_HIGHZ_OK) { + if (++i == 5) + printf("\n%s ", indent); + printf(" [highz OK]"); + } + if (power->flags & CISTPL_POWER_HIGHZ_REQ) { + printf(" [highz]"); + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_cftable_entry(cistpl_cftable_entry_t * entry) +{ + int i; + + printf("%scftable_entry 0x%2.2x%s\n", indent, entry->index, + (entry->flags & CISTPL_CFTABLE_DEFAULT) ? " [default]" : ""); + + if (entry->flags & ~CISTPL_CFTABLE_DEFAULT) { + printf("%s ", indent); + if (entry->flags & CISTPL_CFTABLE_BVDS) + printf(" [bvd]"); + if (entry->flags & CISTPL_CFTABLE_WP) + printf(" [wp]"); + if (entry->flags & CISTPL_CFTABLE_RDYBSY) + printf(" [rdybsy]"); + if (entry->flags & CISTPL_CFTABLE_MWAIT) + printf(" [mwait]"); + if (entry->flags & CISTPL_CFTABLE_AUDIO) + printf(" [audio]"); + if (entry->flags & CISTPL_CFTABLE_READONLY) + printf(" [readonly]"); + if (entry->flags & CISTPL_CFTABLE_PWRDOWN) + printf(" [pwrdown]"); + putchar('\n'); + } + + if (entry->vcc.present) + print_power("Vcc", &entry->vcc); + if (entry->vpp1.present) + print_power("Vpp1", &entry->vpp1); + if (entry->vpp2.present) + print_power("Vpp2", &entry->vpp2); + + if ((entry->timing.wait != 0) || (entry->timing.ready != 0) || + (entry->timing.reserved != 0)) { + printf("%s timing", indent); + if (entry->timing.wait != 0) { + printf(" wait "); + print_time(entry->timing.wait, entry->timing.waitscale); + } + if (entry->timing.ready != 0) { + printf(" ready "); + print_time(entry->timing.ready, entry->timing.rdyscale); + } + if (entry->timing.reserved != 0) { + printf(" reserved "); + print_time(entry->timing.reserved, + entry->timing.rsvscale); + } + putchar('\n'); + } + + if (entry->io.nwin) { + cistpl_io_t *io = &entry->io; + printf("%s io", indent); + for (i = 0; i < io->nwin; i++) { + if (i) + putchar(','); + printf(" 0x%4.4x-0x%4.4x", io->win[i].base, + io->win[i].base + io->win[i].len - 1); + } + printf(" [lines=%d]", io->flags & CISTPL_IO_LINES_MASK); + if (io->flags & CISTPL_IO_8BIT) + printf(" [8bit]"); + if (io->flags & CISTPL_IO_16BIT) + printf(" [16bit]"); + if (io->flags & CISTPL_IO_RANGE) + printf(" [range]"); + putchar('\n'); + } + + if (entry->irq.IRQInfo1) { + printf("%s irq ", indent); + if (entry->irq.IRQInfo1 & IRQ_INFO2_VALID) + printf("mask 0x%04x", entry->irq.IRQInfo2); + else + printf("%u", entry->irq.IRQInfo1 & IRQ_MASK); + if (entry->irq.IRQInfo1 & IRQ_LEVEL_ID) + printf(" [level]"); + if (entry->irq.IRQInfo1 & IRQ_PULSE_ID) + printf(" [pulse]"); + if (entry->irq.IRQInfo1 & IRQ_SHARE_ID) + printf(" [shared]"); + putchar('\n'); + } + + if (entry->mem.nwin) { + cistpl_mem_t *mem = &entry->mem; + printf("%s memory", indent); + for (i = 0; i < mem->nwin; i++) { + if (i) + putchar(','); + printf(" 0x%4.4x-0x%4.4x @ 0x%4.4x", + mem->win[i].card_addr, + mem->win[i].card_addr + mem->win[i].len - 1, + mem->win[i].host_addr); + } + putchar('\n'); + } + + if (verbose && entry->subtuples) + printf("%s %d bytes in subtuples\n", indent, entry->subtuples); + +} + +/*====================================================================*/ + +static void print_cftable_entry_cb(cistpl_cftable_entry_cb_t * entry) +{ + int i; + + printf("%scftable_entry_cb 0x%2.2x%s\n", indent, entry->index, + (entry->flags & CISTPL_CFTABLE_DEFAULT) ? " [default]" : ""); + + if (entry->flags & ~CISTPL_CFTABLE_DEFAULT) { + printf("%s ", indent); + if (entry->flags & CISTPL_CFTABLE_MASTER) + printf(" [master]"); + if (entry->flags & CISTPL_CFTABLE_INVALIDATE) + printf(" [invalidate]"); + if (entry->flags & CISTPL_CFTABLE_VGA_PALETTE) + printf(" [vga palette]"); + if (entry->flags & CISTPL_CFTABLE_PARITY) + printf(" [parity]"); + if (entry->flags & CISTPL_CFTABLE_WAIT) + printf(" [wait]"); + if (entry->flags & CISTPL_CFTABLE_SERR) + printf(" [serr]"); + if (entry->flags & CISTPL_CFTABLE_FAST_BACK) + printf(" [fast back]"); + if (entry->flags & CISTPL_CFTABLE_BINARY_AUDIO) + printf(" [binary audio]"); + if (entry->flags & CISTPL_CFTABLE_PWM_AUDIO) + printf(" [pwm audio]"); + putchar('\n'); + } + + if (entry->vcc.present) + print_power("Vcc", &entry->vcc); + if (entry->vpp1.present) + print_power("Vpp1", &entry->vpp1); + if (entry->vpp2.present) + print_power("Vpp2", &entry->vpp2); + + if (entry->io) { + printf("%s io_base", indent); + for (i = 0; i < 8; i++) + if (entry->io & (1 << i)) + printf(" %d", i); + putchar('\n'); + } + + if (entry->irq.IRQInfo1) { + printf("%s irq ", indent); + if (entry->irq.IRQInfo1 & IRQ_INFO2_VALID) + printf("mask 0x%4.4x", entry->irq.IRQInfo2); + else + printf("%u", entry->irq.IRQInfo1 & IRQ_MASK); + if (entry->irq.IRQInfo1 & IRQ_LEVEL_ID) + printf(" [level]"); + if (entry->irq.IRQInfo1 & IRQ_PULSE_ID) + printf(" [pulse]"); + if (entry->irq.IRQInfo1 & IRQ_SHARE_ID) + printf(" [shared]"); + putchar('\n'); + } + + if (entry->mem) { + printf("%s mem_base", indent); + for (i = 0; i < 8; i++) + if (entry->mem & (1 << i)) + printf(" %d", i); + putchar('\n'); + } + + if (verbose && entry->subtuples) + printf("%s %d bytes in subtuples\n", indent, entry->subtuples); + +} + +/*====================================================================*/ + +static void print_jedec(cistpl_jedec_t * j) +{ + int i; + for (i = 0; i < j->nid; i++) { + if (i != 0) + putchar(','); + printf(" 0x%02x 0x%02x", j->id[i].mfr, j->id[i].info); + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_device_geo(cistpl_device_geo_t * geo) +{ + int i; + for (i = 0; i < geo->ngeo; i++) { + printf("%s width %d erase 0x%x read 0x%x write 0x%x " + "partition 0x%x interleave 0x%x\n", indent, + geo->geo[i].buswidth, geo->geo[i].erase_block, + geo->geo[i].read_block, geo->geo[i].write_block, + geo->geo[i].partition, geo->geo[i].interleave); + } +} + +/*====================================================================*/ + +static void print_org(cistpl_org_t * org) +{ + printf("%sdata_org ", indent); + switch (org->data_org) { + case CISTPL_ORG_FS: + printf("[filesystem]"); + break; + case CISTPL_ORG_APPSPEC: + printf("[app_specific]"); + break; + case CISTPL_ORG_XIP: + printf("[code]"); + break; + default: + if (org->data_org < 0x80) + printf("[reserved]"); + else + printf("[vendor_specific]"); + } + printf(", \"%s\"\n", org->desc); +} + +/*====================================================================*/ + +static char *data_mod[] = { + "Bell103", "V.21", "V.23", "V.22", "Bell212A", "V.22bis", + "V.26", "V.26bis", "V.27bis", "V.29", "V.32", "V.32bis", + "V.34", "rfu", "rfu", "rfu" +}; + +static char *fax_mod[] = { + "V.21-C2", "V.27ter", "V.29", "V.17", "V.33", "rfu", "rfu", "rfu" +}; + +static char *fax_features[] = { + "T.3", "T.4", "T.6", "error", "voice", "poll", "file", "passwd" +}; + +static char *cmd_protocol[] = { + "AT1", "AT2", "AT3", "MNP_AT", "V.25bis", "V.25A", "DMCL" +}; + +static char *uart[] = { + "8250", "16450", "16550", "8251", "8530", "85230" +}; +static char *parity[] = { "space", "mark", "odd", "even" }; +static char *stop[] = { "1", "1.5", "2" }; + +static char *flow[] = { + "XON/XOFF xmit", "XON/XOFF rcv", "hw xmit", "hw rcv", "transparent" +}; + +static void print_serial(cistpl_funce_t * funce) +{ + cistpl_serial_t *s; + cistpl_data_serv_t *ds; + cistpl_fax_serv_t *fs; + cistpl_modem_cap_t *cp; + int i, j; + + switch (funce->type & 0x0f) { + case CISTPL_FUNCE_SERIAL_IF: + case CISTPL_FUNCE_SERIAL_IF_DATA: + case CISTPL_FUNCE_SERIAL_IF_FAX: + case CISTPL_FUNCE_SERIAL_IF_VOICE: + s = (cistpl_serial_t *) (funce->data); + printf("%sserial_interface", indent); + if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_DATA) + printf("_data"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_FAX) + printf("_fax"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_VOICE) + printf("_voice"); + printf("\n%s uart %s", indent, + (s->uart_type < 6) ? uart[s->uart_type] : "reserved"); + if (s->uart_cap_0) { + printf(" ["); + for (i = 0; i < 4; i++) + if (s->uart_cap_0 & (1 << i)) + printf("%s%s", parity[i], + (s->uart_cap_0 >= + (2 << i)) ? "/" : "]"); + } + if (s->uart_cap_1) { + int m = s->uart_cap_1 & 0x0f; + int n = s->uart_cap_1 >> 4; + printf(" ["); + for (i = 0; i < 4; i++) + if (m & (1 << i)) + printf("%d%s", i + 5, + (m >= (2 << i)) ? "/" : ""); + printf("] ["); + for (i = 0; i < 3; i++) + if (n & (1 << i)) + printf("%s%s", stop[i], + (n >= (2 << i)) ? "/" : "]"); + } + printf("\n"); + break; + case CISTPL_FUNCE_SERIAL_CAP: + case CISTPL_FUNCE_SERIAL_CAP_DATA: + case CISTPL_FUNCE_SERIAL_CAP_FAX: + case CISTPL_FUNCE_SERIAL_CAP_VOICE: + cp = (cistpl_modem_cap_t *) (funce->data); + printf("%sserial_modem_cap", indent); + if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_DATA) + printf("_data"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_FAX) + printf("_fax"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_VOICE) + printf("_voice"); + if (cp->flow) { + printf("\n%s flow", indent); + for (i = 0; i < 5; i++) + if (cp->flow & (1 << i)) + printf(" [%s]", flow[i]); + } + printf("\n%s cmd_buf %d rcv_buf %d xmit_buf %d\n", + indent, 4 * (cp->cmd_buf + 1), + cp->rcv_buf_0 + (cp->rcv_buf_1 << 8) + + (cp->rcv_buf_2 << 16), + cp->xmit_buf_0 + (cp->xmit_buf_1 << 8) + + (cp->xmit_buf_2 << 16)); + break; + case CISTPL_FUNCE_SERIAL_SERV_DATA: + ds = (cistpl_data_serv_t *) (funce->data); + printf("%sserial_data_services\n", indent); + printf("%s data_rate %d\n", indent, + 75 * ((ds->max_data_0 << 8) + ds->max_data_1)); + printf("%s modulation", indent); + for (i = j = 0; i < 16; i++) + if (((ds->modulation_1 << 8) + + ds->modulation_0) & (1 << i)) { + if (++j % 6 == 0) + printf("\n%s ", indent); + printf(" [%s]", data_mod[i]); + } + printf("\n"); + if (ds->error_control) { + printf("%s error_control", indent); + if (ds->error_control & CISTPL_SERIAL_ERR_MNP2_4) + printf(" [MNP2-4]"); + if (ds->error_control & CISTPL_SERIAL_ERR_V42_LAPM) + printf(" [V.42/LAPM]"); + printf("\n"); + } + if (ds->compression) { + printf("%s compression", indent); + if (ds->compression & CISTPL_SERIAL_CMPR_V42BIS) + printf(" [V.42bis]"); + if (ds->compression & CISTPL_SERIAL_CMPR_MNP5) + printf(" [MNP5]"); + printf("\n"); + } + if (ds->cmd_protocol) { + printf("%s cmd_protocol", indent); + for (i = 0; i < 7; i++) + if (ds->cmd_protocol & (1 << i)) + printf(" [%s]", cmd_protocol[i]); + printf("\n"); + } + break; + + case CISTPL_FUNCE_SERIAL_SERV_FAX: + fs = (cistpl_fax_serv_t *) (funce->data); + printf("%sserial_fax_services [class=%d]\n", + indent, funce->type >> 4); + printf("%s data_rate %d\n", indent, + 75 * ((fs->max_data_0 << 8) + fs->max_data_1)); + printf("%s modulation", indent); + for (i = 0; i < 8; i++) + if (fs->modulation & (1 << i)) + printf(" [%s]", fax_mod[i]); + printf("\n"); + if (fs->features_0) { + printf("%s features", indent); + for (i = 0; i < 8; i++) + if (fs->features_0 & (1 << i)) + printf(" [%s]", fax_features[i]); + printf("\n"); + } + break; + } +} + +/*====================================================================*/ + +static void print_fixed(cistpl_funce_t * funce) +{ + cistpl_ide_interface_t *i; + cistpl_ide_feature_t *f; + + switch (funce->type) { + case CISTPL_FUNCE_IDE_IFACE: + i = (cistpl_ide_interface_t *) (funce->data); + printf("%sdisk_interface ", indent); + if (i->interface == CISTPL_IDE_INTERFACE) + printf("[ide]\n"); + else + printf("[undefined]\n"); + break; + case CISTPL_FUNCE_IDE_MASTER: + case CISTPL_FUNCE_IDE_SLAVE: + f = (cistpl_ide_feature_t *) (funce->data); + printf("%sdisk_features", indent); + if (f->feature1 & CISTPL_IDE_SILICON) + printf(" [silicon]"); + else + printf(" [rotating]"); + if (f->feature1 & CISTPL_IDE_UNIQUE) + printf(" [unique]"); + if (f->feature1 & CISTPL_IDE_DUAL) + printf(" [dual]"); + else + printf(" [single]"); + if (f->feature1 && f->feature2) + printf("\n%s ", indent); + if (f->feature2 & CISTPL_IDE_HAS_SLEEP) + printf(" [sleep]"); + if (f->feature2 & CISTPL_IDE_HAS_STANDBY) + printf(" [standby]"); + if (f->feature2 & CISTPL_IDE_HAS_IDLE) + printf(" [idle]"); + if (f->feature2 & CISTPL_IDE_LOW_POWER) + printf(" [low power]"); + if (f->feature2 & CISTPL_IDE_REG_INHIBIT) + printf(" [reg inhibit]"); + if (f->feature2 & CISTPL_IDE_HAS_INDEX) + printf(" [index]"); + if (f->feature2 & CISTPL_IDE_IOIS16) + printf(" [iois16]"); + putchar('\n'); + break; + } +} + +/*====================================================================*/ + +static const char *tech[] = { + "undefined", "ARCnet", "ethernet", "token_ring", "localtalk", + "FDDI/CDDI", "ATM", "wireless" +}; + +static const char *media[] = { + "undefined", "unshielded_twisted_pair", "shielded_twisted_pair", + "thin_coax", "thick_coax", "fiber", "900_MHz", "2.4_GHz", + "5.4_GHz", "diffuse_infrared", "point_to_point_infrared" +}; + +static void print_network(cistpl_funce_t * funce) +{ + cistpl_lan_tech_t *t; + cistpl_lan_speed_t *s; + cistpl_lan_media_t *m; + cistpl_lan_node_id_t *n; + cistpl_lan_connector_t *c; + int i; + + switch (funce->type) { + case CISTPL_FUNCE_LAN_TECH: + t = (cistpl_lan_tech_t *) (funce->data); + printf("%slan_technology %s\n", indent, tech[t->tech]); + break; + case CISTPL_FUNCE_LAN_SPEED: + s = (cistpl_lan_speed_t *) (funce->data); + printf("%slan_speed ", indent); + print_speed(s->speed); + putchar('\n'); + break; + case CISTPL_FUNCE_LAN_MEDIA: + m = (cistpl_lan_media_t *) (funce->data); + printf("%slan_media %s\n", indent, media[m->media]); + break; + case CISTPL_FUNCE_LAN_NODE_ID: + n = (cistpl_lan_node_id_t *) (funce->data); + printf("%slan_node_id", indent); + for (i = 0; i < n->nb; i++) + printf(" %02x", n->id[i]); + putchar('\n'); + break; + case CISTPL_FUNCE_LAN_CONNECTOR: + c = (cistpl_lan_connector_t *) (funce->data); + printf("%slan_connector ", indent); + if (c->code == 0) + printf("Open connector standard\n"); + else + printf("Closed connector standard\n"); + break; + } +} + +/*====================================================================*/ + +static void print_vers_1(cistpl_vers_1_t * v1) +{ + int i, n; + char s[32]; + sprintf(s, "%svers_1 %d.%d", indent, v1->major, v1->minor); + printf("%s", s); + n = strlen(s); + for (i = 0; i < v1->ns; i++) { + if (n + strlen(v1->str + v1->ofs[i]) + 4 > 72) { + n = strlen(indent) + 2; + printf(",\n%s ", indent); + } else { + printf(", "); + n += 2; + } + printf("\"%s\"", v1->str + v1->ofs[i]); + n += strlen(v1->str + v1->ofs[i]) + 2; + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_vers_2(cistpl_vers_2_t * v2) +{ + printf("%sversion 0x%2.2x, compliance 0x%2.2x, dindex 0x%4.4x\n", + indent, v2->vers, v2->comply, v2->dindex); + printf("%s vspec8 0x%2.2x, vspec9 0x%2.2x, nhdr %d\n", + indent, v2->vspec8, v2->vspec9, v2->nhdr); + printf("%s vendor \"%s\"\n", indent, v2->str + v2->vendor); + printf("%s info \"%s\"\n", indent, v2->str + v2->info); +} + +/*====================================================================*/ + +#ifdef CISTPL_FORMAT_DISK +static void print_format(cistpl_format_t * fmt) +{ + if (fmt->type == CISTPL_FORMAT_DISK) + printf("%s [disk]", indent); + else if (fmt->type == CISTPL_FORMAT_MEM) + printf("%s [memory]", indent); + else + printf("%s [type 0x%02x]\n", indent, fmt->type); + if (fmt->edc == CISTPL_EDC_NONE) + printf(" [no edc]"); + else if (fmt->edc == CISTPL_EDC_CKSUM) + printf(" [cksum]"); + else if (fmt->edc == CISTPL_EDC_CRC) + printf(" [crc]"); + else if (fmt->edc == CISTPL_EDC_PCC) + printf(" [pcc]"); + else + printf(" [edc 0x%02x]", fmt->edc); + printf(" offset 0x%04x length ", fmt->offset); + print_size(fmt->length); + putchar('\n'); +} +#endif + +/*====================================================================*/ + +static void print_config(int code, cistpl_config_t * cfg) +{ + printf("%sconfig%s base 0x%4.4x", indent, + (code == CISTPL_CONFIG_CB) ? "_cb" : "", cfg->base); + if (code == CISTPL_CONFIG) + printf(" mask 0x%4.4x", cfg->rmask[0]); + printf(" last_index 0x%2.2x\n", cfg->last_idx); + if (verbose && cfg->subtuples) + printf("%s %d bytes in subtuples\n", indent, cfg->subtuples); +} + +/*====================================================================*/ + +static int nfn = 0, cur = 0; + +static void print_parse(tuple_parse_t * tup) +{ + static int func = 0; + int i; + + switch (tup->tuple.TupleCode) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + if (tup->tuple.TupleCode == CISTPL_DEVICE) + printf("%sdev_info\n", indent); + else + printf("%sattr_dev_info\n", indent); + print_device(&tup->parse.device); + break; + case CISTPL_CHECKSUM: + printf("%schecksum 0x%04x-0x%04x = 0x%02x\n", + indent, tup->parse.checksum.addr, + tup->parse.checksum.addr + tup->parse.checksum.len - 1, + tup->parse.checksum.sum); + break; + case CISTPL_LONGLINK_A: + if (verbose) + printf("%slong_link_attr 0x%04x\n", indent, + tup->parse.longlink.addr); + break; + case CISTPL_LONGLINK_C: + if (verbose) + printf("%slong_link 0x%04x\n", indent, + tup->parse.longlink.addr); + break; + case CISTPL_LONGLINK_MFC: + if (verbose) { + printf("%smfc_long_link\n", indent); + for (i = 0; i < tup->parse.longlink_mfc.nfn; i++) + printf("%s function %d: %s 0x%04x\n", indent, i, + tup->parse.longlink_mfc.fn[i].space ? + "common" : "attr", + tup->parse.longlink_mfc.fn[i].addr); + } + + printf("%smfc {\n", indent); + nfn = tup->parse.longlink_mfc.nfn; + cur = 0; + strcat(indent, " "); + while (cur < nfn) { + tuple_parse_t tuple_parse = *tup; + tuple_parse.tuple.CISOffset = + tup->parse.longlink_mfc.fn[cur].addr; + tuple_parse.tuple.TupleLink = 0; + + while (1) { + if (get_tuple_buf(-1, &tuple_parse.tuple, 0)) + break; + if (verbose) + print_tuple(&tuple_parse); + if (parse_tuple + (&tuple_parse.tuple, + &tuple_parse.parse) == 0) + print_parse(&tuple_parse); + else + printf("%sparse error\n", indent); + if (verbose) + putchar('\n'); + if (tuple_parse.tuple.TupleCode == CISTPL_END) + break; + } + } + break; + case CISTPL_NO_LINK: + if (verbose) + printf("%sno_long_link\n", indent); + break; +#ifdef CISTPL_INDIRECT + case CISTPL_INDIRECT: + if (verbose) + printf("%sindirect_access\n", indent); + break; +#endif + case CISTPL_LINKTARGET: + if (verbose) + printf("%slink_target\n", indent); + + if (cur++) + printf("%s}, {\n", indent + 2); + break; + case CISTPL_VERS_1: + print_vers_1(&tup->parse.version_1); + break; + case CISTPL_ALTSTR: + break; + case CISTPL_JEDEC_A: + case CISTPL_JEDEC_C: + if (tup->tuple.TupleCode == CISTPL_JEDEC_C) + printf("%scommon_jedec", indent); + else + printf("%sattr_jedec", indent); + print_jedec(&tup->parse.jedec); + break; + case CISTPL_DEVICE_GEO: + case CISTPL_DEVICE_GEO_A: + if (tup->tuple.TupleCode == CISTPL_DEVICE_GEO) + printf("%scommon_geometry\n", indent); + else + printf("%sattr_geometry\n", indent); + print_device_geo(&tup->parse.device_geo); + break; + case CISTPL_MANFID: + printf("%smanfid 0x%4.4x, 0x%4.4x\n", indent, + tup->parse.manfid.manf, tup->parse.manfid.card); + break; + case CISTPL_FUNCID: + print_funcid(&tup->parse.funcid); + func = tup->parse.funcid.func; + break; + case CISTPL_FUNCE: + switch (func) { + case CISTPL_FUNCID_SERIAL: + print_serial(&tup->parse.funce); + break; + case CISTPL_FUNCID_FIXED: + print_fixed(&tup->parse.funce); + break; + case CISTPL_FUNCID_NETWORK: + print_network(&tup->parse.funce); + break; + } + break; + case CISTPL_BAR: + printf("%sBAR %d size ", indent, + tup->parse.bar.attr & CISTPL_BAR_SPACE); + print_size(tup->parse.bar.size); + if (tup->parse.bar.attr & CISTPL_BAR_SPACE_IO) + printf(" [io]"); + else + printf(" [mem]"); + if (tup->parse.bar.attr & CISTPL_BAR_PREFETCH) + printf(" [prefetch]"); + if (tup->parse.bar.attr & CISTPL_BAR_CACHEABLE) + printf(" [cacheable]"); + if (tup->parse.bar.attr & CISTPL_BAR_1MEG_MAP) + printf(" [<1mb]"); + putchar('\n'); + break; + case CISTPL_CONFIG: + case CISTPL_CONFIG_CB: + print_config(tup->tuple.TupleCode, &tup->parse.config); + break; + case CISTPL_CFTABLE_ENTRY: + print_cftable_entry(&tup->parse.cftable_entry); + break; + case CISTPL_CFTABLE_ENTRY_CB: + print_cftable_entry_cb(&tup->parse.cftable_entry_cb); + break; + case CISTPL_VERS_2: + print_vers_2(&tup->parse.vers_2); + break; + case CISTPL_ORG: + print_org(&tup->parse.org); + break; +#ifdef CISTPL_FORMAT_DISK + case CISTPL_FORMAT: + case CISTPL_FORMAT_A: + if (tup->tuple.TupleCode == CISTPL_FORMAT) + printf("%scommon_format\n", indent); + else + printf("%sattr_format\n", indent); + print_format(&tup->parse.format); +#endif + } +} + +/*====================================================================*/ + +static int get_tuple_buf(int fd, tuple_t * tuple, int first) +{ + u_int ofs; + static int nb = 0; + static u_char buf[1024]; + + if (first) { + nb = read(fd, buf, sizeof(buf)); + tuple->TupleLink = tuple->CISOffset = 0; + } + ofs = tuple->CISOffset + tuple->TupleLink; + if (ofs >= nb) + return -1; + tuple->TupleCode = buf[ofs++]; + tuple->TupleDataLen = tuple->TupleLink = buf[ofs++]; + tuple->CISOffset = ofs; + memcpy(tuple->TupleData, buf + ofs, tuple->TupleLink); + return 0; +} + +/*====================================================================== + + Parsing routines for individual tuples + +======================================================================*/ + +static const u_char mantissa[] = { + 10, 12, 13, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 70, 80, 90 +}; + +static const u_int exponent[] = { + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 +}; + +/* Convert an extended speed byte to a time in nanoseconds */ +#define SPEED_CVT(v) \ + (mantissa[(((v)>>3)&15)-1] * exponent[(v)&7] / 10) +/* Convert a power byte to a current in 0.1 microamps */ +#define POWER_CVT(v) \ + (mantissa[((v)>>3)&15] * exponent[(v)&7] / 10) +#define POWER_SCALE(v) (exponent[(v)&7]) + +static int parse_device(tuple_t * tuple, cistpl_device_t * device) +{ + int i; + u_char scale; + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + device->ndev = 0; + for (i = 0; i < CISTPL_MAX_DEVICES; i++) { + + if (*p == 0xff) + break; + device->dev[i].type = (*p >> 4); + device->dev[i].wp = (*p & 0x08) ? 1 : 0; + switch (*p & 0x07) { + case 0: + device->dev[i].speed = 0; + break; + case 1: + device->dev[i].speed = 250; + break; + case 2: + device->dev[i].speed = 200; + break; + case 3: + device->dev[i].speed = 150; + break; + case 4: + device->dev[i].speed = 100; + break; + case 7: + if (++p == q) + return -1; + if (p == q) + return -1; + device->dev[i].speed = SPEED_CVT(*p); + while (*p & 0x80) + if (++p == q) + return -1; + break; + default: + return -1; + } + + if (++p == q) + return -1; + if (*p == 0xff) + break; + scale = *p & 7; + if (scale == 7) + return -1; + device->dev[i].size = ((*p >> 3) + 1) * (512 << (scale * 2)); + device->ndev++; + if (++p == q) + break; + } + + return 0; +} + +/*====================================================================*/ + +static int parse_checksum(tuple_t * tuple, cistpl_checksum_t * csum) +{ + u_char *p; + if (tuple->TupleDataLen < 5) + return -1; + p = (u_char *) tuple->TupleData; + csum->addr = tuple->CISOffset + (short)le16toh(*(u_short *) p) - 2; + csum->len = le16toh(*(u_short *) (p + 2)); + csum->sum = *(p + 4); + return 0; +} + +/*====================================================================*/ + +static int parse_longlink(tuple_t * tuple, cistpl_longlink_t * link) +{ + if (tuple->TupleDataLen < 4) + return -1; + link->addr = le32toh(*(u_int *) tuple->TupleData); + return 0; +} + +/*====================================================================*/ + +static int parse_longlink_mfc(tuple_t * tuple, cistpl_longlink_mfc_t * link) +{ + u_char *p; + int i; + + p = (u_char *) tuple->TupleData; + + link->nfn = *p; + p++; + if (tuple->TupleDataLen <= link->nfn * 5) + return -1; + for (i = 0; i < link->nfn; i++) { + link->fn[i].space = *p; + p++; + link->fn[i].addr = le32toh(*(u_int *) p); + p += 4; + } + return 0; +} + +/*====================================================================*/ + +static int parse_strings(u_char * p, u_char * q, int max, + char *s, u_char * ofs, u_char * found) +{ + int i, j, ns; + + if (p == q) + return -1; + ns = 0; + j = 0; + for (i = 0; i < max; i++) { + if (*p == 0xff) + break; + ofs[i] = j; + ns++; + for (;;) { + s[j++] = (*p == 0xff) ? '\0' : *p; + if ((*p == '\0') || (*p == 0xff)) + break; + if (++p == q) + return -1; + } + if ((*p == 0xff) || (++p == q)) + break; + } + if (found) { + *found = ns; + return 0; + } else { + return (ns == max) ? 0 : -1; + } +} + +/*====================================================================*/ + +static int parse_vers_1(tuple_t * tuple, cistpl_vers_1_t * vers_1) +{ + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + vers_1->major = *p; + p++; + vers_1->minor = *p; + p++; + if (p >= q) + return -1; + + return parse_strings(p, q, CISTPL_VERS_1_MAX_PROD_STRINGS, + vers_1->str, vers_1->ofs, &vers_1->ns); +} + +/*====================================================================*/ + +static int parse_altstr(tuple_t * tuple, cistpl_altstr_t * altstr) +{ + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + return parse_strings(p, q, CISTPL_MAX_ALTSTR_STRINGS, + altstr->str, altstr->ofs, &altstr->ns); +} + +/*====================================================================*/ + +static int parse_jedec(tuple_t * tuple, cistpl_jedec_t * jedec) +{ + u_char *p, *q; + int nid; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + for (nid = 0; nid < CISTPL_MAX_DEVICES; nid++) { + if (p > q - 2) + break; + jedec->id[nid].mfr = p[0]; + jedec->id[nid].info = p[1]; + p += 2; + } + jedec->nid = nid; + return 0; +} + +/*====================================================================*/ + +static int parse_manfid(tuple_t * tuple, cistpl_manfid_t * m) +{ + u_short *p; + if (tuple->TupleDataLen < 4) + return -1; + p = (u_short *) tuple->TupleData; + m->manf = le16toh(p[0]); + m->card = le16toh(p[1]); + return 0; +} + +/*====================================================================*/ + +static int parse_funcid(tuple_t * tuple, cistpl_funcid_t * f) +{ + u_char *p; + if (tuple->TupleDataLen < 2) + return -1; + p = (u_char *) tuple->TupleData; + f->func = p[0]; + f->sysinit = p[1]; + return 0; +} + +/*====================================================================*/ + +static int parse_funce(tuple_t * tuple, cistpl_funce_t * f) +{ + u_char *p; + int i; + if (tuple->TupleDataLen < 1) + return -1; + p = (u_char *) tuple->TupleData; + f->type = p[0]; + for (i = 1; i < tuple->TupleDataLen; i++) + f->data[i - 1] = p[i]; + return 0; +} + +/*====================================================================*/ + +static int parse_config(tuple_t * tuple, cistpl_config_t * config) +{ + int rasz, rmsz, i; + u_char *p; + + p = (u_char *) tuple->TupleData; + rasz = *p & 0x03; + rmsz = (*p & 0x3c) >> 2; + if (tuple->TupleDataLen < rasz + rmsz + 4) + return -1; + config->last_idx = *(++p); + p++; + config->base = 0; + for (i = 0; i <= rasz; i++) + config->base += p[i] << (8 * i); + p += rasz + 1; + for (i = 0; i < 4; i++) + config->rmask[i] = 0; + for (i = 0; i <= rmsz; i++) + config->rmask[i >> 2] += p[i] << (8 * (i % 4)); + config->subtuples = tuple->TupleDataLen - (rasz + rmsz + 4); + return 0; +} + +/*====================================================================== + + The following routines are all used to parse the nightmarish + config table entries. + +======================================================================*/ + +static u_char *parse_power(u_char * p, u_char * q, cistpl_power_t * pwr) +{ + int i; + u_int scale; + + if (p == q) + return NULL; + pwr->present = *p; + pwr->flags = 0; + p++; + for (i = 0; i < 7; i++) + if (pwr->present & (1 << i)) { + if (p == q) + return NULL; + pwr->param[i] = POWER_CVT(*p); + scale = POWER_SCALE(*p); + while (*p & 0x80) { + if (++p == q) + return NULL; + if ((*p & 0x7f) < 100) + pwr->param[i] += + (*p & 0x7f) * scale / 100; + else if (*p == 0x7d) + pwr->flags |= CISTPL_POWER_HIGHZ_OK; + else if (*p == 0x7e) + pwr->param[i] = 0; + else if (*p == 0x7f) + pwr->flags |= CISTPL_POWER_HIGHZ_REQ; + else + return NULL; + } + p++; + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_timing(u_char * p, u_char * q, cistpl_timing_t * timing) +{ + u_char scale; + + if (p == q) + return NULL; + scale = *p; + if ((scale & 3) != 3) { + if (++p == q) + return NULL; + timing->wait = SPEED_CVT(*p); + timing->waitscale = exponent[scale & 3]; + } else + timing->wait = 0; + scale >>= 2; + if ((scale & 7) != 7) { + if (++p == q) + return NULL; + timing->ready = SPEED_CVT(*p); + timing->rdyscale = exponent[scale & 7]; + } else + timing->ready = 0; + scale >>= 3; + if (scale != 7) { + if (++p == q) + return NULL; + timing->reserved = SPEED_CVT(*p); + timing->rsvscale = exponent[scale]; + } else + timing->reserved = 0; + p++; + return p; +} + +/*====================================================================*/ + +static u_char *parse_io(u_char * p, u_char * q, cistpl_io_t * io) +{ + int i, j, bsz, lsz; + + if (p == q) + return NULL; + io->flags = *p; + + if (!(*p & 0x80)) { + io->nwin = 1; + io->win[0].base = 0; + io->win[0].len = (1 << (io->flags & CISTPL_IO_LINES_MASK)); + return p + 1; + } + + if (++p == q) + return NULL; + io->nwin = (*p & 0x0f) + 1; + bsz = (*p & 0x30) >> 4; + if (bsz == 3) + bsz++; + lsz = (*p & 0xc0) >> 6; + if (lsz == 3) + lsz++; + p++; + + for (i = 0; i < io->nwin; i++) { + io->win[i].base = 0; + io->win[i].len = 1; + for (j = 0; j < bsz; j++, p++) { + if (p == q) + return NULL; + io->win[i].base += *p << (j * 8); + } + for (j = 0; j < lsz; j++, p++) { + if (p == q) + return NULL; + io->win[i].len += *p << (j * 8); + } + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_mem(u_char * p, u_char * q, cistpl_mem_t * mem) +{ + int i, j, asz, lsz, has_ha; + u_int len, ca, ha; + + if (p == q) + return NULL; + + mem->nwin = (*p & 0x07) + 1; + lsz = (*p & 0x18) >> 3; + asz = (*p & 0x60) >> 5; + has_ha = (*p & 0x80); + if (++p == q) + return NULL; + + for (i = 0; i < mem->nwin; i++) { + len = ca = ha = 0; + for (j = 0; j < lsz; j++, p++) { + if (p == q) + return NULL; + len += *p << (j * 8); + } + for (j = 0; j < asz; j++, p++) { + if (p == q) + return NULL; + ca += *p << (j * 8); + } + if (has_ha) + for (j = 0; j < asz; j++, p++) { + if (p == q) + return NULL; + ha += *p << (j * 8); + } + mem->win[i].len = len << 8; + mem->win[i].card_addr = ca << 8; + mem->win[i].host_addr = ha << 8; + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_irq(u_char * p, u_char * q, cistpl_irq_t * irq) +{ + if (p == q) + return NULL; + irq->IRQInfo1 = *p; + p++; + if (irq->IRQInfo1 & IRQ_INFO2_VALID) { + if (p + 2 > q) + return NULL; + irq->IRQInfo2 = (p[1] << 8) + p[0]; + p += 2; + } + return p; +} + +/*====================================================================*/ + +static int parse_cftable_entry(tuple_t * tuple, cistpl_cftable_entry_t * entry) +{ + u_char *p, *q, features; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + entry->index = *p & 0x3f; + entry->flags = 0; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_DEFAULT; + if (*p & 0x80) { + if (++p == q) + return -1; + if (*p & 0x10) + entry->flags |= CISTPL_CFTABLE_BVDS; + if (*p & 0x20) + entry->flags |= CISTPL_CFTABLE_WP; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_RDYBSY; + if (*p & 0x80) + entry->flags |= CISTPL_CFTABLE_MWAIT; + entry->interface = *p & 0x0f; + } else + entry->interface = 0; + + /* Process optional features */ + if (++p == q) + return -1; + features = *p; + p++; + + /* Power options */ + if ((features & 3) > 0) { + p = parse_power(p, q, &entry->vcc); + if (p == NULL) + return -1; + } else + entry->vcc.present = 0; + if ((features & 3) > 1) { + p = parse_power(p, q, &entry->vpp1); + if (p == NULL) + return -1; + } else + entry->vpp1.present = 0; + if ((features & 3) > 2) { + p = parse_power(p, q, &entry->vpp2); + if (p == NULL) + return -1; + } else + entry->vpp2.present = 0; + + /* Timing options */ + if (features & 0x04) { + p = parse_timing(p, q, &entry->timing); + if (p == NULL) + return -1; + } else { + entry->timing.wait = 0; + entry->timing.ready = 0; + entry->timing.reserved = 0; + } + + /* I/O window options */ + if (features & 0x08) { + p = parse_io(p, q, &entry->io); + if (p == NULL) + return -1; + } else + entry->io.nwin = 0; + + /* Interrupt options */ + if (features & 0x10) { + p = parse_irq(p, q, &entry->irq); + if (p == NULL) + return -1; + } else + entry->irq.IRQInfo1 = 0; + + switch (features & 0x60) { + case 0x00: + entry->mem.nwin = 0; + break; + case 0x20: + entry->mem.nwin = 1; + entry->mem.win[0].len = le16toh(*(u_short *) p) << 8; + entry->mem.win[0].card_addr = 0; + entry->mem.win[0].host_addr = 0; + p += 2; + if (p > q) + return -1; + break; + case 0x40: + entry->mem.nwin = 1; + entry->mem.win[0].len = le16toh(*(u_short *) p) << 8; + entry->mem.win[0].card_addr = + le16toh(*(u_short *) (p + 2)) << 8; + entry->mem.win[0].host_addr = 0; + p += 4; + if (p > q) + return -1; + break; + case 0x60: + p = parse_mem(p, q, &entry->mem); + if (p == NULL) + return -1; + break; + } + + /* Misc features */ + if (features & 0x80) { + if (p == q) + return -1; + entry->flags |= (*p << 8); + while (*p & 0x80) + if (++p == q) + return -1; + p++; + } + + entry->subtuples = q - p; + + return 0; +} + +/*====================================================================*/ + +static int parse_bar(tuple_t * tuple, cistpl_bar_t * bar) +{ + u_char *p; + if (tuple->TupleDataLen < 6) + return -1; + p = (u_char *) tuple->TupleData; + bar->attr = *p; + p += 2; + bar->size = le32toh(*(u_int *) p); + return 0; +} + +static int parse_config_cb(tuple_t * tuple, cistpl_config_t * config) +{ + u_char *p; + + p = (u_char *) tuple->TupleData; + if ((*p != 3) || (tuple->TupleDataLen < 6)) + return -1; + config->last_idx = *(++p); + p++; + config->base = le32toh(*(u_int *) p); + config->subtuples = tuple->TupleDataLen - 6; + return 0; +} + +static int parse_cftable_entry_cb(tuple_t * tuple, + cistpl_cftable_entry_cb_t * entry) +{ + u_char *p, *q, features; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + entry->index = *p & 0x3f; + entry->flags = 0; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_DEFAULT; + + /* Process optional features */ + if (++p == q) + return -1; + features = *p; + p++; + + /* Power options */ + if ((features & 3) > 0) { + p = parse_power(p, q, &entry->vcc); + if (p == NULL) + return -1; + } else + entry->vcc.present = 0; + if ((features & 3) > 1) { + p = parse_power(p, q, &entry->vpp1); + if (p == NULL) + return -1; + } else + entry->vpp1.present = 0; + if ((features & 3) > 2) { + p = parse_power(p, q, &entry->vpp2); + if (p == NULL) + return -1; + } else + entry->vpp2.present = 0; + + /* I/O window options */ + if (features & 0x08) { + if (p == q) + return -1; + entry->io = *p; + p++; + } else + entry->io = 0; + + /* Interrupt options */ + if (features & 0x10) { + p = parse_irq(p, q, &entry->irq); + if (p == NULL) + return -1; + } else + entry->irq.IRQInfo1 = 0; + + if (features & 0x20) { + if (p == q) + return -1; + entry->mem = *p; + p++; + } else + entry->mem = 0; + + /* Misc features */ + if (features & 0x80) { + if (p == q) + return -1; + entry->flags |= (*p << 8); + if (*p & 0x80) { + if (++p == q) + return -1; + entry->flags |= (*p << 16); + } + while (*p & 0x80) + if (++p == q) + return -1; + p++; + } + + entry->subtuples = q - p; + + return 0; +} + +/*====================================================================*/ + +static int parse_device_geo(tuple_t * tuple, cistpl_device_geo_t * geo) +{ + u_char *p, *q; + int n; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + for (n = 0; n < CISTPL_MAX_DEVICES; n++) { + if (p > q - 6) + break; + geo->geo[n].buswidth = p[0]; + geo->geo[n].erase_block = 1 << (p[1] - 1); + geo->geo[n].read_block = 1 << (p[2] - 1); + geo->geo[n].write_block = 1 << (p[3] - 1); + geo->geo[n].partition = 1 << (p[4] - 1); + geo->geo[n].interleave = 1 << (p[5] - 1); + p += 6; + } + geo->ngeo = n; + return 0; +} + +/*====================================================================*/ + +static int parse_vers_2(tuple_t * tuple, cistpl_vers_2_t * v2) +{ + u_char *p, *q; + + if (tuple->TupleDataLen < 10) + return -1; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + + v2->vers = p[0]; + v2->comply = p[1]; + v2->dindex = le16toh(*(u_short *) (p + 2)); + v2->vspec8 = p[6]; + v2->vspec9 = p[7]; + v2->nhdr = p[8]; + p += 9; + return parse_strings(p, q, 2, v2->str, &v2->vendor, NULL); +} + +/*====================================================================*/ + +static int parse_org(tuple_t * tuple, cistpl_org_t * org) +{ + u_char *p, *q; + int i; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + if (p == q) + return -1; + org->data_org = *p; + if (++p == q) + return -1; + for (i = 0; i < 30; i++) { + org->desc[i] = *p; + if (*p == '\0') + break; + if (++p == q) + return -1; + } + return 0; +} + +/*====================================================================*/ + +static int parse_format(tuple_t * tuple, cistpl_format_t * fmt) +{ + u_char *p; + + if (tuple->TupleDataLen < 10) + return -1; + + p = tuple->TupleData; + + fmt->type = p[0]; + fmt->edc = p[1]; + fmt->offset = le32toh(*(u_int *) (p + 2)); + fmt->length = le32toh(*(u_int *) (p + 6)); + + return 0; +} + +/*====================================================================*/ + +static int parse_tuple(tuple_t * tuple, cisparse_t * parse) +{ + int ret = 0; + + if (tuple->TupleDataLen > tuple->TupleDataMax) + return -1; + switch (tuple->TupleCode) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + ret = parse_device(tuple, &parse->device); + break; + case CISTPL_BAR: + ret = parse_bar(tuple, &parse->bar); + break; + case CISTPL_CONFIG_CB: + ret = parse_config_cb(tuple, &parse->config); + break; + case CISTPL_CFTABLE_ENTRY_CB: + ret = parse_cftable_entry_cb(tuple, &parse->cftable_entry_cb); + break; + case CISTPL_CHECKSUM: + ret = parse_checksum(tuple, &parse->checksum); + break; + case CISTPL_LONGLINK_A: + case CISTPL_LONGLINK_C: + ret = parse_longlink(tuple, &parse->longlink); + break; + case CISTPL_LONGLINK_MFC: + ret = parse_longlink_mfc(tuple, &parse->longlink_mfc); + break; + case CISTPL_VERS_1: + ret = parse_vers_1(tuple, &parse->version_1); + break; + case CISTPL_ALTSTR: + ret = parse_altstr(tuple, &parse->altstr); + break; + case CISTPL_JEDEC_A: + case CISTPL_JEDEC_C: + ret = parse_jedec(tuple, &parse->jedec); + break; + case CISTPL_MANFID: + ret = parse_manfid(tuple, &parse->manfid); + break; + case CISTPL_FUNCID: + ret = parse_funcid(tuple, &parse->funcid); + break; + case CISTPL_FUNCE: + ret = parse_funce(tuple, &parse->funce); + break; + case CISTPL_CONFIG: + ret = parse_config(tuple, &parse->config); + break; + case CISTPL_CFTABLE_ENTRY: + ret = parse_cftable_entry(tuple, &parse->cftable_entry); + break; + case CISTPL_DEVICE_GEO: + case CISTPL_DEVICE_GEO_A: + ret = parse_device_geo(tuple, &parse->device_geo); + break; + case CISTPL_VERS_2: + ret = parse_vers_2(tuple, &parse->vers_2); + break; + case CISTPL_ORG: + ret = parse_org(tuple, &parse->org); + break; + case CISTPL_FORMAT: + case CISTPL_FORMAT_A: + ret = parse_format(tuple, &parse->format); + break; + case CISTPL_NO_LINK: + case CISTPL_LINKTARGET: + ret = 0; + break; + case CISTPL_END: + ret = 0; + break; + default: + ret = -1; + break; + } + return ret; +} + +/*====================================================================*/ + +#define MAX_SOCKS 8 + +int main(int argc, char *argv[]) +{ + int i, fd; + tuple_parse_t tuple_parse; + int optch, errflg, first; + char *infile = NULL; + + errflg = 0; + while ((optch = getopt(argc, argv, "vi:")) != -1) { + switch (optch) { + case 'v': + verbose = 1; + break; + default: + errflg = 1; + break; + } + } + if (errflg || (optind > argc - 1)) { + fprintf(stderr, "usage: %s [-v] infile\n", argv[0]); + exit(EXIT_FAILURE); + } + + for (i = 0; optind + i < argc; i++) { + infile = argv[optind + i]; + + nfn = cur = 0; + indent[0] = '\0'; + fd = open(infile, O_RDONLY); + if (fd < 0) { + perror("open()"); + return -1; + } + + if (!verbose && (i > 0)) + putchar('\n'); + + tuple_parse.tuple.TupleDataMax = sizeof(tuple_parse.data); + tuple_parse.tuple.Attributes = + TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON; + tuple_parse.tuple.DesiredTuple = RETURN_FIRST_TUPLE; + tuple_parse.tuple.TupleOffset = 0; + tuple_parse.tuple.TupleData = tuple_parse.data; + + for (first = 1;; first = 0) { + if (get_tuple_buf(fd, &tuple_parse.tuple, first) != 0) + break; + if (verbose) + print_tuple(&tuple_parse); + if (parse_tuple(&tuple_parse.tuple, &tuple_parse.parse)) + printf("%sparse error\n", indent); + else + print_parse(&tuple_parse); + if (verbose) + putchar('\n'); + if (tuple_parse.tuple.TupleCode == CISTPL_END) + break; + } + + if (!verbose && (nfn > 0)) + printf("%s}\n", indent + 2); + } + + return 0; +} -- 1.5.6.5 From dwmw2 at infradead.org Thu Sep 23 11:29:12 2010 From: dwmw2 at infradead.org (David Woodhouse) Date: Thu, 23 Sep 2010 16:29:12 +0100 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285255752.10687.20.camel@i7.infradead.org> On Thu, 2010-09-23 at 19:19 +0400, Dmitry Eremin-Solenikov wrote: > For CIS files (describing hardware on PCMCIA and some other busses) > binary file isn't the 'preferred for for modification' in most cases. > pcmcia-cs project have developed pack_cis program which can be used > (and was used most probably) to generate .cis files from simple text > descriptions. Import this code to the kernel under the name of mkcis. This is useful, thanks -- but NACK. The firmware/ directory of the kernel will hopefully die soon, and is no longer what's actually shipped by many distributions. We should be concentrating on the linux-firmware.git repository instead. -- David Woodhouse Open Source Technology Centre David.Woodhouse at intel.com Intel Corporation From dbaryshkov at gmail.com Thu Sep 23 11:36:09 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Thu, 23 Sep 2010 19:36:09 +0400 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: <1285255752.10687.20.camel@i7.infradead.org> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> <1285255752.10687.20.camel@i7.infradead.org> Message-ID: On Thu, Sep 23, 2010 at 7:29 PM, David Woodhouse wrote: > On Thu, 2010-09-23 at 19:19 +0400, Dmitry Eremin-Solenikov wrote: >> For CIS files (describing hardware on PCMCIA and some other busses) >> binary file isn't the 'preferred for for modification' in most cases. >> pcmcia-cs project have developed pack_cis program which can be used >> (and was used most probably) to generate .cis files from simple text >> descriptions. Import this code to the kernel under the name of mkcis. > > This is useful, thanks -- but NACK. The firmware/ directory of the > kernel will hopefully die soon, and is no longer what's actually shipped > by many distributions. > > We should be concentrating on the linux-firmware.git repository instead. Should I redo this patch serie against linux-firmware.git (probably with just putting .ct files near .cis)? > > -- > David Woodhouse ? ? ? ? ? ? ? ? ? ? ? ? ? ?Open Source Technology Centre > David.Woodhouse at intel.com ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Intel Corporation > > -- With best wishes Dmitry From sam at ravnborg.org Thu Sep 23 11:45:05 2010 From: sam at ravnborg.org (Sam Ravnborg) Date: Thu, 23 Sep 2010 17:45:05 +0200 Subject: [PATCH 1/5] Makefile.fwinst: include Makefile.lib In-Reply-To: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <20100923154505.GB30836@merkur.ravnborg.org> On Thu, Sep 23, 2010 at 07:19:53PM +0400, Dmitry Eremin-Solenikov wrote: > Include Makefile.lib into Makefile.fwinst to enable _shipped processing. The mess in Makefile.lib is better not exposed too much. I suggest to move the _shipped processing to Kbuild.include. Sam From dwmw2 at infradead.org Thu Sep 23 11:54:11 2010 From: dwmw2 at infradead.org (David Woodhouse) Date: Thu, 23 Sep 2010 16:54:11 +0100 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> <1285255752.10687.20.camel@i7.infradead.org> Message-ID: <1285257251.10687.22.camel@i7.infradead.org> On Thu, 2010-09-23 at 19:36 +0400, Dmitry Eremin-Solenikov wrote: > Should I redo this patch serie against linux-firmware.git (probably > with just putting .ct files near .cis)? Yes please. -- dwmw2 From w.sang at pengutronix.de Thu Sep 23 12:58:21 2010 From: w.sang at pengutronix.de (Wolfram Sang) Date: Thu, 23 Sep 2010 18:58:21 +0200 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: References: <1285255197-9262-1-git-send-email-dbaryshkov@gmail.com> <1285255197-9262-2-git-send-email-dbaryshkov@gmail.com> <1285255752.10687.20.camel@i7.infradead.org> Message-ID: <20100923165821.GA1343@pengutronix.de> > > We should be concentrating on the linux-firmware.git repository instead. > > Should I redo this patch serie against linux-firmware.git (probably with > just putting .ct files near .cis)? \o/ That was on my todo-list for "somewhen", too. Thanks! -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From dbaryshkov at gmail.com Fri Sep 24 12:49:20 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:20 +0400 Subject: [PATCH 0/5] Add programs to work with CIS files Message-ID: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> linux-firmware.git has several CIS files - special files fixing bugs in description of PCMCIA hardware. Those files are binary, but they can be (and most probably were in the past) generated from simple text files by the use of special compiler (developed by pcmcia-cs project). This patch serie adds text sources of CIS files and two programs to convert between text and binary representations of CIS files. From dbaryshkov at gmail.com Fri Sep 24 12:49:21 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:21 +0400 Subject: [PATCH 1/5] Import cistpl.h header from linux kernel In-Reply-To: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285346965-23499-2-git-send-email-dbaryshkov@gmail.com> For mkcis and dump_cis programs we need a header from the linux kernel. Signed-off-by: Dmitry Eremin-Solenikov --- mkcis/cistpl.h | 580 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 580 insertions(+), 0 deletions(-) create mode 100644 mkcis/cistpl.h diff --git a/mkcis/cistpl.h b/mkcis/cistpl.h new file mode 100644 index 0000000..1c5088c --- /dev/null +++ b/mkcis/cistpl.h @@ -0,0 +1,580 @@ +/* + * cistpl.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * (C) 1999 David A. Hinds + */ + +#ifndef _LINUX_CISTPL_H +#define _LINUX_CISTPL_H + +typedef unsigned char cisdata_t; + +#define CISTPL_NULL 0x00 +#define CISTPL_DEVICE 0x01 +#define CISTPL_LONGLINK_CB 0x02 +#define CISTPL_INDIRECT 0x03 +#define CISTPL_CONFIG_CB 0x04 +#define CISTPL_CFTABLE_ENTRY_CB 0x05 +#define CISTPL_LONGLINK_MFC 0x06 +#define CISTPL_BAR 0x07 +#define CISTPL_PWR_MGMNT 0x08 +#define CISTPL_EXTDEVICE 0x09 +#define CISTPL_CHECKSUM 0x10 +#define CISTPL_LONGLINK_A 0x11 +#define CISTPL_LONGLINK_C 0x12 +#define CISTPL_LINKTARGET 0x13 +#define CISTPL_NO_LINK 0x14 +#define CISTPL_VERS_1 0x15 +#define CISTPL_ALTSTR 0x16 +#define CISTPL_DEVICE_A 0x17 +#define CISTPL_JEDEC_C 0x18 +#define CISTPL_JEDEC_A 0x19 +#define CISTPL_CONFIG 0x1a +#define CISTPL_CFTABLE_ENTRY 0x1b +#define CISTPL_DEVICE_OC 0x1c +#define CISTPL_DEVICE_OA 0x1d +#define CISTPL_DEVICE_GEO 0x1e +#define CISTPL_DEVICE_GEO_A 0x1f +#define CISTPL_MANFID 0x20 +#define CISTPL_FUNCID 0x21 +#define CISTPL_FUNCE 0x22 +#define CISTPL_SWIL 0x23 +#define CISTPL_END 0xff +/* Layer 2 tuples */ +#define CISTPL_VERS_2 0x40 +#define CISTPL_FORMAT 0x41 +#define CISTPL_GEOMETRY 0x42 +#define CISTPL_BYTEORDER 0x43 +#define CISTPL_DATE 0x44 +#define CISTPL_BATTERY 0x45 +#define CISTPL_FORMAT_A 0x47 +/* Layer 3 tuples */ +#define CISTPL_ORG 0x46 +#define CISTPL_SPCL 0x90 + +typedef struct cistpl_longlink_t { + u_int addr; +} cistpl_longlink_t; + +typedef struct cistpl_checksum_t { + u_short addr; + u_short len; + u_char sum; +} cistpl_checksum_t; + +#define CISTPL_MAX_FUNCTIONS 8 +#define CISTPL_MFC_ATTR 0x00 +#define CISTPL_MFC_COMMON 0x01 + +typedef struct cistpl_longlink_mfc_t { + u_char nfn; + struct { + u_char space; + u_int addr; + } fn[CISTPL_MAX_FUNCTIONS]; +} cistpl_longlink_mfc_t; + +#define CISTPL_MAX_ALTSTR_STRINGS 4 + +typedef struct cistpl_altstr_t { + u_char ns; + u_char ofs[CISTPL_MAX_ALTSTR_STRINGS]; + char str[254]; +} cistpl_altstr_t; + +#define CISTPL_DTYPE_NULL 0x00 +#define CISTPL_DTYPE_ROM 0x01 +#define CISTPL_DTYPE_OTPROM 0x02 +#define CISTPL_DTYPE_EPROM 0x03 +#define CISTPL_DTYPE_EEPROM 0x04 +#define CISTPL_DTYPE_FLASH 0x05 +#define CISTPL_DTYPE_SRAM 0x06 +#define CISTPL_DTYPE_DRAM 0x07 +#define CISTPL_DTYPE_FUNCSPEC 0x0d +#define CISTPL_DTYPE_EXTEND 0x0e + +#define CISTPL_MAX_DEVICES 4 + +typedef struct cistpl_device_t { + u_char ndev; + struct { + u_char type; + u_char wp; + u_int speed; + u_int size; + } dev[CISTPL_MAX_DEVICES]; +} cistpl_device_t; + +#define CISTPL_DEVICE_MWAIT 0x01 +#define CISTPL_DEVICE_3VCC 0x02 + +typedef struct cistpl_device_o_t { + u_char flags; + cistpl_device_t device; +} cistpl_device_o_t; + +#define CISTPL_VERS_1_MAX_PROD_STRINGS 4 + +typedef struct cistpl_vers_1_t { + u_char major; + u_char minor; + u_char ns; + u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS]; + char str[254]; +} cistpl_vers_1_t; + +typedef struct cistpl_jedec_t { + u_char nid; + struct { + u_char mfr; + u_char info; + } id[CISTPL_MAX_DEVICES]; +} cistpl_jedec_t; + +typedef struct cistpl_manfid_t { + u_short manf; + u_short card; +} cistpl_manfid_t; + +#define CISTPL_FUNCID_MULTI 0x00 +#define CISTPL_FUNCID_MEMORY 0x01 +#define CISTPL_FUNCID_SERIAL 0x02 +#define CISTPL_FUNCID_PARALLEL 0x03 +#define CISTPL_FUNCID_FIXED 0x04 +#define CISTPL_FUNCID_VIDEO 0x05 +#define CISTPL_FUNCID_NETWORK 0x06 +#define CISTPL_FUNCID_AIMS 0x07 +#define CISTPL_FUNCID_SCSI 0x08 + +#define CISTPL_SYSINIT_POST 0x01 +#define CISTPL_SYSINIT_ROM 0x02 + +typedef struct cistpl_funcid_t { + u_char func; + u_char sysinit; +} cistpl_funcid_t; + +typedef struct cistpl_funce_t { + u_char type; + u_char data[0]; +} cistpl_funce_t; + +/*====================================================================== + + Modem Function Extension Tuples + +======================================================================*/ + +#define CISTPL_FUNCE_SERIAL_IF 0x00 +#define CISTPL_FUNCE_SERIAL_CAP 0x01 +#define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02 +#define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03 +#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04 +#define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05 +#define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06 +#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07 +#define CISTPL_FUNCE_SERIAL_IF_DATA 0x08 +#define CISTPL_FUNCE_SERIAL_IF_FAX 0x09 +#define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a + +/* UART identification */ +#define CISTPL_SERIAL_UART_8250 0x00 +#define CISTPL_SERIAL_UART_16450 0x01 +#define CISTPL_SERIAL_UART_16550 0x02 +#define CISTPL_SERIAL_UART_8251 0x03 +#define CISTPL_SERIAL_UART_8530 0x04 +#define CISTPL_SERIAL_UART_85230 0x05 + +/* UART capabilities */ +#define CISTPL_SERIAL_UART_SPACE 0x01 +#define CISTPL_SERIAL_UART_MARK 0x02 +#define CISTPL_SERIAL_UART_ODD 0x04 +#define CISTPL_SERIAL_UART_EVEN 0x08 +#define CISTPL_SERIAL_UART_5BIT 0x01 +#define CISTPL_SERIAL_UART_6BIT 0x02 +#define CISTPL_SERIAL_UART_7BIT 0x04 +#define CISTPL_SERIAL_UART_8BIT 0x08 +#define CISTPL_SERIAL_UART_1STOP 0x10 +#define CISTPL_SERIAL_UART_MSTOP 0x20 +#define CISTPL_SERIAL_UART_2STOP 0x40 + +typedef struct cistpl_serial_t { + u_char uart_type; + u_char uart_cap_0; + u_char uart_cap_1; +} cistpl_serial_t; + +typedef struct cistpl_modem_cap_t { + u_char flow; + u_char cmd_buf; + u_char rcv_buf_0, rcv_buf_1, rcv_buf_2; + u_char xmit_buf_0, xmit_buf_1, xmit_buf_2; +} cistpl_modem_cap_t; + +#define CISTPL_SERIAL_MOD_103 0x01 +#define CISTPL_SERIAL_MOD_V21 0x02 +#define CISTPL_SERIAL_MOD_V23 0x04 +#define CISTPL_SERIAL_MOD_V22 0x08 +#define CISTPL_SERIAL_MOD_212A 0x10 +#define CISTPL_SERIAL_MOD_V22BIS 0x20 +#define CISTPL_SERIAL_MOD_V26 0x40 +#define CISTPL_SERIAL_MOD_V26BIS 0x80 +#define CISTPL_SERIAL_MOD_V27BIS 0x01 +#define CISTPL_SERIAL_MOD_V29 0x02 +#define CISTPL_SERIAL_MOD_V32 0x04 +#define CISTPL_SERIAL_MOD_V32BIS 0x08 +#define CISTPL_SERIAL_MOD_V34 0x10 + +#define CISTPL_SERIAL_ERR_MNP2_4 0x01 +#define CISTPL_SERIAL_ERR_V42_LAPM 0x02 + +#define CISTPL_SERIAL_CMPR_V42BIS 0x01 +#define CISTPL_SERIAL_CMPR_MNP5 0x02 + +#define CISTPL_SERIAL_CMD_AT1 0x01 +#define CISTPL_SERIAL_CMD_AT2 0x02 +#define CISTPL_SERIAL_CMD_AT3 0x04 +#define CISTPL_SERIAL_CMD_MNP_AT 0x08 +#define CISTPL_SERIAL_CMD_V25BIS 0x10 +#define CISTPL_SERIAL_CMD_V25A 0x20 +#define CISTPL_SERIAL_CMD_DMCL 0x40 + +typedef struct cistpl_data_serv_t { + u_char max_data_0; + u_char max_data_1; + u_char modulation_0; + u_char modulation_1; + u_char error_control; + u_char compression; + u_char cmd_protocol; + u_char escape; + u_char encrypt; + u_char misc_features; + u_char ccitt_code[0]; +} cistpl_data_serv_t; + +typedef struct cistpl_fax_serv_t { + u_char max_data_0; + u_char max_data_1; + u_char modulation; + u_char encrypt; + u_char features_0; + u_char features_1; + u_char ccitt_code[0]; +} cistpl_fax_serv_t; + +typedef struct cistpl_voice_serv_t { + u_char max_data_0; + u_char max_data_1; +} cistpl_voice_serv_t; + +/*====================================================================== + + LAN Function Extension Tuples + +======================================================================*/ + +#define CISTPL_FUNCE_LAN_TECH 0x01 +#define CISTPL_FUNCE_LAN_SPEED 0x02 +#define CISTPL_FUNCE_LAN_MEDIA 0x03 +#define CISTPL_FUNCE_LAN_NODE_ID 0x04 +#define CISTPL_FUNCE_LAN_CONNECTOR 0x05 + +/* LAN technologies */ +#define CISTPL_LAN_TECH_ARCNET 0x01 +#define CISTPL_LAN_TECH_ETHERNET 0x02 +#define CISTPL_LAN_TECH_TOKENRING 0x03 +#define CISTPL_LAN_TECH_LOCALTALK 0x04 +#define CISTPL_LAN_TECH_FDDI 0x05 +#define CISTPL_LAN_TECH_ATM 0x06 +#define CISTPL_LAN_TECH_WIRELESS 0x07 + +typedef struct cistpl_lan_tech_t { + u_char tech; +} cistpl_lan_tech_t; + +typedef struct cistpl_lan_speed_t { + u_int speed; +} cistpl_lan_speed_t; + +/* LAN media definitions */ +#define CISTPL_LAN_MEDIA_UTP 0x01 +#define CISTPL_LAN_MEDIA_STP 0x02 +#define CISTPL_LAN_MEDIA_THIN_COAX 0x03 +#define CISTPL_LAN_MEDIA_THICK_COAX 0x04 +#define CISTPL_LAN_MEDIA_FIBER 0x05 +#define CISTPL_LAN_MEDIA_900MHZ 0x06 +#define CISTPL_LAN_MEDIA_2GHZ 0x07 +#define CISTPL_LAN_MEDIA_5GHZ 0x08 +#define CISTPL_LAN_MEDIA_DIFF_IR 0x09 +#define CISTPL_LAN_MEDIA_PTP_IR 0x0a + +typedef struct cistpl_lan_media_t { + u_char media; +} cistpl_lan_media_t; + +typedef struct cistpl_lan_node_id_t { + u_char nb; + u_char id[16]; +} cistpl_lan_node_id_t; + +typedef struct cistpl_lan_connector_t { + u_char code; +} cistpl_lan_connector_t; + +/*====================================================================== + + IDE Function Extension Tuples + +======================================================================*/ + +#define CISTPL_IDE_INTERFACE 0x01 + +typedef struct cistpl_ide_interface_t { + u_char interface; +} cistpl_ide_interface_t; + +/* First feature byte */ +#define CISTPL_IDE_SILICON 0x04 +#define CISTPL_IDE_UNIQUE 0x08 +#define CISTPL_IDE_DUAL 0x10 + +/* Second feature byte */ +#define CISTPL_IDE_HAS_SLEEP 0x01 +#define CISTPL_IDE_HAS_STANDBY 0x02 +#define CISTPL_IDE_HAS_IDLE 0x04 +#define CISTPL_IDE_LOW_POWER 0x08 +#define CISTPL_IDE_REG_INHIBIT 0x10 +#define CISTPL_IDE_HAS_INDEX 0x20 +#define CISTPL_IDE_IOIS16 0x40 + +typedef struct cistpl_ide_feature_t { + u_char feature1; + u_char feature2; +} cistpl_ide_feature_t; + +#define CISTPL_FUNCE_IDE_IFACE 0x01 +#define CISTPL_FUNCE_IDE_MASTER 0x02 +#define CISTPL_FUNCE_IDE_SLAVE 0x03 + +/*====================================================================== + + Configuration Table Entries + +======================================================================*/ + +#define CISTPL_BAR_SPACE 0x07 +#define CISTPL_BAR_SPACE_IO 0x10 +#define CISTPL_BAR_PREFETCH 0x20 +#define CISTPL_BAR_CACHEABLE 0x40 +#define CISTPL_BAR_1MEG_MAP 0x80 + +typedef struct cistpl_bar_t { + u_char attr; + u_int size; +} cistpl_bar_t; + +typedef struct cistpl_config_t { + u_char last_idx; + u_int base; + u_int rmask[4]; + u_char subtuples; +} cistpl_config_t; + +/* These are bits in the 'present' field, and indices in 'param' */ +#define CISTPL_POWER_VNOM 0 +#define CISTPL_POWER_VMIN 1 +#define CISTPL_POWER_VMAX 2 +#define CISTPL_POWER_ISTATIC 3 +#define CISTPL_POWER_IAVG 4 +#define CISTPL_POWER_IPEAK 5 +#define CISTPL_POWER_IDOWN 6 + +#define CISTPL_POWER_HIGHZ_OK 0x01 +#define CISTPL_POWER_HIGHZ_REQ 0x02 + +typedef struct cistpl_power_t { + u_char present; + u_char flags; + u_int param[7]; +} cistpl_power_t; + +typedef struct cistpl_timing_t { + u_int wait, waitscale; + u_int ready, rdyscale; + u_int reserved, rsvscale; +} cistpl_timing_t; + +#define CISTPL_IO_LINES_MASK 0x1f +#define CISTPL_IO_8BIT 0x20 +#define CISTPL_IO_16BIT 0x40 +#define CISTPL_IO_RANGE 0x80 + +#define CISTPL_IO_MAX_WIN 16 + +typedef struct cistpl_io_t { + u_char flags; + u_char nwin; + struct { + u_int base; + u_int len; + } win[CISTPL_IO_MAX_WIN]; +} cistpl_io_t; + +typedef struct cistpl_irq_t { + u_int IRQInfo1; + u_int IRQInfo2; +} cistpl_irq_t; + +#define CISTPL_MEM_MAX_WIN 8 + +typedef struct cistpl_mem_t { + u_char flags; + u_char nwin; + struct { + u_int len; + u_int card_addr; + u_int host_addr; + } win[CISTPL_MEM_MAX_WIN]; +} cistpl_mem_t; + +#define CISTPL_CFTABLE_DEFAULT 0x0001 +#define CISTPL_CFTABLE_BVDS 0x0002 +#define CISTPL_CFTABLE_WP 0x0004 +#define CISTPL_CFTABLE_RDYBSY 0x0008 +#define CISTPL_CFTABLE_MWAIT 0x0010 +#define CISTPL_CFTABLE_AUDIO 0x0800 +#define CISTPL_CFTABLE_READONLY 0x1000 +#define CISTPL_CFTABLE_PWRDOWN 0x2000 + +typedef struct cistpl_cftable_entry_t { + u_char index; + u_short flags; + u_char interface; + cistpl_power_t vcc, vpp1, vpp2; + cistpl_timing_t timing; + cistpl_io_t io; + cistpl_irq_t irq; + cistpl_mem_t mem; + u_char subtuples; +} cistpl_cftable_entry_t; + +#define CISTPL_CFTABLE_MASTER 0x000100 +#define CISTPL_CFTABLE_INVALIDATE 0x000200 +#define CISTPL_CFTABLE_VGA_PALETTE 0x000400 +#define CISTPL_CFTABLE_PARITY 0x000800 +#define CISTPL_CFTABLE_WAIT 0x001000 +#define CISTPL_CFTABLE_SERR 0x002000 +#define CISTPL_CFTABLE_FAST_BACK 0x004000 +#define CISTPL_CFTABLE_BINARY_AUDIO 0x010000 +#define CISTPL_CFTABLE_PWM_AUDIO 0x020000 + +typedef struct cistpl_cftable_entry_cb_t { + u_char index; + u_int flags; + cistpl_power_t vcc, vpp1, vpp2; + u_char io; + cistpl_irq_t irq; + u_char mem; + u_char subtuples; +} cistpl_cftable_entry_cb_t; + +typedef struct cistpl_device_geo_t { + u_char ngeo; + struct { + u_char buswidth; + u_int erase_block; + u_int read_block; + u_int write_block; + u_int partition; + u_int interleave; + } geo[CISTPL_MAX_DEVICES]; +} cistpl_device_geo_t; + +typedef struct cistpl_vers_2_t { + u_char vers; + u_char comply; + u_short dindex; + u_char vspec8, vspec9; + u_char nhdr; + u_char vendor, info; + char str[244]; +} cistpl_vers_2_t; + +typedef struct cistpl_org_t { + u_char data_org; + char desc[30]; +} cistpl_org_t; + +#define CISTPL_ORG_FS 0x00 +#define CISTPL_ORG_APPSPEC 0x01 +#define CISTPL_ORG_XIP 0x02 + +typedef struct cistpl_format_t { + u_char type; + u_char edc; + u_int offset; + u_int length; +} cistpl_format_t; + +#define CISTPL_FORMAT_DISK 0x00 +#define CISTPL_FORMAT_MEM 0x01 + +#define CISTPL_EDC_NONE 0x00 +#define CISTPL_EDC_CKSUM 0x01 +#define CISTPL_EDC_CRC 0x02 +#define CISTPL_EDC_PCC 0x03 + +typedef union cisparse_t { + cistpl_device_t device; + cistpl_checksum_t checksum; + cistpl_longlink_t longlink; + cistpl_longlink_mfc_t longlink_mfc; + cistpl_vers_1_t version_1; + cistpl_altstr_t altstr; + cistpl_jedec_t jedec; + cistpl_manfid_t manfid; + cistpl_funcid_t funcid; + cistpl_funce_t funce; + cistpl_bar_t bar; + cistpl_config_t config; + cistpl_cftable_entry_t cftable_entry; + cistpl_cftable_entry_cb_t cftable_entry_cb; + cistpl_device_geo_t device_geo; + cistpl_vers_2_t vers_2; + cistpl_org_t org; + cistpl_format_t format; +} cisparse_t; + +typedef struct tuple_t { + u_int Attributes; + cisdata_t DesiredTuple; + u_int Flags; /* internal use */ + u_int LinkOffset; /* internal use */ + u_int CISOffset; /* internal use */ + cisdata_t TupleCode; + cisdata_t TupleLink; + cisdata_t TupleOffset; + cisdata_t TupleDataMax; + cisdata_t TupleDataLen; + cisdata_t *TupleData; +} tuple_t; + +/* Special cisdata_t value */ +#define RETURN_FIRST_TUPLE 0xff + +/* Attributes for tuple calls */ +#define TUPLE_RETURN_LINK 0x01 +#define TUPLE_RETURN_COMMON 0x02 + +#define CISTPL_MAX_CIS_SIZE 0x200 + +#endif /* LINUX_CISTPL_H */ -- 1.7.1 From dbaryshkov at gmail.com Fri Sep 24 12:49:22 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:22 +0400 Subject: [PATCH 2/5] Add mkcis - a program that can create .cis from text description In-Reply-To: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285346965-23499-3-git-send-email-dbaryshkov@gmail.com> For CIS files (describing hardware on PCMCIA and some other busses) binary file isn't the 'preferred for for modification' in most cases. pcmcia-cs project have developed pack_cis program which can be used (and was used most probably) to generate .cis files from simple text descriptions. Import this code under the name of mkcis. Signed-off-by: Dmitry Eremin-Solenikov --- mkcis/mkcis-lexer.l | 228 +++++ mkcis/mkcis-lexer.lex.c | 2547 ++++++++++++++++++++++++++++++++++++++++++++++ mkcis/mkcis-parser.tab.c | 2338 ++++++++++++++++++++++++++++++++++++++++++ mkcis/mkcis-parser.tab.h | 127 +++ mkcis/mkcis-parser.y | 383 +++++++ mkcis/mkcis.c | 471 +++++++++ mkcis/mkcis.h | 49 + 7 files changed, 6143 insertions(+), 0 deletions(-) create mode 100644 mkcis/mkcis-lexer.l create mode 100644 mkcis/mkcis-lexer.lex.c create mode 100644 mkcis/mkcis-parser.tab.c create mode 100644 mkcis/mkcis-parser.tab.h create mode 100644 mkcis/mkcis-parser.y create mode 100644 mkcis/mkcis.c create mode 100644 mkcis/mkcis.h diff --git a/mkcis/mkcis-lexer.l b/mkcis/mkcis-lexer.l new file mode 100644 index 0000000..d802e3e --- /dev/null +++ b/mkcis/mkcis-lexer.l @@ -0,0 +1,228 @@ +%{ +/* + * lex_cis.l 1.13 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +#define YY_NO_INPUT +#include "mkcis-parser.tab.h" + +/* For assembling nice error messages */ +int current_lineno; + +static int lex_number(char *); +static int lex_units(char *, int, int); +static int lex_float(char *); +static int lex_string(char *); + +%} +%option nounput + + +int [0-9]+ +hex 0x[0-9a-fA-F]+ +flt [0-9]+\.[0-9]* +str \"([^"]|\\.)*\" + +%% + +\n current_lineno++; +[ \t]* /* skip */ ; +[ ]*[#;].* /* skip */ ; + +funcid return FUNCID; +mfc return MFC; +manfid return MANFID; +vers_1 return VERS_1; +checksum return CHECKSUM; + +dev_info return DEV_INFO; +attr_dev_info return ATTR_DEV_INFO; +no_info return NO_INFO; +NULL return lex_number("0"); +ROM return lex_number("1"); +EPROM return lex_number("3"); +EEPROM return lex_number("4"); +FLASH return lex_number("5"); +SRAM return lex_number("6"); +DRAM return lex_number("7"); +fn_specific return lex_number("13"); + +config return CONFIG; +base return BASE; +mask return MASK; +last_index return LAST_INDEX; +\[post\] return POST; +\[rom\] return ROM; + +cftable_entry return CFTABLE; +\[default\] return DEFAULT; +\[bvd\] return BVD; +\[wp\] return WP; +\[rdybsy\] return RDYBSY; +\[mwait\] return MWAIT; +\[audio\] return AUDIO; +\[readonly\] return READONLY; +\[pwrdown\] return PWRDOWN; + +Vcc return VCC; +Vpp1 return VPP1; +Vpp2 return VPP2; +Vnom return VNOM; +Vmin return VMIN; +Vmax return VMAX; +Istatic return ISTATIC; +Iavg return IAVG; +Ipeak return IPEAK; +Idown return IDOWN; + +io return IO; +memory return MEM; +\[8bit\] return BIT8; +\[16bit\] return BIT16; +\[lines return LINES; +\[range\] return RANGE; + +irq return IRQ_NO; +\[level\] return LEVEL; +\[pulse\] return PULSE; +\[shared\] return SHARED; + +timing return TIMING; +wait return WAIT; +ready return READY; +reserved return RESERVED; + +multi_function return lex_number("0"); +memory_card return lex_number("1"); +serial_port return lex_number("2"); +parallel_port return lex_number("3"); +fixed_disk return lex_number("4"); +video_adapter return lex_number("5"); +network_adapter return lex_number("6"); +aims_card return lex_number("7"); +scsi_adapter return lex_number("8"); + +{int} return lex_number(yytext); +{hex} return lex_number(yytext); + +{int}b return lex_units(yytext, 1, SIZE); +{int}kb return lex_units(yytext, 1024, SIZE); +{int}mb return lex_units(yytext, 1024*1024, SIZE); + +{flt}s return lex_units(yytext, 1000000000, TIME); +{flt}ms return lex_units(yytext, 1000000, TIME); +{flt}us return lex_units(yytext, 1000, TIME); +{flt}ns return lex_units(yytext, 1, TIME); +{int}s return lex_units(yytext, 1000000000, TIME); +{int}ms return lex_units(yytext, 1000000, TIME); +{int}us return lex_units(yytext, 1000, TIME); +{int}ns return lex_units(yytext, 1, TIME); + +{flt}V return lex_units(yytext, 100000, VOLTAGE); +{flt}mV return lex_units(yytext, 100, VOLTAGE); +{flt}uV return lex_units(yytext, 0.1, VOLTAGE); +{int}V return lex_units(yytext, 100000, VOLTAGE); +{int}mV return lex_units(yytext, 100, VOLTAGE); +{int}uV return lex_units(yytext, 0.1, VOLTAGE); + +{flt}A return lex_units(yytext, 10000000, CURRENT); +{flt}mA return lex_units(yytext, 10000, CURRENT); +{flt}uA return lex_units(yytext, 10, CURRENT); +{int}A return lex_units(yytext, 10000000, CURRENT); +{int}mA return lex_units(yytext, 10000, CURRENT); +{int}uA return lex_units(yytext, 10, CURRENT); + +{flt} return lex_float(yytext); + +{str} return lex_string(yytext); + +. return yytext[0]; + +%% + +#ifndef yywrap +int yywrap() { return 1; } +#endif + +/*====================================================================== + + Stuff to parse basic data types + +======================================================================*/ + +static int lex_number(char *s) +{ + yylval.num = strtoul(s, NULL, 0); + return NUMBER; +} + +static int lex_float(char *s) +{ + yylval.flt = strtod(s, NULL); + return FLOAT; +} + +static int lex_units(char *s, int scale, int token) +{ + float f; + sscanf(s, "%f", &f); + yylval.num = scale*f + 0.5; + return token; +} + +static int lex_string(char *s) +{ + int n = strlen(s); + yylval.str = malloc(n-1); + strncpy(yylval.str, s+1, n-2); + yylval.str[n-2] = '\0'; + return STRING; +} + +/*====================================================================== + + The main parser entry point + +======================================================================*/ + +void parse_cis(FILE *f) +{ + current_lineno = 1; + yyrestart(f); + yyparse(); +} + diff --git a/mkcis/mkcis-lexer.lex.c b/mkcis/mkcis-lexer.lex.c new file mode 100644 index 0000000..aa3da20 --- /dev/null +++ b/mkcis/mkcis-lexer.lex.c @@ -0,0 +1,2547 @@ +#line 2 "firmware/mkcis-lexer.lex.c" + +#line 4 "firmware/mkcis-lexer.lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 96 +#define YY_END_OF_BUFFER 97 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[442] = + { 0, + 2, 2, 97, 95, 2, 1, 2, 95, 3, 68, + 68, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 2, 2, 3, 0, 94, + 0, 3, 93, 68, 90, 84, 70, 0, 0, 0, + 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 94, 0, 93, + 87, 81, 0, 0, 73, 0, 71, 91, 85, 72, + 78, 80, 92, 86, 79, 69, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 13, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 88, 82, 74, + 76, 89, 83, 75, 18, 0, 0, 0, 42, 0, + + 0, 0, 12, 17, 40, 39, 38, 36, 37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 29, 0, 0, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 56, 0, 14, 16, 44, 43, 0, 0, 0, + 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 57, 0, 0, 0, 0, 0, 0, 15, 0, 0, + + 47, 0, 0, 0, 49, 0, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 4, 0, 6, 46, 0, 0, 0, 0, 0, + 0, 0, 55, 7, 0, 41, 48, 32, 0, 52, + 31, 53, 0, 50, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 54, 0, + 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, + 0, 58, 0, 0, 0, 27, 34, 0, 66, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 33, 0, 0, 63, 0, 23, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 60, 0, 0, + 0, 0, 61, 0, 0, 0, 0, 0, 0, 67, + 0, 10, 26, 0, 0, 62, 64, 59, 0, 65, + 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 7, 1, 8, 9, 10, + 11, 11, 11, 12, 11, 13, 11, 1, 6, 1, + 1, 1, 1, 1, 14, 15, 15, 16, 17, 18, + 1, 19, 20, 1, 1, 21, 22, 23, 24, 25, + 1, 26, 27, 1, 28, 29, 1, 1, 1, 1, + 30, 31, 32, 1, 33, 1, 34, 35, 36, 37, + + 38, 39, 40, 41, 42, 1, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[58] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[446] = + { 0, + 0, 0, 497, 498, 56, 498, 57, 57, 0, 82, + 440, 469, 47, 473, 31, 465, 468, 465, 30, 130, + 25, 456, 58, 451, 27, 24, 454, 47, 60, 453, + 448, 65, 443, 45, 450, 100, 104, 0, 109, 498, + 110, 0, 178, 427, 498, 498, 498, 447, 95, 430, + 498, 102, 0, 466, 454, 452, 463, 422, 428, 436, + 421, 451, 449, 456, 433, 78, 421, 419, 454, 430, + 411, 409, 424, 80, 406, 79, 110, 419, 411, 413, + 405, 405, 403, 416, 407, 398, 395, 417, 403, 498, + 399, 396, 91, 401, 409, 400, 391, 409, 391, 85, + + 389, 389, 393, 387, 399, 393, 118, 124, 151, 0, + 498, 498, 144, 383, 498, 147, 498, 498, 498, 498, + 498, 498, 498, 498, 498, 0, 411, 406, 407, 403, + 389, 373, 393, 392, 404, 498, 402, 498, 367, 376, + 376, 141, 385, 377, 381, 380, 377, 361, 368, 379, + 361, 367, 360, 363, 351, 373, 361, 371, 372, 352, + 352, 363, 366, 363, 359, 364, 358, 344, 358, 498, + 341, 353, 348, 343, 498, 337, 333, 345, 352, 348, + 346, 341, 340, 339, 329, 341, 326, 498, 498, 498, + 498, 498, 498, 498, 498, 353, 354, 356, 498, 328, + + 330, 320, 498, 498, 498, 498, 498, 498, 498, 329, + 318, 327, 336, 333, 328, 327, 322, 311, 311, 324, + 320, 324, 321, 325, 306, 498, 322, 321, 498, 318, + 309, 309, 308, 312, 300, 305, 313, 303, 498, 294, + 301, 295, 295, 296, 282, 288, 304, 302, 289, 301, + 286, 498, 310, 498, 498, 498, 498, 289, 278, 297, + 281, 498, 274, 282, 274, 272, 291, 284, 274, 282, + 268, 271, 498, 279, 280, 278, 270, 262, 272, 265, + 277, 271, 271, 265, 269, 248, 271, 253, 263, 257, + 498, 246, 265, 254, 257, 287, 262, 498, 258, 261, + + 498, 260, 247, 258, 498, 257, 498, 256, 232, 254, + 228, 238, 246, 248, 243, 242, 226, 498, 239, 240, + 240, 498, 229, 498, 241, 234, 229, 224, 232, 231, + 231, 234, 498, 498, 232, 498, 498, 498, 213, 498, + 498, 498, 218, 498, 231, 218, 229, 210, 205, 225, + 212, 209, 213, 212, 216, 216, 198, 217, 498, 205, + 211, 213, 198, 208, 212, 211, 498, 185, 498, 204, + 203, 192, 498, 498, 177, 188, 188, 191, 176, 187, + 187, 498, 171, 171, 183, 498, 498, 184, 498, 173, + 168, 170, 170, 155, 160, 173, 171, 158, 153, 154, + + 155, 498, 156, 149, 498, 164, 498, 162, 145, 162, + 147, 155, 132, 131, 140, 127, 498, 498, 130, 123, + 120, 119, 498, 130, 119, 106, 115, 108, 107, 498, + 102, 498, 498, 99, 83, 498, 498, 498, 34, 498, + 498, 231, 234, 237, 67 + } ; + +static yyconst flex_int16_t yy_def[446] = + { 0, + 441, 1, 441, 441, 441, 441, 441, 442, 443, 441, + 10, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 443, 442, 441, + 444, 443, 441, 10, 441, 441, 441, 441, 441, 441, + 441, 441, 445, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 442, 442, 444, 43, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 445, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 0, 441, 441, 441, 441 + } ; + +static yyconst flex_int16_t yy_nxt[556] = + { 0, + 4, 5, 6, 7, 8, 9, 4, 10, 11, 11, + 11, 11, 11, 4, 4, 12, 13, 14, 4, 15, + 4, 4, 16, 4, 4, 17, 18, 4, 19, 20, + 4, 4, 4, 21, 22, 23, 24, 4, 25, 4, + 4, 26, 4, 27, 28, 29, 4, 30, 4, 31, + 32, 33, 4, 34, 35, 4, 4, 36, 36, 36, + 37, 40, 38, 55, 58, 65, 80, 59, 87, 126, + 90, 56, 88, 91, 66, 67, 81, 68, 60, 89, + 93, 61, 104, 440, 94, 95, 105, 41, 43, 44, + 44, 44, 44, 44, 44, 45, 83, 97, 84, 96, + + 101, 36, 102, 36, 85, 36, 98, 37, 118, 38, + 46, 139, 39, 40, 108, 123, 47, 148, 180, 140, + 439, 149, 40, 119, 48, 151, 49, 50, 40, 120, + 124, 152, 51, 153, 52, 181, 172, 53, 69, 41, + 109, 173, 70, 154, 438, 121, 155, 156, 41, 208, + 209, 437, 125, 39, 41, 108, 157, 188, 436, 435, + 192, 434, 433, 71, 72, 432, 73, 431, 430, 429, + 428, 427, 189, 74, 75, 193, 426, 76, 425, 77, + 78, 109, 424, 423, 79, 110, 110, 110, 110, 110, + 110, 111, 422, 421, 190, 420, 419, 194, 418, 417, + + 416, 415, 414, 413, 412, 411, 112, 410, 409, 408, + 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, + 397, 396, 113, 114, 395, 394, 393, 392, 115, 391, + 116, 39, 39, 39, 42, 390, 42, 107, 107, 107, + 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, + 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, + 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, + 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, + 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, + 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, + + 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, + 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, + 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, + 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, + 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, + 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, + 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, + 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, + 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, + 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, + + 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, + 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, + 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, + 197, 196, 195, 191, 187, 186, 185, 184, 183, 182, + 179, 178, 177, 176, 175, 174, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, + 150, 147, 146, 145, 144, 143, 142, 141, 138, 137, + 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, + 122, 117, 441, 106, 103, 100, 99, 92, 86, 82, + 64, 63, 62, 57, 54, 441, 441, 3, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441 + } ; + +static yyconst flex_int16_t yy_chk[556] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 7, 5, + 7, 8, 7, 13, 15, 19, 21, 15, 25, 445, + 26, 13, 25, 26, 19, 19, 21, 19, 15, 25, + 28, 15, 34, 439, 28, 28, 34, 8, 10, 10, + 10, 10, 10, 10, 10, 10, 23, 29, 23, 28, + + 32, 36, 32, 36, 23, 37, 29, 37, 49, 37, + 10, 66, 41, 39, 41, 52, 10, 74, 100, 66, + 435, 74, 107, 49, 10, 76, 10, 10, 108, 49, + 52, 76, 10, 76, 10, 100, 93, 10, 20, 39, + 41, 93, 20, 77, 434, 49, 77, 77, 107, 142, + 142, 431, 52, 109, 108, 109, 77, 113, 429, 428, + 116, 427, 426, 20, 20, 425, 20, 424, 422, 421, + 420, 419, 113, 20, 20, 116, 416, 20, 415, 20, + 20, 109, 414, 413, 20, 43, 43, 43, 43, 43, + 43, 43, 412, 411, 113, 410, 409, 116, 408, 406, + + 404, 403, 401, 400, 399, 398, 43, 397, 396, 395, + 394, 393, 392, 391, 390, 388, 385, 384, 383, 381, + 380, 379, 43, 43, 378, 377, 376, 375, 43, 372, + 43, 442, 442, 442, 443, 371, 443, 444, 444, 444, + 370, 368, 366, 365, 364, 363, 362, 361, 360, 358, + 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, + 347, 346, 345, 343, 339, 335, 332, 331, 330, 329, + 328, 327, 326, 325, 323, 321, 320, 319, 317, 316, + 315, 314, 313, 312, 311, 310, 309, 308, 306, 304, + 303, 302, 300, 299, 297, 296, 295, 294, 293, 292, + + 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, + 280, 279, 278, 277, 276, 275, 274, 272, 271, 270, + 269, 268, 267, 266, 265, 264, 263, 261, 260, 259, + 258, 253, 251, 250, 249, 248, 247, 246, 245, 244, + 243, 242, 241, 240, 238, 237, 236, 235, 234, 233, + 232, 231, 230, 228, 227, 225, 224, 223, 222, 221, + 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, + 210, 202, 201, 200, 198, 197, 196, 187, 186, 185, + 184, 183, 182, 181, 180, 179, 178, 177, 176, 174, + 173, 172, 171, 169, 168, 167, 166, 165, 164, 163, + + 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, + 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, + 141, 140, 139, 137, 135, 134, 133, 132, 131, 130, + 129, 128, 127, 114, 106, 105, 104, 103, 102, 101, + 99, 98, 97, 96, 95, 94, 92, 91, 89, 88, + 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, + 75, 73, 72, 71, 70, 69, 68, 67, 65, 64, + 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, + 50, 48, 44, 35, 33, 31, 30, 27, 24, 22, + 18, 17, 16, 14, 12, 11, 3, 441, 441, 441, + + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "firmware/mkcis-lexer.l" +#line 2 "firmware/mkcis-lexer.l" +/* + * lex_cis.l 1.13 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +#define YY_NO_INPUT +#include "mkcis-parser.tab.h" + +/* For assembling nice error messages */ +int current_lineno; + +static int lex_number(char *); +static int lex_units(char *, int, int); +static int lex_float(char *); +static int lex_string(char *); + +#line 778 "firmware/mkcis-lexer.lex.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 60 "firmware/mkcis-lexer.l" + + +#line 966 "firmware/mkcis-lexer.lex.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 498 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 62 "firmware/mkcis-lexer.l" +current_lineno++; + YY_BREAK +case 2: +YY_RULE_SETUP +#line 63 "firmware/mkcis-lexer.l" +/* skip */ ; + YY_BREAK +case 3: +YY_RULE_SETUP +#line 64 "firmware/mkcis-lexer.l" +/* skip */ ; + YY_BREAK +case 4: +YY_RULE_SETUP +#line 66 "firmware/mkcis-lexer.l" +return FUNCID; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 67 "firmware/mkcis-lexer.l" +return MFC; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 68 "firmware/mkcis-lexer.l" +return MANFID; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 69 "firmware/mkcis-lexer.l" +return VERS_1; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 70 "firmware/mkcis-lexer.l" +return CHECKSUM; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 72 "firmware/mkcis-lexer.l" +return DEV_INFO; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 73 "firmware/mkcis-lexer.l" +return ATTR_DEV_INFO; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 74 "firmware/mkcis-lexer.l" +return NO_INFO; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 75 "firmware/mkcis-lexer.l" +return lex_number("0"); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 76 "firmware/mkcis-lexer.l" +return lex_number("1"); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 77 "firmware/mkcis-lexer.l" +return lex_number("3"); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 78 "firmware/mkcis-lexer.l" +return lex_number("4"); + YY_BREAK +case 16: +YY_RULE_SETUP +#line 79 "firmware/mkcis-lexer.l" +return lex_number("5"); + YY_BREAK +case 17: +YY_RULE_SETUP +#line 80 "firmware/mkcis-lexer.l" +return lex_number("6"); + YY_BREAK +case 18: +YY_RULE_SETUP +#line 81 "firmware/mkcis-lexer.l" +return lex_number("7"); + YY_BREAK +case 19: +YY_RULE_SETUP +#line 82 "firmware/mkcis-lexer.l" +return lex_number("13"); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 84 "firmware/mkcis-lexer.l" +return CONFIG; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 85 "firmware/mkcis-lexer.l" +return BASE; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 86 "firmware/mkcis-lexer.l" +return MASK; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 87 "firmware/mkcis-lexer.l" +return LAST_INDEX; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 88 "firmware/mkcis-lexer.l" +return POST; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 89 "firmware/mkcis-lexer.l" +return ROM; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 91 "firmware/mkcis-lexer.l" +return CFTABLE; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 92 "firmware/mkcis-lexer.l" +return DEFAULT; + YY_BREAK +case 28: +YY_RULE_SETUP +#line 93 "firmware/mkcis-lexer.l" +return BVD; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 94 "firmware/mkcis-lexer.l" +return WP; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 95 "firmware/mkcis-lexer.l" +return RDYBSY; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 96 "firmware/mkcis-lexer.l" +return MWAIT; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 97 "firmware/mkcis-lexer.l" +return AUDIO; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 98 "firmware/mkcis-lexer.l" +return READONLY; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 99 "firmware/mkcis-lexer.l" +return PWRDOWN; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 101 "firmware/mkcis-lexer.l" +return VCC; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 102 "firmware/mkcis-lexer.l" +return VPP1; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 103 "firmware/mkcis-lexer.l" +return VPP2; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 104 "firmware/mkcis-lexer.l" +return VNOM; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 105 "firmware/mkcis-lexer.l" +return VMIN; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 106 "firmware/mkcis-lexer.l" +return VMAX; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 107 "firmware/mkcis-lexer.l" +return ISTATIC; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 108 "firmware/mkcis-lexer.l" +return IAVG; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 109 "firmware/mkcis-lexer.l" +return IPEAK; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 110 "firmware/mkcis-lexer.l" +return IDOWN; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 112 "firmware/mkcis-lexer.l" +return IO; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 113 "firmware/mkcis-lexer.l" +return MEM; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 114 "firmware/mkcis-lexer.l" +return BIT8; + YY_BREAK +case 48: +YY_RULE_SETUP +#line 115 "firmware/mkcis-lexer.l" +return BIT16; + YY_BREAK +case 49: +YY_RULE_SETUP +#line 116 "firmware/mkcis-lexer.l" +return LINES; + YY_BREAK +case 50: +YY_RULE_SETUP +#line 117 "firmware/mkcis-lexer.l" +return RANGE; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 119 "firmware/mkcis-lexer.l" +return IRQ_NO; + YY_BREAK +case 52: +YY_RULE_SETUP +#line 120 "firmware/mkcis-lexer.l" +return LEVEL; + YY_BREAK +case 53: +YY_RULE_SETUP +#line 121 "firmware/mkcis-lexer.l" +return PULSE; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 122 "firmware/mkcis-lexer.l" +return SHARED; + YY_BREAK +case 55: +YY_RULE_SETUP +#line 124 "firmware/mkcis-lexer.l" +return TIMING; + YY_BREAK +case 56: +YY_RULE_SETUP +#line 125 "firmware/mkcis-lexer.l" +return WAIT; + YY_BREAK +case 57: +YY_RULE_SETUP +#line 126 "firmware/mkcis-lexer.l" +return READY; + YY_BREAK +case 58: +YY_RULE_SETUP +#line 127 "firmware/mkcis-lexer.l" +return RESERVED; + YY_BREAK +case 59: +YY_RULE_SETUP +#line 129 "firmware/mkcis-lexer.l" +return lex_number("0"); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 130 "firmware/mkcis-lexer.l" +return lex_number("1"); + YY_BREAK +case 61: +YY_RULE_SETUP +#line 131 "firmware/mkcis-lexer.l" +return lex_number("2"); + YY_BREAK +case 62: +YY_RULE_SETUP +#line 132 "firmware/mkcis-lexer.l" +return lex_number("3"); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 133 "firmware/mkcis-lexer.l" +return lex_number("4"); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 134 "firmware/mkcis-lexer.l" +return lex_number("5"); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 135 "firmware/mkcis-lexer.l" +return lex_number("6"); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 136 "firmware/mkcis-lexer.l" +return lex_number("7"); + YY_BREAK +case 67: +YY_RULE_SETUP +#line 137 "firmware/mkcis-lexer.l" +return lex_number("8"); + YY_BREAK +case 68: +YY_RULE_SETUP +#line 139 "firmware/mkcis-lexer.l" +return lex_number(yytext); + YY_BREAK +case 69: +YY_RULE_SETUP +#line 140 "firmware/mkcis-lexer.l" +return lex_number(yytext); + YY_BREAK +case 70: +YY_RULE_SETUP +#line 142 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, SIZE); + YY_BREAK +case 71: +YY_RULE_SETUP +#line 143 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1024, SIZE); + YY_BREAK +case 72: +YY_RULE_SETUP +#line 144 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1024*1024, SIZE); + YY_BREAK +case 73: +YY_RULE_SETUP +#line 146 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000000, TIME); + YY_BREAK +case 74: +YY_RULE_SETUP +#line 147 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000, TIME); + YY_BREAK +case 75: +YY_RULE_SETUP +#line 148 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000, TIME); + YY_BREAK +case 76: +YY_RULE_SETUP +#line 149 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, TIME); + YY_BREAK +case 77: +YY_RULE_SETUP +#line 150 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000000, TIME); + YY_BREAK +case 78: +YY_RULE_SETUP +#line 151 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000000, TIME); + YY_BREAK +case 79: +YY_RULE_SETUP +#line 152 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1000, TIME); + YY_BREAK +case 80: +YY_RULE_SETUP +#line 153 "firmware/mkcis-lexer.l" +return lex_units(yytext, 1, TIME); + YY_BREAK +case 81: +YY_RULE_SETUP +#line 155 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100000, VOLTAGE); + YY_BREAK +case 82: +YY_RULE_SETUP +#line 156 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100, VOLTAGE); + YY_BREAK +case 83: +YY_RULE_SETUP +#line 157 "firmware/mkcis-lexer.l" +return lex_units(yytext, 0.1, VOLTAGE); + YY_BREAK +case 84: +YY_RULE_SETUP +#line 158 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100000, VOLTAGE); + YY_BREAK +case 85: +YY_RULE_SETUP +#line 159 "firmware/mkcis-lexer.l" +return lex_units(yytext, 100, VOLTAGE); + YY_BREAK +case 86: +YY_RULE_SETUP +#line 160 "firmware/mkcis-lexer.l" +return lex_units(yytext, 0.1, VOLTAGE); + YY_BREAK +case 87: +YY_RULE_SETUP +#line 162 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000000, CURRENT); + YY_BREAK +case 88: +YY_RULE_SETUP +#line 163 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000, CURRENT); + YY_BREAK +case 89: +YY_RULE_SETUP +#line 164 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10, CURRENT); + YY_BREAK +case 90: +YY_RULE_SETUP +#line 165 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000000, CURRENT); + YY_BREAK +case 91: +YY_RULE_SETUP +#line 166 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10000, CURRENT); + YY_BREAK +case 92: +YY_RULE_SETUP +#line 167 "firmware/mkcis-lexer.l" +return lex_units(yytext, 10, CURRENT); + YY_BREAK +case 93: +YY_RULE_SETUP +#line 169 "firmware/mkcis-lexer.l" +return lex_float(yytext); + YY_BREAK +case 94: +/* rule 94 can match eol */ +YY_RULE_SETUP +#line 171 "firmware/mkcis-lexer.l" +return lex_string(yytext); + YY_BREAK +case 95: +YY_RULE_SETUP +#line 173 "firmware/mkcis-lexer.l" +return yytext[0]; + YY_BREAK +case 96: +YY_RULE_SETUP +#line 175 "firmware/mkcis-lexer.l" +ECHO; + YY_BREAK +#line 1531 "firmware/mkcis-lexer.lex.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 442 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 441); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 175 "firmware/mkcis-lexer.l" + + + +#ifndef yywrap +int yywrap() { return 1; } +#endif + +/*====================================================================== + + Stuff to parse basic data types + +======================================================================*/ + +static int lex_number(char *s) +{ + yylval.num = strtoul(s, NULL, 0); + return NUMBER; +} + +static int lex_float(char *s) +{ + yylval.flt = strtod(s, NULL); + return FLOAT; +} + +static int lex_units(char *s, int scale, int token) +{ + float f; + sscanf(s, "%f", &f); + yylval.num = scale*f + 0.5; + return token; +} + +static int lex_string(char *s) +{ + int n = strlen(s); + yylval.str = malloc(n-1); + strncpy(yylval.str, s+1, n-2); + yylval.str[n-2] = '\0'; + return STRING; +} + +/*====================================================================== + + The main parser entry point + +======================================================================*/ + +void parse_cis(FILE *f) +{ + current_lineno = 1; + yyrestart(f); + yyparse(); +} + + diff --git a/mkcis/mkcis-parser.tab.c b/mkcis/mkcis-parser.tab.c new file mode 100644 index 0000000..4b11702 --- /dev/null +++ b/mkcis/mkcis-parser.tab.c @@ -0,0 +1,2338 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "mkcis-parser.y" + +/* + * yacc_cis.y 1.11 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +/* If bison: generate nicer error messages */ +#define YYERROR_VERBOSE 1 + +void yyerror(char *msg, ...); +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse); + + + +/* Line 189 of yacc.c */ +#line 123 "mkcis-parser.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + STRING = 258, + NUMBER = 259, + FLOAT = 260, + VOLTAGE = 261, + CURRENT = 262, + SIZE = 263, + VERS_1 = 264, + MANFID = 265, + FUNCID = 266, + CONFIG = 267, + CFTABLE = 268, + MFC = 269, + CHECKSUM = 270, + POST = 271, + ROM = 272, + BASE = 273, + LAST_INDEX = 274, + DEV_INFO = 275, + ATTR_DEV_INFO = 276, + NO_INFO = 277, + TIME = 278, + TIMING = 279, + WAIT = 280, + READY = 281, + RESERVED = 282, + VNOM = 283, + VMIN = 284, + VMAX = 285, + ISTATIC = 286, + IAVG = 287, + IPEAK = 288, + IDOWN = 289, + VCC = 290, + VPP1 = 291, + VPP2 = 292, + IO = 293, + MEM = 294, + DEFAULT = 295, + BVD = 296, + WP = 297, + RDYBSY = 298, + MWAIT = 299, + AUDIO = 300, + READONLY = 301, + PWRDOWN = 302, + BIT8 = 303, + BIT16 = 304, + LINES = 305, + RANGE = 306, + IRQ_NO = 307, + MASK = 308, + LEVEL = 309, + PULSE = 310, + SHARED = 311 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 61 "mkcis-parser.y" + + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; + + + +/* Line 214 of yacc.c */ +#line 226 "mkcis-parser.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 238 "mkcis-parser.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 137 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 64 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 19 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 74 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 138 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 311 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 59, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 57, 2, 58, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 8, 9, 12, 17, 23, 25, + 27, 29, 31, 33, 35, 37, 39, 41, 43, 49, + 52, 54, 60, 63, 66, 70, 75, 78, 81, 84, + 92, 95, 98, 101, 104, 107, 110, 113, 114, 117, + 120, 124, 128, 132, 138, 144, 147, 150, 156, 159, + 167, 175, 178, 181, 185, 190, 193, 196, 199, 202, + 205, 208, 211, 214, 217, 220, 223, 226, 230, 234, + 238, 240, 242, 244, 246 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 65, 0, -1, 66, -1, 66, 67, -1, -1, 66, + 68, -1, 14, 57, 66, 58, -1, 67, 59, 57, + 66, 58, -1, 69, -1, 70, -1, 71, -1, 72, + -1, 73, -1, 74, -1, 81, -1, 82, -1, 1, + -1, 20, -1, 69, 4, 23, 59, 8, -1, 69, + 22, -1, 21, -1, 70, 4, 23, 59, 8, -1, + 70, 22, -1, 9, 5, -1, 71, 59, 3, -1, + 10, 4, 59, 4, -1, 11, 4, -1, 73, 16, + -1, 73, 17, -1, 12, 18, 4, 53, 4, 19, + 4, -1, 28, 6, -1, 29, 6, -1, 30, 6, + -1, 31, 7, -1, 32, 7, -1, 33, 7, -1, + 34, 7, -1, -1, 76, 75, -1, 81, 24, -1, + 77, 25, 23, -1, 77, 26, 23, -1, 77, 27, + 23, -1, 81, 38, 4, 60, 4, -1, 78, 59, + 4, 60, 4, -1, 78, 48, -1, 78, 49, -1, + 78, 50, 61, 4, 62, -1, 78, 51, -1, 81, + 39, 4, 60, 4, 63, 4, -1, 79, 59, 4, + 60, 4, 63, 4, -1, 79, 48, -1, 79, 49, + -1, 81, 52, 4, -1, 81, 52, 53, 4, -1, + 80, 55, -1, 80, 54, -1, 80, 56, -1, 13, + 4, -1, 81, 40, -1, 81, 41, -1, 81, 42, + -1, 81, 43, -1, 81, 44, -1, 81, 45, -1, + 81, 46, -1, 81, 47, -1, 81, 35, 76, -1, + 81, 36, 76, -1, 81, 37, 76, -1, 78, -1, + 79, -1, 80, -1, 77, -1, 15, 4, 60, 4, + 61, 4, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 79, 79, 81, 86, 87, 102, 104, 108, 110, + 112, 114, 116, 118, 120, 122, 124, 128, 130, 137, + 140, 142, 149, 152, 162, 176, 184, 189, 191, 195, + 204, 209, 214, 219, 224, 229, 234, 242, 245, 252, + 253, 254, 255, 258, 265, 272, 274, 276, 278, 281, + 289, 297, 299, 303, 305, 310, 312, 314, 318, 323, + 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, + 345, 346, 347, 348, 351 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "STRING", "NUMBER", "FLOAT", "VOLTAGE", + "CURRENT", "SIZE", "VERS_1", "MANFID", "FUNCID", "CONFIG", "CFTABLE", + "MFC", "CHECKSUM", "POST", "ROM", "BASE", "LAST_INDEX", "DEV_INFO", + "ATTR_DEV_INFO", "NO_INFO", "TIME", "TIMING", "WAIT", "READY", + "RESERVED", "VNOM", "VMIN", "VMAX", "ISTATIC", "IAVG", "IPEAK", "IDOWN", + "VCC", "VPP1", "VPP2", "IO", "MEM", "DEFAULT", "BVD", "WP", "RDYBSY", + "MWAIT", "AUDIO", "READONLY", "PWRDOWN", "BIT8", "BIT16", "LINES", + "RANGE", "IRQ_NO", "MASK", "LEVEL", "PULSE", "SHARED", "'{'", "'}'", + "','", "'-'", "'='", "']'", "'@'", "$accept", "cis", "chain", "mfc", + "tuple", "dev_info", "attr_dev_info", "vers_1", "manfid", "funcid", + "config", "pwr", "pwrlist", "timing", "io", "mem", "irq", "cftab", + "checksum", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 123, 125, 44, + 45, 61, 93, 64 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 64, 65, 65, 66, 66, 67, 67, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, + 70, 70, 70, 71, 71, 72, 73, 73, 73, 74, + 75, 75, 75, 75, 75, 75, 75, 76, 76, 77, + 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, + 79, 79, 79, 80, 80, 80, 80, 80, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 82 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 2, 0, 2, 4, 5, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 5, 2, + 1, 5, 2, 2, 3, 4, 2, 2, 2, 7, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 3, 3, 3, 5, 5, 2, 2, 5, 2, 7, + 7, 2, 2, 3, 4, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, + 1, 1, 1, 1, 6 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 4, 0, 0, 1, 16, 0, 0, 0, 0, 0, + 0, 0, 17, 20, 3, 5, 8, 9, 10, 11, + 12, 13, 73, 70, 71, 72, 14, 15, 23, 0, + 26, 0, 58, 4, 0, 0, 0, 19, 0, 22, + 0, 27, 28, 0, 0, 0, 45, 46, 0, 48, + 0, 51, 52, 0, 56, 55, 57, 39, 37, 37, + 37, 0, 0, 59, 60, 61, 62, 63, 64, 65, + 66, 0, 0, 0, 0, 0, 4, 0, 0, 24, + 40, 41, 42, 0, 0, 0, 67, 68, 69, 0, + 0, 53, 0, 25, 0, 6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 0, 0, 54, 0, 0, 7, 18, 21, 47, + 44, 0, 30, 31, 32, 33, 34, 35, 36, 43, + 0, 0, 74, 0, 0, 29, 50, 49 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 2, 14, 15, 16, 17, 18, 19, 20, + 21, 110, 86, 22, 23, 24, 25, 26, 27 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -45 +static const yytype_int16 yypact[] = +{ + -45, 16, 28, -45, -45, -2, 22, 40, 43, 49, + -23, 83, -45, -45, -13, -45, 13, 14, -12, -45, + 42, -45, 29, -44, 3, 30, 36, -45, -45, 31, + -45, 85, -45, -45, 32, 34, 70, -45, 71, -45, + 92, -45, -45, 73, 74, 75, -45, -45, 38, -45, + 96, -45, -45, 97, -45, -45, -45, -45, -45, -45, + -45, 98, 99, -45, -45, -45, -45, -45, -45, -45, + -45, -3, 100, 52, -1, 102, -45, 48, 50, -45, + -45, -45, -45, 104, 51, 53, 35, 35, 35, 54, + 55, -45, 106, -45, 108, -45, 56, 12, 110, 111, + 58, 112, 117, 116, 118, 119, 120, 121, 122, 123, + -45, 127, 128, -45, 107, 129, -45, -45, -45, -45, + -45, 60, -45, -45, -45, -45, -45, -45, -45, -45, + 72, 130, -45, 132, 133, -45, -45, -45 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -45, -45, -31, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -29, -45, -45, -45, -45, -45, -45 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -3 +static const yytype_int16 yytable[] = +{ + 4, 91, 74, 28, 46, 47, 48, 49, 5, 6, + 7, 8, 9, 4, 11, 50, 3, 36, 38, 12, + 13, 5, 6, 7, 8, 9, 29, 11, -2, 4, + 87, 88, 12, 13, 33, 37, 39, 5, 6, 7, + 8, 9, 10, 11, 30, 97, 35, 40, 12, 13, + 92, 51, 52, 32, 43, 44, 45, 95, 41, 42, + 57, 31, 53, 103, 104, 105, 106, 107, 108, 109, + 116, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 54, 55, 56, 34, 71, 73, + 72, 76, 75, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 89, 90, 93, 94, 96, 98, 100, 99, + 113, 101, 114, 102, 111, 112, 120, 115, 117, 118, + 119, 121, 122, 133, 123, 124, 131, 125, 126, 127, + 128, 129, 130, 132, 135, 134, 136, 137 +}; + +static const yytype_uint8 yycheck[] = +{ + 1, 4, 33, 5, 48, 49, 50, 51, 9, 10, + 11, 12, 13, 1, 15, 59, 0, 4, 4, 20, + 21, 9, 10, 11, 12, 13, 4, 15, 0, 1, + 59, 60, 20, 21, 57, 22, 22, 9, 10, 11, + 12, 13, 14, 15, 4, 76, 59, 59, 20, 21, + 53, 48, 49, 4, 25, 26, 27, 58, 16, 17, + 24, 18, 59, 28, 29, 30, 31, 32, 33, 34, + 58, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 54, 55, 56, 4, 52, 4, + 59, 57, 60, 23, 23, 3, 23, 23, 23, 61, + 4, 4, 4, 4, 4, 53, 4, 59, 4, 59, + 4, 60, 4, 60, 60, 60, 4, 61, 8, 8, + 62, 4, 6, 63, 6, 6, 19, 7, 7, 7, + 7, 4, 4, 4, 4, 63, 4, 4 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 65, 66, 0, 1, 9, 10, 11, 12, 13, + 14, 15, 20, 21, 67, 68, 69, 70, 71, 72, + 73, 74, 77, 78, 79, 80, 81, 82, 5, 4, + 4, 18, 4, 57, 4, 59, 4, 22, 4, 22, + 59, 16, 17, 25, 26, 27, 48, 49, 50, 51, + 59, 48, 49, 59, 54, 55, 56, 24, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 52, 59, 4, 66, 60, 57, 23, 23, 3, + 23, 23, 23, 61, 4, 4, 76, 76, 76, 4, + 4, 4, 53, 4, 53, 58, 4, 66, 59, 59, + 4, 60, 60, 28, 29, 30, 31, 32, 33, 34, + 75, 60, 60, 4, 4, 61, 58, 8, 8, 62, + 4, 4, 6, 6, 6, 7, 7, 7, 7, 4, + 4, 19, 4, 63, 63, 4, 4, 4 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 1455 of yacc.c */ +#line 80 "mkcis-parser.y" + { cis_root = (yyvsp[(1) - (1)].tuple); ;} + break; + + case 3: + +/* Line 1455 of yacc.c */ +#line 82 "mkcis-parser.y" + { cis_root = (yyvsp[(1) - (2)].tuple); ;} + break; + + case 4: + +/* Line 1455 of yacc.c */ +#line 86 "mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 5: + +/* Line 1455 of yacc.c */ +#line 88 "mkcis-parser.y" + { + if ((yyvsp[(1) - (2)].tuple) == NULL) { + (yyval.tuple) = (yyvsp[(2) - (2)].tuple); + } else if ((yyvsp[(2) - (2)].tuple) == NULL) { + (yyval.tuple) = (yyvsp[(1) - (2)].tuple); + } else { + tuple_info_t *tail = (yyvsp[(1) - (2)].tuple); + while (tail->next != NULL) tail = tail->next; + tail->next = (yyvsp[(2) - (2)].tuple); + (yyval.tuple) = (yyvsp[(1) - (2)].tuple); + } + ;} + break; + + case 6: + +/* Line 1455 of yacc.c */ +#line 103 "mkcis-parser.y" + { mfc[nf++] = (yyvsp[(3) - (4)].tuple); ;} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 105 "mkcis-parser.y" + { mfc[nf++] = (yyvsp[(4) - (5)].tuple); ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 109 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_DEVICE, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 111 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_DEVICE_A, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 113 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_VERS_1, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 115 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_MANFID, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 117 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_FUNCID, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 119 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_CONFIG, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 121 "mkcis-parser.y" + { (yyval.tuple) = new_tuple(CISTPL_CFTABLE_ENTRY, (yyvsp[(1) - (1)].parse)); ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 123 "mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 125 "mkcis-parser.y" + { (yyval.tuple) = NULL; ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 129 "mkcis-parser.y" + { (yyval.parse) = calloc(1, sizeof(cisparse_t)); ;} + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 131 "mkcis-parser.y" + { + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].type = (yyvsp[(2) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].speed = (yyvsp[(3) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].size = (yyvsp[(5) - (5)].num); + (yyval.parse)->device.ndev++; + ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 141 "mkcis-parser.y" + { (yyval.parse) = calloc(1, sizeof(cisparse_t)); ;} + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 143 "mkcis-parser.y" + { + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].type = (yyvsp[(2) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].speed = (yyvsp[(3) - (5)].num); + (yyval.parse)->device.dev[(yyval.parse)->device.ndev].size = (yyvsp[(5) - (5)].num); + (yyval.parse)->device.ndev++; + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 153 "mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->version_1.major = (yyvsp[(2) - (2)].flt); + (yyvsp[(2) - (2)].flt) -= floor((yyvsp[(2) - (2)].flt)+0.01); + while (fabs((yyvsp[(2) - (2)].flt) - floor((yyvsp[(2) - (2)].flt)+0.5)) > 0.01) { + (yyvsp[(2) - (2)].flt) *= 10; + } + (yyval.parse)->version_1.minor = (yyvsp[(2) - (2)].flt)+0.01; + ;} + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 163 "mkcis-parser.y" + { + cistpl_vers_1_t *v = &(yyval.parse)->version_1; + u_int pos = 0; + if (v->ns) { + pos = v->ofs[v->ns-1]; + pos += strlen(v->str+pos)+1; + } + v->ofs[v->ns] = pos; + strcpy(v->str+pos, (yyvsp[(3) - (3)].str)); + v->ns++; + ;} + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 177 "mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->manfid.manf = (yyvsp[(2) - (4)].num); + (yyval.parse)->manfid.card = (yyvsp[(4) - (4)].num); + ;} + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 185 "mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->funcid.func = (yyvsp[(2) - (2)].num); + ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 190 "mkcis-parser.y" + { (yyval.parse)->funcid.sysinit |= CISTPL_SYSINIT_POST; ;} + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 192 "mkcis-parser.y" + { (yyval.parse)->funcid.sysinit |= CISTPL_SYSINIT_ROM; ;} + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 196 "mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->config.base = (yyvsp[(3) - (7)].num); + (yyval.parse)->config.rmask[0] = (yyvsp[(5) - (7)].num); + (yyval.parse)->config.last_idx = (yyvsp[(7) - (7)].num); + ;} + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 205 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VNOM; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 210 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VMIN; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 215 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_VMAX; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 220 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_ISTATIC; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 225 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IAVG; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 230 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IPEAK; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 235 "mkcis-parser.y" + { + (yyval.pwr).present = CISTPL_POWER_IDOWN; + (yyval.pwr).param[0] = (yyvsp[(2) - (2)].num); + ;} + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 242 "mkcis-parser.y" + { + (yyval.pwr).present = 0; + ;} + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 246 "mkcis-parser.y" + { + (yyval.pwr).present |= 1<<((yyvsp[(2) - (2)].pwr).present); + (yyval.pwr).param[(yyvsp[(2) - (2)].pwr).present] = (yyvsp[(2) - (2)].pwr).param[0]; + ;} + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 259 "mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.io.nwin; + (yyval.parse)->cftable_entry.io.win[n].base = (yyvsp[(3) - (5)].num); + (yyval.parse)->cftable_entry.io.win[n].len = (yyvsp[(5) - (5)].num)-(yyvsp[(3) - (5)].num)+1; + (yyval.parse)->cftable_entry.io.nwin++; + ;} + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 266 "mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.io.nwin; + (yyval.parse)->cftable_entry.io.win[n].base = (yyvsp[(3) - (5)].num); + (yyval.parse)->cftable_entry.io.win[n].len = (yyvsp[(5) - (5)].num)-(yyvsp[(3) - (5)].num)+1; + (yyval.parse)->cftable_entry.io.nwin++; + ;} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 273 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_8BIT; ;} + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 275 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_16BIT; ;} + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 277 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= (yyvsp[(4) - (5)].num); ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 282 "mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.mem.nwin; + (yyval.parse)->cftable_entry.mem.win[n].card_addr = (yyvsp[(3) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].host_addr = (yyvsp[(7) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].len = (yyvsp[(5) - (7)].num)-(yyvsp[(3) - (7)].num)+1; + (yyval.parse)->cftable_entry.mem.nwin++; + ;} + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 290 "mkcis-parser.y" + { + int n = (yyval.parse)->cftable_entry.mem.nwin; + (yyval.parse)->cftable_entry.mem.win[n].card_addr = (yyvsp[(3) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].host_addr = (yyvsp[(7) - (7)].num); + (yyval.parse)->cftable_entry.mem.win[n].len = (yyvsp[(5) - (7)].num)-(yyvsp[(3) - (7)].num)+1; + (yyval.parse)->cftable_entry.mem.nwin++; + ;} + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 298 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_8BIT; ;} + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 300 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.io.flags |= CISTPL_IO_16BIT; ;} + break; + + case 53: + +/* Line 1455 of yacc.c */ +#line 304 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 = ((yyvsp[(3) - (3)].num) & 0x0f); ;} + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 306 "mkcis-parser.y" + { + (yyval.parse)->cftable_entry.irq.IRQInfo1 = IRQ_INFO2_VALID; + (yyval.parse)->cftable_entry.irq.IRQInfo2 = (yyvsp[(4) - (4)].num); + ;} + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 311 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_PULSE_ID; ;} + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 313 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_LEVEL_ID; ;} + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 315 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.irq.IRQInfo1 |= IRQ_SHARE_ID; ;} + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 319 "mkcis-parser.y" + { + (yyval.parse) = calloc(1, sizeof(cisparse_t)); + (yyval.parse)->cftable_entry.index = (yyvsp[(2) - (2)].num); + ;} + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 324 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_DEFAULT; ;} + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 326 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_BVDS; ;} + break; + + case 61: + +/* Line 1455 of yacc.c */ +#line 328 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_WP; ;} + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 330 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_RDYBSY; ;} + break; + + case 63: + +/* Line 1455 of yacc.c */ +#line 332 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_MWAIT; ;} + break; + + case 64: + +/* Line 1455 of yacc.c */ +#line 334 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_AUDIO; ;} + break; + + case 65: + +/* Line 1455 of yacc.c */ +#line 336 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_READONLY; ;} + break; + + case 66: + +/* Line 1455 of yacc.c */ +#line 338 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.flags |= CISTPL_CFTABLE_PWRDOWN; ;} + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 340 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.vcc = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 68: + +/* Line 1455 of yacc.c */ +#line 342 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.vpp1 = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 344 "mkcis-parser.y" + { (yyval.parse)->cftable_entry.vpp2 = (yyvsp[(3) - (3)].pwr); ;} + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 352 "mkcis-parser.y" + { (yyval.parse) = NULL; ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 2096 "mkcis-parser.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 354 "mkcis-parser.y" + + +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse) +{ + tuple_info_t *t = calloc(1, sizeof(tuple_info_t)); + t->type = type; + t->parse = parse; + t->next = NULL; + return t; +} + +void yyerror(char *msg, ...) +{ + va_list ap; + char str[256]; + + va_start(ap, msg); + sprintf(str, "error at line %d: ", current_lineno); + vsprintf(str+strlen(str), msg, ap); + fprintf(stderr, "%s\n", str); + va_end(ap); +} + +#ifdef DEBUG +void main(int argc, char *argv[]) +{ + if (argc > 1) + parse_cis(argv[1]); +} +#endif + diff --git a/mkcis/mkcis-parser.tab.h b/mkcis/mkcis-parser.tab.h new file mode 100644 index 0000000..5c37097 --- /dev/null +++ b/mkcis/mkcis-parser.tab.h @@ -0,0 +1,127 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + STRING = 258, + NUMBER = 259, + FLOAT = 260, + VOLTAGE = 261, + CURRENT = 262, + SIZE = 263, + VERS_1 = 264, + MANFID = 265, + FUNCID = 266, + CONFIG = 267, + CFTABLE = 268, + MFC = 269, + CHECKSUM = 270, + POST = 271, + ROM = 272, + BASE = 273, + LAST_INDEX = 274, + DEV_INFO = 275, + ATTR_DEV_INFO = 276, + NO_INFO = 277, + TIME = 278, + TIMING = 279, + WAIT = 280, + READY = 281, + RESERVED = 282, + VNOM = 283, + VMIN = 284, + VMAX = 285, + ISTATIC = 286, + IAVG = 287, + IPEAK = 288, + IDOWN = 289, + VCC = 290, + VPP1 = 291, + VPP2 = 292, + IO = 293, + MEM = 294, + DEFAULT = 295, + BVD = 296, + WP = 297, + RDYBSY = 298, + MWAIT = 299, + AUDIO = 300, + READONLY = 301, + PWRDOWN = 302, + BIT8 = 303, + BIT16 = 304, + LINES = 305, + RANGE = 306, + IRQ_NO = 307, + MASK = 308, + LEVEL = 309, + PULSE = 310, + SHARED = 311 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 61 "mkcis-parser.y" + + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; + + + +/* Line 1676 of yacc.c */ +#line 119 "mkcis-parser.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE yylval; + + diff --git a/mkcis/mkcis-parser.y b/mkcis/mkcis-parser.y new file mode 100644 index 0000000..c565e0e --- /dev/null +++ b/mkcis/mkcis-parser.y @@ -0,0 +1,383 @@ +%{ +/* + * yacc_cis.y 1.11 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +/* If bison: generate nicer error messages */ +#define YYERROR_VERBOSE 1 + +void yyerror(char *msg, ...); +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse); + +%} + +%token STRING NUMBER FLOAT VOLTAGE CURRENT SIZE +%token VERS_1 MANFID FUNCID CONFIG CFTABLE MFC CHECKSUM +%token POST ROM BASE LAST_INDEX +%token DEV_INFO ATTR_DEV_INFO NO_INFO +%token TIME TIMING WAIT READY RESERVED +%token VNOM VMIN VMAX ISTATIC IAVG IPEAK IDOWN +%token VCC VPP1 VPP2 IO MEM +%token DEFAULT BVD WP RDYBSY MWAIT AUDIO READONLY PWRDOWN +%token BIT8 BIT16 LINES RANGE +%token IRQ_NO MASK LEVEL PULSE SHARED + +%union { + char *str; + u_long num; + float flt; + cistpl_power_t pwr; + cisparse_t *parse; + tuple_info_t *tuple; +} + +%type STRING +%type NUMBER SIZE VOLTAGE CURRENT TIME +%type FLOAT +%type pwr pwrlist +%type vers_1 manfid funcid config cftab io mem irq timing +%type dev_info attr_dev_info checksum +%type tuple chain cis; +%% + +cis: chain + { cis_root = $1; } + | chain mfc + { cis_root = $1; } + ; + +chain: /* nothing */ + { $$ = NULL; } + | chain tuple + { + if ($1 == NULL) { + $$ = $2; + } else if ($2 == NULL) { + $$ = $1; + } else { + tuple_info_t *tail = $1; + while (tail->next != NULL) tail = tail->next; + tail->next = $2; + $$ = $1; + } + } + ; + +mfc: MFC '{' chain '}' + { mfc[nf++] = $3; } + | mfc ',' '{' chain '}' + { mfc[nf++] = $4; } + ; + +tuple: dev_info + { $$ = new_tuple(CISTPL_DEVICE, $1); } + | attr_dev_info + { $$ = new_tuple(CISTPL_DEVICE_A, $1); } + | vers_1 + { $$ = new_tuple(CISTPL_VERS_1, $1); } + | manfid + { $$ = new_tuple(CISTPL_MANFID, $1); } + | funcid + { $$ = new_tuple(CISTPL_FUNCID, $1); } + | config + { $$ = new_tuple(CISTPL_CONFIG, $1); } + | cftab + { $$ = new_tuple(CISTPL_CFTABLE_ENTRY, $1); } + | checksum + { $$ = NULL; } + | error + { $$ = NULL; } + ; + +dev_info: DEV_INFO + { $$ = calloc(1, sizeof(cisparse_t)); } + | dev_info NUMBER TIME ',' SIZE + { + $$->device.dev[$$->device.ndev].type = $2; + $$->device.dev[$$->device.ndev].speed = $3; + $$->device.dev[$$->device.ndev].size = $5; + $$->device.ndev++; + } + | dev_info NO_INFO + ; + +attr_dev_info: ATTR_DEV_INFO + { $$ = calloc(1, sizeof(cisparse_t)); } + | attr_dev_info NUMBER TIME ',' SIZE + { + $$->device.dev[$$->device.ndev].type = $2; + $$->device.dev[$$->device.ndev].speed = $3; + $$->device.dev[$$->device.ndev].size = $5; + $$->device.ndev++; + } + | attr_dev_info NO_INFO + ; + +vers_1: VERS_1 FLOAT + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->version_1.major = $2; + $2 -= floor($2+0.01); + while (fabs($2 - floor($2+0.5)) > 0.01) { + $2 *= 10; + } + $$->version_1.minor = $2+0.01; + } + | vers_1 ',' STRING + { + cistpl_vers_1_t *v = &$$->version_1; + u_int pos = 0; + if (v->ns) { + pos = v->ofs[v->ns-1]; + pos += strlen(v->str+pos)+1; + } + v->ofs[v->ns] = pos; + strcpy(v->str+pos, $3); + v->ns++; + } + ; + +manfid: MANFID NUMBER ',' NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->manfid.manf = $2; + $$->manfid.card = $4; + } + ; + +funcid: FUNCID NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->funcid.func = $2; + } + | funcid POST + { $$->funcid.sysinit |= CISTPL_SYSINIT_POST; } + | funcid ROM + { $$->funcid.sysinit |= CISTPL_SYSINIT_ROM; } + ; + +config: CONFIG BASE NUMBER MASK NUMBER LAST_INDEX NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->config.base = $3; + $$->config.rmask[0] = $5; + $$->config.last_idx = $7; + } + ; + +pwr: VNOM VOLTAGE + { + $$.present = CISTPL_POWER_VNOM; + $$.param[0] = $2; + } + | VMIN VOLTAGE + { + $$.present = CISTPL_POWER_VMIN; + $$.param[0] = $2; + } + | VMAX VOLTAGE + { + $$.present = CISTPL_POWER_VMAX; + $$.param[0] = $2; + } + | ISTATIC CURRENT + { + $$.present = CISTPL_POWER_ISTATIC; + $$.param[0] = $2; + } + | IAVG CURRENT + { + $$.present = CISTPL_POWER_IAVG; + $$.param[0] = $2; + } + | IPEAK CURRENT + { + $$.present = CISTPL_POWER_IPEAK; + $$.param[0] = $2; + } + | IDOWN CURRENT + { + $$.present = CISTPL_POWER_IDOWN; + $$.param[0] = $2; + } + ; + +pwrlist: /* nothing */ + { + $$.present = 0; + } + | pwrlist pwr + { + $$.present |= 1<<($2.present); + $$.param[$2.present] = $2.param[0]; + } + ; + +timing: cftab TIMING + | timing WAIT TIME + | timing READY TIME + | timing RESERVED TIME + ; + +io: cftab IO NUMBER '-' NUMBER + { + int n = $$->cftable_entry.io.nwin; + $$->cftable_entry.io.win[n].base = $3; + $$->cftable_entry.io.win[n].len = $5-$3+1; + $$->cftable_entry.io.nwin++; + } + | io ',' NUMBER '-' NUMBER + { + int n = $$->cftable_entry.io.nwin; + $$->cftable_entry.io.win[n].base = $3; + $$->cftable_entry.io.win[n].len = $5-$3+1; + $$->cftable_entry.io.nwin++; + } + | io BIT8 + { $$->cftable_entry.io.flags |= CISTPL_IO_8BIT; } + | io BIT16 + { $$->cftable_entry.io.flags |= CISTPL_IO_16BIT; } + | io LINES '=' NUMBER ']' + { $$->cftable_entry.io.flags |= $4; } + | io RANGE + ; + +mem: cftab MEM NUMBER '-' NUMBER '@' NUMBER + { + int n = $$->cftable_entry.mem.nwin; + $$->cftable_entry.mem.win[n].card_addr = $3; + $$->cftable_entry.mem.win[n].host_addr = $7; + $$->cftable_entry.mem.win[n].len = $5-$3+1; + $$->cftable_entry.mem.nwin++; + } + | mem ',' NUMBER '-' NUMBER '@' NUMBER + { + int n = $$->cftable_entry.mem.nwin; + $$->cftable_entry.mem.win[n].card_addr = $3; + $$->cftable_entry.mem.win[n].host_addr = $7; + $$->cftable_entry.mem.win[n].len = $5-$3+1; + $$->cftable_entry.mem.nwin++; + } + | mem BIT8 + { $$->cftable_entry.io.flags |= CISTPL_IO_8BIT; } + | mem BIT16 + { $$->cftable_entry.io.flags |= CISTPL_IO_16BIT; } + ; + +irq: cftab IRQ_NO NUMBER + { $$->cftable_entry.irq.IRQInfo1 = ($3 & 0x0f); } + | cftab IRQ_NO MASK NUMBER + { + $$->cftable_entry.irq.IRQInfo1 = IRQ_INFO2_VALID; + $$->cftable_entry.irq.IRQInfo2 = $4; + } + | irq PULSE + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_PULSE_ID; } + | irq LEVEL + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_LEVEL_ID; } + | irq SHARED + { $$->cftable_entry.irq.IRQInfo1 |= IRQ_SHARE_ID; } + ; + +cftab: CFTABLE NUMBER + { + $$ = calloc(1, sizeof(cisparse_t)); + $$->cftable_entry.index = $2; + } + | cftab DEFAULT + { $$->cftable_entry.flags |= CISTPL_CFTABLE_DEFAULT; } + | cftab BVD + { $$->cftable_entry.flags |= CISTPL_CFTABLE_BVDS; } + | cftab WP + { $$->cftable_entry.flags |= CISTPL_CFTABLE_WP; } + | cftab RDYBSY + { $$->cftable_entry.flags |= CISTPL_CFTABLE_RDYBSY; } + | cftab MWAIT + { $$->cftable_entry.flags |= CISTPL_CFTABLE_MWAIT; } + | cftab AUDIO + { $$->cftable_entry.flags |= CISTPL_CFTABLE_AUDIO; } + | cftab READONLY + { $$->cftable_entry.flags |= CISTPL_CFTABLE_READONLY; } + | cftab PWRDOWN + { $$->cftable_entry.flags |= CISTPL_CFTABLE_PWRDOWN; } + | cftab VCC pwrlist + { $$->cftable_entry.vcc = $3; } + | cftab VPP1 pwrlist + { $$->cftable_entry.vpp1 = $3; } + | cftab VPP2 pwrlist + { $$->cftable_entry.vpp2 = $3; } + | io + | mem + | irq + | timing + ; + +checksum: CHECKSUM NUMBER '-' NUMBER '=' NUMBER + { $$ = NULL; } + +%% + +static tuple_info_t *new_tuple(u_char type, cisparse_t *parse) +{ + tuple_info_t *t = calloc(1, sizeof(tuple_info_t)); + t->type = type; + t->parse = parse; + t->next = NULL; + return t; +} + +void yyerror(char *msg, ...) +{ + va_list ap; + char str[256]; + + va_start(ap, msg); + sprintf(str, "error at line %d: ", current_lineno); + vsprintf(str+strlen(str), msg, ap); + fprintf(stderr, "%s\n", str); + va_end(ap); +} + +#ifdef DEBUG +void main(int argc, char *argv[]) +{ + if (argc > 1) + parse_cis(argv[1]); +} +#endif diff --git a/mkcis/mkcis.c b/mkcis/mkcis.c new file mode 100644 index 0000000..b1fc5c6 --- /dev/null +++ b/mkcis/mkcis.c @@ -0,0 +1,471 @@ +/*====================================================================== + + A utility to convert a plain text description of a Card + Information Structure into its packed binary representation. + + The contents of this file are subject to the Mozilla Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The initial developer of the original code is David A. Hinds + . Portions created by David A. Hinds + are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + + Alternatively, the contents of this file may be used under the + terms of the GNU Public License version 2 (the "GPL"), in which + case the provisions of the GPL are applicable instead of the + above. If you wish to allow the use of your version of this file + only under the terms of the GPL and not to allow others to use + your version of this file under the MPL, indicate your decision + by deleting the provisions above and replace them with the notice + and other provisions required by the GPL. If you do not delete + the provisions above, a recipient may use your version of this + file under either the MPL or the GPL. + + Usage: + + mkcis [-o outfile] [infile] + + [infile] defaults to stdin, and [outfile] defaults to stdout. + +======================================================================*/ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mkcis.h" + +tuple_info_t *cis_root, *mfc[8] = { NULL }; +int nf; + +/*====================================================================== + + Support routines for packing parts of configuration table entries + +======================================================================*/ + +static u_int mantissa[] = { + 10, 12, 13, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 70, 80, 90 +}; +static int pack_power(cistpl_power_t *pwr, u_char *b) +{ + u_int tmp, i; + u_char m = 0 , e, x = 0, *c = b; + *c = pwr->present; c++; + for (i = 0; i < 7; i++) { + if (!(pwr->present & (1<param[i]; + for (e = 1; ((tmp % 10) == 0) || (tmp > 999); e++) + tmp /= 10; + if (tmp < 100) { + if (tmp < 10) { + tmp *= 10; + e--; + } + for (m = 0; m < 16; m++) + if (mantissa[m] == tmp) + break; + if (m == 16) { + tmp *= 10; + e--; + } + x = 0; + } + if (tmp >= 100) { + e++; + x = (tmp/10) - ((tmp/10) % 10); + for (m = 0; m < 16; m++) + if (mantissa[m] == x) + break; + x = (u_char)(tmp - 10*(u_int)x); + } + *c = (m<<3) | e | (x ? 0x80 : 0); c++; + if (x) { + *c = x; + c++; + } + } + return c-b; +} + +static int pack_io(cistpl_io_t *p, u_char *b) +{ + u_char *c = b; + u_int i, j, ml, ma; + *c = p->flags & (CISTPL_IO_8BIT|CISTPL_IO_16BIT); + if ((p->nwin == 1) && (p->win[0].base == 0)) { + for (i = 1, j = 0; i < p->win[0].len; i *= 2, j++) + ; + *c |= j; c++; + } else { + for (i = ma = ml = 0; i < p->nwin; i++) { + ma |= p->win[i].base; + ml |= p->win[i].len-1; + } + ma = (ma > 0xffff) ? 3 : ((ma > 0xff) ? 2 : 1); + ml = (ml > 0xffff) ? 3 : ((ml > 0xff) ? 2 : 1); + *c |= 0x80 | (p->flags & CISTPL_IO_LINES_MASK); c++; + *c = (p->nwin-1) | (ma<<4) | (ml<<6); c++; + if (ma == 3) + ma++; + if (ml == 3) + ml++; + for (i = 0; i < p->nwin; i++) { + for (j = 0; j < ma; j++) { + *c = (p->win[i].base >> (8*j)) & 0xff; c++; + } + for (j = 0; j < ml; j++) { + *c = ((p->win[i].len-1) >> (8*j)) & 0xff; c++; + } + } + } + return c-b; +} + +static int pack_mem(cistpl_mem_t *p, u_char *b) +{ + u_char *c = b; + u_int i, j, ml, ma, ha; + for (i = ma = ml = ha = 0; i < p->nwin; i++) { + ma |= p->win[i].card_addr; + ml |= p->win[i].len; + ha |= p->win[i].host_addr; + } + ma = (ma|ha) >> 8; ml >>= 8; + ma = (ma > 0xffff) ? 3 : ((ma > 0xff) ? 2 : 1); + ml = (ml > 0xffff) ? 3 : ((ml > 0xff) ? 2 : 1); + *c = (p->nwin-1) | (ma<<5) | (ml<<3) | (ha ? 0x80 : 0); c++; + for (i = 0; i < p->nwin; i++) { + for (j = 1; j <= ml; j++) { + *c = (p->win[i].len >> (8*j)) & 0xff; c++; + } + for (j = 1; j <= ma; j++) { + *c = (p->win[i].card_addr >> (8*j)) & 0xff; c++; + } + if (ha) + for (j = 1; j <= ma; j++) { + *c = (p->win[i].host_addr >> (8*j)) & 0xff; c++; + } + } + return c-b; +} + +static int pack_irq(cistpl_irq_t *p, u_char *b) +{ + b[0] = p->IRQInfo1; + if (p->IRQInfo1 & IRQ_INFO2_VALID) { + b[1] = p->IRQInfo2 & 0xff; + b[2] = (p->IRQInfo2 >> 8) & 0xff; + return 3; + } + return 1; +} + +static void pack_cftable(cistpl_cftable_entry_t *p, u_char *b) +{ + u_char *c; + b[2] = p->index | 0x80; + if (p->flags & CISTPL_CFTABLE_DEFAULT) + b[2] |= 0x40; + b[3] = 0x01; + b[3] |= (p->flags & CISTPL_CFTABLE_BVDS) ? 0x10 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_WP) ? 0x20 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_RDYBSY) ? 0x40 : 0; + b[3] |= (p->flags & CISTPL_CFTABLE_MWAIT) ? 0x80 : 0; + b[4] = 0; + c = b+5; + if (p->vcc.present) { + b[4]++; c += pack_power(&p->vcc, c); + if (p->vpp1.present) { + b[4]++; c += pack_power(&p->vpp1, c); + if (p->vpp2.present) { + b[4]++; c += pack_power(&p->vpp2, c); + } + } + } + if (p->io.nwin > 0) { + b[4] |= 0x08; + c += pack_io(&p->io, c); + } + if (p->irq.IRQInfo1 > 0) { + b[4] |= 0x10; + c += pack_irq(&p->irq, c); + } + if (p->mem.nwin > 0) { + b[4] |= 0x60; + c += pack_mem(&p->mem, c); + } + if (p->flags >> 8) { + b[4] |= 0x80; + *c++ = p->flags >> 8; + } + b[1] = c-b-2; +} + +/*====================================================================== + + Routines for packing device info tuples + +======================================================================*/ + +static int pack_speed(u_int speed, u_char *b) +{ + u_char e, m, *c = b; + switch (speed) { + case 0: + *c |= 0; + c++; + break; + case 250: + *c |= 1; + c++; + break; + case 200: + *c |= 2; + c++; + break; + case 150: + *c |= 3; + c++; + break; + case 100: + *c |= 4; + c++; + break; + default: + *c |= 7; + c++; + for (e = 1; speed > 80; e++) + speed /= 10; + for (m = 0; m < 15; m++) + if (mantissa[m] >= speed) + break; + *c = ((m+1)<<3) | e; + c++; + } + return c-b; +} + +static void pack_device(cistpl_device_t *d, u_char *b) +{ + u_int i, sz; + u_char e, *c = b+2; + for (i = 0; i < d->ndev; i++) { + *c = (d->dev[i].type<<4); + c += pack_speed(d->dev[i].speed, c); + sz = d->dev[i].size/512; + for (e = 0; sz > 32; e++) + sz /= 4; + *c = (e & 7) | ((sz-1) << 3); c++; + } + *c = 0xff; c++; + b[1] = c-b-2; +} + +/*====================================================================== + + For now, I only implement a subset of tuples types, intended to be + enough to handle most IO-oriented cards. + +======================================================================*/ + +static int pack_tuple(tuple_info_t *t, u_char *b) +{ + cisparse_t *p = t->parse; + u_int i, m; + u_char *c; + + *b = t->type; + switch (t->type) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + if (p) { + pack_device(&p->device, b); + } else { + /* Fake null device tuple */ + b[1] = 3; b[2] = 0; b[3] = 0; b[4] = 0xff; + } + break; + case CISTPL_MANFID: + b[1] = 4; + b[2] = p->manfid.manf & 0xff; + b[3] = p->manfid.manf >> 8; + b[4] = p->manfid.card & 0xff; + b[5] = p->manfid.card >> 8; + break; + case CISTPL_FUNCID: + b[1] = 2; + b[2] = p->funcid.func; + b[3] = p->funcid.sysinit; + break; + case CISTPL_CONFIG: + b[3] = p->config.last_idx; + i = p->config.base; + for (c = b+4, m = 0; (i > 0) || !m; i >>= 8, m++) + c[m] = i & 0xff; + b[2] = m-1; + i = p->config.rmask[0]; + for (c = c+m, m = 0; (i > 0) || !m; i >>= 8, m++) + c[m] = i & 0xff; + b[2] |= ((m-1) << 2); + b[1] = c+m-b-2; + break; + case CISTPL_VERS_1: + b[2] = p->version_1.major; + b[3] = p->version_1.minor; + c = b+4; + for (i = 0; i < p->version_1.ns; i++) { + strcpy((char *)c, p->version_1.str+p->version_1.ofs[i]); + c += strlen((char *)c) + 1; + } + for (; i < 4; i++) { + *c = 0; + c++; + } + *c = 0xff; c++; + b[1] = c-b-2; + break; + case CISTPL_CFTABLE_ENTRY: + pack_cftable(&p->cftable_entry, b); + break; + case CISTPL_LINKTARGET: + b[1] = 3; b[2] = 'C'; b[3] = 'I'; b[4] = 'S'; + break; + case CISTPL_NO_LINK: + case CISTPL_END: + b[1] = 0; + break; + } + return b[1]+2; +} + +/*====================================================================== + + The following routines handle parsing of aggregates of tuples. + pack_chain() is the simplest: just return a string of tuples and + terminate with an END tuple. pack_mfc() is used to tie the + function-specific tuple chains for a multifunction card together + using a LONGLINK_MFC tuple. And pack_cis() handles a complete + CIS, whether it is multifunction or not. + +======================================================================*/ + +static int pack_chain(tuple_info_t *t, u_char *b) +{ + int n = 0; + tuple_info_t end = { CISTPL_END, NULL, NULL }; + while (t) { + n += pack_tuple(t, b+n); + t = t->next; + } + n += pack_tuple(&end, b+n); + return n; +} + +static int pack_mfc(u_int ofs, u_char *b) +{ + u_int i, j, pos; + tuple_info_t target = { CISTPL_LINKTARGET, NULL, NULL }; + + b[0] = CISTPL_LONGLINK_MFC; + b[1] = 5*nf + 1; + b[2] = nf; + b[5*nf+3] = CISTPL_END; + b[5*nf+4] = 0; + /* Leave space for this tuple and the CISTPL_END tuple */ + pos = 5*nf+5; + for (i = 0; i < nf; i++) { + b[3+i*5] = 0; + for (j = 0; j < 4; j++) + b[4+i*5+j] = ((ofs+pos) >> (8*j)) & 0xff; + pos += pack_tuple(&target, b+pos); + pos += pack_chain(mfc[i], b+pos); + } + return ofs+pos; +} + +static int pack_cis(tuple_info_t *t, u_char *b) +{ + int n = 0; + tuple_info_t device = { CISTPL_DEVICE, NULL, NULL }; + tuple_info_t nolink = { CISTPL_NO_LINK, NULL, NULL }; + tuple_info_t end = { CISTPL_END, NULL, NULL }; + if (t->type != CISTPL_DEVICE) + n = pack_tuple(&device, b); + while (t) { + n += pack_tuple(t, b+n); + t = t->next; + } + if (nf > 0) { + n = pack_mfc(n, b+n); + } else { + n += pack_tuple(&nolink, b+n); + n += pack_tuple(&end, b+n); + } + return n; +} + +/*====================================================================*/ + +int main(int argc, char *argv[]) +{ + int optch, errflg = 0; + char *out = NULL; + u_char buf[1024]; + int n; + FILE *f; + + while ((optch = getopt(argc, argv, "o:")) != -1) { + switch (optch) { + case 'o': + out = strdup(optarg); break; + default: + errflg = 1; break; + } + } + if (errflg || (optind < argc-1)) { + fprintf(stderr, "usage: %s [-o outfile] [infile]\n", + argv[0]); + exit(EXIT_FAILURE); + } + if (optind < argc) { + f = fopen(argv[optind], "r"); + if (!f) { + fprintf(stderr, "could not open '%s': %s\n", + argv[optind], + strerror(errno)); + return -1; + } + } else + f = stdin; + parse_cis(f); + fclose(f); + n = pack_cis(cis_root, buf); + if (out) { + f = fopen(out, "w"); + if (!f) { + fprintf(stderr, "could not open '%s': %s\n", out, + strerror(errno)); + return -1; + } + } else + f = stdout; + fwrite(buf, n, 1, f); + fclose(f); + + return 0; +} diff --git a/mkcis/mkcis.h b/mkcis/mkcis.h new file mode 100644 index 0000000..bf06f9b --- /dev/null +++ b/mkcis/mkcis.h @@ -0,0 +1,49 @@ +/* + * pack_cis.h 1.6 2000/06/12 21:34:19 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License + * at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and + * limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file + * under either the MPL or the GPL. + */ +typedef struct tuple_info_t { + u_char type; + cisparse_t *parse; + struct tuple_info_t *next; +} tuple_info_t; + +extern tuple_info_t *cis_root, *mfc[8]; +extern int nf; + +void parse_cis(FILE *f); + +/* removed from pcmcia/cs.h */ +#define IRQ_INFO2_VALID 0x10 +#define IRQ_LEVEL_ID 0x20 +#define IRQ_PULSE_ID 0x40 +#define IRQ_SHARE_ID 0x80 + +/* lex-yacc interface */ +extern int current_lineno; +extern int yylex(void); +extern int yyparse(void); -- 1.7.1 From dbaryshkov at gmail.com Fri Sep 24 12:49:23 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:23 +0400 Subject: [PATCH 3/5] Add files with text descriptions for CIS files In-Reply-To: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285346965-23499-4-git-send-email-dbaryshkov@gmail.com> Now as we support generation of cis files from .ct, import new .ct from original pcmcia-cs project. They correspond to the binary cis files. Signed-off-by: Dmitry Eremin-Solenikov --- cis/3CCFEM556.ct | 22 ++++++++++++++++++++++ cis/3CXEM556.ct | 22 ++++++++++++++++++++++ cis/COMpad2.ct | 20 ++++++++++++++++++++ cis/COMpad4.ct | 14 ++++++++++++++ cis/DP83903.ct | 24 ++++++++++++++++++++++++ cis/E-CARD.ct | 9 +++++++++ cis/LA-PCM.ct | 44 ++++++++++++++++++++++++++++++++++++++++++++ cis/MT5634ZLX.ct | 18 ++++++++++++++++++ cis/NE2K.ct | 10 ++++++++++ cis/PCMLM28.ct | 37 +++++++++++++++++++++++++++++++++++++ cis/PE-200.ct | 11 +++++++++++ cis/PE520.ct | 11 +++++++++++ cis/RS-COM-2P.ct | 14 ++++++++++++++ cis/SW_555_SER.ct | 19 +++++++++++++++++++ cis/SW_7xx_SER.ct | 21 +++++++++++++++++++++ cis/SW_8xx_SER.ct | 20 ++++++++++++++++++++ cis/tamarack.ct | 17 +++++++++++++++++ 17 files changed, 333 insertions(+), 0 deletions(-) create mode 100644 cis/3CCFEM556.ct create mode 100644 cis/3CXEM556.ct create mode 100644 cis/COMpad2.ct create mode 100644 cis/COMpad4.ct create mode 100644 cis/DP83903.ct create mode 100644 cis/E-CARD.ct create mode 100644 cis/LA-PCM.ct create mode 100644 cis/MT5634ZLX.ct create mode 100644 cis/NE2K.ct create mode 100644 cis/PCMLM28.ct create mode 100644 cis/PE-200.ct create mode 100644 cis/PE520.ct create mode 100644 cis/RS-COM-2P.ct create mode 100644 cis/SW_555_SER.ct create mode 100644 cis/SW_7xx_SER.ct create mode 100644 cis/SW_8xx_SER.ct create mode 100644 cis/tamarack.ct diff --git a/cis/3CCFEM556.ct b/cis/3CCFEM556.ct new file mode 100644 index 0000000..be627d0 --- /dev/null +++ b/cis/3CCFEM556.ct @@ -0,0 +1,22 @@ +# +# This card is MFC-compliant, but identifies itself as single function +# +vers_1 5.0, "3Com", "Megahertz 3CCFEM556", "LAN + 56k Modem" +manfid 0x0101, 0x0556 +funcid 0 + +mfc { + funcid network_adapter + config base 0x1000 mask 0x267 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f [8bit] [16bit] +}, { + funcid serial_port + config base 0x1100 mask 0x277 last_index 0x27 + cftable_entry 0x27 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/cis/3CXEM556.ct b/cis/3CXEM556.ct new file mode 100644 index 0000000..819f08f --- /dev/null +++ b/cis/3CXEM556.ct @@ -0,0 +1,22 @@ +# +# This card is MFC-compliant, but identifies itself as single function +# +vers_1 5.0, "3Com", "Megahertz 3CXEM556", "LAN + 56k Modem" +manfid 0x0101, 0x0035 +funcid 0 + +mfc { + funcid network_adapter + config base 0x0800 mask 0x63 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f [8bit] [16bit] +}, { + funcid serial_port + config base 0x900 mask 0x63 last_index 0x27 + cftable_entry 0x27 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/cis/COMpad2.ct b/cis/COMpad2.ct new file mode 100644 index 0000000..bfc2374 --- /dev/null +++ b/cis/COMpad2.ct @@ -0,0 +1,20 @@ +# +# Replacement CIS for Advantech COMpad-32/85 +# +dev_info + NULL 0ns, 512b +vers_1 4.1, "ADVANTECH", "COMpad-32/85", "1.0" +funcid serial_port [post] +config base 0x0100 mask 0x0003 last_index 0x05 +cftable_entry 0x01 [default] + [mwait] + io 0x02e8-0x02ef, 0x03e8-0x03ef [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0330-0x033f [lines=10] [8bit] [range] +cftable_entry 0x03 + io 0x0340-0x034f [lines=10] [8bit] [range] +cftable_entry 0x04 + io 0x0350-0x035f [lines=10] [8bit] [range] +cftable_entry 0x05 + io 0x0360-0x036f [lines=10] [8bit] [range] diff --git a/cis/COMpad4.ct b/cis/COMpad4.ct new file mode 100644 index 0000000..325991c --- /dev/null +++ b/cis/COMpad4.ct @@ -0,0 +1,14 @@ +# +# Replacement CIS for Advantech COMpad-32/85B-4 +# +dev_info + NULL 0ns, 512b +vers_1 4.1, "ADVANTECH", "COMpad-32/85B-4" +funcid serial_port [post] +config base 0x0100 mask 0x0001 last_index 0x02 +cftable_entry 0x01 [default] + [mwait] + io 0x0240-0x025f [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0340-0x035f [lines=10] [8bit] [range] diff --git a/cis/DP83903.ct b/cis/DP83903.ct new file mode 100644 index 0000000..ce86f45 --- /dev/null +++ b/cis/DP83903.ct @@ -0,0 +1,24 @@ +# +# This CIS is for cards based on the National Semiconductor +# DP83903 Multiple Function Interface Chip +# +vers_1 4.1, "Multifunction Card", "", "", "NSC MF LAN/Modem" +manfid 0x0175, 0x0000 +funcid 0 + +mfc { + funcid network_adapter + config base 0x1020 mask 0x277 last_index 0x17 + cftable_entry 0x17 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] + memory 0x0000-0x3fff @ 0x0000 +}, { + funcid serial_port + config base 0x1040 mask 0x0277 last_index 0x07 + cftable_entry 0x07 + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x0007 [8bit] +} diff --git a/cis/E-CARD.ct b/cis/E-CARD.ct new file mode 100644 index 0000000..fb09b71 --- /dev/null +++ b/cis/E-CARD.ct @@ -0,0 +1,9 @@ +# +# Replacement CIS for old, broken Linksys cards +# +vers_1 4.1, "LINKSYS", "E-CARD" +config base 0x0008 mask 0x000b last_index 0x00 +cftable_entry 0x1 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f, 0x0010-0x001f [8bit] [16bit] diff --git a/cis/LA-PCM.ct b/cis/LA-PCM.ct new file mode 100644 index 0000000..5c427bd --- /dev/null +++ b/cis/LA-PCM.ct @@ -0,0 +1,44 @@ +# +# Replacement CIS for Allied Telesis LA-PCM +# +dev_info + fn_specific 100ns, 64kb + FLASH 150ns, 60kb +attr_dev_info + FLASH 150ns, 4kb +manfid 0xc00f, 0x0002 +funcid network_adapter [post] [rom] +vers_1 4.1, "Allied Telesis,K.K", "Ethernet LAN Card", "CentreCOM", "LA-PCM" +config base 0x20000 mask 0x000b last_index 0x10 +cftable_entry 0x01 + io 0x0200-0x021f [8bit] [16bit] +cftable_entry 0x02 + io 0x0220-0x023f [8bit] [16bit] +cftable_entry 0x03 + io 0x0240-0x025f [8bit] [16bit] +cftable_entry 0x04 + io 0x0260-0x027f [8bit] [16bit] +cftable_entry 0x05 + io 0x0280-0x029f [8bit] [16bit] +cftable_entry 0x06 + io 0x02a0-0x02bf [8bit] [16bit] +cftable_entry 0x07 + io 0x02c0-0x02df [8bit] [16bit] +cftable_entry 0x08 + io 0x02e0-0x02ff [8bit] [16bit] +cftable_entry 0x09 + io 0x0300-0x031f [8bit] [16bit] +cftable_entry 0x0a + io 0x0320-0x033f [8bit] [16bit] +cftable_entry 0x0b + io 0x0340-0x035f [8bit] [16bit] +cftable_entry 0x0c + io 0x0360-0x037f [8bit] [16bit] +cftable_entry 0x0d + io 0x0380-0x039f [8bit] [16bit] +cftable_entry 0x0e + io 0x03a0-0x03bf [8bit] [16bit] +cftable_entry 0x0f + io 0x03c0-0x03df [8bit] [16bit] +cftable_entry 0x10 + io 0x03e0-0x03ff [8bit] [16bit] diff --git a/cis/MT5634ZLX.ct b/cis/MT5634ZLX.ct new file mode 100644 index 0000000..52249b3 --- /dev/null +++ b/cis/MT5634ZLX.ct @@ -0,0 +1,18 @@ +# +# Replacement CIS for Multitech MT5634ZLX modems +# +dev_info no_info +vers_1 4.1, "MultiTech", "PCMCIA 56K DataFax" +manfid 0x0200, 0x0001 +funcid serial_port +config base 0xff80 mask 0x0067 last_index 0x27 +cftable_entry 0x0f [default] + [rdybsy] [audio] [pwrdown] + Vcc Vnom 5V Vpp1 Vnom 5V Vpp2 Vnom 5V + io 0x03f8-0x03ff [lines=10] [8bit] +cftable_entry 0x17 + io 0x02f8-0x02ff [lines=10] [8bit] +cftable_entry 0x1f + io 0x03e8-0x03ef [lines=10] [8bit] +cftable_entry 0x27 + io 0x02e8-0x02ef [lines=10] [8bit] diff --git a/cis/NE2K.ct b/cis/NE2K.ct new file mode 100644 index 0000000..d1d47f3 --- /dev/null +++ b/cis/NE2K.ct @@ -0,0 +1,10 @@ +# +# Replacement CIS for various busted NE2000-compatible cards +# +vers_1 4.1, "PCMCIA", "Ethernet" +funcid network_adapter +config base 0x03f8 mask 0x03 last_index 0x20 +cftable_entry 0x20 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] diff --git a/cis/PCMLM28.ct b/cis/PCMLM28.ct new file mode 100644 index 0000000..39c6d16 --- /dev/null +++ b/cis/PCMLM28.ct @@ -0,0 +1,37 @@ +# +# The on-card CIS says it is MFC-compliant, but it is not +# +vers_1 4.1, "LINKSYS", "PCMLM28" +manfid 0x0143, 0xc0ab +funcid 0 +config base 0x03f8 mask 0x03 last_index 0x2f + +cftable_entry 0x24 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0300-0x031f, 0x02f8-0x02ff [8bit] [16bit] + +cftable_entry 0x25 + io 0x0320-0x033f, 0x02f8-0x02ff [8bit] [16bit] +cftable_entry 0x26 + io 0x0340-0x035f, 0x02f8-0x02ff [8bit] [16bit] +cftable_entry 0x27 + io 0x0360-0x037f, 0x02f8-0x02ff [8bit] [16bit] + +cftable_entry 0x28 + io 0x0300-0x031f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x29 + io 0x0320-0x033f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x2a + io 0x0340-0x035f, 0x03e8-0x03ef [8bit] [16bit] +cftable_entry 0x2b + io 0x0360-0x037f, 0x03e8-0x03ef [8bit] [16bit] + +cftable_entry 0x2c + io 0x0300-0x031f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2d + io 0x0320-0x033f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2e + io 0x0340-0x035f, 0x02e8-0x02ef [8bit] [16bit] +cftable_entry 0x2f + io 0x0360-0x037f, 0x02e8-0x02ef [8bit] [16bit] diff --git a/cis/PE-200.ct b/cis/PE-200.ct new file mode 100644 index 0000000..7db7494 --- /dev/null +++ b/cis/PE-200.ct @@ -0,0 +1,11 @@ +# +# Replacement CIS for PE-200 ethernet card +# +vers_1 4.1, "PMX ", "PE-200", "ETHERNET", "R01" +funcid network_adapter [post] [rom] +config base 0x0100 mask 0x0001 last_index 0x01 +cftable_entry 0x1 [default] + [mwait] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x000f, 0x0010-0x001f [8bit] [16bit] diff --git a/cis/PE520.ct b/cis/PE520.ct new file mode 100644 index 0000000..fb411ab --- /dev/null +++ b/cis/PE520.ct @@ -0,0 +1,11 @@ +# +# Replacement CIS for LanPro EP-4000A ethernet card +# +vers_1 4.1, "KTI", "PE520 PLUS", "PCMCIA Ethernet" +manfid 0x0161, 0x0010 +funcid network_adapter +config base 0x0fd0 mask 0x0b last_index 0x01 +cftable_entry 0x01 [default] + Vcc Vnom 5V + irq mask 0xffff [level] + io 0x0000-0x001f [8bit] [16bit] diff --git a/cis/RS-COM-2P.ct b/cis/RS-COM-2P.ct new file mode 100644 index 0000000..2e385cb --- /dev/null +++ b/cis/RS-COM-2P.ct @@ -0,0 +1,14 @@ +# +# Replacement CIS for dual-serial-port IO card +# +vers_1 4.1, "PCMCIA", "RS-COM 2P" +funcid serial_port [post] +config base 0x0100 mask 0x0001 last_index 0x03 +cftable_entry 0x01 [default] + [mwait] + io 0x03e8-0x03ef, 0x02e8-0x02ef [lines=10] [8bit] [range] + irq mask 0x9eb8 [level] +cftable_entry 0x02 + io 0x0250-0x0257, 0x0258-0x025f [lines=10] [8bit] [range] +cftable_entry 0x03 + io 0x0260-0x0267, 0x0268-0x026f [lines=10] [8bit] [range] diff --git a/cis/SW_555_SER.ct b/cis/SW_555_SER.ct new file mode 100644 index 0000000..7519505 --- /dev/null +++ b/cis/SW_555_SER.ct @@ -0,0 +1,19 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x013f, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AirCard 555", "A555", "Rev 1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + io 0x03f8-0x03ff [lines=3] [8bit] [range] + irq mask 0x3fbc [level] +cftable_entry 0x21 + io 0x02f8-0x02ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x03e8-0x03ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x02e8-0x02ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/cis/SW_7xx_SER.ct b/cis/SW_7xx_SER.ct new file mode 100644 index 0000000..2991617 --- /dev/null +++ b/cis/SW_7xx_SER.ct @@ -0,0 +1,21 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x0192, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AC710/AC750", "GPRS Network Adapter", + "R1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + Vcc Istatic 45mA Iavg 50mA Ipeak 55mA Idown 20mA + io 0x03f8-0x03ff [lines=3] [8bit] [range] + irq mask 0x86bc [level] +cftable_entry 0x21 + io 0x02f8-0x02ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x03e8-0x03ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x02e8-0x02ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/cis/SW_8xx_SER.ct b/cis/SW_8xx_SER.ct new file mode 100644 index 0000000..7dbdd57 --- /dev/null +++ b/cis/SW_8xx_SER.ct @@ -0,0 +1,20 @@ +dev_info + no_info +attr_dev_info + EEPROM 250ns, 512b +manfid 0x0192, 0x0710 +funcid serial_port +vers_1 7.0, "Sierra Wireless", "AC850", "3G Network Adapter", "R1" +config base 0x0700 mask 0x0073 last_index 0x03 +cftable_entry 0x20 [default] + Vcc Istatic 45mA Iavg 50mA Ipeak 55mA Idown 20mA + io 0x48f8-0x48ff [lines=3] [8bit] [range] + irq mask 0x86bc [level] +cftable_entry 0x21 + io 0x47f8-0x47ff [lines=3] [8bit] [range] +cftable_entry 0x22 + io 0x48e8-0x48ef [lines=3] [8bit] [range] +cftable_entry 0x23 + io 0x47e8-0x47ef [lines=3] [8bit] [range] +cftable_entry 0x24 + io 0x0000-0x0007 [lines=3] [8bit] diff --git a/cis/tamarack.ct b/cis/tamarack.ct new file mode 100644 index 0000000..8802694 --- /dev/null +++ b/cis/tamarack.ct @@ -0,0 +1,17 @@ +# +# Replacement CIS for Surecom, Tamarack NE2000 cards +# +dev_info + fn_specific 100ns, 512b +attr_dev_info + EEPROM 250ns, 512b +vers_1 4.1, "TAMARACK", "Ethernet", "A", "004743118001" +funcid network_adapter +config base 0x03f8 mask 0x0003 last_index 0x20 +cftable_entry 0x20 [default] + [mwait] + Vcc Vnom 5V Vmin 4500mV Vmax 5500mV Istatic 100mA + Iavg 170mA Ipeak 200mA + timing wait 15us + io 0x0000-0x000f, 0x0010-0x001f [lines=5] [8bit] [16bit] + irq mask 0xffff [level] -- 1.7.1 From dbaryshkov at gmail.com Fri Sep 24 12:49:25 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:25 +0400 Subject: [PATCH 5/5] Build infrastructure for mkcis and dump_cis programs In-Reply-To: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285346965-23499-6-git-send-email-dbaryshkov@gmail.com> Add Makefile and .gitignore for mkcis/dump_cis programs. Signed-off-by: Dmitry Eremin-Solenikov --- mkcis/.gitignore | 4 ++++ mkcis/Makefile | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 mkcis/.gitignore create mode 100644 mkcis/Makefile diff --git a/mkcis/.gitignore b/mkcis/.gitignore new file mode 100644 index 0000000..8d19f6d --- /dev/null +++ b/mkcis/.gitignore @@ -0,0 +1,4 @@ +*.o +mkcis +dump_cis + diff --git a/mkcis/Makefile b/mkcis/Makefile new file mode 100644 index 0000000..b7faa6f --- /dev/null +++ b/mkcis/Makefile @@ -0,0 +1,29 @@ +CFLAGS = -Wall -I. +LDFLAGS = -lm + +# Uncomment to regenerate flex/bison output +# GENERATE_PARSER = 1 + +BISON = bison +FLEX = flex + +all: mkcis dump_cis + +dump_cis: dump_cis.o + +mkcis: mkcis.o mkcis-lexer.lex.o mkcis-parser.tab.o + +clean: + -rm -f mkcis dump_cis *.o + +mkcis-lexer.lex.o: mkcis-parser.tab.h + +ifeq ($(GENERATE_PARSER),1) +mkcis-parser.tab.h: mkcis-parser.tab.c + +mkcis-parser.tab.c: mkcis-parser.y + $(BISON) -d -o $@ $< + +mkcis-lexer.lex.c: mkcis-lexer.l + $(FLEX) -o $@ $< +endif -- 1.7.1 From dbaryshkov at gmail.com Fri Sep 24 12:49:24 2010 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Fri, 24 Sep 2010 20:49:24 +0400 Subject: [PATCH 4/5] Add an utility to parse CIS files to readable form In-Reply-To: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> Message-ID: <1285346965-23499-5-git-send-email-dbaryshkov@gmail.com> Import from pcmcia-cs project a dump_cis utility. It reads machine-readable CIS file and output text representation (which can be processed by mkcis utility). Signed-off-by: Dmitry Eremin-Solenikov --- mkcis/dump_cis.c | 1992 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1992 insertions(+), 0 deletions(-) create mode 100644 mkcis/dump_cis.c diff --git a/mkcis/dump_cis.c b/mkcis/dump_cis.c new file mode 100644 index 0000000..4de8641 --- /dev/null +++ b/mkcis/dump_cis.c @@ -0,0 +1,1992 @@ +/*********************************************************************** + * PC Card CIS dump utility + * + * dump_cis.c from pcmcia-cs + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The initial developer of the original code is David A. Hinds + * . Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete + * the provisions above, a recipient may use your version of this + * file under either the MPL or the GPL. + ***********************************************************************/ + +#include +#include +#include +#include + +#ifndef le16toh +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define le16toh(x) (x) +# define le32toh(x) (x) +# else +# define le16toh(x) bswap_16(x) +# define le32toh(x) bswap_32(x) +# endif +#endif + +#include +#include +#include + +#include + +/* Bits in IRQInfo1 field */ +#define IRQ_MASK 0x0f +#define IRQ_NMI_ID 0x01 +#define IRQ_IOCK_ID 0x02 +#define IRQ_BERR_ID 0x04 +#define IRQ_VEND_ID 0x08 +#define IRQ_INFO2_VALID 0x10 +#define IRQ_LEVEL_ID 0x20 +#define IRQ_PULSE_ID 0x40 +#define IRQ_SHARE_ID 0x80 + +typedef struct tuple_parse_t { + tuple_t tuple; + cisdata_t data[255]; + cisparse_t parse; +} tuple_parse_t; + +static int get_tuple_buf(int fd, tuple_t * tuple, int first); +static int parse_tuple(tuple_t * tuple, cisparse_t * parse); + +static int verbose; +static char indent[10] = " "; + +/*====================================================================*/ + +static void print_tuple(tuple_parse_t * tup) +{ + int i; + printf("%soffset 0x%2.2x, tuple 0x%2.2x, link 0x%2.2x\n", + indent, tup->tuple.CISOffset, tup->tuple.TupleCode, + tup->tuple.TupleLink); + for (i = 0; i < tup->tuple.TupleDataLen; i++) { + if ((i % 16) == 0) + printf("%s ", indent); + printf("%2.2x ", (u_char) tup->data[i]); + if ((i % 16) == 15) + putchar('\n'); + } + if ((i % 16) != 0) + putchar('\n'); +} + +/*====================================================================*/ + +static void print_funcid(cistpl_funcid_t * fn) +{ + printf("%sfuncid ", indent); + switch (fn->func) { + case CISTPL_FUNCID_MULTI: + printf("multi_function"); + break; + case CISTPL_FUNCID_MEMORY: + printf("memory_card"); + break; + case CISTPL_FUNCID_SERIAL: + printf("serial_port"); + break; + case CISTPL_FUNCID_PARALLEL: + printf("parallel_port"); + break; + case CISTPL_FUNCID_FIXED: + printf("fixed_disk"); + break; + case CISTPL_FUNCID_VIDEO: + printf("video_adapter"); + break; + case CISTPL_FUNCID_NETWORK: + printf("network_adapter"); + break; + case CISTPL_FUNCID_AIMS: + printf("aims_card"); + break; + case CISTPL_FUNCID_SCSI: + printf("scsi_adapter"); + break; + default: + printf("unknown"); + break; + } + if (fn->sysinit & CISTPL_SYSINIT_POST) + printf(" [post]"); + if (fn->sysinit & CISTPL_SYSINIT_ROM) + printf(" [rom]"); + putchar('\n'); +} + +/*====================================================================*/ + +static void print_size(u_int size) +{ + if (size < 1024) + printf("%ub", size); + else if (size < 1024 * 1024) + printf("%ukb", size / 1024); + else + printf("%umb", size / (1024 * 1024)); +} + +static void print_unit(u_int v, char *unit, char tag) +{ + int n; + for (n = 0; (v % 1000) == 0; n++) + v /= 1000; + printf("%u", v); + if (n < strlen(unit)) + putchar(unit[n]); + putchar(tag); +} + +static void print_time(u_int tm, u_long scale) +{ + print_unit(tm * scale, "num", 's'); +} + +static void print_volt(u_int vi) +{ + print_unit(vi * 10, "um", 'V'); +} + +static void print_current(u_int ii) +{ + print_unit(ii / 10, "um", 'A'); +} + +static void print_speed(u_int b) +{ + if (b < 1000) + printf("%u bits/sec", b); + else if (b < 1000000) + printf("%u kb/sec", b / 1000); + else + printf("%u mb/sec", b / 1000000); +} + +/*====================================================================*/ + +static const char *dtype[] = { + "NULL", "ROM", "OTPROM", "EPROM", "EEPROM", "FLASH", "SRAM", + "DRAM", "rsvd", "rsvd", "rsvd", "rsvd", "rsvd", "fn_specific", + "extended", "rsvd" +}; + +static void print_device(cistpl_device_t * dev) +{ + int i; + for (i = 0; i < dev->ndev; i++) { + printf("%s %s ", indent, dtype[dev->dev[i].type]); + printf("%uns, ", dev->dev[i].speed); + print_size(dev->dev[i].size); + putchar('\n'); + } + if (dev->ndev == 0) + printf("%s no_info\n", indent); +} + +/*====================================================================*/ + +static void print_power(char *tag, cistpl_power_t * power) +{ + int i, n; + for (i = n = 0; i < 8; i++) + if (power->present & (1 << i)) + n++; + i = 0; + printf("%s %s", indent, tag); + if (power->present & (1 << CISTPL_POWER_VNOM)) { + printf(" Vnom "); + i++; + print_volt(power->param[CISTPL_POWER_VNOM]); + } + if (power->present & (1 << CISTPL_POWER_VMIN)) { + printf(" Vmin "); + i++; + print_volt(power->param[CISTPL_POWER_VMIN]); + } + if (power->present & (1 << CISTPL_POWER_VMAX)) { + printf(" Vmax "); + i++; + print_volt(power->param[CISTPL_POWER_VMAX]); + } + if (power->present & (1 << CISTPL_POWER_ISTATIC)) { + printf(" Istatic "); + i++; + print_current(power->param[CISTPL_POWER_ISTATIC]); + } + if (power->present & (1 << CISTPL_POWER_IAVG)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Iavg "); + print_current(power->param[CISTPL_POWER_IAVG]); + } + if (power->present & (1 << CISTPL_POWER_IPEAK)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Ipeak "); + print_current(power->param[CISTPL_POWER_IPEAK]); + } + if (power->present & (1 << CISTPL_POWER_IDOWN)) { + if (++i == 5) + printf("\n%s ", indent); + printf(" Idown "); + print_current(power->param[CISTPL_POWER_IDOWN]); + } + if (power->flags & CISTPL_POWER_HIGHZ_OK) { + if (++i == 5) + printf("\n%s ", indent); + printf(" [highz OK]"); + } + if (power->flags & CISTPL_POWER_HIGHZ_REQ) { + printf(" [highz]"); + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_cftable_entry(cistpl_cftable_entry_t * entry) +{ + int i; + + printf("%scftable_entry 0x%2.2x%s\n", indent, entry->index, + (entry->flags & CISTPL_CFTABLE_DEFAULT) ? " [default]" : ""); + + if (entry->flags & ~CISTPL_CFTABLE_DEFAULT) { + printf("%s ", indent); + if (entry->flags & CISTPL_CFTABLE_BVDS) + printf(" [bvd]"); + if (entry->flags & CISTPL_CFTABLE_WP) + printf(" [wp]"); + if (entry->flags & CISTPL_CFTABLE_RDYBSY) + printf(" [rdybsy]"); + if (entry->flags & CISTPL_CFTABLE_MWAIT) + printf(" [mwait]"); + if (entry->flags & CISTPL_CFTABLE_AUDIO) + printf(" [audio]"); + if (entry->flags & CISTPL_CFTABLE_READONLY) + printf(" [readonly]"); + if (entry->flags & CISTPL_CFTABLE_PWRDOWN) + printf(" [pwrdown]"); + putchar('\n'); + } + + if (entry->vcc.present) + print_power("Vcc", &entry->vcc); + if (entry->vpp1.present) + print_power("Vpp1", &entry->vpp1); + if (entry->vpp2.present) + print_power("Vpp2", &entry->vpp2); + + if ((entry->timing.wait != 0) || (entry->timing.ready != 0) || + (entry->timing.reserved != 0)) { + printf("%s timing", indent); + if (entry->timing.wait != 0) { + printf(" wait "); + print_time(entry->timing.wait, entry->timing.waitscale); + } + if (entry->timing.ready != 0) { + printf(" ready "); + print_time(entry->timing.ready, entry->timing.rdyscale); + } + if (entry->timing.reserved != 0) { + printf(" reserved "); + print_time(entry->timing.reserved, + entry->timing.rsvscale); + } + putchar('\n'); + } + + if (entry->io.nwin) { + cistpl_io_t *io = &entry->io; + printf("%s io", indent); + for (i = 0; i < io->nwin; i++) { + if (i) + putchar(','); + printf(" 0x%4.4x-0x%4.4x", io->win[i].base, + io->win[i].base + io->win[i].len - 1); + } + printf(" [lines=%d]", io->flags & CISTPL_IO_LINES_MASK); + if (io->flags & CISTPL_IO_8BIT) + printf(" [8bit]"); + if (io->flags & CISTPL_IO_16BIT) + printf(" [16bit]"); + if (io->flags & CISTPL_IO_RANGE) + printf(" [range]"); + putchar('\n'); + } + + if (entry->irq.IRQInfo1) { + printf("%s irq ", indent); + if (entry->irq.IRQInfo1 & IRQ_INFO2_VALID) + printf("mask 0x%04x", entry->irq.IRQInfo2); + else + printf("%u", entry->irq.IRQInfo1 & IRQ_MASK); + if (entry->irq.IRQInfo1 & IRQ_LEVEL_ID) + printf(" [level]"); + if (entry->irq.IRQInfo1 & IRQ_PULSE_ID) + printf(" [pulse]"); + if (entry->irq.IRQInfo1 & IRQ_SHARE_ID) + printf(" [shared]"); + putchar('\n'); + } + + if (entry->mem.nwin) { + cistpl_mem_t *mem = &entry->mem; + printf("%s memory", indent); + for (i = 0; i < mem->nwin; i++) { + if (i) + putchar(','); + printf(" 0x%4.4x-0x%4.4x @ 0x%4.4x", + mem->win[i].card_addr, + mem->win[i].card_addr + mem->win[i].len - 1, + mem->win[i].host_addr); + } + putchar('\n'); + } + + if (verbose && entry->subtuples) + printf("%s %d bytes in subtuples\n", indent, entry->subtuples); + +} + +/*====================================================================*/ + +static void print_cftable_entry_cb(cistpl_cftable_entry_cb_t * entry) +{ + int i; + + printf("%scftable_entry_cb 0x%2.2x%s\n", indent, entry->index, + (entry->flags & CISTPL_CFTABLE_DEFAULT) ? " [default]" : ""); + + if (entry->flags & ~CISTPL_CFTABLE_DEFAULT) { + printf("%s ", indent); + if (entry->flags & CISTPL_CFTABLE_MASTER) + printf(" [master]"); + if (entry->flags & CISTPL_CFTABLE_INVALIDATE) + printf(" [invalidate]"); + if (entry->flags & CISTPL_CFTABLE_VGA_PALETTE) + printf(" [vga palette]"); + if (entry->flags & CISTPL_CFTABLE_PARITY) + printf(" [parity]"); + if (entry->flags & CISTPL_CFTABLE_WAIT) + printf(" [wait]"); + if (entry->flags & CISTPL_CFTABLE_SERR) + printf(" [serr]"); + if (entry->flags & CISTPL_CFTABLE_FAST_BACK) + printf(" [fast back]"); + if (entry->flags & CISTPL_CFTABLE_BINARY_AUDIO) + printf(" [binary audio]"); + if (entry->flags & CISTPL_CFTABLE_PWM_AUDIO) + printf(" [pwm audio]"); + putchar('\n'); + } + + if (entry->vcc.present) + print_power("Vcc", &entry->vcc); + if (entry->vpp1.present) + print_power("Vpp1", &entry->vpp1); + if (entry->vpp2.present) + print_power("Vpp2", &entry->vpp2); + + if (entry->io) { + printf("%s io_base", indent); + for (i = 0; i < 8; i++) + if (entry->io & (1 << i)) + printf(" %d", i); + putchar('\n'); + } + + if (entry->irq.IRQInfo1) { + printf("%s irq ", indent); + if (entry->irq.IRQInfo1 & IRQ_INFO2_VALID) + printf("mask 0x%4.4x", entry->irq.IRQInfo2); + else + printf("%u", entry->irq.IRQInfo1 & IRQ_MASK); + if (entry->irq.IRQInfo1 & IRQ_LEVEL_ID) + printf(" [level]"); + if (entry->irq.IRQInfo1 & IRQ_PULSE_ID) + printf(" [pulse]"); + if (entry->irq.IRQInfo1 & IRQ_SHARE_ID) + printf(" [shared]"); + putchar('\n'); + } + + if (entry->mem) { + printf("%s mem_base", indent); + for (i = 0; i < 8; i++) + if (entry->mem & (1 << i)) + printf(" %d", i); + putchar('\n'); + } + + if (verbose && entry->subtuples) + printf("%s %d bytes in subtuples\n", indent, entry->subtuples); + +} + +/*====================================================================*/ + +static void print_jedec(cistpl_jedec_t * j) +{ + int i; + for (i = 0; i < j->nid; i++) { + if (i != 0) + putchar(','); + printf(" 0x%02x 0x%02x", j->id[i].mfr, j->id[i].info); + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_device_geo(cistpl_device_geo_t * geo) +{ + int i; + for (i = 0; i < geo->ngeo; i++) { + printf("%s width %d erase 0x%x read 0x%x write 0x%x " + "partition 0x%x interleave 0x%x\n", indent, + geo->geo[i].buswidth, geo->geo[i].erase_block, + geo->geo[i].read_block, geo->geo[i].write_block, + geo->geo[i].partition, geo->geo[i].interleave); + } +} + +/*====================================================================*/ + +static void print_org(cistpl_org_t * org) +{ + printf("%sdata_org ", indent); + switch (org->data_org) { + case CISTPL_ORG_FS: + printf("[filesystem]"); + break; + case CISTPL_ORG_APPSPEC: + printf("[app_specific]"); + break; + case CISTPL_ORG_XIP: + printf("[code]"); + break; + default: + if (org->data_org < 0x80) + printf("[reserved]"); + else + printf("[vendor_specific]"); + } + printf(", \"%s\"\n", org->desc); +} + +/*====================================================================*/ + +static char *data_mod[] = { + "Bell103", "V.21", "V.23", "V.22", "Bell212A", "V.22bis", + "V.26", "V.26bis", "V.27bis", "V.29", "V.32", "V.32bis", + "V.34", "rfu", "rfu", "rfu" +}; + +static char *fax_mod[] = { + "V.21-C2", "V.27ter", "V.29", "V.17", "V.33", "rfu", "rfu", "rfu" +}; + +static char *fax_features[] = { + "T.3", "T.4", "T.6", "error", "voice", "poll", "file", "passwd" +}; + +static char *cmd_protocol[] = { + "AT1", "AT2", "AT3", "MNP_AT", "V.25bis", "V.25A", "DMCL" +}; + +static char *uart[] = { + "8250", "16450", "16550", "8251", "8530", "85230" +}; +static char *parity[] = { "space", "mark", "odd", "even" }; +static char *stop[] = { "1", "1.5", "2" }; + +static char *flow[] = { + "XON/XOFF xmit", "XON/XOFF rcv", "hw xmit", "hw rcv", "transparent" +}; + +static void print_serial(cistpl_funce_t * funce) +{ + cistpl_serial_t *s; + cistpl_data_serv_t *ds; + cistpl_fax_serv_t *fs; + cistpl_modem_cap_t *cp; + int i, j; + + switch (funce->type & 0x0f) { + case CISTPL_FUNCE_SERIAL_IF: + case CISTPL_FUNCE_SERIAL_IF_DATA: + case CISTPL_FUNCE_SERIAL_IF_FAX: + case CISTPL_FUNCE_SERIAL_IF_VOICE: + s = (cistpl_serial_t *) (funce->data); + printf("%sserial_interface", indent); + if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_DATA) + printf("_data"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_FAX) + printf("_fax"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_VOICE) + printf("_voice"); + printf("\n%s uart %s", indent, + (s->uart_type < 6) ? uart[s->uart_type] : "reserved"); + if (s->uart_cap_0) { + printf(" ["); + for (i = 0; i < 4; i++) + if (s->uart_cap_0 & (1 << i)) + printf("%s%s", parity[i], + (s->uart_cap_0 >= + (2 << i)) ? "/" : "]"); + } + if (s->uart_cap_1) { + int m = s->uart_cap_1 & 0x0f; + int n = s->uart_cap_1 >> 4; + printf(" ["); + for (i = 0; i < 4; i++) + if (m & (1 << i)) + printf("%d%s", i + 5, + (m >= (2 << i)) ? "/" : ""); + printf("] ["); + for (i = 0; i < 3; i++) + if (n & (1 << i)) + printf("%s%s", stop[i], + (n >= (2 << i)) ? "/" : "]"); + } + printf("\n"); + break; + case CISTPL_FUNCE_SERIAL_CAP: + case CISTPL_FUNCE_SERIAL_CAP_DATA: + case CISTPL_FUNCE_SERIAL_CAP_FAX: + case CISTPL_FUNCE_SERIAL_CAP_VOICE: + cp = (cistpl_modem_cap_t *) (funce->data); + printf("%sserial_modem_cap", indent); + if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_DATA) + printf("_data"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_FAX) + printf("_fax"); + else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_VOICE) + printf("_voice"); + if (cp->flow) { + printf("\n%s flow", indent); + for (i = 0; i < 5; i++) + if (cp->flow & (1 << i)) + printf(" [%s]", flow[i]); + } + printf("\n%s cmd_buf %d rcv_buf %d xmit_buf %d\n", + indent, 4 * (cp->cmd_buf + 1), + cp->rcv_buf_0 + (cp->rcv_buf_1 << 8) + + (cp->rcv_buf_2 << 16), + cp->xmit_buf_0 + (cp->xmit_buf_1 << 8) + + (cp->xmit_buf_2 << 16)); + break; + case CISTPL_FUNCE_SERIAL_SERV_DATA: + ds = (cistpl_data_serv_t *) (funce->data); + printf("%sserial_data_services\n", indent); + printf("%s data_rate %d\n", indent, + 75 * ((ds->max_data_0 << 8) + ds->max_data_1)); + printf("%s modulation", indent); + for (i = j = 0; i < 16; i++) + if (((ds->modulation_1 << 8) + + ds->modulation_0) & (1 << i)) { + if (++j % 6 == 0) + printf("\n%s ", indent); + printf(" [%s]", data_mod[i]); + } + printf("\n"); + if (ds->error_control) { + printf("%s error_control", indent); + if (ds->error_control & CISTPL_SERIAL_ERR_MNP2_4) + printf(" [MNP2-4]"); + if (ds->error_control & CISTPL_SERIAL_ERR_V42_LAPM) + printf(" [V.42/LAPM]"); + printf("\n"); + } + if (ds->compression) { + printf("%s compression", indent); + if (ds->compression & CISTPL_SERIAL_CMPR_V42BIS) + printf(" [V.42bis]"); + if (ds->compression & CISTPL_SERIAL_CMPR_MNP5) + printf(" [MNP5]"); + printf("\n"); + } + if (ds->cmd_protocol) { + printf("%s cmd_protocol", indent); + for (i = 0; i < 7; i++) + if (ds->cmd_protocol & (1 << i)) + printf(" [%s]", cmd_protocol[i]); + printf("\n"); + } + break; + + case CISTPL_FUNCE_SERIAL_SERV_FAX: + fs = (cistpl_fax_serv_t *) (funce->data); + printf("%sserial_fax_services [class=%d]\n", + indent, funce->type >> 4); + printf("%s data_rate %d\n", indent, + 75 * ((fs->max_data_0 << 8) + fs->max_data_1)); + printf("%s modulation", indent); + for (i = 0; i < 8; i++) + if (fs->modulation & (1 << i)) + printf(" [%s]", fax_mod[i]); + printf("\n"); + if (fs->features_0) { + printf("%s features", indent); + for (i = 0; i < 8; i++) + if (fs->features_0 & (1 << i)) + printf(" [%s]", fax_features[i]); + printf("\n"); + } + break; + } +} + +/*====================================================================*/ + +static void print_fixed(cistpl_funce_t * funce) +{ + cistpl_ide_interface_t *i; + cistpl_ide_feature_t *f; + + switch (funce->type) { + case CISTPL_FUNCE_IDE_IFACE: + i = (cistpl_ide_interface_t *) (funce->data); + printf("%sdisk_interface ", indent); + if (i->interface == CISTPL_IDE_INTERFACE) + printf("[ide]\n"); + else + printf("[undefined]\n"); + break; + case CISTPL_FUNCE_IDE_MASTER: + case CISTPL_FUNCE_IDE_SLAVE: + f = (cistpl_ide_feature_t *) (funce->data); + printf("%sdisk_features", indent); + if (f->feature1 & CISTPL_IDE_SILICON) + printf(" [silicon]"); + else + printf(" [rotating]"); + if (f->feature1 & CISTPL_IDE_UNIQUE) + printf(" [unique]"); + if (f->feature1 & CISTPL_IDE_DUAL) + printf(" [dual]"); + else + printf(" [single]"); + if (f->feature1 && f->feature2) + printf("\n%s ", indent); + if (f->feature2 & CISTPL_IDE_HAS_SLEEP) + printf(" [sleep]"); + if (f->feature2 & CISTPL_IDE_HAS_STANDBY) + printf(" [standby]"); + if (f->feature2 & CISTPL_IDE_HAS_IDLE) + printf(" [idle]"); + if (f->feature2 & CISTPL_IDE_LOW_POWER) + printf(" [low power]"); + if (f->feature2 & CISTPL_IDE_REG_INHIBIT) + printf(" [reg inhibit]"); + if (f->feature2 & CISTPL_IDE_HAS_INDEX) + printf(" [index]"); + if (f->feature2 & CISTPL_IDE_IOIS16) + printf(" [iois16]"); + putchar('\n'); + break; + } +} + +/*====================================================================*/ + +static const char *tech[] = { + "undefined", "ARCnet", "ethernet", "token_ring", "localtalk", + "FDDI/CDDI", "ATM", "wireless" +}; + +static const char *media[] = { + "undefined", "unshielded_twisted_pair", "shielded_twisted_pair", + "thin_coax", "thick_coax", "fiber", "900_MHz", "2.4_GHz", + "5.4_GHz", "diffuse_infrared", "point_to_point_infrared" +}; + +static void print_network(cistpl_funce_t * funce) +{ + cistpl_lan_tech_t *t; + cistpl_lan_speed_t *s; + cistpl_lan_media_t *m; + cistpl_lan_node_id_t *n; + cistpl_lan_connector_t *c; + int i; + + switch (funce->type) { + case CISTPL_FUNCE_LAN_TECH: + t = (cistpl_lan_tech_t *) (funce->data); + printf("%slan_technology %s\n", indent, tech[t->tech]); + break; + case CISTPL_FUNCE_LAN_SPEED: + s = (cistpl_lan_speed_t *) (funce->data); + printf("%slan_speed ", indent); + print_speed(s->speed); + putchar('\n'); + break; + case CISTPL_FUNCE_LAN_MEDIA: + m = (cistpl_lan_media_t *) (funce->data); + printf("%slan_media %s\n", indent, media[m->media]); + break; + case CISTPL_FUNCE_LAN_NODE_ID: + n = (cistpl_lan_node_id_t *) (funce->data); + printf("%slan_node_id", indent); + for (i = 0; i < n->nb; i++) + printf(" %02x", n->id[i]); + putchar('\n'); + break; + case CISTPL_FUNCE_LAN_CONNECTOR: + c = (cistpl_lan_connector_t *) (funce->data); + printf("%slan_connector ", indent); + if (c->code == 0) + printf("Open connector standard\n"); + else + printf("Closed connector standard\n"); + break; + } +} + +/*====================================================================*/ + +static void print_vers_1(cistpl_vers_1_t * v1) +{ + int i, n; + char s[32]; + sprintf(s, "%svers_1 %d.%d", indent, v1->major, v1->minor); + printf("%s", s); + n = strlen(s); + for (i = 0; i < v1->ns; i++) { + if (n + strlen(v1->str + v1->ofs[i]) + 4 > 72) { + n = strlen(indent) + 2; + printf(",\n%s ", indent); + } else { + printf(", "); + n += 2; + } + printf("\"%s\"", v1->str + v1->ofs[i]); + n += strlen(v1->str + v1->ofs[i]) + 2; + } + putchar('\n'); +} + +/*====================================================================*/ + +static void print_vers_2(cistpl_vers_2_t * v2) +{ + printf("%sversion 0x%2.2x, compliance 0x%2.2x, dindex 0x%4.4x\n", + indent, v2->vers, v2->comply, v2->dindex); + printf("%s vspec8 0x%2.2x, vspec9 0x%2.2x, nhdr %d\n", + indent, v2->vspec8, v2->vspec9, v2->nhdr); + printf("%s vendor \"%s\"\n", indent, v2->str + v2->vendor); + printf("%s info \"%s\"\n", indent, v2->str + v2->info); +} + +/*====================================================================*/ + +#ifdef CISTPL_FORMAT_DISK +static void print_format(cistpl_format_t * fmt) +{ + if (fmt->type == CISTPL_FORMAT_DISK) + printf("%s [disk]", indent); + else if (fmt->type == CISTPL_FORMAT_MEM) + printf("%s [memory]", indent); + else + printf("%s [type 0x%02x]\n", indent, fmt->type); + if (fmt->edc == CISTPL_EDC_NONE) + printf(" [no edc]"); + else if (fmt->edc == CISTPL_EDC_CKSUM) + printf(" [cksum]"); + else if (fmt->edc == CISTPL_EDC_CRC) + printf(" [crc]"); + else if (fmt->edc == CISTPL_EDC_PCC) + printf(" [pcc]"); + else + printf(" [edc 0x%02x]", fmt->edc); + printf(" offset 0x%04x length ", fmt->offset); + print_size(fmt->length); + putchar('\n'); +} +#endif + +/*====================================================================*/ + +static void print_config(int code, cistpl_config_t * cfg) +{ + printf("%sconfig%s base 0x%4.4x", indent, + (code == CISTPL_CONFIG_CB) ? "_cb" : "", cfg->base); + if (code == CISTPL_CONFIG) + printf(" mask 0x%4.4x", cfg->rmask[0]); + printf(" last_index 0x%2.2x\n", cfg->last_idx); + if (verbose && cfg->subtuples) + printf("%s %d bytes in subtuples\n", indent, cfg->subtuples); +} + +/*====================================================================*/ + +static int nfn = 0, cur = 0; + +static void print_parse(tuple_parse_t * tup) +{ + static int func = 0; + int i; + + switch (tup->tuple.TupleCode) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + if (tup->tuple.TupleCode == CISTPL_DEVICE) + printf("%sdev_info\n", indent); + else + printf("%sattr_dev_info\n", indent); + print_device(&tup->parse.device); + break; + case CISTPL_CHECKSUM: + printf("%schecksum 0x%04x-0x%04x = 0x%02x\n", + indent, tup->parse.checksum.addr, + tup->parse.checksum.addr + tup->parse.checksum.len - 1, + tup->parse.checksum.sum); + break; + case CISTPL_LONGLINK_A: + if (verbose) + printf("%slong_link_attr 0x%04x\n", indent, + tup->parse.longlink.addr); + break; + case CISTPL_LONGLINK_C: + if (verbose) + printf("%slong_link 0x%04x\n", indent, + tup->parse.longlink.addr); + break; + case CISTPL_LONGLINK_MFC: + if (verbose) { + printf("%smfc_long_link\n", indent); + for (i = 0; i < tup->parse.longlink_mfc.nfn; i++) + printf("%s function %d: %s 0x%04x\n", indent, i, + tup->parse.longlink_mfc.fn[i].space ? + "common" : "attr", + tup->parse.longlink_mfc.fn[i].addr); + } + + printf("%smfc {\n", indent); + nfn = tup->parse.longlink_mfc.nfn; + cur = 0; + strcat(indent, " "); + while (cur < nfn) { + tuple_parse_t tuple_parse = *tup; + tuple_parse.tuple.CISOffset = + tup->parse.longlink_mfc.fn[cur].addr; + tuple_parse.tuple.TupleLink = 0; + + while (1) { + if (get_tuple_buf(-1, &tuple_parse.tuple, 0)) + break; + if (verbose) + print_tuple(&tuple_parse); + if (parse_tuple + (&tuple_parse.tuple, + &tuple_parse.parse) == 0) + print_parse(&tuple_parse); + else + printf("%sparse error\n", indent); + if (verbose) + putchar('\n'); + if (tuple_parse.tuple.TupleCode == CISTPL_END) + break; + } + } + break; + case CISTPL_NO_LINK: + if (verbose) + printf("%sno_long_link\n", indent); + break; +#ifdef CISTPL_INDIRECT + case CISTPL_INDIRECT: + if (verbose) + printf("%sindirect_access\n", indent); + break; +#endif + case CISTPL_LINKTARGET: + if (verbose) + printf("%slink_target\n", indent); + + if (cur++) + printf("%s}, {\n", indent + 2); + break; + case CISTPL_VERS_1: + print_vers_1(&tup->parse.version_1); + break; + case CISTPL_ALTSTR: + break; + case CISTPL_JEDEC_A: + case CISTPL_JEDEC_C: + if (tup->tuple.TupleCode == CISTPL_JEDEC_C) + printf("%scommon_jedec", indent); + else + printf("%sattr_jedec", indent); + print_jedec(&tup->parse.jedec); + break; + case CISTPL_DEVICE_GEO: + case CISTPL_DEVICE_GEO_A: + if (tup->tuple.TupleCode == CISTPL_DEVICE_GEO) + printf("%scommon_geometry\n", indent); + else + printf("%sattr_geometry\n", indent); + print_device_geo(&tup->parse.device_geo); + break; + case CISTPL_MANFID: + printf("%smanfid 0x%4.4x, 0x%4.4x\n", indent, + tup->parse.manfid.manf, tup->parse.manfid.card); + break; + case CISTPL_FUNCID: + print_funcid(&tup->parse.funcid); + func = tup->parse.funcid.func; + break; + case CISTPL_FUNCE: + switch (func) { + case CISTPL_FUNCID_SERIAL: + print_serial(&tup->parse.funce); + break; + case CISTPL_FUNCID_FIXED: + print_fixed(&tup->parse.funce); + break; + case CISTPL_FUNCID_NETWORK: + print_network(&tup->parse.funce); + break; + } + break; + case CISTPL_BAR: + printf("%sBAR %d size ", indent, + tup->parse.bar.attr & CISTPL_BAR_SPACE); + print_size(tup->parse.bar.size); + if (tup->parse.bar.attr & CISTPL_BAR_SPACE_IO) + printf(" [io]"); + else + printf(" [mem]"); + if (tup->parse.bar.attr & CISTPL_BAR_PREFETCH) + printf(" [prefetch]"); + if (tup->parse.bar.attr & CISTPL_BAR_CACHEABLE) + printf(" [cacheable]"); + if (tup->parse.bar.attr & CISTPL_BAR_1MEG_MAP) + printf(" [<1mb]"); + putchar('\n'); + break; + case CISTPL_CONFIG: + case CISTPL_CONFIG_CB: + print_config(tup->tuple.TupleCode, &tup->parse.config); + break; + case CISTPL_CFTABLE_ENTRY: + print_cftable_entry(&tup->parse.cftable_entry); + break; + case CISTPL_CFTABLE_ENTRY_CB: + print_cftable_entry_cb(&tup->parse.cftable_entry_cb); + break; + case CISTPL_VERS_2: + print_vers_2(&tup->parse.vers_2); + break; + case CISTPL_ORG: + print_org(&tup->parse.org); + break; +#ifdef CISTPL_FORMAT_DISK + case CISTPL_FORMAT: + case CISTPL_FORMAT_A: + if (tup->tuple.TupleCode == CISTPL_FORMAT) + printf("%scommon_format\n", indent); + else + printf("%sattr_format\n", indent); + print_format(&tup->parse.format); +#endif + } +} + +/*====================================================================*/ + +static int get_tuple_buf(int fd, tuple_t * tuple, int first) +{ + u_int ofs; + static int nb = 0; + static u_char buf[1024]; + + if (first) { + nb = read(fd, buf, sizeof(buf)); + tuple->TupleLink = tuple->CISOffset = 0; + } + ofs = tuple->CISOffset + tuple->TupleLink; + if (ofs >= nb) + return -1; + tuple->TupleCode = buf[ofs++]; + tuple->TupleDataLen = tuple->TupleLink = buf[ofs++]; + tuple->CISOffset = ofs; + memcpy(tuple->TupleData, buf + ofs, tuple->TupleLink); + return 0; +} + +/*====================================================================== + + Parsing routines for individual tuples + +======================================================================*/ + +static const u_char mantissa[] = { + 10, 12, 13, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 70, 80, 90 +}; + +static const u_int exponent[] = { + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 +}; + +/* Convert an extended speed byte to a time in nanoseconds */ +#define SPEED_CVT(v) \ + (mantissa[(((v)>>3)&15)-1] * exponent[(v)&7] / 10) +/* Convert a power byte to a current in 0.1 microamps */ +#define POWER_CVT(v) \ + (mantissa[((v)>>3)&15] * exponent[(v)&7] / 10) +#define POWER_SCALE(v) (exponent[(v)&7]) + +static int parse_device(tuple_t * tuple, cistpl_device_t * device) +{ + int i; + u_char scale; + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + device->ndev = 0; + for (i = 0; i < CISTPL_MAX_DEVICES; i++) { + + if (*p == 0xff) + break; + device->dev[i].type = (*p >> 4); + device->dev[i].wp = (*p & 0x08) ? 1 : 0; + switch (*p & 0x07) { + case 0: + device->dev[i].speed = 0; + break; + case 1: + device->dev[i].speed = 250; + break; + case 2: + device->dev[i].speed = 200; + break; + case 3: + device->dev[i].speed = 150; + break; + case 4: + device->dev[i].speed = 100; + break; + case 7: + if (++p == q) + return -1; + if (p == q) + return -1; + device->dev[i].speed = SPEED_CVT(*p); + while (*p & 0x80) + if (++p == q) + return -1; + break; + default: + return -1; + } + + if (++p == q) + return -1; + if (*p == 0xff) + break; + scale = *p & 7; + if (scale == 7) + return -1; + device->dev[i].size = ((*p >> 3) + 1) * (512 << (scale * 2)); + device->ndev++; + if (++p == q) + break; + } + + return 0; +} + +/*====================================================================*/ + +static int parse_checksum(tuple_t * tuple, cistpl_checksum_t * csum) +{ + u_char *p; + if (tuple->TupleDataLen < 5) + return -1; + p = (u_char *) tuple->TupleData; + csum->addr = tuple->CISOffset + (short)le16toh(*(u_short *) p) - 2; + csum->len = le16toh(*(u_short *) (p + 2)); + csum->sum = *(p + 4); + return 0; +} + +/*====================================================================*/ + +static int parse_longlink(tuple_t * tuple, cistpl_longlink_t * link) +{ + if (tuple->TupleDataLen < 4) + return -1; + link->addr = le32toh(*(u_int *) tuple->TupleData); + return 0; +} + +/*====================================================================*/ + +static int parse_longlink_mfc(tuple_t * tuple, cistpl_longlink_mfc_t * link) +{ + u_char *p; + int i; + + p = (u_char *) tuple->TupleData; + + link->nfn = *p; + p++; + if (tuple->TupleDataLen <= link->nfn * 5) + return -1; + for (i = 0; i < link->nfn; i++) { + link->fn[i].space = *p; + p++; + link->fn[i].addr = le32toh(*(u_int *) p); + p += 4; + } + return 0; +} + +/*====================================================================*/ + +static int parse_strings(u_char * p, u_char * q, int max, + char *s, u_char * ofs, u_char * found) +{ + int i, j, ns; + + if (p == q) + return -1; + ns = 0; + j = 0; + for (i = 0; i < max; i++) { + if (*p == 0xff) + break; + ofs[i] = j; + ns++; + for (;;) { + s[j++] = (*p == 0xff) ? '\0' : *p; + if ((*p == '\0') || (*p == 0xff)) + break; + if (++p == q) + return -1; + } + if ((*p == 0xff) || (++p == q)) + break; + } + if (found) { + *found = ns; + return 0; + } else { + return (ns == max) ? 0 : -1; + } +} + +/*====================================================================*/ + +static int parse_vers_1(tuple_t * tuple, cistpl_vers_1_t * vers_1) +{ + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + vers_1->major = *p; + p++; + vers_1->minor = *p; + p++; + if (p >= q) + return -1; + + return parse_strings(p, q, CISTPL_VERS_1_MAX_PROD_STRINGS, + vers_1->str, vers_1->ofs, &vers_1->ns); +} + +/*====================================================================*/ + +static int parse_altstr(tuple_t * tuple, cistpl_altstr_t * altstr) +{ + u_char *p, *q; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + return parse_strings(p, q, CISTPL_MAX_ALTSTR_STRINGS, + altstr->str, altstr->ofs, &altstr->ns); +} + +/*====================================================================*/ + +static int parse_jedec(tuple_t * tuple, cistpl_jedec_t * jedec) +{ + u_char *p, *q; + int nid; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + for (nid = 0; nid < CISTPL_MAX_DEVICES; nid++) { + if (p > q - 2) + break; + jedec->id[nid].mfr = p[0]; + jedec->id[nid].info = p[1]; + p += 2; + } + jedec->nid = nid; + return 0; +} + +/*====================================================================*/ + +static int parse_manfid(tuple_t * tuple, cistpl_manfid_t * m) +{ + u_short *p; + if (tuple->TupleDataLen < 4) + return -1; + p = (u_short *) tuple->TupleData; + m->manf = le16toh(p[0]); + m->card = le16toh(p[1]); + return 0; +} + +/*====================================================================*/ + +static int parse_funcid(tuple_t * tuple, cistpl_funcid_t * f) +{ + u_char *p; + if (tuple->TupleDataLen < 2) + return -1; + p = (u_char *) tuple->TupleData; + f->func = p[0]; + f->sysinit = p[1]; + return 0; +} + +/*====================================================================*/ + +static int parse_funce(tuple_t * tuple, cistpl_funce_t * f) +{ + u_char *p; + int i; + if (tuple->TupleDataLen < 1) + return -1; + p = (u_char *) tuple->TupleData; + f->type = p[0]; + for (i = 1; i < tuple->TupleDataLen; i++) + f->data[i - 1] = p[i]; + return 0; +} + +/*====================================================================*/ + +static int parse_config(tuple_t * tuple, cistpl_config_t * config) +{ + int rasz, rmsz, i; + u_char *p; + + p = (u_char *) tuple->TupleData; + rasz = *p & 0x03; + rmsz = (*p & 0x3c) >> 2; + if (tuple->TupleDataLen < rasz + rmsz + 4) + return -1; + config->last_idx = *(++p); + p++; + config->base = 0; + for (i = 0; i <= rasz; i++) + config->base += p[i] << (8 * i); + p += rasz + 1; + for (i = 0; i < 4; i++) + config->rmask[i] = 0; + for (i = 0; i <= rmsz; i++) + config->rmask[i >> 2] += p[i] << (8 * (i % 4)); + config->subtuples = tuple->TupleDataLen - (rasz + rmsz + 4); + return 0; +} + +/*====================================================================== + + The following routines are all used to parse the nightmarish + config table entries. + +======================================================================*/ + +static u_char *parse_power(u_char * p, u_char * q, cistpl_power_t * pwr) +{ + int i; + u_int scale; + + if (p == q) + return NULL; + pwr->present = *p; + pwr->flags = 0; + p++; + for (i = 0; i < 7; i++) + if (pwr->present & (1 << i)) { + if (p == q) + return NULL; + pwr->param[i] = POWER_CVT(*p); + scale = POWER_SCALE(*p); + while (*p & 0x80) { + if (++p == q) + return NULL; + if ((*p & 0x7f) < 100) + pwr->param[i] += + (*p & 0x7f) * scale / 100; + else if (*p == 0x7d) + pwr->flags |= CISTPL_POWER_HIGHZ_OK; + else if (*p == 0x7e) + pwr->param[i] = 0; + else if (*p == 0x7f) + pwr->flags |= CISTPL_POWER_HIGHZ_REQ; + else + return NULL; + } + p++; + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_timing(u_char * p, u_char * q, cistpl_timing_t * timing) +{ + u_char scale; + + if (p == q) + return NULL; + scale = *p; + if ((scale & 3) != 3) { + if (++p == q) + return NULL; + timing->wait = SPEED_CVT(*p); + timing->waitscale = exponent[scale & 3]; + } else + timing->wait = 0; + scale >>= 2; + if ((scale & 7) != 7) { + if (++p == q) + return NULL; + timing->ready = SPEED_CVT(*p); + timing->rdyscale = exponent[scale & 7]; + } else + timing->ready = 0; + scale >>= 3; + if (scale != 7) { + if (++p == q) + return NULL; + timing->reserved = SPEED_CVT(*p); + timing->rsvscale = exponent[scale]; + } else + timing->reserved = 0; + p++; + return p; +} + +/*====================================================================*/ + +static u_char *parse_io(u_char * p, u_char * q, cistpl_io_t * io) +{ + int i, j, bsz, lsz; + + if (p == q) + return NULL; + io->flags = *p; + + if (!(*p & 0x80)) { + io->nwin = 1; + io->win[0].base = 0; + io->win[0].len = (1 << (io->flags & CISTPL_IO_LINES_MASK)); + return p + 1; + } + + if (++p == q) + return NULL; + io->nwin = (*p & 0x0f) + 1; + bsz = (*p & 0x30) >> 4; + if (bsz == 3) + bsz++; + lsz = (*p & 0xc0) >> 6; + if (lsz == 3) + lsz++; + p++; + + for (i = 0; i < io->nwin; i++) { + io->win[i].base = 0; + io->win[i].len = 1; + for (j = 0; j < bsz; j++, p++) { + if (p == q) + return NULL; + io->win[i].base += *p << (j * 8); + } + for (j = 0; j < lsz; j++, p++) { + if (p == q) + return NULL; + io->win[i].len += *p << (j * 8); + } + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_mem(u_char * p, u_char * q, cistpl_mem_t * mem) +{ + int i, j, asz, lsz, has_ha; + u_int len, ca, ha; + + if (p == q) + return NULL; + + mem->nwin = (*p & 0x07) + 1; + lsz = (*p & 0x18) >> 3; + asz = (*p & 0x60) >> 5; + has_ha = (*p & 0x80); + if (++p == q) + return NULL; + + for (i = 0; i < mem->nwin; i++) { + len = ca = ha = 0; + for (j = 0; j < lsz; j++, p++) { + if (p == q) + return NULL; + len += *p << (j * 8); + } + for (j = 0; j < asz; j++, p++) { + if (p == q) + return NULL; + ca += *p << (j * 8); + } + if (has_ha) + for (j = 0; j < asz; j++, p++) { + if (p == q) + return NULL; + ha += *p << (j * 8); + } + mem->win[i].len = len << 8; + mem->win[i].card_addr = ca << 8; + mem->win[i].host_addr = ha << 8; + } + return p; +} + +/*====================================================================*/ + +static u_char *parse_irq(u_char * p, u_char * q, cistpl_irq_t * irq) +{ + if (p == q) + return NULL; + irq->IRQInfo1 = *p; + p++; + if (irq->IRQInfo1 & IRQ_INFO2_VALID) { + if (p + 2 > q) + return NULL; + irq->IRQInfo2 = (p[1] << 8) + p[0]; + p += 2; + } + return p; +} + +/*====================================================================*/ + +static int parse_cftable_entry(tuple_t * tuple, cistpl_cftable_entry_t * entry) +{ + u_char *p, *q, features; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + entry->index = *p & 0x3f; + entry->flags = 0; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_DEFAULT; + if (*p & 0x80) { + if (++p == q) + return -1; + if (*p & 0x10) + entry->flags |= CISTPL_CFTABLE_BVDS; + if (*p & 0x20) + entry->flags |= CISTPL_CFTABLE_WP; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_RDYBSY; + if (*p & 0x80) + entry->flags |= CISTPL_CFTABLE_MWAIT; + entry->interface = *p & 0x0f; + } else + entry->interface = 0; + + /* Process optional features */ + if (++p == q) + return -1; + features = *p; + p++; + + /* Power options */ + if ((features & 3) > 0) { + p = parse_power(p, q, &entry->vcc); + if (p == NULL) + return -1; + } else + entry->vcc.present = 0; + if ((features & 3) > 1) { + p = parse_power(p, q, &entry->vpp1); + if (p == NULL) + return -1; + } else + entry->vpp1.present = 0; + if ((features & 3) > 2) { + p = parse_power(p, q, &entry->vpp2); + if (p == NULL) + return -1; + } else + entry->vpp2.present = 0; + + /* Timing options */ + if (features & 0x04) { + p = parse_timing(p, q, &entry->timing); + if (p == NULL) + return -1; + } else { + entry->timing.wait = 0; + entry->timing.ready = 0; + entry->timing.reserved = 0; + } + + /* I/O window options */ + if (features & 0x08) { + p = parse_io(p, q, &entry->io); + if (p == NULL) + return -1; + } else + entry->io.nwin = 0; + + /* Interrupt options */ + if (features & 0x10) { + p = parse_irq(p, q, &entry->irq); + if (p == NULL) + return -1; + } else + entry->irq.IRQInfo1 = 0; + + switch (features & 0x60) { + case 0x00: + entry->mem.nwin = 0; + break; + case 0x20: + entry->mem.nwin = 1; + entry->mem.win[0].len = le16toh(*(u_short *) p) << 8; + entry->mem.win[0].card_addr = 0; + entry->mem.win[0].host_addr = 0; + p += 2; + if (p > q) + return -1; + break; + case 0x40: + entry->mem.nwin = 1; + entry->mem.win[0].len = le16toh(*(u_short *) p) << 8; + entry->mem.win[0].card_addr = + le16toh(*(u_short *) (p + 2)) << 8; + entry->mem.win[0].host_addr = 0; + p += 4; + if (p > q) + return -1; + break; + case 0x60: + p = parse_mem(p, q, &entry->mem); + if (p == NULL) + return -1; + break; + } + + /* Misc features */ + if (features & 0x80) { + if (p == q) + return -1; + entry->flags |= (*p << 8); + while (*p & 0x80) + if (++p == q) + return -1; + p++; + } + + entry->subtuples = q - p; + + return 0; +} + +/*====================================================================*/ + +static int parse_bar(tuple_t * tuple, cistpl_bar_t * bar) +{ + u_char *p; + if (tuple->TupleDataLen < 6) + return -1; + p = (u_char *) tuple->TupleData; + bar->attr = *p; + p += 2; + bar->size = le32toh(*(u_int *) p); + return 0; +} + +static int parse_config_cb(tuple_t * tuple, cistpl_config_t * config) +{ + u_char *p; + + p = (u_char *) tuple->TupleData; + if ((*p != 3) || (tuple->TupleDataLen < 6)) + return -1; + config->last_idx = *(++p); + p++; + config->base = le32toh(*(u_int *) p); + config->subtuples = tuple->TupleDataLen - 6; + return 0; +} + +static int parse_cftable_entry_cb(tuple_t * tuple, + cistpl_cftable_entry_cb_t * entry) +{ + u_char *p, *q, features; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + entry->index = *p & 0x3f; + entry->flags = 0; + if (*p & 0x40) + entry->flags |= CISTPL_CFTABLE_DEFAULT; + + /* Process optional features */ + if (++p == q) + return -1; + features = *p; + p++; + + /* Power options */ + if ((features & 3) > 0) { + p = parse_power(p, q, &entry->vcc); + if (p == NULL) + return -1; + } else + entry->vcc.present = 0; + if ((features & 3) > 1) { + p = parse_power(p, q, &entry->vpp1); + if (p == NULL) + return -1; + } else + entry->vpp1.present = 0; + if ((features & 3) > 2) { + p = parse_power(p, q, &entry->vpp2); + if (p == NULL) + return -1; + } else + entry->vpp2.present = 0; + + /* I/O window options */ + if (features & 0x08) { + if (p == q) + return -1; + entry->io = *p; + p++; + } else + entry->io = 0; + + /* Interrupt options */ + if (features & 0x10) { + p = parse_irq(p, q, &entry->irq); + if (p == NULL) + return -1; + } else + entry->irq.IRQInfo1 = 0; + + if (features & 0x20) { + if (p == q) + return -1; + entry->mem = *p; + p++; + } else + entry->mem = 0; + + /* Misc features */ + if (features & 0x80) { + if (p == q) + return -1; + entry->flags |= (*p << 8); + if (*p & 0x80) { + if (++p == q) + return -1; + entry->flags |= (*p << 16); + } + while (*p & 0x80) + if (++p == q) + return -1; + p++; + } + + entry->subtuples = q - p; + + return 0; +} + +/*====================================================================*/ + +static int parse_device_geo(tuple_t * tuple, cistpl_device_geo_t * geo) +{ + u_char *p, *q; + int n; + + p = (u_char *) tuple->TupleData; + q = p + tuple->TupleDataLen; + + for (n = 0; n < CISTPL_MAX_DEVICES; n++) { + if (p > q - 6) + break; + geo->geo[n].buswidth = p[0]; + geo->geo[n].erase_block = 1 << (p[1] - 1); + geo->geo[n].read_block = 1 << (p[2] - 1); + geo->geo[n].write_block = 1 << (p[3] - 1); + geo->geo[n].partition = 1 << (p[4] - 1); + geo->geo[n].interleave = 1 << (p[5] - 1); + p += 6; + } + geo->ngeo = n; + return 0; +} + +/*====================================================================*/ + +static int parse_vers_2(tuple_t * tuple, cistpl_vers_2_t * v2) +{ + u_char *p, *q; + + if (tuple->TupleDataLen < 10) + return -1; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + + v2->vers = p[0]; + v2->comply = p[1]; + v2->dindex = le16toh(*(u_short *) (p + 2)); + v2->vspec8 = p[6]; + v2->vspec9 = p[7]; + v2->nhdr = p[8]; + p += 9; + return parse_strings(p, q, 2, v2->str, &v2->vendor, NULL); +} + +/*====================================================================*/ + +static int parse_org(tuple_t * tuple, cistpl_org_t * org) +{ + u_char *p, *q; + int i; + + p = tuple->TupleData; + q = p + tuple->TupleDataLen; + if (p == q) + return -1; + org->data_org = *p; + if (++p == q) + return -1; + for (i = 0; i < 30; i++) { + org->desc[i] = *p; + if (*p == '\0') + break; + if (++p == q) + return -1; + } + return 0; +} + +/*====================================================================*/ + +static int parse_format(tuple_t * tuple, cistpl_format_t * fmt) +{ + u_char *p; + + if (tuple->TupleDataLen < 10) + return -1; + + p = tuple->TupleData; + + fmt->type = p[0]; + fmt->edc = p[1]; + fmt->offset = le32toh(*(u_int *) (p + 2)); + fmt->length = le32toh(*(u_int *) (p + 6)); + + return 0; +} + +/*====================================================================*/ + +static int parse_tuple(tuple_t * tuple, cisparse_t * parse) +{ + int ret = 0; + + if (tuple->TupleDataLen > tuple->TupleDataMax) + return -1; + switch (tuple->TupleCode) { + case CISTPL_DEVICE: + case CISTPL_DEVICE_A: + ret = parse_device(tuple, &parse->device); + break; + case CISTPL_BAR: + ret = parse_bar(tuple, &parse->bar); + break; + case CISTPL_CONFIG_CB: + ret = parse_config_cb(tuple, &parse->config); + break; + case CISTPL_CFTABLE_ENTRY_CB: + ret = parse_cftable_entry_cb(tuple, &parse->cftable_entry_cb); + break; + case CISTPL_CHECKSUM: + ret = parse_checksum(tuple, &parse->checksum); + break; + case CISTPL_LONGLINK_A: + case CISTPL_LONGLINK_C: + ret = parse_longlink(tuple, &parse->longlink); + break; + case CISTPL_LONGLINK_MFC: + ret = parse_longlink_mfc(tuple, &parse->longlink_mfc); + break; + case CISTPL_VERS_1: + ret = parse_vers_1(tuple, &parse->version_1); + break; + case CISTPL_ALTSTR: + ret = parse_altstr(tuple, &parse->altstr); + break; + case CISTPL_JEDEC_A: + case CISTPL_JEDEC_C: + ret = parse_jedec(tuple, &parse->jedec); + break; + case CISTPL_MANFID: + ret = parse_manfid(tuple, &parse->manfid); + break; + case CISTPL_FUNCID: + ret = parse_funcid(tuple, &parse->funcid); + break; + case CISTPL_FUNCE: + ret = parse_funce(tuple, &parse->funce); + break; + case CISTPL_CONFIG: + ret = parse_config(tuple, &parse->config); + break; + case CISTPL_CFTABLE_ENTRY: + ret = parse_cftable_entry(tuple, &parse->cftable_entry); + break; + case CISTPL_DEVICE_GEO: + case CISTPL_DEVICE_GEO_A: + ret = parse_device_geo(tuple, &parse->device_geo); + break; + case CISTPL_VERS_2: + ret = parse_vers_2(tuple, &parse->vers_2); + break; + case CISTPL_ORG: + ret = parse_org(tuple, &parse->org); + break; + case CISTPL_FORMAT: + case CISTPL_FORMAT_A: + ret = parse_format(tuple, &parse->format); + break; + case CISTPL_NO_LINK: + case CISTPL_LINKTARGET: + ret = 0; + break; + case CISTPL_END: + ret = 0; + break; + default: + ret = -1; + break; + } + return ret; +} + +/*====================================================================*/ + +#define MAX_SOCKS 8 + +int main(int argc, char *argv[]) +{ + int i, fd; + tuple_parse_t tuple_parse; + int optch, errflg, first; + char *infile = NULL; + + errflg = 0; + while ((optch = getopt(argc, argv, "vi:")) != -1) { + switch (optch) { + case 'v': + verbose = 1; + break; + default: + errflg = 1; + break; + } + } + if (errflg || (optind > argc - 1)) { + fprintf(stderr, "usage: %s [-v] infile\n", argv[0]); + exit(EXIT_FAILURE); + } + + for (i = 0; optind + i < argc; i++) { + infile = argv[optind + i]; + + nfn = cur = 0; + indent[0] = '\0'; + fd = open(infile, O_RDONLY); + if (fd < 0) { + perror("open()"); + return -1; + } + + if (!verbose && (i > 0)) + putchar('\n'); + + tuple_parse.tuple.TupleDataMax = sizeof(tuple_parse.data); + tuple_parse.tuple.Attributes = + TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON; + tuple_parse.tuple.DesiredTuple = RETURN_FIRST_TUPLE; + tuple_parse.tuple.TupleOffset = 0; + tuple_parse.tuple.TupleData = tuple_parse.data; + + for (first = 1;; first = 0) { + if (get_tuple_buf(fd, &tuple_parse.tuple, first) != 0) + break; + if (verbose) + print_tuple(&tuple_parse); + if (parse_tuple(&tuple_parse.tuple, &tuple_parse.parse)) + printf("%sparse error\n", indent); + else + print_parse(&tuple_parse); + if (verbose) + putchar('\n'); + if (tuple_parse.tuple.TupleCode == CISTPL_END) + break; + } + + if (!verbose && (nfn > 0)) + printf("%s}\n", indent + 2); + } + + return 0; +} -- 1.7.1 From w.sang at pengutronix.de Sat Sep 25 03:33:42 2010 From: w.sang at pengutronix.de (Wolfram Sang) Date: Sat, 25 Sep 2010 09:33:42 +0200 Subject: [PATCH 4/5] Add an utility to parse CIS files to readable form In-Reply-To: <1285346965-23499-5-git-send-email-dbaryshkov@gmail.com> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> <1285346965-23499-5-git-send-email-dbaryshkov@gmail.com> Message-ID: <20100925073342.GA31947@pengutronix.de> On Fri, Sep 24, 2010 at 08:49:24PM +0400, Dmitry Eremin-Solenikov wrote: > Import from pcmcia-cs project a dump_cis utility. It reads > machine-readable CIS file and output text representation (which can be > processed by mkcis utility). > > Signed-off-by: Dmitry Eremin-Solenikov pcmciautils also include dump_cis ("make debugtools"). As this version is probably better maintained, we probably should not introduce a split here? Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From linux at dominikbrodowski.net Sat Sep 25 08:00:23 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sat, 25 Sep 2010 14:00:23 +0200 Subject: [PATCH 4/5] Add an utility to parse CIS files to readable form In-Reply-To: <20100925073342.GA31947@pengutronix.de> References: <1285346965-23499-1-git-send-email-dbaryshkov@gmail.com> <1285346965-23499-5-git-send-email-dbaryshkov@gmail.com> <20100925073342.GA31947@pengutronix.de> Message-ID: <20100925120023.GA4223@isilmar-3.linta.de> Hey, On Sat, Sep 25, 2010 at 09:33:42AM +0200, Wolfram Sang wrote: > On Fri, Sep 24, 2010 at 08:49:24PM +0400, Dmitry Eremin-Solenikov wrote: > > Import from pcmcia-cs project a dump_cis utility. It reads > > machine-readable CIS file and output text representation (which can be > > processed by mkcis utility). > > > > Signed-off-by: Dmitry Eremin-Solenikov > > pcmciautils also include dump_cis ("make debugtools"). As this version is > probably better maintained, we probably should not introduce a split here? dump_cis did not receive a single meaningful change, and I do not expect one, so I wouldn't fear a split/fork here. Best, Dominik From rahul.ruikar at gmail.com Sun Sep 26 07:30:29 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Sun, 26 Sep 2010 17:00:29 +0530 Subject: [PATCH] pcmcia: pd6729: Fix error path Message-ID: <1285500629-6024-1-git-send-email-rahul.ruikar@gmail.com> In error return path call pci_disable_device() which was enabled earlier. Signed-off-by: Rahul Ruikar --- drivers/pcmcia/pd6729.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index b8a869a..deef665 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -646,7 +646,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, if (!pci_resource_start(dev, 0)) { dev_warn(&dev->dev, "refusing to load the driver as the " "io_base is NULL.\n"); - goto err_out_free_mem; + goto err_out_disable; } dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " -- 1.7.2.3 From linux at dominikbrodowski.net Sun Sep 26 09:54:44 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 26 Sep 2010 15:54:44 +0200 Subject: [PATCH] pcmcia: pd6729: Fix error path In-Reply-To: <1285500629-6024-1-git-send-email-rahul.ruikar@gmail.com> References: <1285500629-6024-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: <20100926135444.GA32380@comet.dominikbrodowski.net> On Sun, Sep 26, 2010 at 05:00:29PM +0530, Rahul Ruikar wrote: > In error return path > call pci_disable_device() which was enabled earlier. > > Signed-off-by: Rahul Ruikar Applied, thanks! Dominik From linux at dominikbrodowski.net Sun Sep 26 10:03:26 2010 From: linux at dominikbrodowski.net (Dominik Brodowski) Date: Sun, 26 Sep 2010 16:03:26 +0200 Subject: [git pull] PCMCIA bugfixes for 2.6.36-rc5 Message-ID: <20100926140326.GA859@comet.dominikbrodowski.net> Linus, in order to get some more serial devices to work, and to fix an error path in a socet driver, please pull from git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git urgent Thanks, Dominik Dominik Brodowski (1): pcmcia: preserve configuration information if request_io fails partly Rahul Ruikar (1): pcmcia: pd6729: Fix error path drivers/pcmcia/pcmcia_resource.c | 6 ++++++ drivers/pcmcia/pd6729.c | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) From rahul.ruikar at gmail.com Sun Sep 26 12:41:33 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Sun, 26 Sep 2010 22:11:33 +0530 Subject: [PATCH] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device Message-ID: <1285519293-6764-1-git-send-email-rahul.ruikar@gmail.com> - pci_release_regions called during return error path. - pci_disable_device called for cases where earlier it was enabled. - code duplication avoided/reduced by adding resource release at goto statements. Signed-off-by: Rahul Ruikar --- drivers/pcmcia/vrc4173_cardu.c | 56 +++++++++++++++++++++++++++------------- 1 files changed, 38 insertions(+), 18 deletions(-) diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c index 9b3c158..5f43a72 100644 --- a/drivers/pcmcia/vrc4173_cardu.c +++ b/drivers/pcmcia/vrc4173_cardu.c @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, return err; start = pci_resource_start(dev, 0); - if (start == 0) - return -ENODEV; + if (start == 0) { + ret = -ENODEV; + goto disable; + } len = pci_resource_len(dev, 0); - if (len == 0) - return -ENODEV; + if (len == 0) { + ret = -ENODEV; + goto disable; + } - if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) - return -EBUSY; + flags = pci_resource_flags(dev, 0); + if ((flags & IORESOURCE_MEM) == 0) { + ret = -EBUSY; + goto disable; + } - if ((err = pci_request_regions(dev, socket->name)) < 0) - return err; + err = pci_request_regions(dev, socket->name); + if (err < 0) { + ret = err; + goto disable; + } socket->base = ioremap(start, len); - if (socket->base == NULL) - return -ENODEV; + if (socket->base == NULL) { + ret = -ENODEV; + goto release; + } socket->dev = dev; socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); if (socket->pcmcia_socket == NULL) { - iounmap(socket->base); - socket->base = NULL; - return -ENOMEM; + ret = -ENOMEM; + goto unmap; } if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { - pcmcia_unregister_socket(socket->pcmcia_socket); - socket->pcmcia_socket = NULL; - iounmap(socket->base); - socket->base = NULL; - return -EBUSY; + ret = -EBUSY; + goto unregister; } printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); return 0; + +unregister: + pcmcia_unregister_socket(socket->pcmcia_socket); + socket->pcmcia_socket = NULL; +unmap: + iounmap(socket->base); + socket->base = NULL; +release: + pci_release_regions(dev); +disable: + pci_disable_device(dev); + return ret; } static int __devinit vrc4173_cardu_setup(char *options) -- 1.7.2.3 From rahul.ruikar at gmail.com Sun Sep 26 12:45:18 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Sun, 26 Sep 2010 22:15:18 +0530 Subject: [PATCH] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device In-Reply-To: <1285519293-6764-1-git-send-email-rahul.ruikar@gmail.com> References: <1285519293-6764-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: somethings missed... i will resend this patch. - Rahul Ruikar On 26 September 2010 22:11, Rahul Ruikar wrote: > - pci_release_regions called during return error path. > - pci_disable_device called for cases where earlier it was enabled. > - code duplication avoided/reduced by adding resource release at goto statements. > > Signed-off-by: Rahul Ruikar > --- > ?drivers/pcmcia/vrc4173_cardu.c | ? 56 +++++++++++++++++++++++++++------------- > ?1 files changed, 38 insertions(+), 18 deletions(-) > > diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c > index 9b3c158..5f43a72 100644 > --- a/drivers/pcmcia/vrc4173_cardu.c > +++ b/drivers/pcmcia/vrc4173_cardu.c > @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, > ? ? ? ? ? ? ? ?return err; > > ? ? ? ?start = pci_resource_start(dev, 0); > - ? ? ? if (start == 0) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (start == 0) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > ? ? ? ?len = pci_resource_len(dev, 0); > - ? ? ? if (len == 0) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (len == 0) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > - ? ? ? if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) > - ? ? ? ? ? ? ? return -EBUSY; > + ? ? ? flags = pci_resource_flags(dev, 0); > + ? ? ? if ((flags & IORESOURCE_MEM) == 0) { > + ? ? ? ? ? ? ? ret = -EBUSY; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > - ? ? ? if ((err = pci_request_regions(dev, socket->name)) < 0) > - ? ? ? ? ? ? ? return err; > + ? ? ? err = pci_request_regions(dev, socket->name); > + ? ? ? if (err < 0) { > + ? ? ? ? ? ? ? ret = err; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > ? ? ? ?socket->base = ioremap(start, len); > - ? ? ? if (socket->base == NULL) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (socket->base == NULL) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto release; > + ? ? ? } > > ? ? ? ?socket->dev = dev; > > ? ? ? ?socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); > ? ? ? ?if (socket->pcmcia_socket == NULL) { > - ? ? ? ? ? ? ? iounmap(socket->base); > - ? ? ? ? ? ? ? socket->base = NULL; > - ? ? ? ? ? ? ? return -ENOMEM; > + ? ? ? ? ? ? ? ret = ?-ENOMEM; > + ? ? ? ? ? ? ? goto unmap; > ? ? ? ?} > > ? ? ? ?if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { > - ? ? ? ? ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); > - ? ? ? ? ? ? ? socket->pcmcia_socket = NULL; > - ? ? ? ? ? ? ? iounmap(socket->base); > - ? ? ? ? ? ? ? socket->base = NULL; > - ? ? ? ? ? ? ? return -EBUSY; > + ? ? ? ? ? ? ? ret = -EBUSY; > + ? ? ? ? ? ? ? goto unregister; > ? ? ? ?} > > ? ? ? ?printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); > > ? ? ? ?return 0; > + > +unregister: > + ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); > + ? ? ? socket->pcmcia_socket = NULL; > +unmap: > + ? ? ? iounmap(socket->base); > + ? ? ? socket->base = NULL; > +release: > + ? ? ? pci_release_regions(dev); > +disable: > + ? ? ? pci_disable_device(dev); > + ? ? ? return ret; > ?} > > ?static int __devinit vrc4173_cardu_setup(char *options) > -- > 1.7.2.3 > > From rahul.ruikar at gmail.com Sun Sep 26 12:50:30 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Sun, 26 Sep 2010 22:20:30 +0530 Subject: [RESEND] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device Message-ID: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> - pci_release_regions called during return error path. - pci_disable_device called for cases where earlier it was enabled. - code duplication avoided/reduced by adding resource release at goto statements. Signed-off-by: Rahul Ruikar --- drivers/pcmcia/vrc4173_cardu.c | 58 +++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 19 deletions(-) diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c index 9b3c158..c6d36b3 100644 --- a/drivers/pcmcia/vrc4173_cardu.c +++ b/drivers/pcmcia/vrc4173_cardu.c @@ -461,7 +461,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, { vrc4173_socket_t *socket; unsigned long start, len, flags; - int slot, err; + int slot, err, ret; slot = vrc4173_cardu_slots++; socket = &cardu_sockets[slot]; @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, return err; start = pci_resource_start(dev, 0); - if (start == 0) - return -ENODEV; + if (start == 0) { + ret = -ENODEV; + goto disable; + } len = pci_resource_len(dev, 0); - if (len == 0) - return -ENODEV; + if (len == 0) { + ret = -ENODEV; + goto disable; + } - if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) - return -EBUSY; + flags = pci_resource_flags(dev, 0); + if ((flags & IORESOURCE_MEM) == 0) { + ret = -EBUSY; + goto disable; + } - if ((err = pci_request_regions(dev, socket->name)) < 0) - return err; + err = pci_request_regions(dev, socket->name); + if (err < 0) { + ret = err; + goto disable; + } socket->base = ioremap(start, len); - if (socket->base == NULL) - return -ENODEV; + if (socket->base == NULL) { + ret = -ENODEV; + goto release; + } socket->dev = dev; socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); if (socket->pcmcia_socket == NULL) { - iounmap(socket->base); - socket->base = NULL; - return -ENOMEM; + ret = -ENOMEM; + goto unmap; } if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { - pcmcia_unregister_socket(socket->pcmcia_socket); - socket->pcmcia_socket = NULL; - iounmap(socket->base); - socket->base = NULL; - return -EBUSY; + ret = -EBUSY; + goto unregister; } printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); return 0; + +unregister: + pcmcia_unregister_socket(socket->pcmcia_socket); + socket->pcmcia_socket = NULL; +unmap: + iounmap(socket->base); + socket->base = NULL; +release: + pci_release_regions(dev); +disable: + pci_disable_device(dev); + return ret; } static int __devinit vrc4173_cardu_setup(char *options) -- 1.7.2.3 From rahul.ruikar at gmail.com Sun Sep 26 13:11:43 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Sun, 26 Sep 2010 22:41:43 +0530 Subject: [RESEND] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device In-Reply-To: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> References: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: patchwork link not showing latest changes of RESEND patch. hence attaching in mail https://patchwork.kernel.org/patch/210152/ - Rahul Ruikar On 26 September 2010 22:20, Rahul Ruikar wrote: > - pci_release_regions called during return error path. > - pci_disable_device called for cases where earlier it was enabled. > - code duplication avoided/reduced by adding resource release at goto statements. > > Signed-off-by: Rahul Ruikar > --- > ?drivers/pcmcia/vrc4173_cardu.c | ? 58 +++++++++++++++++++++++++++------------- > ?1 files changed, 39 insertions(+), 19 deletions(-) > > diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c > index 9b3c158..c6d36b3 100644 > --- a/drivers/pcmcia/vrc4173_cardu.c > +++ b/drivers/pcmcia/vrc4173_cardu.c > @@ -461,7 +461,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, > ?{ > ? ? ? ?vrc4173_socket_t *socket; > ? ? ? ?unsigned long start, len, flags; > - ? ? ? int slot, err; > + ? ? ? int slot, err, ret; > > ? ? ? ?slot = vrc4173_cardu_slots++; > ? ? ? ?socket = &cardu_sockets[slot]; > @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, > ? ? ? ? ? ? ? ?return err; > > ? ? ? ?start = pci_resource_start(dev, 0); > - ? ? ? if (start == 0) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (start == 0) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > ? ? ? ?len = pci_resource_len(dev, 0); > - ? ? ? if (len == 0) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (len == 0) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > - ? ? ? if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) > - ? ? ? ? ? ? ? return -EBUSY; > + ? ? ? flags = pci_resource_flags(dev, 0); > + ? ? ? if ((flags & IORESOURCE_MEM) == 0) { > + ? ? ? ? ? ? ? ret = -EBUSY; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > - ? ? ? if ((err = pci_request_regions(dev, socket->name)) < 0) > - ? ? ? ? ? ? ? return err; > + ? ? ? err = pci_request_regions(dev, socket->name); > + ? ? ? if (err < 0) { > + ? ? ? ? ? ? ? ret = err; > + ? ? ? ? ? ? ? goto disable; > + ? ? ? } > > ? ? ? ?socket->base = ioremap(start, len); > - ? ? ? if (socket->base == NULL) > - ? ? ? ? ? ? ? return -ENODEV; > + ? ? ? if (socket->base == NULL) { > + ? ? ? ? ? ? ? ret = -ENODEV; > + ? ? ? ? ? ? ? goto release; > + ? ? ? } > > ? ? ? ?socket->dev = dev; > > ? ? ? ?socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); > ? ? ? ?if (socket->pcmcia_socket == NULL) { > - ? ? ? ? ? ? ? iounmap(socket->base); > - ? ? ? ? ? ? ? socket->base = NULL; > - ? ? ? ? ? ? ? return -ENOMEM; > + ? ? ? ? ? ? ? ret = ?-ENOMEM; > + ? ? ? ? ? ? ? goto unmap; > ? ? ? ?} > > ? ? ? ?if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { > - ? ? ? ? ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); > - ? ? ? ? ? ? ? socket->pcmcia_socket = NULL; > - ? ? ? ? ? ? ? iounmap(socket->base); > - ? ? ? ? ? ? ? socket->base = NULL; > - ? ? ? ? ? ? ? return -EBUSY; > + ? ? ? ? ? ? ? ret = -EBUSY; > + ? ? ? ? ? ? ? goto unregister; > ? ? ? ?} > > ? ? ? ?printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); > > ? ? ? ?return 0; > + > +unregister: > + ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); > + ? ? ? socket->pcmcia_socket = NULL; > +unmap: > + ? ? ? iounmap(socket->base); > + ? ? ? socket->base = NULL; > +release: > + ? ? ? pci_release_regions(dev); > +disable: > + ? ? ? pci_disable_device(dev); > + ? ? ? return ret; > ?} > > ?static int __devinit vrc4173_cardu_setup(char *options) > -- > 1.7.2.3 > > -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-pcmcia-vrc4173_cardu-Fix-error-path-for-pci_release_.patch Type: application/octet-stream Size: 2927 bytes Desc: not available URL: From zachso at arcor.de Tue Sep 28 11:39:18 2010 From: zachso at arcor.de (Arne Zachlod) Date: Tue, 28 Sep 2010 16:39:18 +0100 Subject: bug in addressspace? In-Reply-To: References: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: <4CA20C26.8040801@arcor.de> Hello! currently I'm working on my own CardBus card and I test and debug it with your beautiful tools. I have seen that the Linux-system freezes if I plug in my card if I give the card these initial values for address spaces: BAR0 - 0x0000 9011 BAR1 - 0x0000 9019 BAR2 - 0x0000 9021 BAR3 - 0x0000 9029 BAR4 - 0x0000 9031 BAR5 - 0x0000 9001 I know these values are completely bullsh*t but i think a system shouldn't get unstable ore freeze because you plug in something thats not covered by the specs. I tested this with kernel 2.6.35.6. I don't know which other informations you need, so please give me a list or something like this. If you like I could show you some kind of LogicAnalyzer output of the situation (you can probably see there what data got transferred). dmesg and lspci is not possible because the complete PC freezes in that situation. Regards, Arne From rahul.ruikar at gmail.com Tue Sep 28 23:34:22 2010 From: rahul.ruikar at gmail.com (Rahul Ruikar) Date: Wed, 29 Sep 2010 09:04:22 +0530 Subject: [RESEND] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device In-Reply-To: References: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: anyone to review / accept ??? I could not find any particular maintainer for this patch through "./scripts/get_maintainer.pl" except these 2 lists. Regards, Rahul Ruikar On 26 September 2010 22:41, Rahul Ruikar wrote: > patchwork link not showing latest changes of RESEND patch. hence > attaching in mail > https://patchwork.kernel.org/patch/210152/ > > - Rahul Ruikar > > > > > > On 26 September 2010 22:20, Rahul Ruikar wrote: >> - pci_release_regions called during return error path. >> - pci_disable_device called for cases where earlier it was enabled. >> - code duplication avoided/reduced by adding resource release at goto statements. >> >> Signed-off-by: Rahul Ruikar >> --- >> ?drivers/pcmcia/vrc4173_cardu.c | ? 58 +++++++++++++++++++++++++++------------- >> ?1 files changed, 39 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c >> index 9b3c158..c6d36b3 100644 >> --- a/drivers/pcmcia/vrc4173_cardu.c >> +++ b/drivers/pcmcia/vrc4173_cardu.c >> @@ -461,7 +461,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, >> ?{ >> ? ? ? ?vrc4173_socket_t *socket; >> ? ? ? ?unsigned long start, len, flags; >> - ? ? ? int slot, err; >> + ? ? ? int slot, err, ret; >> >> ? ? ? ?slot = vrc4173_cardu_slots++; >> ? ? ? ?socket = &cardu_sockets[slot]; >> @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, >> ? ? ? ? ? ? ? ?return err; >> >> ? ? ? ?start = pci_resource_start(dev, 0); >> - ? ? ? if (start == 0) >> - ? ? ? ? ? ? ? return -ENODEV; >> + ? ? ? if (start == 0) { >> + ? ? ? ? ? ? ? ret = -ENODEV; >> + ? ? ? ? ? ? ? goto disable; >> + ? ? ? } >> >> ? ? ? ?len = pci_resource_len(dev, 0); >> - ? ? ? if (len == 0) >> - ? ? ? ? ? ? ? return -ENODEV; >> + ? ? ? if (len == 0) { >> + ? ? ? ? ? ? ? ret = -ENODEV; >> + ? ? ? ? ? ? ? goto disable; >> + ? ? ? } >> >> - ? ? ? if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) >> - ? ? ? ? ? ? ? return -EBUSY; >> + ? ? ? flags = pci_resource_flags(dev, 0); >> + ? ? ? if ((flags & IORESOURCE_MEM) == 0) { >> + ? ? ? ? ? ? ? ret = -EBUSY; >> + ? ? ? ? ? ? ? goto disable; >> + ? ? ? } >> >> - ? ? ? if ((err = pci_request_regions(dev, socket->name)) < 0) >> - ? ? ? ? ? ? ? return err; >> + ? ? ? err = pci_request_regions(dev, socket->name); >> + ? ? ? if (err < 0) { >> + ? ? ? ? ? ? ? ret = err; >> + ? ? ? ? ? ? ? goto disable; >> + ? ? ? } >> >> ? ? ? ?socket->base = ioremap(start, len); >> - ? ? ? if (socket->base == NULL) >> - ? ? ? ? ? ? ? return -ENODEV; >> + ? ? ? if (socket->base == NULL) { >> + ? ? ? ? ? ? ? ret = -ENODEV; >> + ? ? ? ? ? ? ? goto release; >> + ? ? ? } >> >> ? ? ? ?socket->dev = dev; >> >> ? ? ? ?socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); >> ? ? ? ?if (socket->pcmcia_socket == NULL) { >> - ? ? ? ? ? ? ? iounmap(socket->base); >> - ? ? ? ? ? ? ? socket->base = NULL; >> - ? ? ? ? ? ? ? return -ENOMEM; >> + ? ? ? ? ? ? ? ret = ?-ENOMEM; >> + ? ? ? ? ? ? ? goto unmap; >> ? ? ? ?} >> >> ? ? ? ?if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { >> - ? ? ? ? ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); >> - ? ? ? ? ? ? ? socket->pcmcia_socket = NULL; >> - ? ? ? ? ? ? ? iounmap(socket->base); >> - ? ? ? ? ? ? ? socket->base = NULL; >> - ? ? ? ? ? ? ? return -EBUSY; >> + ? ? ? ? ? ? ? ret = -EBUSY; >> + ? ? ? ? ? ? ? goto unregister; >> ? ? ? ?} >> >> ? ? ? ?printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); >> >> ? ? ? ?return 0; >> + >> +unregister: >> + ? ? ? pcmcia_unregister_socket(socket->pcmcia_socket); >> + ? ? ? socket->pcmcia_socket = NULL; >> +unmap: >> + ? ? ? iounmap(socket->base); >> + ? ? ? socket->base = NULL; >> +release: >> + ? ? ? pci_release_regions(dev); >> +disable: >> + ? ? ? pci_disable_device(dev); >> + ? ? ? return ret; >> ?} >> >> ?static int __devinit vrc4173_cardu_setup(char *options) >> -- >> 1.7.2.3 >> >> > From yuasa at linux-mips.org Wed Sep 29 04:47:26 2010 From: yuasa at linux-mips.org (Yuasa Yoichi) Date: Wed, 29 Sep 2010 17:47:26 +0900 Subject: [RESEND] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device In-Reply-To: References: <1285519830-6826-1-git-send-email-rahul.ruikar@gmail.com> Message-ID: Hi, 2010/9/29 Rahul Ruikar : > anyone to review / accept ??? > I could not find any particular maintainer for this patch through > "./scripts/get_maintainer.pl" except these 2 lists. I reviewed it. It's OK. Yoichi