console.c (8018:f3975c1b6009) console.c (8019:4af5d8f5ce56)
1/*
2 * Copyright (c) 2003, 2004
3 * The Regents of The University of Michigan
4 * All Rights Reserved
5 *
6 * This code is part of the M5 simulator, developed by Nathan Binkert,
7 * Erik Hallnor, Steve Raasch, and Steve Reinhardt, with contributions
8 * from Ron Dreslinski, Dave Greene, Lisa Hsu, Ali Saidi, and Andrew

--- 55 unchanged lines hidden (view full) ---

64#include "cserve.h"
65#include "rpb.h"
66
67#define CONS_INT_TX 0x01 /* interrupt enable / state bits */
68#define CONS_INT_RX 0x02
69
70#define PAGE_SIZE (8192)
71
1/*
2 * Copyright (c) 2003, 2004
3 * The Regents of The University of Michigan
4 * All Rights Reserved
5 *
6 * This code is part of the M5 simulator, developed by Nathan Binkert,
7 * Erik Hallnor, Steve Raasch, and Steve Reinhardt, with contributions
8 * from Ron Dreslinski, Dave Greene, Lisa Hsu, Ali Saidi, and Andrew

--- 55 unchanged lines hidden (view full) ---

64#include "cserve.h"
65#include "rpb.h"
66
67#define CONS_INT_TX 0x01 /* interrupt enable / state bits */
68#define CONS_INT_RX 0x02
69
70#define PAGE_SIZE (8192)
71
72#define KSTACK_REGION_VA 0x20040000
73
74#define KSEG 0xfffffc0000000000
75#define K1BASE 0xfffffc8000000000
76#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG)
77
78#define ROUNDUP8(x) ((ulong)(((ulong)x)+7) & ~7)
79#define ROUNDUP128(x) ((ulong)(((ulong)x) + 127) & ~127)
80#define ROUNDUP8K(x) ((ulong)(((ulong)(x)) + 8191) & ~8191)
81

--- 428 unchanged lines hidden (view full) ---

510 }
511
512 /* Protect the PAL pages */
513 for (i = 1; i < PFN(first); i++)
514 third_rpb[HWRPB_PAGES + MDT_BITMAP_PAGES + i] = KPTE(i);
515
516 /* Set up third_kernel after it's loaded, when we know where it is */
517 kern_first_page = (KSEG_TO_PHYS(m5Conf.kernStart)/PAGE_SIZE);
72#define KSEG 0xfffffc0000000000
73#define K1BASE 0xfffffc8000000000
74#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG)
75
76#define ROUNDUP8(x) ((ulong)(((ulong)x)+7) & ~7)
77#define ROUNDUP128(x) ((ulong)(((ulong)x) + 127) & ~127)
78#define ROUNDUP8K(x) ((ulong)(((ulong)(x)) + 8191) & ~8191)
79

--- 428 unchanged lines hidden (view full) ---

