Date: Wed, 15 Sep 2010 00:17:52 +0000 (UTC) From: Peter Grehan <grehan@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212627 - in head/sys/powerpc: aim booke include Message-ID: <201009150017.o8F0HqZg097137@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: grehan Date: Wed Sep 15 00:17:52 2010 New Revision: 212627 URL: http://svn.freebsd.org/changeset/base/212627 Log: 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 Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/mmuvar.h Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Sep 14 23:54:03 2010 (r212626) +++ head/sys/powerpc/aim/mmu_oea.c Wed Sep 15 00:17:52 2010 (r212627) @@ -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) Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Sep 14 23:54:03 2010 (r212626) +++ head/sys/powerpc/aim/mmu_oea64.c Wed Sep 15 00:17:52 2010 (r212627) @@ -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) Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Sep 14 23:54:03 2010 (r212626) +++ head/sys/powerpc/booke/pmap.c Wed Sep 15 00:17:52 2010 (r212627) @@ -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) Modified: head/sys/powerpc/include/mmuvar.h ============================================================================== --- head/sys/powerpc/include/mmuvar.h Tue Sep 14 23:54:03 2010 (r212626) +++ head/sys/powerpc/include/mmuvar.h Wed Sep 15 00:17:52 2010 (r212627) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009150017.o8F0HqZg097137>