From owner-freebsd-mobile Fri Feb 25 23: 9: 4 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from oxygen.yy.ics.keio.ac.jp (oxygen.yy.ics.keio.ac.jp [131.113.47.3]) by hub.freebsd.org (Postfix) with ESMTP id 70E0C37BF0B for ; Fri, 25 Feb 2000 23:08:54 -0800 (PST) (envelope-from sanpei@sanpei.org) Received: from lavender.yy.cs.keio.ac.jp (lavender.rad.cc.keio.ac.jp [131.113.16.115]) by oxygen.yy.ics.keio.ac.jp (8.9.3+3.2W/3.7W) with ESMTP id QAA23317; Sat, 26 Feb 2000 16:08:48 +0900 (JST) (envelope-from sanpei@sanpei.org) Received: (from sanpei@localhost) by lavender.yy.cs.keio.ac.jp (8.9.3/3.7W) id QAA09602; Sat, 26 Feb 2000 16:08:48 +0900 (JST) Message-Id: <200002260708.QAA09602@lavender.yy.cs.keio.ac.jp> To: imp@village.org Cc: freebsd-mobile@FreeBSD.ORG, sos@freebsd.dk, ambrisko@whistle.com Subject: Re: Update to pccard ata changes (removal support) In-Reply-To: Your message of "Fri, 25 Feb 2000 22:56:08 -0700" References: <200002260556.WAA55601@harmony.village.org> X-Mailer: Mew version 1.70 on Emacs 19.34.1 / Mule 2.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 26 Feb 2000 16:08:47 +0900 From: MIHIRA Sanpei Yoshiro Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >: Next, I think we need to merge function 'fixed_disk/serial' from >: PAO pccardd. Does someone have any plan or experimental code? > >No plans from me. I think it is a good thing to try to port, even if >it isn't done in time for 4.0. I ported ``function 'fixed_disk/serial''' code from PAO3. I tested below PC-Card: PC-Card Modem - AIWA PV-JF5601 OK - AIWA PV-JF56E1 OK - TDK Modem DF5600/J OK PC-Card Modem(ISDN/serial) - IO DATA PCINS II-128 OK Flash ATA - IBM Flash ATA 10MB(Richo Flash ATA 10MB) OK - Non-brand 32MB Compact Flash NG (it needs to change config index auto--> 0x1, I will post about this card) I hope to check my code. Thank you --- MIHIRA Sanpei Yoshiro Yokohama, Japan. --- /usr/src/etc/pccard.conf.sample Sat Feb 26 10:46:21 2000 +++ src/etc/pccard.conf.sample Sat Feb 26 15:48:45 2000 @@ -882,3 +882,38 @@ insert /etc/pccard_ether $device remove logger -t pccard:$device -s Melco Airconnect removed remove /sbin/ifconfig $device delete + +# ------------------------------------------------------------------- +# +# "Wildcard" entries +# +# ------------------------------------------------------------------- + +# GENERIC PCMCIA modem +function serial + config auto "sio3" ? +# config 0x23 "sio3" ? # alternative definitions +# config 0x21 "sio3" ? # ......... +# config 0x22 "sio3" ? +# config 0x23 "sio3" pio +# config 0x21 "sio3" pio +# config 0x22 "sio3" pio +# config 0x23 "sio3" 5 +# config 0x21 "sio3" 5 +# config 0x22 "sio3" 5 +# reset 100 # default + reset 1000 # safety reset time +# reset 10000 # for unstable cards + insert logger -t pccard:$device -s PCMCIA Modem inserted + remove logger -t pccard:$device -s PCMCIA Modem removed + +# GENERIC Flash ATA / ATA HDD +function fixed_disk +# config auto "ata2" 15 +# config auto "ata2" ? +# config 0x03 "ata2" 15 +# config 0x03 "ata2" ? + config auto "ata2" ? iosize 16 +# config auto "ata2" ? iosize 16 + insert logger -t pccard:$device -s Flash ATA / ATA HDD inserted + remove logger -t pccard:$device -s Flash ATA / ATA HDD removed diff -ur /usr/src/usr.sbin/pccard/pccardd/cardd.c src/usr.sbin/pccard/pccardd/cardd.c --- /usr/src/usr.sbin/pccard/pccardd/cardd.c Sat Feb 26 10:48:41 2000 +++ src/usr.sbin/pccard/pccardd/cardd.c Sat Feb 26 15:41:07 2000 @@ -229,10 +229,36 @@ #if 0 dumpcis(sp->cis); #endif - for (cp = cards; cp; cp = cp->next) - if (strncmp(cp->manuf, sp->cis->manuf, CIS_MAXSTR) == 0 && - strncmp(cp->version, sp->cis->vers, CIS_MAXSTR) == 0) + for (cp = cards; cp; cp = cp->next) { + switch (cp->deftype) { + case DT_VERS: + if (strncmp(cp->manuf, sp->cis->manuf, CIS_MAXSTR) == 0 && + strncmp(cp->version, sp->cis->vers, CIS_MAXSTR) == 0) { + logmsg("Card \"%s\"(\"%s\") " + "matched \"%s\" (\"%s\") ", + sp->cis->manuf, sp->cis->vers, + cp->manuf, cp->version + ); + goto escape; + } break; + case DT_FUNC: + if (cp->func_id == sp->cis->func_id1) { + logmsg("Card \"%s\"(\"%s\") " + "[%s] [%s] " + "has function ID %d\n", + sp->cis->manuf, sp->cis->vers, + sp->cis->add_info1, sp->cis->add_info2, + cp->func_id); + goto escape; + } + break; + default: + logmsg("Unknown deftype %d\n", cp->deftype); + die("cardd.c:card_inserted()"); + } + } +escape: sp->card = cp; #if 0 reset_slot(sp); diff -ur /usr/src/usr.sbin/pccard/pccardd/cardd.h src/usr.sbin/pccard/pccardd/cardd.h --- /usr/src/usr.sbin/pccard/pccardd/cardd.h Sat Feb 26 10:48:41 2000 +++ src/usr.sbin/pccard/pccardd/cardd.h Sat Feb 26 15:41:24 2000 @@ -67,6 +67,8 @@ struct card *next; char *manuf; char *version; + u_char func_id; + int deftype; struct ether *ether; /* For net cards, ether at offset */ int reset_time; /* Reset time */ int iosize; /* I/O window size (ignore location) */ @@ -181,3 +183,5 @@ #define DEFAULT_INDEX 1 #define AUTO_INDEX 2 +#define DT_VERS 0 +#define DT_FUNC 1 diff -ur /usr/src/usr.sbin/pccard/pccardd/file.c src/usr.sbin/pccard/pccardd/file.c --- /usr/src/usr.sbin/pccard/pccardd/file.c Sat Feb 26 10:48:41 2000 +++ src/usr.sbin/pccard/pccardd/file.c Sat Feb 26 15:47:14 2000 @@ -57,6 +57,7 @@ "iosize", /* 12 */ "debuglevel", /* 13 */ "include", /* 14 */ + "function", /* 15 */ 0 }; @@ -74,6 +75,7 @@ #define KWD_IOSIZE 12 #define KWD_DEBUGLEVEL 13 #define KWD_INCLUDE 14 +#define KWD_FUNCTION 15 struct flags { char *name; @@ -88,6 +90,7 @@ static int keyword(char *); static int irq_tok(int); static int config_tok(unsigned char *); +static int func_tok(void); static int debuglevel_tok(int); static struct allocblk *ioblk_tok(int); static struct allocblk *memblk_tok(int); @@ -96,7 +99,7 @@ static void file_include(char *); static void addcmd(struct cmd **); -static void parse_card(void); +static void parse_card(int); /* * Read a file and parse the pcmcia configuration data. @@ -190,7 +193,11 @@ break; case KWD_CARD: /* Card definition. */ - parse_card(); + parse_card(DT_VERS); + break; + case KWD_FUNCTION: + /* Function definition. */ + parse_card(DT_FUNC); break; case KWD_DEBUGLEVEL: i = debuglevel_tok(0); @@ -212,7 +219,7 @@ * Parse a card definition. */ static void -parse_card(void) +parse_card(int deftype) { char *man, *vers, *tmp; unsigned char index_type; @@ -222,11 +229,25 @@ struct ether *ether; confp = 0; - man = newstr(next_tok()); - vers = newstr(next_tok()); cp = xmalloc(sizeof(*cp)); - cp->manuf = man; - cp->version = vers; + cp->deftype = deftype; + switch (deftype) { + case DT_VERS: + man = newstr(next_tok()); + vers = newstr(next_tok()); + cp->manuf = man; + cp->version = vers; + cp->func_id = 0; + break; + case DT_FUNC: + cp->manuf = ""; + cp->version = ""; + cp->func_id = (u_char) func_tok(); + break; + default: + fprintf(stderr, "parse_card: unknown deftype %d\n", deftype); + exit(1); + } cp->reset_time = 50; cp->next = cards; cards = cp; @@ -461,6 +482,21 @@ *index_type = NORMAL_INDEX; return num_tok(); } +/* + * Function ID token + */ +static int +func_tok(void) +{ + if (strcmp("serial", next_tok()) == 0) + return 2; + pusht = 1; + if (strcmp("fixed_disk", next_tok()) == 0) + return 4; + pusht = 1; + return num_tok(); +} + /* * debuglevel token. Must be between 0 and 9. diff -ur /usr/src/usr.sbin/pccard/pccardd/readcis.c src/usr.sbin/pccard/pccardd/readcis.c --- /usr/src/usr.sbin/pccard/pccardd/readcis.c Sat Dec 11 19:24:20 1999 +++ src/usr.sbin/pccard/pccardd/readcis.c Sat Feb 26 15:25:59 2000 @@ -47,6 +47,7 @@ static void device_desc(unsigned char *, int, struct dev_mem *); static void config_map(struct cis *, unsigned char *, int); static void cis_config(struct cis *, unsigned char *, int); +static void cis_func_id(struct cis *, unsigned char *, int); static struct tuple_list *read_one_tuplelist(int, int, off_t); static struct tuple_list *read_tuples(int); static struct tuple *find_tuple_in_list(struct tuple_list *, unsigned char); @@ -123,6 +124,10 @@ case CIS_CONFIG: /* 0x1B */ cis_config(cp, tp->data, tp->length); break; + case CIS_FUNC_ID: /* 0x21 */ + cis_func_id(cp, tp->data, tp->length); + break; + } } return (cp); @@ -180,6 +185,15 @@ strncpy(cp->add_info1, p, CIS_MAXSTR - 1); while (*p++); strncpy(cp->add_info2, p, CIS_MAXSTR - 1); +} +/* + * Fills in CIS function ID. + */ +static void +cis_func_id(struct cis *cp, unsigned char *p, int len) +{ + cp->func_id1 = *p++; + cp->func_id2 = *p++; } /* diff -ur /usr/src/usr.sbin/pccard/pccardd/readcis.h src/usr.sbin/pccard/pccardd/readcis.h --- /usr/src/usr.sbin/pccard/pccardd/readcis.h Sat Dec 11 19:24:20 1999 +++ src/usr.sbin/pccard/pccardd/readcis.h Sat Feb 26 14:50:52 2000 @@ -119,6 +119,7 @@ unsigned char last_config; unsigned char ccrs; unsigned long reg_addr; + unsigned char func_id1, func_id2; struct dev_mem attr_mem; struct dev_mem common_mem; struct cis_config *def_config; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message