Add some infrastructure support for dealing with large attribute

memory space needed by the raylink driver (in progress, nearing
completion).

This is a minorly cleaned up diff from Duncan to help him reduce the
diffs from stock FreeBSD.

Submitted by: Duncan Barclay <dmlb@ragnet.demon.co.uk>
This commit is contained in:
imp 2000-08-10 17:35:11 +00:00
parent 17a384d63d
commit 3f186393a8
2 changed files with 61 additions and 5 deletions

View File

@ -299,6 +299,14 @@ pccard_set_memory_offset(device_t bus, device_t child, int rid,
offset);
}
static int
pccard_get_memory_offset(device_t bus, device_t child, int rid,
u_int32_t *offset)
{
return CARD_GET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset);
}
static int
pccard_get_function(device_t bus, device_t child, int *function)
{
@ -346,6 +354,7 @@ static device_method_t pccard_methods[] = {
DEVMETHOD(card_set_res_flags, pccard_set_res_flags),
DEVMETHOD(card_get_res_flags, pccard_get_res_flags),
DEVMETHOD(card_set_memory_offset, pccard_set_memory_offset),
DEVMETHOD(card_get_memory_offset, pccard_get_memory_offset),
DEVMETHOD(card_get_function, pccard_get_function),
DEVMETHOD(card_activate_function, pccard_activate_function),
DEVMETHOD(card_deactivate_function, pccard_deactivate_function),

View File

@ -923,10 +923,17 @@ pcic_set_res_flags(device_t bus, device_t child, int restype, int rid,
switch (restype) {
case SYS_RES_MEMORY: {
struct mem_desc *mp = &devi->slt->mem[rid];
if (value)
mp->flags |= MDF_ATTR;
else
switch (value) {
case 0:
mp->flags &= ~MDF_ATTR;
break;
case 1:
mp->flags |= MDF_ATTR;
break;
case 2:
mp->flags &= ~MDF_16BITS;
break;
}
err = pcic_memory(devi->slt, rid);
break;
}
@ -940,13 +947,52 @@ static int
pcic_get_res_flags(device_t bus, device_t child, int restype, int rid,
u_long *value)
{
return (EOPNOTSUPP);
struct pccard_devinfo *devi = device_get_ivars(child);
int err = 0;
if (value == 0)
return (ENOMEM);
switch (restype) {
case SYS_RES_IOPORT: {
struct io_desc *ip = &devi->slt->io[rid];
*value = ip->flags;
break;
}
case SYS_RES_MEMORY: {
struct mem_desc *mp = &devi->slt->mem[rid];
*value = mp->flags;
break;
}
default:
err = EOPNOTSUPP;
}
return (0);
}
static int
pcic_set_memory_offset(device_t bus, device_t child, int rid, u_int32_t offset)
{
return (EOPNOTSUPP);
struct pccard_devinfo *devi = device_get_ivars(child);
struct mem_desc *mp = &devi->slt->mem[rid];
mp->card = offset;
return (pcic_memory(devi->slt, rid));
}
static int
pcic_get_memory_offset(device_t bus, device_t child, int rid, u_int32_t *offset)
{
struct pccard_devinfo *devi = device_get_ivars(child);
struct mem_desc *mp = &devi->slt->mem[rid];
if (offset == 0)
return (ENOMEM);
*offset = mp->card;
return (0);
}
static device_method_t pcic_methods[] = {
@ -971,6 +1017,7 @@ static device_method_t pcic_methods[] = {
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),
DEVMETHOD(card_get_memory_offset, pcic_get_memory_offset),
{ 0, 0 }
};