Checkin my first batch of New Mexico changes:

o minor whitespace things (bad because this is also a functional commit)
o Backport reading in of CIS entries from the driver level.
This commit is contained in:
Warner Losh 2000-04-25 06:07:27 +00:00
parent 6e478b8154
commit da05ca010e
4 changed files with 48 additions and 43 deletions

View File

@ -209,14 +209,17 @@ pccard_alloc_resource(device_t bus, device_t child, int type, int *rid,
* irq, 0-3 for memory and 0-1 for ports
*/
int passthrough = (device_get_parent(child) != bus);
int isdefault = (start == 0UL && end == ~0UL);
int isdefault;
struct pccard_devinfo *devi = device_get_ivars(child);
struct resource_list *rl = &devi->resources;
struct resource_list_entry *rle;
struct resource *res;
/* XXX Do I need to add a special case here for the cis memory? XXX */
if (start == 0 && end == ~0 && type == SYS_RES_MEMORY && count != 1) {
start = 0xd0000;
end = 0xdffff;
}
isdefault = (start == 0UL && end == ~0UL);
if (!passthrough && !isdefault) {
rle = resource_list_find(rl, type, *rid);
if (!rle) {
@ -245,10 +248,9 @@ pccard_alloc_resource(device_t bus, device_t child, int type, int *rid,
resource_list_add(rl, type, *rid, start, end, count);
}
}
res = resource_list_alloc(rl, bus, child, type, rid, start, end,
count, flags);
return res;
return (res);
}
static int

View File

@ -270,9 +270,9 @@ pcic_io(struct slot *slt, int win)
*/
/*
* VLSI 82C146 has incompatibilities about the I/O address
* of slot 1. Assume it's the only PCIC whose vendor ID is 0x84,
* contact Nate Williams <nate@FreeBSD.org> if incorrect.
* VLSI 82C146 has incompatibilities about the I/O address of slot 1.
* Assume it's the only PCIC whose vendor ID is 0x84,
* contact Warner Losh <imp@freebsd.org> if correct.
*/
static int
pcic_probe(device_t dev)
@ -537,8 +537,7 @@ pcic_attach(device_t dev)
irq = 0;
}
if (irq == 0) {
pcictimeout_ch = timeout(pcictimeout, (void *) GET_UNIT(dev),
hz/2);
pcictimeout_ch = timeout(pcictimeout, (void *) GET_UNIT(dev), hz/2);
device_printf(dev, "Polling mode\n");
}
@ -687,8 +686,7 @@ pcic_mapirq(struct slot *slt, int irq)
if (irq == 0)
clrb(sp, PCIC_INT_GEN, 0xF);
else
sp->putb(sp, PCIC_INT_GEN,
(sp->getb(sp, PCIC_INT_GEN) & 0xF0) | irq);
sp->putb(sp, PCIC_INT_GEN, (sp->getb(sp, PCIC_INT_GEN) & 0xF0) | irq);
}
/*
@ -937,16 +935,17 @@ pcic_set_res_flags(device_t bus, device_t child, int restype, int rid,
return (err);
}
static struct resource *
pcic_alloc_resource(device_t bus, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
static int
pcic_get_res_flags(device_t bus, device_t child, int restype, int rid,
u_long *value)
{
if (start == 0 && end == ~0 && type == SYS_RES_MEMORY && count != 1) {
start = 0xd0000;
end = 0xdffff;
}
return bus_generic_alloc_resource(bus, child, type, rid, start, end,
count, flags);
return (EOPNOTSUPP);
}
static int
pcic_set_memory_offset(device_t bus, device_t child, int rid, u_int32_t offset)
{
return (EOPNOTSUPP);
}
static device_method_t pcic_methods[] = {
@ -960,13 +959,18 @@ static device_method_t pcic_methods[] = {
/* Bus interface */
DEVMETHOD(bus_print_child, bus_generic_print_child),
DEVMETHOD(bus_alloc_resource, pcic_alloc_resource),
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, pcic_activate_resource),
DEVMETHOD(bus_deactivate_resource, pcic_deactivate_resource),
DEVMETHOD(bus_setup_intr, pcic_setup_intr),
DEVMETHOD(bus_teardown_intr, pcic_teardown_intr),
/* Card interface */
DEVMETHOD(card_set_res_flags, pcic_set_res_flags),
DEVMETHOD(card_get_res_flags, pcic_get_res_flags),
DEVMETHOD(card_set_memory_offset, pcic_set_memory_offset),
{ 0, 0 }
};

View File

@ -1,5 +1,4 @@
/*
* Prototypes for APIC compatible interrupt register and unregister.
* PCMCIA Card Interface Controller
*
* Copyright (c) 1999 Roger Hardiman