Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys On x86, change the bus_space_tag_t to a pointer to a struct



details:   https://anonhg.NetBSD.org/src/rev/4b024bbff729
branches:  trunk
changeset: 754354:4b024bbff729
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Apr 28 19:17:03 2010 +0000

description:
On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag.  For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM.  In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem.  Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.

diffstat:

 sys/arch/amd64/amd64/busfunc.S     |  50 ++++++++++++------------
 sys/arch/amd64/amd64/genassym.cf   |   6 ++-
 sys/arch/amd64/amd64/mainbus.c     |  35 +++++++++--------
 sys/arch/i386/i386/apmbios.c       |   6 +-
 sys/arch/i386/i386/busfunc.S       |  58 +++++++++++++++++++----------
 sys/arch/i386/i386/genassym.cf     |   6 ++-
 sys/arch/i386/i386/ipkdb_glue.c    |   6 +-
 sys/arch/i386/i386/mainbus.c       |  43 +++++++++++----------
 sys/arch/i386/isa/isapnp_machdep.c |   8 ++--
 sys/arch/i386/pci/pceb.c           |  12 +++---
 sys/arch/i386/pci/pcibios.c        |   6 +-
 sys/arch/i386/pci/pcmb.c           |   8 ++--
 sys/arch/i386/pnpbios/pnpbios.c    |  10 ++--
 sys/arch/i386/xbox/xbox.c          |  10 ++--
 sys/arch/i386/xbox/xboxfb.c        |  20 +++++-----
 sys/arch/x86/include/bus.h         |  13 +++++-
 sys/arch/x86/pci/pcib.c            |   8 ++--
 sys/arch/x86/x86/acpi_machdep.c    |   8 ++--
 sys/arch/x86/x86/bus_space.c       |  76 +++++++++++++++++++++++++------------
 sys/arch/x86/x86/consinit.c        |  21 ++++------
 sys/arch/x86/x86/genfb_machdep.c   |   6 +-
 sys/arch/xen/x86/consinit.c        |  10 ++--
 sys/arch/xen/x86/mainbus.c         |   8 ++--
 sys/arch/xen/xen/hypervisor.c      |  16 ++++----
 sys/arch/xen/xen/xpci_xenbus.c     |   8 ++--
 sys/compat/ndis/nbcompat.h         |   4 +-
 sys/dev/if_ndis/if_ndis_pci.c      |   8 ++--
 sys/dev/pci/puccn.c                |   6 +-
 28 files changed, 268 insertions(+), 208 deletions(-)

diffs (truncated from 1703 to 300 lines):

diff -r 8fd804fd40b2 -r 4b024bbff729 sys/arch/amd64/amd64/busfunc.S
--- a/sys/arch/amd64/amd64/busfunc.S    Wed Apr 28 18:04:31 2010 +0000
+++ b/sys/arch/amd64/amd64/busfunc.S    Wed Apr 28 19:17:03 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: busfunc.S,v 1.7 2008/05/25 15:56:12 chs Exp $  */
+/*     $NetBSD: busfunc.S,v 1.8 2010/04/28 19:17:03 dyoung Exp $       */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 ENTRY(bus_space_read_1)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movzbl  (%rdx), %eax
        ret
@@ -67,7 +67,7 @@
  */
 ENTRY(bus_space_read_2)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movzwl  (%rdx), %eax
        ret
@@ -82,7 +82,7 @@
  */
 ENTRY(bus_space_read_4)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movl    (%rdx), %eax
        ret
@@ -96,7 +96,7 @@
  */
 ENTRY(bus_space_read_8)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        movq    (%rdx), %rax
        ret
@@ -112,7 +112,7 @@
  */
 ENTRY(bus_space_write_1)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movb    %cl, (%rdx)
        ret
@@ -127,7 +127,7 @@
  */
 ENTRY(bus_space_write_2)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movw    %cx, (%rdx)
        ret
@@ -142,7 +142,7 @@
  */
 ENTRY(bus_space_write_4)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      1f
        movl    %ecx, (%rdx)
        ret
@@ -157,7 +157,7 @@
  */
 ENTRY(bus_space_write_8)
        addq    %rsi, %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        movq    %rcx, (%rdx)
        ret
@@ -173,7 +173,7 @@
  */
 ENTRY(bus_space_read_multi_1)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rdi
        movq    %r8, %rcx
@@ -195,7 +195,7 @@
  */
 ENTRY(bus_space_read_multi_2)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rdi
        movq    %r8, %rcx
@@ -217,7 +217,7 @@
  */
 ENTRY(bus_space_read_multi_4)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rdi
        movq    %r8, %rcx
@@ -239,7 +239,7 @@
  */
 ENTRY(bus_space_read_multi_8)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        .align  16
 1:
@@ -261,7 +261,7 @@
  */
 ENTRY(bus_space_write_multi_1)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rsi
        movq    %r8, %rcx
@@ -283,7 +283,7 @@
  */
 ENTRY(bus_space_write_multi_2)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rsi
        movq    %r8, %rcx
@@ -305,7 +305,7 @@
  */
 ENTRY(bus_space_write_multi_4)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        jne     1f
        movq    %rcx, %rsi
        movq    %r8, %rcx
@@ -327,7 +327,7 @@
  */
 ENTRY(bus_space_write_multi_8)
        leaq    (%rsi,%rdx,1), %rdx
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        .align  16
 1:
@@ -348,7 +348,7 @@
  *    bus_size_t offset, uint8_t *addr, size_t count);
  */
 ENTRY(bus_space_read_region_1)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        addq    %rdx, %rsi
        movq    %rcx, %rdi
@@ -372,7 +372,7 @@
  *    bus_size_t offset, uint16_t *addr, size_t count);
  */
 ENTRY(bus_space_read_region_2)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        addq    %rdx, %rsi
        movq    %rcx, %rdi
@@ -396,7 +396,7 @@
  *    bus_size_t offset, uint32_t *addr, size_t count);
  */
 ENTRY(bus_space_read_region_4)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        addq    %rdx, %rsi
        movq    %rcx, %rdi
@@ -420,7 +420,7 @@
  *    bus_size_t offset, uint64_t *addr, size_t count);
  */
 ENTRY(bus_space_read_region_8)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        addq    %rdx, %rsi
        movq    %rcx, %rdi
@@ -439,7 +439,7 @@
  *    bus_size_t offset, const uint8_t *addr, size_t count);
  */
 ENTRY(bus_space_write_region_1)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        leaq    (%rdx,%rsi,1), %rdi
        movq    %rcx, %rsi
@@ -463,7 +463,7 @@
  *    bus_size_t offset, const uint16_t *addr, size_t count);
  */
 ENTRY(bus_space_write_region_2)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        leaq    (%rdx,%rsi,1), %rdi
        movq    %rcx, %rsi
@@ -487,7 +487,7 @@
  *    bus_size_t offset, const uint32_t *addr, size_t count);
  */
 ENTRY(bus_space_write_region_4)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      2f
        leaq    (%rdx,%rsi,1), %rdi
        movq    %rcx, %rsi
@@ -511,7 +511,7 @@
  *    bus_size_t offset, const uint64_t *addr, size_t count);
  */
 ENTRY(bus_space_write_region_8)
-       testl   %edi, %edi
+       cmpl    $X86_BUS_SPACE_IO, BST_TYPE(%rdi)
        je      .Ldopanic
        leaq    (%rdx,%rsi,1), %rdi
        movq    %rcx, %rsi
diff -r 8fd804fd40b2 -r 4b024bbff729 sys/arch/amd64/amd64/genassym.cf
--- a/sys/arch/amd64/amd64/genassym.cf  Wed Apr 28 18:04:31 2010 +0000
+++ b/sys/arch/amd64/amd64/genassym.cf  Wed Apr 28 19:17:03 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.43 2009/11/27 03:23:04 rmind Exp $
+#      $NetBSD: genassym.cf,v 1.44 2010/04/28 19:17:03 dyoung Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@
 include <xen/xen3-public/xen.h>
 endif  
 
-include <x86/busdefs.h>
+include <x86/bus.h>
 
 define LSRUN                   LSRUN
 define LSONPROC                LSONPROC
@@ -364,6 +364,8 @@
 
 define X86_BUS_SPACE_IO        X86_BUS_SPACE_IO
 
+define BST_TYPE                offsetof(struct bus_space_tag, bst_type)
+
 ifdef XEN
 define CPU_INFO_VCPU           offsetof(struct cpu_info, ci_vcpu)
 define EVTCHN_UPCALL_MASK      offsetof(struct vcpu_info, evtchn_upcall_mask)
diff -r 8fd804fd40b2 -r 4b024bbff729 sys/arch/amd64/amd64/mainbus.c
--- a/sys/arch/amd64/amd64/mainbus.c    Wed Apr 28 18:04:31 2010 +0000
+++ b/sys/arch/amd64/amd64/mainbus.c    Wed Apr 28 19:17:03 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.30 2010/02/15 23:53:07 dyoung Exp $      */
+/*     $NetBSD: mainbus.c,v 1.31 2010/04/28 19:17:03 dyoung Exp $      */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2010/02/15 23:53:07 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.31 2010/04/28 19:17:03 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -109,11 +109,10 @@
 int    isa_has_been_seen;
 struct x86_isa_chipset x86_isa_chipset;
 #if NISA > 0
-struct isabus_attach_args mba_iba = {
-       "isa",
-       X86_BUS_SPACE_IO, X86_BUS_SPACE_MEM,
-       &isa_bus_dma_tag,
-       &x86_isa_chipset
+static const struct isabus_attach_args mba_iba = {
+       ._iba_busname = "isa",
+       .iba_dmat = &isa_bus_dma_tag,
+       .iba_ic = &x86_isa_chipset
 };
 #endif
 
@@ -226,14 +225,14 @@
        /*
         * ACPI needs ISA DMA initialized before they start probing.
         */
-       isa_dmainit(&x86_isa_chipset, X86_BUS_SPACE_IO, &isa_bus_dma_tag,
+       isa_dmainit(&x86_isa_chipset, x86_bus_space_io, &isa_bus_dma_tag,
            self);
 #endif
 
 #if NACPICA > 0
        if (acpi_present) {
-               mba.mba_acpi.aa_iot = X86_BUS_SPACE_IO;
-               mba.mba_acpi.aa_memt = X86_BUS_SPACE_MEM;
+               mba.mba_acpi.aa_iot = x86_bus_space_io;



Home | Main Index | Thread Index | Old Index