508 }
509
510 /* Protect the PAL pages */
511 for (i = 1; i < PFN(first); i++)
512 third_rpb[HWRPB_PAGES + MDT_BITMAP_PAGES + i] = KPTE(i);
513
514 /* Set up third_kernel after it's loaded, when we know where it is */
515 kern_first_page = (KSEG_TO_PHYS(m5Conf.kernStart)/PAGE_SIZE);
518 kernel_end = ROUNDUP8K(m5Conf.kernEnd);
516 kernel_end = ksp_top = ROUNDUP8K(m5Conf.kernEnd);
519 bootadr = m5Conf.entryPoint;
520
521 printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x"
522 " l2reserv 0x%x\n",
523 rpb, first, second, third_rpb, third_kernel, reservedFixup);
524 if (kernel_end - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
525 printf_lock("Kernel is more than 8MB 0x%x - 0x%x = 0x%x\n",
526 kernel_end, m5Conf.kernStart,
527 kernel_end - m5Conf.kernStart );
528 panic("kernel too big\n");
529 }
530 printf_lock("kstart = 0x%x, kend = 0x%x, kentry = 0x%x, numCPUs = 0x%x\n", m5Conf.kernStart, m5Conf.kernEnd, m5Conf.entryPoint, m5Conf.numCPUs);
517 bootadr = m5Conf.entryPoint;
518
519 printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x"
520 " l2reserv 0x%x\n",
521 rpb, first, second, third_rpb, third_kernel, reservedFixup);
522 if (kernel_end - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
523 printf_lock("Kernel is more than 8MB 0x%x - 0x%x = 0x%x\n",
524 kernel_end, m5Conf.kernStart,
525 kernel_end - m5Conf.kernStart );
526 panic("kernel too big\n");
527 }
528 printf_lock("kstart = 0x%x, kend = 0x%x, kentry = 0x%x, numCPUs = 0x%x\n", m5Conf.kernStart, m5Conf.kernEnd, m5Conf.entryPoint, m5Conf.numCPUs);
529 /* Map the kernel's pages into the third level of region 2 */
530 //for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) {
531 // third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr));
532 //}
531
533
532 ksp_bottom = (ulong)unix_boot_alloc(1);
533 ksp_top = ksp_bottom + PAGE_SIZE;
534 ksp_top = (ulong)unix_boot_alloc(1);
535 ksp = ksp_top + PAGE_SIZE;
534
536
535 ptr = (ulong) ksp_bottom;
536 bzero((char *)ptr, PAGE_SIZE);
537 dbPage[THIRD(KSTACK_REGION_VA)] = 0; /* Stack Guard Page */
538 dbPage[THIRD(KSTACK_REGION_VA + PAGE_SIZE)] = KPTE(PFN(ptr)); /* Kernel Stack Page */
539 dbPage[THIRD(KSTACK_REGION_VA + 2*PAGE_SIZE)] = 0; /* Stack Guard Page */
537 //if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
538 // printf_lock("Kernel stack pushd us over 8MB\n");
539 // panic("ksp too big\n");
540 //}
541 //if (THIRD_XXX((ulong)ksp_top) > NUM_KERNEL_THIRD * 1024) {
542 // panic("increase NUM_KERNEL_THIRD, and change THIRD_XXX\n");
543 //}
544 ptr = (ulong) ksp_top;
545 bzero((char *)ptr, PAGE_SIZE * 2);
546 dbPage[THIRD(0x20040000)] = 0; /* Stack Guard Page */
547 dbPage[THIRD(0x20042000)] = KPTE(PFN(ptr)); /* Kernel Stack Pages */
548 dbPage[THIRD(0x20046000)] = 0; /* Stack Guard Page */
540
541 /* put argv into the bottom of the stack - argv starts at 1 because
542 * the command thatr got us here (i.e. "unixboot) is in argv[0].
543 */
549
550 /* put argv into the bottom of the stack - argv starts at 1 because
551 * the command thatr got us here (i.e. "unixboot) is in argv[0].
552 */
544 ksp = ksp_top - 8; /* Back up one longword */
553 ksp -= 8; /* Back up one longword */
545 ksp -= argc * sizeof(char *); /* Make room for argv */
546 kargv = (char **) ksp;
547 for (i = 1; i < argc; i++) { /* Copy arguments to stack */
548 ksp -= ((strlen(argv[i]) + 1) + 7) & ~0x7;
549 kargv[i-1] = (char *) ksp;
550 strcpy(kargv[i - 1], argv[i]);
551 }
552 kargc = i - 1;

--- 42 unchanged lines hidden (view full) ---

