|
From: Jan-Benedict G. <jb...@us...> - 2004-09-29 10:38:52
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/boot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30638 Modified Files: cpu_sel.c Log Message: - Add an alternative implementation of idcpu() using the new vector match structure in spe... - If you don't like something, hack it. Index: cpu_sel.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/cpu_sel.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- cpu_sel.c 23 Sep 2004 23:33:15 -0000 1.8 +++ cpu_sel.c 29 Sep 2004 10:38:38 -0000 1.9 @@ -226,6 +226,49 @@ #endif } +#ifdef USE_NEW_VECTORS +extern struct machvec_match __init_vecmatch_start, __init_vecmatch_end; + +struct vax_mv * +idcpu (void) +{ + unsigned long sid; + unsigned long sidex; + struct machvec_match *mvm; + + sid = __mfpr (PR_SID); + + for (mvm = &__init_vecmatch_start; mvm < &__init_vecmatch_end; mvm++) { + if ((sid & mvm->sid_mask) == mvm->sid_match) { + /* + * No sidex known? Accept the vector. + * FIXME: Maybe sort the metch structs to have + * those with "long" masks first, then the loose + * entries with weaker/shorter masks + */ + if (!mvm->sidex_addr) + return mvm->mv; + + /* + * If a SIDEX match was supplied, too, check it! + */ + sidex = * ((unsigned long *) mvm->sidex_addr); + if ((sidex & mvm->sidex_mask) == mvm->sidex_match) + return mvm->mv; + } + } + + /* + * No matching vector found, so you're on your own to get a SID + * and SIDEX value and add it to one of the existing vectors (if + * that works for you) or create an own vector for your machine. + */ + HALT; + + /* Not reached */ + return NULL; +} +#else struct vax_mv *idcpu(void) { unsigned int sid; @@ -278,4 +321,5 @@ return NULL; } +#endif |