Patchwork [10/10] memory: remove old_portio-style callbacks support

login
register
mail settings
Submitter Hervé Poussineau
Date Jan. 4, 2013, 9:29 p.m.
Message ID <1357334986-13941-11-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/209559/
State New
Headers show

Comments

Hervé Poussineau - Jan. 4, 2013, 9:29 p.m.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 include/exec/memory.h |    4 ----
 memory.c              |   44 --------------------------------------------
 2 files changed, 48 deletions(-)
Andreas Färber - Jan. 10, 2013, 5:45 p.m.
Am 04.01.2013 22:29, schrieb Hervé Poussineau:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  include/exec/memory.h |    4 ----
>  memory.c              |   44 --------------------------------------------
>  2 files changed, 48 deletions(-)
> 
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 2322732..4a757f0 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -103,10 +103,6 @@ struct MemoryRegionOps {
>           bool unaligned;
>      } impl;
>  
> -    /* If .read and .write are not present, old_portio may be used for
> -     * backwards compatibility with old portio registration
> -     */
> -    const MemoryRegionPortio *old_portio;
>      /* If .read and .write are not present, old_mmio may be used for
>       * backwards compatibility with old mmio registration
>       */

Can't struct MemoryRegionPortio be removed as part of the patch?

Andreas
Hervé Poussineau - Jan. 10, 2013, 7:33 p.m.
Andreas Färber a écrit :
> Am 04.01.2013 22:29, schrieb Hervé Poussineau:
>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>> ---
>>  include/exec/memory.h |    4 ----
>>  memory.c              |   44 --------------------------------------------
>>  2 files changed, 48 deletions(-)
>>
>> diff --git a/include/exec/memory.h b/include/exec/memory.h
>> index 2322732..4a757f0 100644
>> --- a/include/exec/memory.h
>> +++ b/include/exec/memory.h
>> @@ -103,10 +103,6 @@ struct MemoryRegionOps {
>>           bool unaligned;
>>      } impl;
>>  
>> -    /* If .read and .write are not present, old_portio may be used for
>> -     * backwards compatibility with old portio registration
>> -     */
>> -    const MemoryRegionPortio *old_portio;
>>      /* If .read and .write are not present, old_mmio may be used for
>>       * backwards compatibility with old mmio registration
>>       */
> 
> Can't struct MemoryRegionPortio be removed as part of the patch?

No, it is also used as parameter for the isa_register_portio_list() 
function. isa_register_portio_list() parses this list and creates 
corresponding MemoryRegions.

Hervé

Patch

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2322732..4a757f0 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -103,10 +103,6 @@  struct MemoryRegionOps {
          bool unaligned;
     } impl;
 
-    /* If .read and .write are not present, old_portio may be used for
-     * backwards compatibility with old portio registration
-     */
-    const MemoryRegionPortio *old_portio;
     /* If .read and .write are not present, old_mmio may be used for
      * backwards compatibility with old mmio registration
      */
diff --git a/memory.c b/memory.c
index 410c5f8..e56ca3c 100644
--- a/memory.c
+++ b/memory.c
@@ -365,21 +365,6 @@  static void access_with_adjusted_size(hwaddr addr,
     }
 }
 
-static const MemoryRegionPortio *find_portio(MemoryRegion *mr, uint64_t offset,
-                                             unsigned width, bool write)
-{
-    const MemoryRegionPortio *mrp;
-
-    for (mrp = mr->ops->old_portio; mrp->size; ++mrp) {
-        if (offset >= mrp->offset && offset < mrp->offset + mrp->len
-            && width == mrp->size
-            && (write ? (bool)mrp->write : (bool)mrp->read)) {
-            return mrp;
-        }
-    }
-    return NULL;
-}
-
 static void memory_region_iorange_read(IORange *iorange,
                                        uint64_t offset,
                                        unsigned width,
@@ -390,21 +375,6 @@  static void memory_region_iorange_read(IORange *iorange,
     MemoryRegion *mr = mrio->mr;
 
     offset += mrio->offset;
-    if (mr->ops->old_portio) {
-        const MemoryRegionPortio *mrp = find_portio(mr, offset - mrio->offset,
-                                                    width, false);
-
-        *data = ((uint64_t)1 << (width * 8)) - 1;
-        if (mrp) {
-            *data = mrp->read(mr->opaque, offset);
-        } else if (width == 2) {
-            mrp = find_portio(mr, offset - mrio->offset, 1, false);
-            assert(mrp);
-            *data = mrp->read(mr->opaque, offset) |
-                    (mrp->read(mr->opaque, offset + 1) << 8);
-        }
-        return;
-    }
     *data = 0;
     access_with_adjusted_size(offset, data, width,
                               mr->ops->impl.min_access_size,
@@ -422,20 +392,6 @@  static void memory_region_iorange_write(IORange *iorange,
     MemoryRegion *mr = mrio->mr;
 
     offset += mrio->offset;
-    if (mr->ops->old_portio) {
-        const MemoryRegionPortio *mrp = find_portio(mr, offset - mrio->offset,
-                                                    width, true);
-
-        if (mrp) {
-            mrp->write(mr->opaque, offset, data);
-        } else if (width == 2) {
-            mrp = find_portio(mr, offset - mrio->offset, 1, true);
-            assert(mrp);
-            mrp->write(mr->opaque, offset, data & 0xff);
-            mrp->write(mr->opaque, offset + 1, data >> 8);
-        }
-        return;
-    }
     access_with_adjusted_size(offset, &data, width,
                               mr->ops->impl.min_access_size,
                               mr->ops->impl.max_access_size,