595 for (i = 0; i < m5Conf.numCPUs; i++) {
596 struct rpb_percpu *thisCPU = (struct rpb_percpu*)
597 ((ulong)rpb_percpu + percpu_size * i);
598
599 bzero((char *)thisCPU, percpu_size);
600 bcopy((char *)&m5_rpb_percpu, (char *)thisCPU,
601 sizeof(struct rpb_percpu));
602
554 ksp -= argc * sizeof(char *); /* Make room for argv */
555 kargv = (char **) ksp;
556 for (i = 1; i < argc; i++) { /* Copy arguments to stack */
557 ksp -= ((strlen(argv[i]) + 1) + 7) & ~0x7;
558 kargv[i-1] = (char *) ksp;
559 strcpy(kargv[i - 1], argv[i]);
560 }
561 kargc = i - 1;

--- 42 unchanged lines hidden (view full) ---

604 for (i = 0; i < m5Conf.numCPUs; i++) {
605 struct rpb_percpu *thisCPU = (struct rpb_percpu*)
606 ((ulong)rpb_percpu + percpu_size * i);
607
608 bzero((char *)thisCPU, percpu_size);
609 bcopy((char *)&m5_rpb_percpu, (char *)thisCPU,
610 sizeof(struct rpb_percpu));
611
603 thisCPU->rpb_pcb.rpb_ksp = (KSTACK_REGION_VA + 2*PAGE_SIZE - (ksp_top - ksp));
612 thisCPU->rpb_pcb.rpb_ksp = (0x20044000 - 0x18);
604 thisCPU->rpb_pcb.rpb_ptbr = PFN(first);
605
606 thisCPU->rpb_logout = KSEG_TO_PHYS(percpu_logout);
607 thisCPU->rpb_logout_len = PAGE_SIZE;
608
609 printf_lock("KSP: 0x%x PTBR 0x%x\n",
610 thisCPU->rpb_pcb.rpb_ksp, thisCPU->rpb_pcb.rpb_ptbr);
611 }

--- 6 unchanged lines hidden (view full) ---

618 rpb_ctb = (struct rpb_ctb *) nextPtr;
619 ctb_tt = (struct ctb_tt*) rpb_ctb;
620
621 rpb->rpb_ctb_off = ((ulong)rpb_ctb) - (ulong)rpb;
622 rpb->rpb_ctb_size = sizeof(struct rpb_ctb);
623
624 bzero((char *)rpb_ctb, sizeof(struct ctb_tt));
625
613 thisCPU->rpb_pcb.rpb_ptbr = PFN(first);
614
615 thisCPU->rpb_logout = KSEG_TO_PHYS(percpu_logout);
616 thisCPU->rpb_logout_len = PAGE_SIZE;
617
618 printf_lock("KSP: 0x%x PTBR 0x%x\n",
619 thisCPU->rpb_pcb.rpb_ksp, thisCPU->rpb_pcb.rpb_ptbr);
620 }

--- 6 unchanged lines hidden (view full) ---

627 rpb_ctb = (struct rpb_ctb *) nextPtr;
628 ctb_tt = (struct ctb_tt*) rpb_ctb;
629
630 rpb->rpb_ctb_off = ((ulong)rpb_ctb) - (ulong)rpb;
631 rpb->rpb_ctb_size = sizeof(struct rpb_ctb);
632
633 bzero((char *)rpb_ctb, sizeof(struct ctb_tt));
634
626 rpb_ctb->rpb_type = CONS_DZ;
635 rpb_ctb->rpb_type = CONS_REM;
627 rpb_ctb->rpb_length = sizeof(ctb_tt) - sizeof(rpb_ctb);
628
629 /*
630 * uart initizliation
631 */
636 rpb_ctb->rpb_length = sizeof(ctb_tt) - sizeof(rpb_ctb);
637
638 /*
639 * uart initizliation
640 */
632 ctb_tt->ctb_csr = 0;
633 ctb_tt->ctb_tivec = 0x6c0; /* matches tlaser pal code */
634 ctb_tt->ctb_rivec = 0x680; /* matches tlaser pal code */
635 ctb_tt->ctb_term_type = 2;
636 ctb_tt->ctb_put_sts = 0;
637 ctb_tt->ctb_get_sts = 0;
641 ctb_tt->ctb_tintr_vec = 0x6c0; /* matches tlaser pal code */
642 ctb_tt->ctb_rintr_vec = 0x680; /* matches tlaser pal code */
643 ctb_tt->ctb_term_type = CTB_GRAPHICS;
638
639 rpb_crb = (struct rpb_crb *) (((ulong)rpb_ctb) + sizeof(struct ctb_tt));
640 rpb->rpb_crb_off = ((ulong)rpb_crb) - (ulong)rpb;
641
642 bzero((char *)rpb_crb, sizeof(struct rpb_crb));
643
644 /*
645 * console callback stuff (m5)

--- 461 unchanged lines hidden ---
644
645 rpb_crb = (struct rpb_crb *) (((ulong)rpb_ctb) + sizeof(struct ctb_tt));
646 rpb->rpb_crb_off = ((ulong)rpb_crb) - (ulong)rpb;
647
648 bzero((char *)rpb_crb, sizeof(struct rpb_crb));
649
650 /*
651 * console callback stuff (m5)

--- 461 unchanged lines hidden ---