summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-01-08 00:22:58 +0000
committernate <nate@FreeBSD.org>1997-01-08 00:22:58 +0000
commit2c93c06cf90a23d4251f12eab7a11828bab3690b (patch)
tree5c3db8b0eef27ef4e4795804cf80dc136e2033c0 /sys
parent9962c79df882dfc75a62f0cce840bbdecd005bfc (diff)
downloadFreeBSD-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')
-rw-r--r--sys/pccard/pccard.c4
-rw-r--r--sys/pccard/pcic.c64
-rw-r--r--sys/pccard/slot.h2
3 files changed, 35 insertions, 35 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 5fa67a7..6242db5 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -350,6 +350,10 @@ slot_resume(void *arg)
struct slot *sp = arg;
struct pccard_dev *dp;
+#ifdef PCIC_RESUME_RESET
+ sp->ctrl->resume(sp);
+#endif
+
if (!sp->suspend_power)
sp->ctrl->power(sp);
if (sp->irq)
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);
+}
diff --git a/sys/pccard/slot.h b/sys/pccard/slot.h
index af19e5e..e0f5fa3 100644
--- a/sys/pccard/slot.h
+++ b/sys/pccard/slot.h
@@ -52,6 +52,8 @@ struct slot_ctrl {
/* ioctl to lower level */
void (*mapirq) __P((struct slot *, int));
/* Map interrupt number */
+ void (*resume) __P((struct slot *));
+ /* suspend/resume support */
int extra; /* Controller specific size */
int maxmem; /* Number of allowed memory windows */
int maxio; /* Number of allowed I/O windows */
OpenPOWER on IntegriCloud