Date: Sun, 26 Dec 1999 00:35:43 +0900 From: NOKUBI Hirotaka <hnokubi@yyy.or.jp> To: Mike Smith <msmith@freebsd.org> Cc: freebsd-smp@freebsd.org Subject: Re: IRQ and APIC pin mapping question Message-ID: <19991225153517.9109915206@hub.freebsd.org> In-Reply-To: Your message of "Fri, 24 Dec 99 12:47:50 PST." <199912242047.MAA11237@mass.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for your response. In message <199912242047.MAA11237@mass.cdrom.com>, Mike Smith writes: >> I've been trying SMP kernel on NEC PC9821RvII which is not PC-AT >> compatible, FreeBSD PC98 port works fine on it with UP kernel. >> >> I made it possible to access MPCT at the top of the physical memory, > >Neat. Looking at the MPCT parsing code as it stands, it should probably >be integrated with our other BIOS signature search code. How do you find >the MPCP at the top of memory? Probably, my poor English would mislead you, sorry. I beleive you are talking about MP Floating Pointer Structure. Current FreeBSD code can find it on NEC PC98. No new BIOS signature search code is needed. I mean that MP Configuration Table is placed at the top of the physical memory on NEC PC98, that's the problem. Current FreeBSD code can't handle it, because these areas are not mapped, and used for message buffer before mptable_pass2() is called. Although latter problem will be solved in PC98 part, it needs to modify common part code for solving former one. I'll attach a patch for it. Please review. After appling patch, mp_probe() is called after pmap_bootstrap() so that making it possible that mp_probe() to use pmap_enter() for reading MPCT at the top of physical memory. >> How can I fix this problem without affecting PC-AT compatible? > >I can't claim to be any sort of expert regarding this code, but since >nobody else seems to be responding to your query, and since I've been >looking at it a bit over the last few days... Thank you for your time, and sorry, I've had to tell that Tor Egge replied to me personally two weeks ago, and he made patch. It solves problems, and I'm just waiting it to be committed. ---- NOKUBI Hirotaka Fingerprint20 = DEBC 0793 7CD6 92F1 0A1F A792 9E2F EEEE A41B 171D Index: i386/i386/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.379 diff -u -u -r1.379 machdep.c --- machdep.c 1999/11/24 01:02:58 1.379 +++ machdep.c 1999/12/25 15:10:12 @@ -1567,9 +1567,6 @@ #ifdef SMP /* make hole for AP bootstrap code */ physmap[1] = mp_bootaddress(physmap[1] / 1024); - - /* look for the MP hardware - needed for apic addresses */ - mp_probe(); #endif /* @@ -1631,6 +1628,10 @@ /* call pmap initialization to make new kernel address space */ pmap_bootstrap(first, 0); +#ifdef SMP + /* look for the MP hardware - needed for apic addresses */ + mp_probe(); +#endif /* * Size up each available chunk of physical memory. */ Index: i386/i386/mp_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/mp_machdep.c,v retrieving revision 1.111 diff -u -u -r1.111 mp_machdep.c --- mp_machdep.c 1999/10/15 21:38:15 1.111 +++ mp_machdep.c 1999/12/25 15:10:12 @@ -391,7 +391,7 @@ found: /* calculate needed resources */ - mpfps = (mpfps_t)x; + mpfps = (mpfps_t)(x + KERNBASE); if (mptable_pass1()) panic("you must reconfigure your kernel"); @@ -690,12 +690,12 @@ {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, {ISA, "ISA"}, + {ISA, "NEC98"}, {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, - {UNKNOWN_BUSTYPE, "---"}, {PCI, "PCI"}, {UNKNOWN_BUSTYPE, "---"}, {UNKNOWN_BUSTYPE, "---"}, @@ -757,6 +757,10 @@ int count; int type; int mustpanic; +#ifdef SMP + int i, j; + struct globaldata *gd; +#endif POSTCODE(MPTABLE_PASS1_POST); @@ -791,6 +795,14 @@ if ((cth = mpfps->pap) == 0) panic("MP Configuration Table Header MISSING!"); + if (cth >= (mpcth_t)0x100000) { + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page((vm_offset_t)cth), VM_PROT_READ, TRUE); + /* XXX do not support MPCT across page boundary */ + cth = (mpcth_t)(CADDR1 + ((int)cth & PAGE_MASK)); + } else { + cth = (mpcth_t)((u_int)cth + KERNBASE); + } cpu_apic_address = (vm_offset_t) cth->apic_address; /* walk the table, recording info of interest */ @@ -857,6 +869,46 @@ --mp_naps; /* subtract the BSP */ + if (cpu_apic_address == 0) + panic("pmap_bootstrap: no local apic!"); + + /* local apic is mapped on last page */ + SMPpt[NPTEPG - 1] = (pt_entry_t)(PG_V | PG_RW | PG_N | /*pgeflag |*/ + (cpu_apic_address & PG_FRAME)); + + for (i = 0; i < mp_napics; i++) { + for (j = 0; j < mp_napics; j++) { + /* same page frame as a previous IO apic? */ + if (((vm_offset_t)SMPpt[NPTEPG-2-j] & PG_FRAME) == + (io_apic_address[0] & PG_FRAME)) { + ioapic[i] = (ioapic_t *)((u_int)SMP_prvspace + + (NPTEPG-2-j)*PAGE_SIZE); + break; + } + /* use this slot if available */ + if (((vm_offset_t)SMPpt[NPTEPG-2-j] & PG_FRAME) == 0) { + SMPpt[NPTEPG-2-j] = (pt_entry_t)(PG_V | PG_RW | + /*pgeflag|*/ (io_apic_address[i] & PG_FRAME)); + ioapic[i] = (ioapic_t *)((u_int)SMP_prvspace + + (NPTEPG-2-j)*PAGE_SIZE); + break; + } + } + } + + /* BSP does this itself, AP's get it pre-set */ + gd = &SMP_prvspace[0].globaldata; + gd->gd_prv_CMAP1 = &SMPpt[1]; + gd->gd_prv_CMAP2 = &SMPpt[2]; + gd->gd_prv_CMAP3 = &SMPpt[3]; + gd->gd_prv_PMAP1 = &SMPpt[4]; + gd->gd_prv_CADDR1 = SMP_prvspace[0].CPAGE1; + gd->gd_prv_CADDR2 = SMP_prvspace[0].CPAGE2; + gd->gd_prv_CADDR3 = SMP_prvspace[0].CPAGE3; + gd->gd_prv_PADDR1 = (unsigned *)SMP_prvspace[0].PPAGE1; + + invltlb(); + return mustpanic; } @@ -914,6 +966,15 @@ if ((cth = mpfps->pap) == 0) panic("MP Configuration Table Header MISSING!"); + + if (cth >= (mpcth_t)0x100000) { + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page((vm_offset_t)cth), VM_PROT_READ, TRUE); + /* XXX do not support MPCT across page boundary */ + cth = (mpcth_t)(CADDR1 + ((int)cth & PAGE_MASK)); + } else { + cth = (mpcth_t)((u_int)cth + KERNBASE); + } /* walk the table, recording info of interest */ totalSize = cth->base_table_length - sizeof(struct MPCTH); Index: i386/i386/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/pmap.c,v retrieving revision 1.250 diff -u -u -r1.250 pmap.c --- pmap.c 1999/11/19 21:34:26 1.250 +++ pmap.c 1999/12/25 15:10:12 @@ -283,10 +283,6 @@ { vm_offset_t va; pt_entry_t *pte; -#ifdef SMP - int i, j; - struct globaldata *gd; -#endif avail_start = firstaddr; @@ -412,46 +408,6 @@ invltlb(); #endif } -#endif - -#ifdef SMP - if (cpu_apic_address == 0) - panic("pmap_bootstrap: no local apic!"); - - /* local apic is mapped on last page */ - SMPpt[NPTEPG - 1] = (pt_entry_t)(PG_V | PG_RW | PG_N | pgeflag | - (cpu_apic_address & PG_FRAME)); - - for (i = 0; i < mp_napics; i++) { - for (j = 0; j < mp_napics; j++) { - /* same page frame as a previous IO apic? */ - if (((vm_offset_t)SMPpt[NPTEPG-2-j] & PG_FRAME) == - (io_apic_address[0] & PG_FRAME)) { - ioapic[i] = (ioapic_t *)((u_int)SMP_prvspace - + (NPTEPG-2-j)*PAGE_SIZE); - break; - } - /* use this slot if available */ - if (((vm_offset_t)SMPpt[NPTEPG-2-j] & PG_FRAME) == 0) { - SMPpt[NPTEPG-2-j] = (pt_entry_t)(PG_V | PG_RW | - pgeflag | (io_apic_address[i] & PG_FRAME)); - ioapic[i] = (ioapic_t *)((u_int)SMP_prvspace - + (NPTEPG-2-j)*PAGE_SIZE); - break; - } - } - } - - /* BSP does this itself, AP's get it pre-set */ - gd = &SMP_prvspace[0].globaldata; - gd->gd_prv_CMAP1 = &SMPpt[1]; - gd->gd_prv_CMAP2 = &SMPpt[2]; - gd->gd_prv_CMAP3 = &SMPpt[3]; - gd->gd_prv_PMAP1 = &SMPpt[4]; - gd->gd_prv_CADDR1 = SMP_prvspace[0].CPAGE1; - gd->gd_prv_CADDR2 = SMP_prvspace[0].CPAGE2; - gd->gd_prv_CADDR3 = SMP_prvspace[0].CPAGE3; - gd->gd_prv_PADDR1 = (unsigned *)SMP_prvspace[0].PPAGE1; #endif invltlb(); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991225153517.9109915206>