diff options
author | grehan <grehan@FreeBSD.org> | 2010-09-15 00:17:52 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2010-09-15 00:17:52 +0000 |
commit | bd5391ac7cb0edfedf0aef8dd05d21c0c1089122 (patch) | |
tree | 8c15c9974def9969555972ad8d9710e59f1334b5 /sys | |
parent | 8c0a66bbc56cdc7db338e9b070b4551c38bf33ef (diff) | |
download | FreeBSD-src-bd5391ac7cb0edfedf0aef8dd05d21c0c1089122.zip FreeBSD-src-bd5391ac7cb0edfedf0aef8dd05d21c0c1089122.tar.gz |
Introduce inheritance into the PowerPC MMU kobj interface.
include/mmuvar.h - Change the MMU_DEF macro to also create the class
definition as well as define the DATA_SET. Add a macro, MMU_DEF_INHERIT,
which has an extra parameter specifying the MMU class to inherit methods
from. Update the comments at the start of the header file to describe the
new macros.
booke/pmap.c
aim/mmu_oea.c
aim/mmu_oea64.c - Collapse mmu_def_t declaration into updated MMU_DEF macro
The MMU_DEF_INHERIT macro will be used in the PS3 MMU implementation to
allow it to inherit the stock powerpc64 MMU methods.
Reviewed by: nwhitehorn
Diffstat (limited to 'sys')
-rw-r--r-- | sys/powerpc/aim/mmu_oea.c | 8 | ||||
-rw-r--r-- | sys/powerpc/aim/mmu_oea64.c | 7 | ||||
-rw-r--r-- | sys/powerpc/booke/pmap.c | 7 | ||||
-rw-r--r-- | sys/powerpc/include/mmuvar.h | 38 |
4 files changed, 34 insertions, 26 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 2ade00f..a31e072 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -379,12 +379,8 @@ static mmu_method_t moea_methods[] = { { 0, 0 } }; -static mmu_def_t oea_mmu = { - MMU_TYPE_OEA, - moea_methods, - 0 -}; -MMU_DEF(oea_mmu); +MMU_DEF(oea_mmu, MMU_TYPE_OEA, moea_methods, 0); + static void tlbie(vm_offset_t va) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index dc055a3..6328e57 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -474,12 +474,7 @@ static mmu_method_t moea64_methods[] = { { 0, 0 } }; -static mmu_def_t oea64_mmu = { - MMU_TYPE_G5, - moea64_methods, - 0 -}; -MMU_DEF(oea64_mmu); +MMU_DEF(oea64_mmu, MMU_TYPE_G5, moea64_methods, 0); static __inline u_int va_to_pteg(uint64_t vsid, vm_offset_t addr, int large) diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 7f2feb9..c5e285c 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -384,12 +384,7 @@ static mmu_method_t mmu_booke_methods[] = { { 0, 0 } }; -static mmu_def_t booke_mmu = { - MMU_TYPE_BOOKE, - mmu_booke_methods, - 0 -}; -MMU_DEF(booke_mmu); +MMU_DEF(booke_mmu, MMU_TYPE_BOOKE, mmu_booke_methods, 0); static inline void tlb_miss_lock(void) diff --git a/sys/powerpc/include/mmuvar.h b/sys/powerpc/include/mmuvar.h index 6e5a213..821a497 100644 --- a/sys/powerpc/include/mmuvar.h +++ b/sys/powerpc/include/mmuvar.h @@ -31,7 +31,8 @@ /* * A PowerPC MMU implementation is declared with a kernel object and - * an associated method table, similar to a device driver. + * an associated method table. The MMU_DEF macro is used to declare + * the class, and also links it to the global MMU class list. * * e.g. * @@ -44,13 +45,12 @@ * { 0, 0 } * }; * - * static mmu_def_t ppc8xx_mmu = { - * "ppc8xx", - * ppc8xx_methods, - * sizeof(ppc8xx_mmu_softc), // or 0 if no softc - * }; + * MMU_DEF(ppc8xx, MMU_TYPE_8xx, ppc8xx_methods, sizeof(ppc8xx_mmu_softc)); + * + * A single level of inheritance is supported in a similar fashion to + * kobj inheritance e.g. * - * MMU_DEF(ppc8xx_mmu); + * MMU_DEF_1(ppc860c, MMU_TYPE_860c, ppc860c_methods, 0, ppc8xx); */ #include <sys/kobj.h> @@ -84,7 +84,29 @@ typedef struct kobj_class mmu_def_t; #define MMUMETHOD KOBJMETHOD -#define MMU_DEF(name) DATA_SET(mmu_set, name) +#define MMU_DEF(name, ident, methods, size) \ + \ +mmu_def_t name = { \ + ident, methods, size, NULL \ +}; \ +DATA_SET(mmu_set, name) + +#define MMU_DEF_INHERIT(name, ident, methods, size, base1) \ + \ +static kobj_class_t name ## _baseclasses[] = \ + { &base1, NULL }; \ +mmu_def_t name = { \ + ident, methods, size, name ## _baseclasses \ +}; \ +DATA_SET(mmu_set, name) + + +#if 0 +mmu_def_t name = { \ + ident, methods, size, name ## _baseclasses \ +}; +DATA_SET(mmu_set, name) +#endif /* * Known MMU names |