Hello,
your first question is pretty tough, and it took me some time to check, how this mechanism works. I hope I will explain it correct and understandably.
In S32DS there is function GetCoreID () which is defined like: #define GetCoreID() ((uint16_t) MFSPR(286)). Number 286 is important, because this is number of SPR register. SPR 286 is Processor ID register.
MFSPR is further define like:
#define MFSPR( rn ) ({unsigned int rval; PPCASM volatile("mfspr %0," stringify(rn) : "=r" (rval)); rval;}) which is simply a function.
Please see, how the function looks like, when you split it into single lines.
#define MFSPR( rn )
(
{
unsigned int rval;
PPCASM volatile("mfspr %0," stringify(rn) : "=r" (rval));
rval;
}
)
rval is local variable, which is used for storing the value from SPR register (SPR is determined by rn parameter, which is given to mfspr instruction). After the mfspr instruction is executed, register r3 is used for returning the value and because it is necessary to access the value using C code, extended assembler is used (("mfspr %0," stringify(rn) : "=r" (rval));) and value is returned using rval variable.
About the MSCR and IMCR register, this is a little bit easier. IMCR register is determined for choosing input functions of the pin.
I will use your example.
SIUL2.MSCR[16].R = 0x03000001; /* PB[0] -> OBE = 1, ODE = 1 and MSCR16_SSS = 1 */
SIUL2.MSCR[17].R = 0x00080000; /* PB[1] -> IBE = 1 */
SIUL2.IMCR[188].R = 0x00080002; /* PB[1] -> MSCR17_SSS = 2, notice that
Pin controller MSCR 16 is used for CAN TX, which means this pin is output. You do not have to care about IMCR register in this case. But pin controlled by MSCR 17 is used for CAN RX, which means this pin is input and when you check pin sheet, you can see following:

For input functions, IMCR pin must be set. From the figure you can see IMCR 700 must be set to 0x0000_0010, but IMCR registers array is defined with size 512, so this means, you must always subtract value 512 from the value in excel sheet.
Result is 700-512 = 188 and this is the value used for IMCR register.
Hope this helps.
Regards,
Martin