diff options
author | nate <nate@FreeBSD.org> | 1997-01-08 00:22:58 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1997-01-08 00:22:58 +0000 |
commit | 2c93c06cf90a23d4251f12eab7a11828bab3690b (patch) | |
tree | 5c3db8b0eef27ef4e4795804cf80dc136e2033c0 /sys/pccard/pcic.c | |
parent | 9962c79df882dfc75a62f0cce840bbdecd005bfc (diff) | |
download | FreeBSD-src-2c93c06cf90a23d4251f12eab7a11828bab3690b.zip FreeBSD-src-2c93c06cf90a23d4251f12eab7a11828bab3690b.tar.gz |
- Added PCIC resume function
- Cleaned up VLSI-PCIC work-around code
Submitted by: nate & the Nomads
Diffstat (limited to 'sys/pccard/pcic.c')
-rw-r--r-- | sys/pccard/pcic.c | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 31a37c3..fe29bbe 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -77,6 +77,7 @@ static void pcicintr __P((int unit)); static int pcic_ioctl __P((struct slot *, int, caddr_t)); static int pcic_power __P((struct slot *)); static timeout_t pcic_reset; +static void pcic_resume(struct slot *); static void pcic_disable __P((struct slot *)); static void pcic_mapirq __P((struct slot *, int)); static timeout_t pcictimeout; @@ -126,6 +127,7 @@ putb (struct pcic_slot *sp, int reg, unsigned char val) outb (sp->index, sp->offset + reg); outb (sp->data, val); } + /* * Clear bit(s) of a register. */ @@ -134,6 +136,7 @@ clrb(struct pcic_slot *sp, int reg, unsigned char mask) { putb (sp, reg, getb (sp, reg) & ~mask); } + /* * Set bit(s) of a register */ @@ -169,7 +172,6 @@ MOD_MISC(pcic); * Once the module is loaded, the probe routine * is called to install the slots (if any). */ - static int pcic_handle(struct lkm_table *lkmtp, int cmd) { @@ -332,8 +334,7 @@ pcic_memory(struct slot *slotp, int win) } #endif /* PC98 */ - if (mp->flags & MDF_ACTIVE) - { + if (mp->flags & MDF_ACTIVE) { unsigned long sys_addr = (unsigned long)mp->start >> 12; /* * Write the addresses, card offsets and length. @@ -379,9 +380,7 @@ pcic_memory(struct slot *slotp, int win) */ setb (sp, PCIC_ADDRWINE, (1<<win) | PCIC_MEMCS16); DELAY(50); - } - else - { + } else { #if 0 printf("Unmapping window %d\n", win); #endif @@ -389,7 +388,7 @@ pcic_memory(struct slot *slotp, int win) putw (sp, reg, 0); putw (sp, reg+2, 0); putw (sp, reg+4, 0); - } + } return(0); } @@ -505,22 +504,17 @@ printf("Map I/O 0x%x (size 0x%x) on Window %d\n", ip->start, ip->size, win); /* * VLSI 82C146 has incompatibilities about the I/O address - * of slot 1. If it's the only PCIC whose vendor ID is 0x84, - * I want to remove this #define and corresponding #ifdef's. - * HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> + * of slot 1. Assume it's the only PCIC whose vendor ID is 0x84, + * contact Nate Williams <nate@FreeBSD.org> if incorrect. */ -#define VLSI_SLOT1 1 - int -pcic_probe () +pcic_probe(void) { int slot, i, validslots = 0; struct slot *slotp; struct pcic_slot *sp; unsigned char c; -#ifdef VLSI_SLOT1 - static int vs = 0; -#endif /* VLSI_SLOT1 */ + static int is_vlsi = 0; /* * Initialise controller information structure. @@ -532,6 +526,7 @@ pcic_probe () cinfo.mapirq = pcic_mapirq; cinfo.reset = pcic_reset; cinfo.disable = pcic_disable; + cinfo.resume = pcic_resume; cinfo.maxmem = PCIC_MEM_WIN; cinfo.maxio = PCIC_IO_WIN; cinfo.irqs = PCIC_INT_MASK_ALLOWED; @@ -545,26 +540,20 @@ pcic_probe () * Initialise the PCIC slot table. */ if (slot < 4) { -#ifdef VLSI_SLOT1 - if (slot == 1 && vs) { - sp->index = PCIC_INDEX_0 + 4; - sp->data = PCIC_DATA_0 + 4; - sp->offset = PCIC_SLOT_SIZE << 1; - } else { - sp->index = PCIC_INDEX_0; - sp->data = PCIC_DATA_0; - sp->offset = slot * PCIC_SLOT_SIZE; - } -#else /* VLSI_SLOT1 */ sp->index = PCIC_INDEX_0; sp->data = PCIC_DATA_0; sp->offset = slot * PCIC_SLOT_SIZE; -#endif /* VLSI_SLOT1 */ } else { sp->index = PCIC_INDEX_1; sp->data = PCIC_DATA_1; sp->offset = (slot - 4) * PCIC_SLOT_SIZE; } + /* XXX - Screwed up slot 1 on the VLSI chips */ + if (slot == 1 && is_vlsi) { + sp->index += 4; + sp->data += 4; + sp->offset = PCIC_SLOT_SIZE << 1; + } /* * see if there's a PCMCIA controller here * Intel PCMCIA controllers use 0x82 and 0x83 @@ -607,9 +596,7 @@ pcic_probe () */ case 0x84: sp->controller = PCIC_VLSI; -#ifdef VLSI_SLOT1 - vs = 1; -#endif /* VLSI_SLOT1 */ + is_vlsi = 1; break; case 0x88: case 0x89: @@ -752,7 +739,6 @@ pcic_probe () #endif /* PC98 */ if (validslots) timeout(pcictimeout,0,hz/2); -/* BUCHI */ return(validslots); } @@ -929,7 +915,6 @@ pcic_mapirq (struct slot *slotp, int irq) /* * pcic_reset - Reset the card and enable initial power. */ - static void pcic_reset(void *chan) { @@ -998,10 +983,9 @@ pcic_disable(struct slot *slotp) } /* - * PCIC timer, it seems that we loose interrupts sometimes + * PCIC timer, it seems that we lose interrupts sometimes * so poll just in case... */ - static void pcictimeout(void *chan) { @@ -1055,3 +1039,13 @@ pcicintr(int unit) } splx(s); } + +/* + * pcic_resume - Suspend/resume support for PCIC + */ +static void +pcic_resume(struct slot *slotp) +{ + if (pcic_irq > 0) + putb(slotp->cdata, PCIC_STAT_INT, (pcic_irq << 4) | 0xF); +} |