summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-10-25 23:17:24 +0000
committerimp <imp@FreeBSD.org>1999-10-25 23:17:24 +0000
commit77334da0994acc658fb1696b98bf6db110b97684 (patch)
tree478cace51c46eb1343c075131540bda59a3d0a66 /sys
parentb7856caf0b88bff433c2a3d76f2fa17cd06fa5a6 (diff)
downloadFreeBSD-src-77334da0994acc658fb1696b98bf6db110b97684.zip
FreeBSD-src-77334da0994acc658fb1696b98bf6db110b97684.tar.gz
Remove debug printfs and Debugger() calls.
Add support for memory mapping This should allow pccard that need memory mapping to work, but I don't have one to test against.
Diffstat (limited to 'sys')
-rw-r--r--sys/pccard/pccard.c83
-rw-r--r--sys/pccard/pcic.c51
2 files changed, 49 insertions, 85 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 111ae3b..99751f4 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -205,13 +205,6 @@ disable_slot(struct slot *slt)
/* Power off the slot 1/2 second after removal of the card */
slt->poff_ch = timeout(power_off_slot, (caddr_t)slt, hz / 2);
slt->pwr_off_pending = 1;
-
- /* De-activate all contexts. */
- for (i = 0; i < slt->ctrl->maxmem; i++)
- if (slt->mem[i].flags & MDF_ACTIVE) {
- slt->mem[i].flags = 0;
- (void)slt->ctrl->mapmem(slt, i);
- }
}
/*
@@ -226,7 +219,6 @@ slot_suspend(void *arg)
/* This code stolen from pccard_event:card_removed */
if (slt->state == filled) {
int s = splhigh();
-printf("splhigh -- slot_suspend\n");
disable_slot(slt);
slt->laststate = filled;
slt->state = suspend;
@@ -329,39 +321,6 @@ pccard_alloc_slot(struct slot_ctrl *ctrl)
}
/*
- * Allocate resources for this device in the rman system.
- */
-static int
-pccard_alloc_resources(device_t dev)
-{
- /* XXX NEED TO DO MEMORY TOO XXX */
- struct pccard_devinfo *devi = device_get_ivars(dev);
- int rid;
- u_long start;
- u_long count;
- int e;
-
- start = devi->isahd.id_iobase;
- count = devi->isahd.id_iosize;
-
- rid = 0;
- e = bus_set_resource(dev, SYS_RES_IOPORT, rid, start, count);
- if (e) {
- printf("ioport error %d\n", e);
- return e;
- }
- rid = 0;
- start = ffs(devi->isahd.id_irq) - 1;
- count = 1;
- e = bus_set_resource(dev, SYS_RES_IRQ, rid, start, count);
- if (e) {
- printf("irq error %d\n", e);
- return e;
- }
- return(0);
-}
-
-/*
* allocate_driver - Create a new device entry for this
* slot, and attach a driver to it.
*/
@@ -383,35 +342,30 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
*/
devi->running = 1;
devi->slt = slt;
- devi->isahd.id_unit = desc->unit;
- devi->isahd.id_msize = desc->memsize;
- devi->isahd.id_iobase = desc->iobase;
- devi->isahd.id_iosize = desc->iosize;
bcopy(desc->misc, devi->misc, sizeof(desc->misc));
- if (irq)
- devi->isahd.id_irq = 1 << irq;
- devi->isahd.id_flags = desc->flags;
- /*
- * Convert the memory to kernel space.
- */
- if (desc->mem)
- devi->isahd.id_maddr = (caddr_t)(void *)(uintptr_t)
- (desc->mem + atdevbase - IOM_BEGIN);
- else
- devi->isahd.id_maddr = 0;
- /*
- * XXX I think the following should be done in an attach
- * routine, but can't seem to slip the knot to get it working
- * right. This is one reason I call this a kludge...
- */
resource_list_init(&devi->resources);
child = devi->isahd.id_device = device_add_child(pccarddev, devi->name,
- devi->isahd.id_unit, devi);
- pccard_alloc_resources(child);
+ desc->unit, devi);
+ device_set_flags(child, desc->flags);
+ err = bus_set_resource(child, SYS_RES_IOPORT, 0, desc->iobase,
+ desc->iosize);
+ if (err)
+ goto err;
+ if (irq)
+ err = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
+ if (err)
+ goto err;
+ if (desc->memsize) {
+ err = bus_set_resource(child, SYS_RES_MEMORY, 0, desc->mem,
+ desc->memsize);
+ if (err)
+ goto err;
+ }
err = device_probe_and_attach(child);
+err:
if (err)
device_delete_child(pccarddev, child);
- return err;
+ return (err);
}
/*
@@ -465,7 +419,6 @@ pccard_event(struct slot *slt, enum card_event event)
*/
if (slt->state == filled) {
int s = splhigh();
-printf("splhigh card_removed\n");
disable_slot(slt);
slt->state = empty;
splx(s);
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index e186403..058924f 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -723,15 +723,10 @@ pcicintr(void *arg)
int slot, s;
unsigned char chg;
struct pcic_slot *sp = pcic_slots;
- static int count = 0;
-
- if (count++ > 20)
- Debugger("Trapdoor");
s = splhigh();
-printf("splhigh for pcicintr\n");
- for (slot = 0; slot < PCIC_MAX_SLOTS; slot++, sp++)
- if (sp->slt && (chg = sp->getb(sp, PCIC_STAT_CHG)) != 0)
+ for (slot = 0; slot < PCIC_MAX_SLOTS; slot++, sp++) {
+ if (sp->slt && (chg = sp->getb(sp, PCIC_STAT_CHG)) != 0) {
if (chg & PCIC_CDTCH) {
if ((sp->getb(sp, PCIC_STATUS) & PCIC_CD) ==
PCIC_CD) {
@@ -740,7 +735,8 @@ printf("splhigh for pcicintr\n");
pccard_event(sp->slt, card_removed);
}
}
-printf("splx\n");
+ }
+ }
splx(s);
}
@@ -765,27 +761,34 @@ pcic_activate_resource(device_t dev, device_t child, int type, int rid,
struct resource *r)
{
struct pccard_devinfo *devi = device_get_ivars(child);
- struct io_desc *ip = &devi->slt->io[rid];
int err;
switch (type) {
case SYS_RES_IOPORT:
-#if 0
- if (ip->flags & IODF_ACTIVE)
- return EBUSY;
-#endif
+ {
+ struct io_desc *ip = &devi->slt->io[rid];
ip->flags |= IODF_ACTIVE;
ip->start = rman_get_start(r);
ip->size = rman_get_end(r) - rman_get_start(r) + 1;
err = pcic_io(devi->slt, rid);
- if (err) {
+ if (err)
return err;
- }
break;
+ }
case SYS_RES_IRQ:
pcic_mapirq(devi->slt, rman_get_start(r));
break;
- case SYS_RES_MEMORY:
+ case SYS_RES_MEMORY:
+ {
+ struct mem_desc *mp = &devi->slt->mem[rid];
+ mp->flags |= IODF_ACTIVE;
+ mp->start = rman_get_start(r);
+ mp->size = rman_get_end(r) - rman_get_start(r) + 1;
+ err = pcic_memory(devi->slt, rid);
+ if (err)
+ return err;
+ break;
+ }
default:
break;
}
@@ -803,20 +806,28 @@ pcic_deactivate_resource(device_t dev, device_t child, int type, int rid,
switch (type) {
case SYS_RES_IOPORT:
-#if 0
- if (ip->flags & IODF_ACTIVE)
- return EBUSY;
-#endif
+ {
+ struct io_desc *ip = &devi->slt->io[rid];
ip->flags &= ~IODF_ACTIVE;
err = pcic_io(devi->slt, rid);
if (err) {
return err;
}
break;
+ }
case SYS_RES_IRQ:
pcic_mapirq(devi->slt, 0);
break;
case SYS_RES_MEMORY:
+ {
+ struct mem_desc *mp = &devi->slt->mem[rid];
+ mp->flags &= ~IODF_ACTIVE;
+ err = pcic_memory(devi->slt, rid);
+ if (err) {
+ return err;
+ }
+ break;
+ }
default:
break;
}
OpenPOWER on IntegriCloud