Added "iosize" directive in /etc/pccard.conf
Allocate free I/O window with given size to card. (example) # IBM PCMCIA Ethernet I/II card "IBM Corp." "Ethernet" config 0x1 "ed0" ? iosize 32 ether 0xff0 (it's currently only useful for externalizing hacks for broken CIS cards, but it will play an important role with "function" directive I'm planninng to merge) Reviewed by: freebsd-mobile list Obtained from: PAO3's "cardio" directive
This commit is contained in:
parent
7592caf7fb
commit
7fdfe857ae
@ -389,12 +389,15 @@ assign_io(struct slot *sp)
|
||||
|
||||
/* Now look at I/O. */
|
||||
bzero(&sp->io, sizeof(sp->io));
|
||||
if (cisconf->iospace || (defconf && defconf->iospace)) {
|
||||
if (cisconf->iospace || (defconf && defconf->iospace)
|
||||
|| sp->card->iosize) {
|
||||
struct cis_config *cp;
|
||||
int iosize;
|
||||
|
||||
cp = cisconf;
|
||||
if (!cisconf->iospace)
|
||||
cp = defconf;
|
||||
iosize = sp->card->iosize;
|
||||
/*
|
||||
* If # of I/O lines decoded == 10, then card does its
|
||||
* own decoding.
|
||||
@ -403,16 +406,20 @@ assign_io(struct slot *sp)
|
||||
* If no address (but a length) is available, allocate
|
||||
* from the pool.
|
||||
*/
|
||||
if (cp->io) {
|
||||
if (iosize) {
|
||||
sp->io.addr = 0;
|
||||
sp->io.size = iosize;
|
||||
}
|
||||
else if (cp->io) {
|
||||
sp->io.addr = cp->io->addr;
|
||||
sp->io.size = cp->io->size;
|
||||
} else
|
||||
} else {
|
||||
/*
|
||||
* No I/O block, assume the address lines
|
||||
* decode gives the size.
|
||||
*/
|
||||
sp->io.size = 1 << cp->io_addr;
|
||||
|
||||
}
|
||||
if (sp->io.addr == 0) {
|
||||
int i = bit_fns(io_avail, IOPORTS, sp->io.size);
|
||||
|
||||
@ -422,6 +429,7 @@ assign_io(struct slot *sp)
|
||||
}
|
||||
bit_nclear(io_avail, sp->io.addr,
|
||||
sp->io.addr + sp->io.size - 1);
|
||||
sp->flags |= IO_ASSIGNED;
|
||||
|
||||
/* Set up the size to take into account the decode lines. */
|
||||
sp->io.cardaddr = cp->io_addr;
|
||||
@ -444,6 +452,7 @@ assign_io(struct slot *sp)
|
||||
#endif
|
||||
}
|
||||
sp->irq = sp->config->irq;
|
||||
sp->flags |= IRQ_ASSIGNED;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -498,8 +507,7 @@ setup_slot(struct slot *sp)
|
||||
lseek(sp->fd, offs + 2, SEEK_SET);
|
||||
write(sp->fd, &c, sizeof(c));
|
||||
}
|
||||
mem.window = 0;
|
||||
if (sp->mem.addr) {
|
||||
if (sp->flags & MEM_ASSIGNED) {
|
||||
mem.window = 0;
|
||||
mem.flags = sp->mem.flags | MDF_ACTIVE | MDF_16BITS;
|
||||
mem.start = (caddr_t) sp->mem.addr;
|
||||
@ -511,7 +519,7 @@ setup_slot(struct slot *sp)
|
||||
}
|
||||
}
|
||||
io.window = 0;
|
||||
if (sp->io.size) {
|
||||
if (sp->flags & IO_ASSIGNED) {
|
||||
io.flags = sp->io.flags;
|
||||
io.start = sp->io.addr;
|
||||
io.size = sp->io.size;
|
||||
@ -537,14 +545,14 @@ setup_slot(struct slot *sp)
|
||||
drv.unit = drvp->unit;
|
||||
drv.irqmask = 1 << sp->irq;
|
||||
drv.flags = 0x80;
|
||||
if (sp->mem.size) {
|
||||
if (sp->flags & MEM_ASSIGNED) {
|
||||
drv.mem = sp->mem.addr;
|
||||
drv.memsize = sp->mem.size;
|
||||
} else {
|
||||
drv.mem = 0;
|
||||
drv.memsize = 0;
|
||||
}
|
||||
if (sp->io.size)
|
||||
if (sp->flags & IO_ASSIGNED)
|
||||
drv.iobase = sp->io.addr;
|
||||
else
|
||||
drv.iobase = 0;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cardd.h,v 1.11 1998/02/27 08:19:24 hosokawa Exp $
|
||||
* $Id: cardd.h,v 1.12 1998/03/09 05:18:55 hosokawa Exp $
|
||||
*
|
||||
* Common include file for PCMCIA daemon
|
||||
*/
|
||||
@ -59,6 +59,7 @@ struct card {
|
||||
char *version;
|
||||
int ether; /* For net cards, ether at offset */
|
||||
int reset_time; /* Reset time */
|
||||
int iosize; /* I/O window size (ignore location) */
|
||||
struct card_config *config; /* List of configs */
|
||||
struct cmd *insert; /* Insert commands */
|
||||
struct cmd *remove; /* Remove commands */
|
||||
@ -109,10 +110,22 @@ struct slot {
|
||||
struct allocblk io; /* I/O block spec */
|
||||
struct allocblk mem; /* Memory block spec */
|
||||
int irq; /* Irq value */
|
||||
int flags; /* Resource assignment flags */
|
||||
};
|
||||
|
||||
EXTERN struct allocblk *pool_ioblks; /* I/O blocks in the pool */
|
||||
EXTERN struct allocblk *pool_mem; /* Memory in the pool */
|
||||
/*
|
||||
* Slot resource assignment/configuration flags
|
||||
*/
|
||||
#define IO_ASSIGNED 0x1
|
||||
#define MEM_ASSIGNED 0x2
|
||||
#define IRQ_ASSIGNED 0x4
|
||||
#define EADDR_CONFIGED 0x8
|
||||
#define WL_CONFIGED 0x10
|
||||
#define AFLAGS (IO_ASSIGNED | MEM_ASSIGNED | IRQ_ASSIGNED)
|
||||
#define CFLAGS (EADDR_CONFIGED | WL_CONFIGED)
|
||||
|
||||
EXTERN struct allocblk *pool_ioblks; /* I/O blocks in the pool */
|
||||
EXTERN struct allocblk *pool_mem; /* Memory in the pool */
|
||||
EXTERN int pool_irq[16]; /* IRQ allocations */
|
||||
EXTERN struct driver *drivers; /* List of drivers */
|
||||
EXTERN struct card *cards;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: file.c,v 1.17 1999/06/17 21:07:58 markm Exp $";
|
||||
"$Id: file.c,v 1.18 1999/07/15 03:04:31 imp Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -52,6 +52,7 @@ static char *keys[] = {
|
||||
"ether", /* 9 */
|
||||
"insert", /* 10 */
|
||||
"remove", /* 11 */
|
||||
"iosize", /* 12 */
|
||||
0
|
||||
};
|
||||
|
||||
@ -66,6 +67,7 @@ static char *keys[] = {
|
||||
#define KWD_ETHER 9
|
||||
#define KWD_INSERT 10
|
||||
#define KWD_REMOVE 11
|
||||
#define KWD_IOSIZE 12
|
||||
|
||||
struct flags {
|
||||
char *name;
|
||||
@ -82,6 +84,7 @@ static int irq_tok(int);
|
||||
static struct allocblk *ioblk_tok(int);
|
||||
static struct allocblk *memblk_tok(int);
|
||||
static struct driver *new_driver(char *);
|
||||
static int iosize_tok(void);
|
||||
|
||||
static void addcmd(struct cmd **);
|
||||
static void parse_card(void);
|
||||
@ -181,9 +184,10 @@ parse_card(void)
|
||||
{
|
||||
char *man, *vers;
|
||||
struct card *cp;
|
||||
int i;
|
||||
int i, iosize;
|
||||
struct card_config *confp, *lastp;
|
||||
|
||||
confp = 0;
|
||||
man = newstr(next_tok());
|
||||
vers = newstr(next_tok());
|
||||
cp = xmalloc(sizeof(*cp));
|
||||
@ -256,6 +260,19 @@ parse_card(void)
|
||||
/* remove */
|
||||
addcmd(&cp->remove);
|
||||
break;
|
||||
case KWD_IOSIZE:
|
||||
/* iosize */
|
||||
iosize = iosize_tok();
|
||||
if (!iosize) {
|
||||
error("Illegal cardio arguments");
|
||||
break;
|
||||
}
|
||||
if (!confp) {
|
||||
error("iosize should be placed after config");
|
||||
break;
|
||||
}
|
||||
cp->iosize = iosize;
|
||||
break;
|
||||
default:
|
||||
pusht = 1;
|
||||
return;
|
||||
@ -379,6 +396,30 @@ irq_tok(int force)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* iosize token
|
||||
* iosize {<size>|auto}
|
||||
*/
|
||||
static int
|
||||
iosize_tok(void)
|
||||
{
|
||||
int iosize = 0;
|
||||
if (strcmp("auto", next_tok()) == 0)
|
||||
iosize = -1; /* wildcard */
|
||||
else {
|
||||
pusht = 1;
|
||||
iosize = num_tok();
|
||||
if (iosize == -1)
|
||||
return 0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (verbose)
|
||||
printf("iosize: size=%x\n", iosize);
|
||||
#endif
|
||||
return iosize;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* search the table for a match.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user