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
This commit is contained in:
Peter Grehan 2010-09-15 00:17:52 +00:00
parent efe8958927
commit 33529b98d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212627
4 changed files with 34 additions and 26 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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));
*
* MMU_DEF(ppc8xx_mmu);
* A single level of inheritance is supported in a similar fashion to
* kobj inheritance e.g.
*
* 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