diff options
| -rw-r--r-- | sys/pccard/pccard_nbk.c | 9 | ||||
| -rw-r--r-- | sys/pccard/pcic.c | 57 |
2 files changed, 61 insertions, 5 deletions
diff --git a/sys/pccard/pccard_nbk.c b/sys/pccard/pccard_nbk.c index e346956cf55a..37e95572c57f 100644 --- a/sys/pccard/pccard_nbk.c +++ b/sys/pccard/pccard_nbk.c @@ -300,6 +300,14 @@ pccard_set_memory_offset(device_t bus, device_t child, int rid, } 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) { *function = 0; @@ -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), diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 4ba9b5c3c2e6..8133883e49ce 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -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 } }; |
