Changeset 255 for soft/giet_vm/boot
- Timestamp:
- Oct 9, 2013, 9:32:41 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/boot/boot_init.c
r253 r255 69 69 #include <stdarg.h> 70 70 71 71 72 #if !defined(NB_CLUSTERS) 72 73 # error The NB_CLUSTERS value must be defined in the 'giet_config.h' file ! … … 80 81 # error The GIET_NB_VSPACE_MAX value must be defined in the 'giet_config.h' file ! 81 82 #endif 83 84 #define max(x, y) (((x) > (y)) ? (x) : (y)) 85 82 86 83 87 //////////////////////////////////////////////////////////////////////////// … … 555 559 556 560 ///////////////////////////////////////////////////////////////////// 557 // This function build the page table for a given vspace.561 // This function builds the page table for a given vspace. 558 562 // The physical base addresses for all vsegs (global and private) 559 563 // must have been previously computed and stored in the mapping. … … 577 581 for (vseg_id = vspace[vspace_id].vseg_offset; 578 582 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs); 579 vseg_id++) 583 vseg_id++) 580 584 { 581 585 vpn = vseg[vseg_id].vbase >> 12; … … 597 601 boot_puts(" / npages = "); 598 602 boot_putd(npages); 603 boot_puts(" / vbase = "); 604 boot_putx(vseg[vseg_id].vbase); 599 605 boot_puts(" / pbase = "); 600 606 boot_putl(vseg[vseg_id].pbase); … … 614 620 { 615 621 vpn = vseg[vseg_id].vbase >> 12; 616 ppn = (unsigned int) (vseg[vseg_id].pbase >> 12);622 ppn = (unsigned int) (vseg[vseg_id].pbase >> 12); 617 623 npages = vseg[vseg_id].length >> 12; 618 624 if ((vseg[vseg_id].length & 0xFFF) != 0) npages++; … … 630 636 boot_puts(" / npages = "); 631 637 boot_putd(npages); 638 boot_puts(" / vbase = "); 639 boot_putx(vseg[vseg_id].vbase); 632 640 boot_puts(" / pbase = "); 633 641 boot_putl(vseg[vseg_id].pbase); … … 646 654 647 655 /////////////////////////////////////////////////////////////////////////// 648 // Align the value of paddr or vaddr to the required alignement,656 // Aligns the value of paddr or vaddr to the required alignement, 649 657 // defined by alignPow2 == L2(alignement). 650 658 /////////////////////////////////////////////////////////////////////////// … … 660 668 return ((vaddr + mask) & ~mask); 661 669 } 670 671 672 673 /////////////////////////////////////////////////////////// 674 // Maps vseg on a pbase with identity mapping required 675 // The pseg is already set 676 // The length of the vseg must already be known 677 /////////////////////////////////////////////////////////// 678 void boot_vseg_set_paddr_ident(mapping_vseg_t * vseg) { 679 unsigned int vseg_id; 680 681 mapping_header_t * header = (mapping_header_t *) & seg_mapping_base; 682 mapping_vseg_t * vseg_base = boot_get_vseg_base(header); 683 684 if (vseg->pbase_set != 0) { 685 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr() function (internal error):\n"); 686 boot_puts("*** vseg->pbase already set\n"); 687 boot_exit(); 688 } 689 690 for (vseg_id = 0; vseg_id < header->vsegs; vseg_id++) { 691 // Already mapped vseg on the same pseg 692 if (vseg_base[vseg_id].psegid == vseg->psegid && vseg_base[vseg_id].pbase_set == 1) { 693 // Checking overlap condition 694 if (vseg->vbase == vseg_base[vseg_id].pbase || 695 ((vseg->vbase < vseg_base[vseg_id].pbase) && (vseg->vbase + vseg->length > vseg_base[vseg_id].pbase)) || 696 ((vseg->vbase > vseg_base[vseg_id].pbase) && (vseg_base[vseg_id].pbase + vseg_base[vseg_id].length > vseg->vbase))) { 697 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr_ident() function\n"); 698 boot_puts("*** Overlapping segments:\n"); 699 boot_puts(" seg with base = "); 700 boot_putl(vseg->vbase); 701 boot_puts(" - length = "); 702 boot_putl(vseg->length); 703 boot_puts("\n"); 704 boot_puts(" seg with base = \n"); 705 boot_putl(vseg_base[vseg_id].vbase); 706 boot_puts(" - length = "); 707 boot_putl(vseg_base[vseg_id].length); 708 boot_puts("\n"); 709 boot_exit(); 710 } 711 } 712 } 713 vseg->pbase = vseg->vbase; 714 vseg->pbase_set = 1; 715 } 716 717 718 719 /////////////////////////////////////////////////////////// 720 // Maps vseg on a pbase with no identity mapping required 721 // The pseg is already set 722 // The length of the vseg must already be known 723 /////////////////////////////////////////////////////////// 724 void boot_vseg_set_paddr(mapping_vseg_t * vseg) { 725 unsigned int vseg_id; 726 unsigned int nb_vsegs_mapped = 0; 727 unsigned int mapped = 0; 728 int i = 0; 729 730 paddr_t prev_base; 731 paddr_t prev_length = 0; 732 paddr_t curr_base = 0; 733 paddr_t curr_length = 0; 734 paddr_t next_base = 0; 735 paddr_t next_length = 0; 736 737 mapping_header_t * header = (mapping_header_t *) & seg_mapping_base; 738 mapping_vseg_t * vseg_base = boot_get_vseg_base(header); 739 mapping_vobj_t * vobj_base = boot_get_vobj_base(header); 740 mapping_pseg_t * pseg = boot_pseg_get(vseg->psegid); 741 742 const int align = max(vobj_base[vseg->vobj_offset].align, 12); 743 744 prev_base = pseg->base; 745 746 if (vseg->pbase_set != 0) { 747 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr() function (internal error):\n"); 748 boot_puts("*** vseg->pbase already set\n"); 749 boot_exit(); 750 } 751 752 // We now determinine the physical base address of the vseg 753 // Method: 754 // Now that all identity segments have been mapped 755 // We are free to place the vseg where we want 756 // From a logical point of view, we have the list of mapped vsegs ordered by their pbase (increasing) 757 // We try to place the vseg between two consecutive elements of this list 758 // If this fails, we try between the next two mapped vsegs 759 760 // Counting the number of vsegs mapped on this pseg 761 // We also initialize curr_base and curr_length with some values 762 for (vseg_id = 0; vseg_id < header->vsegs; vseg_id++) { 763 if (vseg_base[vseg_id].psegid == vseg->psegid && vseg_base[vseg_id].pbase_set == 1) { 764 nb_vsegs_mapped++; 765 curr_base = vseg_base[vseg_id].pbase; 766 curr_length = vseg_base[vseg_id].length; 767 } 768 } 769 770 if (nb_vsegs_mapped == 0) { 771 if (vseg->length <= pseg->length) { 772 vseg->pbase = pseg->base; 773 vseg->pbase_set = 1; 774 return; 775 } 776 else { 777 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr() function\n"); 778 boot_puts("*** PSEG is too small for mapping vseg (base:"); 779 boot_putl(vseg->vbase); 780 boot_puts(" - length: "); 781 boot_putl(vseg->length); 782 boot_puts(")\n"); 783 boot_exit(); 784 } 785 } 786 787 // We look for the vseg mapped on the same pseg having the smallest vaddr 788 for (vseg_id = 0; vseg_id < header->vsegs; vseg_id++) { 789 if (vseg_base[vseg_id].psegid == vseg->psegid 790 && &vseg_base[vseg_id] != vseg 791 && vseg_base[vseg_id].pbase_set == 1 792 && vseg_base[vseg_id].pbase < curr_base) { 793 curr_base = vseg_base[vseg_id].pbase; 794 curr_length = vseg_base[vseg_id].length; 795 } 796 } 797 798 // We iterate on each vseg mapped in the order of their growing pbase 799 // and try to insert the current vseg right after each 800 while (i < nb_vsegs_mapped) { 801 if (paddr_align_to(prev_base + prev_length, align) + vseg->length <= curr_base) { 802 vseg->pbase = paddr_align_to(prev_base + prev_length, align); 803 vseg->pbase_set = 1; 804 mapped = 1; 805 break; 806 } 807 else if (i < nb_vsegs_mapped - 1) { 808 int found = 0; 809 next_base = 0; 810 // We search for the vseg having the minimal pbase which is more than the pbase of the current vseg 811 for (vseg_id = 0; vseg_id < header->vsegs; vseg_id++) { 812 if (vseg_base[vseg_id].psegid == vseg->psegid 813 && &vseg_base[vseg_id] != vseg 814 && vseg_base[vseg_id].pbase_set == 1 815 && (vseg_base[vseg_id].pbase < next_base || !found) 816 && vseg_base[vseg_id].pbase > curr_base) { 817 found = 1; 818 next_base = vseg_base[vseg_id].pbase; 819 next_length = vseg_base[vseg_id].length; 820 } 821 } 822 if (!found) { 823 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr() function (internal error):\n"); 824 boot_puts("*** Next vseg not found\n"); 825 boot_exit(); 826 } 827 828 prev_base = curr_base; 829 prev_length = curr_length; 830 831 curr_base = next_base; 832 curr_length = next_length; 833 } 834 else { 835 // The current vseg is the last one (highest mapped paddr on this pseg) 836 // We try to insert the current vseg after it 837 if (paddr_align_to(curr_base + curr_length, align) + vseg->length <= pseg->base + pseg->length) { 838 vseg->pbase = paddr_align_to(curr_base + curr_length, align); 839 vseg->pbase_set = 1; 840 mapped = 1; 841 } 842 } 843 i++; 844 } 845 846 if (!mapped) { 847 boot_puts("\n[BOOT ERROR] in boot_vseg_set_paddr() function:\n"); 848 boot_puts("*** Not enough space to map vseg (base: "); 849 boot_putl(vseg->vbase); 850 boot_puts(" - length: "); 851 boot_putl(vseg->length); 852 boot_puts(")\n"); 853 boot_exit(); 854 } 855 } 856 662 857 663 858 /////////////////////////////////////////////////////////////////////////// … … 666 861 // It updates the pbase and the length fields of the vseg. 667 862 // It updates the pbase and vbase fields of all vobjs in the vseg. 668 // It updates the next_base field of the pseg, and checks overflow.669 863 // It updates the boot_ptabs_paddr[] and boot_ptabs_vaddr[] arrays. 670 864 // It is a global vseg if vspace_id = (-1). … … 675 869 unsigned int cur_vaddr; 676 870 paddr_t cur_paddr; 871 paddr_t cur_length; 677 872 unsigned int offset; 678 873 679 874 mapping_header_t * header = (mapping_header_t *) & seg_mapping_base; 680 mapping_vobj_t * vobj = boot_get_vobj_base(header); 681 682 // get physical segment pointer 683 mapping_pseg_t* pseg = boot_pseg_get(vseg->psegid); 684 685 // compute vseg physical base address 686 if (vseg->ident != 0) // identity mapping required 687 { 688 vseg->pbase = vseg->vbase; 689 } 690 else // unconstrained mapping 691 { 692 vseg->pbase = pseg->next_base; 693 694 // test alignment constraint 695 if (vobj[vseg->vobj_offset].align) 696 { 697 vseg->pbase = paddr_align_to(vseg->pbase, vobj[vseg->vobj_offset].align); 698 } 699 } 875 mapping_vobj_t * vobj = boot_get_vobj_base(header); 876 877 // We make a first loop on the vobj of the vseg to determine the real length of the vseg 878 // This length is required to determine the pbase of the vseg 879 cur_length = 0; 880 for (vobj_id = vseg->vobj_offset; vobj_id < (vseg->vobj_offset + vseg->vobjs); vobj_id++) { 881 if (vobj[vobj_id].align) { 882 cur_length = vaddr_align_to(cur_length, vobj[vobj_id].align); 883 } 884 cur_length += vobj[vobj_id].length; 885 } 886 vseg->length = paddr_align_to(cur_length, 12); 887 888 // We can now compute the vseg physical base address 889 if (vseg->ident != 0) { 890 // identity mapping required 891 boot_vseg_set_paddr_ident(vseg); 892 } 893 else { 894 // unconstrained mapping 895 boot_vseg_set_paddr(vseg); 896 } 897 700 898 701 899 // loop on vobjs contained in vseg to : 702 900 // (1) computes the length of the vseg, 703 901 // (2) initialize the vaddr and paddr fields of all vobjs, 704 // (3) initialize the page table pointers arrays 902 // (3) initialize the page table pointers arrays 705 903 706 904 cur_vaddr = vseg->vbase; 707 905 cur_paddr = vseg->pbase; 708 906 709 for (vobj_id = vseg->vobj_offset; 710 vobj_id < (vseg->vobj_offset + vseg->vobjs); vobj_id++) 711 { 712 if (vobj[vobj_id].align) 713 { 907 for (vobj_id = vseg->vobj_offset; 908 vobj_id < (vseg->vobj_offset + vseg->vobjs); vobj_id++) { 909 if (vobj[vobj_id].align) { 714 910 cur_paddr = paddr_align_to(cur_paddr, vobj[vobj_id].align); 715 911 cur_vaddr = vaddr_align_to(cur_vaddr, vobj[vobj_id].align); … … 729 925 } 730 926 // we need at least one PT2 731 if (vobj[vobj_id].length < (PT1_SIZE + PT2_SIZE)) 927 if (vobj[vobj_id].length < (PT1_SIZE + PT2_SIZE)) 732 928 { 733 929 boot_puts("\n[BOOT ERROR] in boot_vseg_map() function, "); … … 741 937 742 938 // reset all valid bits in PT1 743 for ( offset = 0 ; offset < 8192; offset = offset + 4)939 for (offset = 0; offset < 8192; offset = offset + 4) 744 940 { 745 941 boot_physical_write(cur_paddr + offset, 0); … … 754 950 cur_paddr = cur_paddr + vobj[vobj_id].length; 755 951 } // end for vobjs 756 757 //set the vseg length758 vseg->length = vaddr_align_to((unsigned int)(cur_paddr - vseg->pbase), 12);759 760 // checking pseg overflow761 if ((vseg->pbase < pseg->base) ||762 ((vseg->pbase + vseg->length) > (pseg->base + pseg->length)))763 {764 boot_puts("\n[BOOT ERROR] in boot_vseg_map() function\n");765 boot_puts("impossible mapping for virtual segment: ");766 boot_puts(vseg->name);767 boot_puts("\n");768 boot_puts("vseg pbase = ");769 boot_putl(vseg->pbase);770 boot_puts("\n");771 boot_puts("vseg length = ");772 boot_putx(vseg->length);773 boot_puts("\n");774 boot_puts("pseg pbase = ");775 boot_putl(pseg->base);776 boot_puts("\n");777 boot_puts("pseg length = ");778 boot_putl(pseg->length);779 boot_puts("\n");780 boot_exit();781 }782 952 783 953 #if BOOT_DEBUG_PT … … 792 962 #endif 793 963 794 // set the next_base field in pseg when it's a RAM795 if ( pseg->type == PSEG_TYPE_RAM )796 {797 pseg->next_base = vseg->pbase + vseg->length;798 }799 964 } // end boot_vseg_map() 800 965 … … 835 1000 836 1001 #if BOOT_DEBUG_MAPPING 837 boot_puts("\nclusters = ");838 boot_putd( header->clusters );839 boot_puts("\nprocs = ");840 boot_putd( header->procs );841 boot_puts("\nperiphs = ");842 boot_putd( header->periphs );843 boot_puts("\nvspaces = ");844 boot_putd( header->vspaces );845 boot_puts("\ntasks = ");846 boot_putd( header->tasks );847 boot_puts("\n");848 849 unsigned int cluster_id;850 mapping_cluster_t * cluster = boot_get_cluster_base(header);851 for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++)852 {853 boot_puts("\n cluster = ");854 boot_putd( cluster_id );855 boot_puts("\n procs = ");856 boot_putd( cluster[cluster_id].procs );857 boot_puts("\n psegs = ");858 boot_putd( cluster[cluster_id].psegs );859 boot_puts("\n periphs = ");860 boot_putd( cluster[cluster_id].periphs );861 boot_puts("\n");862 }1002 boot_puts("\nclusters = "); 1003 boot_putd( header->clusters ); 1004 boot_puts("\nprocs = "); 1005 boot_putd( header->procs ); 1006 boot_puts("\nperiphs = "); 1007 boot_putd( header->periphs ); 1008 boot_puts("\nvspaces = "); 1009 boot_putd( header->vspaces ); 1010 boot_puts("\ntasks = "); 1011 boot_putd( header->tasks ); 1012 boot_puts("\n"); 1013 1014 unsigned int cluster_id; 1015 mapping_cluster_t * cluster = boot_get_cluster_base(header); 1016 for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++) 1017 { 1018 boot_puts("\n cluster = "); 1019 boot_putd( cluster_id ); 1020 boot_puts("\n procs = "); 1021 boot_putd( cluster[cluster_id].procs ); 1022 boot_puts("\n psegs = "); 1023 boot_putd( cluster[cluster_id].psegs ); 1024 boot_puts("\n periphs = "); 1025 boot_putd( cluster[cluster_id].periphs ); 1026 boot_puts("\n"); 1027 } 863 1028 #endif 864 1029 … … 871 1036 } // end boot_check_mapping() 872 1037 873 /////////////////////////////////////////////////////////////////////874 // This function initialises the physical pages table allocators875 // for all psegs (i.e. next_base field of the pseg).876 /////////////////////////////////////////////////////////////////////877 void boot_psegs_init()878 {879 mapping_header_t* header = (mapping_header_t *) &seg_mapping_base;880 mapping_cluster_t* cluster = boot_get_cluster_base(header);881 mapping_pseg_t* pseg = boot_get_pseg_base(header);882 883 unsigned int cluster_id;884 unsigned int pseg_id;885 886 #if BOOT_DEBUG_PT887 boot_puts ("\n[BOOT DEBUG] ****** psegs allocators initialisation ******\n");888 #endif889 890 for (cluster_id = 0; cluster_id < header->clusters; cluster_id++)891 {892 if (cluster[cluster_id].procs > NB_PROCS_MAX)893 {894 boot_puts("\n[BOOT ERROR] The number of processors in cluster ");895 boot_putd(cluster_id);896 boot_puts(" is larger than NB_PROCS_MAX \n");897 boot_exit();898 }899 900 for (pseg_id = cluster[cluster_id].pseg_offset;901 pseg_id < cluster[cluster_id].pseg_offset + cluster[cluster_id].psegs;902 pseg_id++)903 {904 pseg[pseg_id].next_base = pseg[pseg_id].base;905 906 #if BOOT_DEBUG_PT907 boot_puts("cluster ");908 boot_putd(cluster_id);909 boot_puts(" / pseg ");910 boot_puts(pseg[pseg_id].name);911 boot_puts(" : next_base = ");912 boot_putl(pseg[pseg_id].next_base);913 boot_puts("\n");914 #endif915 }916 }917 918 boot_puts("\n[BOOT] Pseg allocators initialisation completed at cycle ");919 boot_putd(boot_proctime());920 boot_puts("\n");921 922 } // end boot_psegs_init()923 1038 924 1039 ///////////////////////////////////////////////////////////////////// … … 941 1056 942 1057 #if BOOT_DEBUG_PT 943 boot_puts("\n[BOOT DEBUG] ****** mapping global vsegs ******\n");1058 boot_puts("\n[BOOT DEBUG] ****** mapping global vsegs ******\n"); 944 1059 #endif 945 1060 946 1061 // step 1 : loop on virtual spaces to map global vsegs 1062 // Identity vseg first 947 1063 for (vseg_id = 0; vseg_id < header->globals; vseg_id++) 948 1064 { 949 boot_vseg_map(&vseg[vseg_id], ((unsigned int) (-1))); 950 } 1065 if (vseg[vseg_id].ident == 1) { 1066 boot_vseg_map(&vseg[vseg_id], ((unsigned int) (-1))); 1067 } 1068 } 1069 // Non identity vseg second 1070 for (vseg_id = 0; vseg_id < header->globals; vseg_id++) 1071 { 1072 if (vseg[vseg_id].ident == 0) { 1073 boot_vseg_map(&vseg[vseg_id], ((unsigned int) (-1))); 1074 } 1075 } 1076 951 1077 952 1078 // step 2 : loop on virtual vspaces to map private vsegs … … 955 1081 956 1082 #if BOOT_DEBUG_PT 957 boot_puts("\n[BOOT DEBUG] ****** mapping private vsegs in vspace "); 958 boot_puts(vspace[vspace_id].name); 959 boot_puts(" ******\n"); 960 #endif 961 1083 boot_puts("\n[BOOT DEBUG] ****** mapping private vsegs in vspace "); 1084 boot_puts(vspace[vspace_id].name); 1085 boot_puts(" ******\n"); 1086 #endif 1087 1088 // Identity vseg first 962 1089 for (vseg_id = vspace[vspace_id].vseg_offset; 963 1090 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs); 964 vseg_id++) 965 { 966 boot_vseg_map(&vseg[vseg_id], vspace_id); 1091 vseg_id++) { 1092 if (vseg[vseg_id].ident == 1) { 1093 boot_vseg_map(&vseg[vseg_id], vspace_id); 1094 } 1095 } 1096 // Non identity vseg second 1097 for (vseg_id = vspace[vspace_id].vseg_offset; 1098 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs); 1099 vseg_id++) { 1100 if (vseg[vseg_id].ident == 0) { 1101 boot_vseg_map(&vseg[vseg_id], vspace_id); 1102 } 967 1103 } 968 1104 } … … 972 1108 { 973 1109 #if BOOT_DEBUG_PT 974 boot_puts("\n[BOOT DEBUG] ****** building page table for vspace "); 975 boot_puts(vspace[vspace_id].name); 976 boot_puts(" ******\n"); 977 #endif 1110 boot_puts("\n[BOOT DEBUG] ****** building page table for vspace "); 1111 boot_puts(vspace[vspace_id].name); 1112 boot_puts(" ******\n"); 1113 #endif 1114 978 1115 boot_vspace_pt_build(vspace_id); 979 1116 980 1117 #if BOOT_DEBUG_PT 981 boot_puts("\n>>> page table physical address = ");982 boot_putl(boot_ptabs_paddr[vspace_id]);983 boot_puts(", number of PT2 = ");984 boot_putd((unsigned int) boot_max_pt2[vspace_id]);985 boot_puts("\n");986 #endif 987 } 988 989 boot_puts("\n[BOOT] Page Tables initiali sation completed at cycle ");1118 boot_puts("\n>>> page table physical address = "); 1119 boot_putl(boot_ptabs_paddr[vspace_id]); 1120 boot_puts(", number of PT2 = "); 1121 boot_putd((unsigned int) boot_max_pt2[vspace_id]); 1122 boot_puts("\n"); 1123 #endif 1124 } 1125 1126 boot_puts("\n[BOOT] Page Tables initialization completed at cycle "); 990 1127 boot_putd(boot_proctime()); 991 1128 boot_puts("\n"); … … 999 1136 // Warning : The MMU is supposed to be activated... 1000 1137 /////////////////////////////////////////////////////////////////////////////// 1001 void boot_vobjs_init() 1138 void boot_vobjs_init() 1002 1139 { 1003 1140 mapping_header_t* header = (mapping_header_t *) & seg_mapping_base; … … 1011 1148 for (vspace_id = 0; vspace_id < header->vspaces; vspace_id++) 1012 1149 { 1150 boot_set_mmu_ptpr((unsigned int) (boot_ptabs_paddr[vspace_id] >> 13)); 1013 1151 1014 1152 #if BOOT_DEBUG_VOBJS 1015 boot_puts("\n[BOOT DEBUG] ****** vobjs initialisation in vspace ");1016 boot_puts(vspace[vspace_id].name);1017 boot_puts(" ******\n");1153 boot_puts("\n[BOOT DEBUG] ****** vobjs initialisation in vspace "); 1154 boot_puts(vspace[vspace_id].name); 1155 boot_puts(" ******\n"); 1018 1156 #endif 1019 1157 … … 1023 1161 for (vobj_id = vspace[vspace_id].vobj_offset; 1024 1162 vobj_id < (vspace[vspace_id].vobj_offset + vspace[vspace_id].vobjs); 1025 vobj_id++) 1163 vobj_id++) 1026 1164 { 1027 1165 switch (vobj[vobj_id].type) … … 1037 1175 mwmr->lock = 0; 1038 1176 #if BOOT_DEBUG_VOBJS 1039 boot_puts("MWMR : ");1040 boot_puts(vobj[vobj_id].name);1041 boot_puts(" / depth = ");1042 boot_putd(mwmr->depth);1043 boot_puts(" / width = ");1044 boot_putd(mwmr->width);1045 boot_puts("\n");1177 boot_puts("MWMR : "); 1178 boot_puts(vobj[vobj_id].name); 1179 boot_puts(" / depth = "); 1180 boot_putd(mwmr->depth); 1181 boot_puts(" / width = "); 1182 boot_putd(mwmr->width); 1183 boot_puts("\n"); 1046 1184 #endif 1047 1185 break; … … 1050 1188 { 1051 1189 #if BOOT_DEBUG_VOBJS 1052 boot_puts("ELF : ");1053 boot_puts(vobj[vobj_id].name);1054 boot_puts(" / length = ");1055 boot_putx(vobj[vobj_id].length);1056 boot_puts("\n");1190 boot_puts("ELF : "); 1191 boot_puts(vobj[vobj_id].name); 1192 boot_puts(" / length = "); 1193 boot_putx(vobj[vobj_id].length); 1194 boot_puts("\n"); 1057 1195 #endif 1058 1196 break; … … 1061 1199 { 1062 1200 #if BOOT_DEBUG_VOBJS 1063 boot_puts("BLOB : ");1064 boot_puts(vobj[vobj_id].name);1065 boot_puts(" / length = ");1066 boot_putx(vobj[vobj_id].length);1067 boot_puts("\n");1201 boot_puts("BLOB : "); 1202 boot_puts(vobj[vobj_id].name); 1203 boot_puts(" / length = "); 1204 boot_putx(vobj[vobj_id].length); 1205 boot_puts("\n"); 1068 1206 #endif 1069 1207 break; … … 1075 1213 barrier->init = vobj[vobj_id].init; 1076 1214 #if BOOT_DEBUG_VOBJS 1077 boot_puts("BARRIER : ");1078 boot_puts(vobj[vobj_id].name);1079 boot_puts(" / init_value = ");1080 boot_putd(barrier->init);1081 boot_puts("\n");1215 boot_puts("BARRIER : "); 1216 boot_puts(vobj[vobj_id].name); 1217 boot_puts(" / init_value = "); 1218 boot_putd(barrier->init); 1219 boot_puts("\n"); 1082 1220 #endif 1083 1221 break; … … 1088 1226 *lock = 0; 1089 1227 #if BOOT_DEBUG_VOBJS 1090 boot_puts("LOCK : ");1091 boot_puts(vobj[vobj_id].name);1092 boot_puts("\n");1228 boot_puts("LOCK : "); 1229 boot_puts(vobj[vobj_id].name); 1230 boot_puts("\n"); 1093 1231 #endif 1094 1232 break; … … 1097 1235 { 1098 1236 #if BOOT_DEBUG_VOBJS 1099 boot_puts("BUFFER : ");1100 boot_puts(vobj[vobj_id].name);1101 boot_puts(" / paddr = ");1102 boot_putl(vobj[vobj_id].paddr);1103 boot_puts(" / length = ");1104 boot_putx(vobj[vobj_id].length);1105 boot_puts("\n");1237 boot_puts("BUFFER : "); 1238 boot_puts(vobj[vobj_id].name); 1239 boot_puts(" / paddr = "); 1240 boot_putl(vobj[vobj_id].paddr); 1241 boot_puts(" / length = "); 1242 boot_putx(vobj[vobj_id].length); 1243 boot_puts("\n"); 1106 1244 #endif 1107 1245 break; … … 1109 1247 case VOBJ_TYPE_MEMSPACE: 1110 1248 { 1111 giet_memspace_t * memspace = (giet_memspace_t *) vobj[vobj_id].vaddr;1249 giet_memspace_t * memspace = (giet_memspace_t *) vobj[vobj_id].vaddr; 1112 1250 memspace->buffer = (void *) vobj[vobj_id].vaddr + 8; 1113 1251 memspace->size = vobj[vobj_id].length - 8; 1114 1252 #if BOOT_DEBUG_VOBJS 1115 boot_puts("MEMSPACE : ");1116 boot_puts(vobj[vobj_id].name);1117 boot_puts(" / vaddr = ");1118 boot_putx(vobj[vobj_id].vaddr);1119 boot_puts(" / length = ");1120 boot_putx(vobj[vobj_id].length);1121 boot_puts(" / buffer = ");1122 boot_putx((unsigned int)memspace->buffer);1123 boot_puts(" / size = ");1124 boot_putx(memspace->size);1125 boot_puts("\n");1253 boot_puts("MEMSPACE : "); 1254 boot_puts(vobj[vobj_id].name); 1255 boot_puts(" / vaddr = "); 1256 boot_putx(vobj[vobj_id].vaddr); 1257 boot_puts(" / length = "); 1258 boot_putx(vobj[vobj_id].length); 1259 boot_puts(" / buffer = "); 1260 boot_putx((unsigned int) memspace->buffer); 1261 boot_puts(" / size = "); 1262 boot_putx(memspace->size); 1263 boot_puts("\n"); 1126 1264 #endif 1127 1265 break; … … 1131 1269 ptab_found = 1; 1132 1270 #if BOOT_DEBUG_VOBJS 1133 boot_puts("PTAB : ");1134 boot_puts(vobj[vobj_id].name);1135 boot_puts(" / length = ");1136 boot_putx(vobj[vobj_id].length);1137 boot_puts("\n");1271 boot_puts("PTAB : "); 1272 boot_puts(vobj[vobj_id].name); 1273 boot_puts(" / length = "); 1274 boot_putx(vobj[vobj_id].length); 1275 boot_puts("\n"); 1138 1276 #endif 1139 1277 break; … … 1144 1282 *addr = vobj[vobj_id].init; 1145 1283 #if BOOT_DEBUG_VOBJS 1146 boot_puts("CONST : ");1147 boot_puts(vobj[vobj_id].name);1148 boot_puts(" / Paddr :");1149 boot_putl(vobj[vobj_id].paddr);1150 boot_puts(" / init = ");1151 boot_putx(*addr);1152 boot_puts("\n");1284 boot_puts("CONST : "); 1285 boot_puts(vobj[vobj_id].name); 1286 boot_puts(" / Paddr :"); 1287 boot_putl(vobj[vobj_id].paddr); 1288 boot_puts(" / init = "); 1289 boot_putx(*addr); 1290 boot_puts("\n"); 1153 1291 #endif 1154 1292 break; … … 1238 1376 1239 1377 #if BOOT_DEBUG_PERI 1240 boot_puts("\n[BOOT DEBUG] ****** peripherals initialisation in cluster ");1241 boot_putd(cluster_id);1242 boot_puts(" ******\n");1378 boot_puts("\n[BOOT DEBUG] ****** peripherals initialisation in cluster "); 1379 boot_putd(cluster_id); 1380 boot_puts(" ******\n"); 1243 1381 #endif 1244 1382 … … 1254 1392 1255 1393 #if BOOT_DEBUG_PERI 1256 boot_puts("- peripheral type : ");1257 boot_putd(type);1258 boot_puts(" / pbase = ");1259 boot_putl(pbase);1260 boot_puts(" / channels = ");1261 boot_putd(channels);1262 boot_puts("\n");1394 boot_puts("- peripheral type : "); 1395 boot_putd(type); 1396 boot_puts(" / pbase = "); 1397 boot_putl(pbase); 1398 boot_puts(" / channels = "); 1399 boot_putd(channels); 1400 boot_puts("\n"); 1263 1401 #endif 1264 1402 … … 1270 1408 boot_physical_write(paddr, 1); 1271 1409 #if BOOT_DEBUG_PERI 1272 boot_puts("- IOC initialised\n");1410 boot_puts("- IOC initialised\n"); 1273 1411 #endif 1274 1412 } … … 1281 1419 } 1282 1420 #if BOOT_DEBUG_PERI 1283 boot_puts("- DMA initialised\n");1421 boot_puts("- DMA initialised\n"); 1284 1422 #endif 1285 1423 break; … … 1290 1428 } 1291 1429 #if BOOT_DEBUG_PERI 1292 boot_puts("- NIC initialised\n");1430 boot_puts("- NIC initialised\n"); 1293 1431 #endif 1294 1432 break; 1295 1433 case PERIPH_TYPE_TTY: // vci_multi_tty component 1296 1434 #if BOOT_DEBUG_PERI 1297 boot_puts("- TTY initialised\n");1435 boot_puts("- TTY initialised\n"); 1298 1436 #endif 1299 1437 break; … … 1310 1448 } 1311 1449 #if BOOT_DEBUG_PERI 1312 boot_puts("- IOB initialised\n");1450 boot_puts("- IOB initialised\n"); 1313 1451 #endif 1314 1452 break; … … 1317 1455 1318 1456 #if BOOT_DEBUG_PERI 1319 boot_puts("\n[BOOT DEBUG] ****** coprocessors initialisation in cluster ");1320 boot_putd(cluster_id);1321 boot_puts(" ******\n");1457 boot_puts("\n[BOOT DEBUG] ****** coprocessors initialisation in cluster "); 1458 boot_putd(cluster_id); 1459 boot_puts(" ******\n"); 1322 1460 #endif 1323 1461 … … 1333 1471 1334 1472 #if BOOT_DEBUG_PERI 1335 boot_puts("- coprocessor name : ");1336 boot_puts(coproc[coproc_id].name);1337 boot_puts(" / nb ports = ");1338 boot_putd((unsigned int) coproc[coproc_id].ports);1339 boot_puts("\n");1473 boot_puts("- coprocessor name : "); 1474 boot_puts(coproc[coproc_id].name); 1475 boot_puts(" / nb ports = "); 1476 boot_putd((unsigned int) coproc[coproc_id].ports); 1477 boot_puts("\n"); 1340 1478 #endif 1341 1479 … … 1354 1492 { 1355 1493 #if BOOT_DEBUG_PERI 1356 boot_puts(" port direction: PORT_TO_COPROC");1494 boot_puts(" port direction: PORT_TO_COPROC"); 1357 1495 #endif 1358 1496 mwmr_hw_init(coproc_pbase, … … 1365 1503 { 1366 1504 #if BOOT_DEBUG_PERI 1367 boot_puts(" port direction: PORT_FROM_COPROC");1505 boot_puts(" port direction: PORT_FROM_COPROC"); 1368 1506 #endif 1369 1507 mwmr_hw_init(coproc_pbase, … … 1374 1512 } 1375 1513 #if BOOT_DEBUG_PERI 1376 boot_puts(", with mwmr: ");1377 boot_puts(vobj[vobj_id].name);1378 boot_puts(" of vspace: ");1379 boot_puts(vspace[vspace_id].name);1514 boot_puts(", with mwmr: "); 1515 boot_puts(vobj[vobj_id].name); 1516 boot_puts(" of vspace: "); 1517 boot_puts(vspace[vspace_id].name); 1380 1518 #endif 1381 1519 } // end for cp_ports … … 1473 1611 1474 1612 #if BOOT_DEBUG_SCHED 1475 boot_puts("\n[BOOT DEBUG] Initialise schedulers in cluster ");1476 boot_putd(cluster_id);1477 boot_puts("\n");1613 boot_puts("\n[BOOT DEBUG] Initialise schedulers in cluster "); 1614 boot_putd(cluster_id); 1615 boot_puts("\n"); 1478 1616 #endif 1479 1617 … … 1523 1661 1524 1662 #if BOOT_DEBUG_SCHED 1525 boot_puts("\nProc ");1526 boot_putd(lpid);1527 boot_puts(" : scheduler virtual base address = ");1528 boot_putx( sched_vbase + (lpid<<12) );1529 boot_puts("\n");1663 boot_puts("\nProc "); 1664 boot_putd(lpid); 1665 boot_puts(" : scheduler virtual base address = "); 1666 boot_putx( sched_vbase + (lpid<<12) ); 1667 boot_puts("\n"); 1530 1668 #endif 1531 1669 // current processor scheduler pointer : psched … … 1552 1690 1553 1691 #if BOOT_DEBUG_SCHED 1554 boot_puts("- IRQ : icu = ");1555 boot_putd(icu_id);1556 boot_puts(" / type = ");1557 boot_putd(type);1558 boot_puts(" / isr = ");1559 boot_putd(isr_id);1560 boot_puts(" / channel = ");1561 boot_putd(channel);1562 boot_puts(" => vector_entry = ");1563 boot_putx( value );1564 boot_puts("\n");1692 boot_puts("- IRQ : icu = "); 1693 boot_putd(icu_id); 1694 boot_puts(" / type = "); 1695 boot_putd(type); 1696 boot_puts(" / isr = "); 1697 boot_putd(isr_id); 1698 boot_puts(" / channel = "); 1699 boot_putd(channel); 1700 boot_puts(" => vector_entry = "); 1701 boot_putx( value ); 1702 boot_puts("\n"); 1565 1703 #endif 1566 1704 } … … 1580 1718 1581 1719 #if BOOT_DEBUG_SCHED 1582 boot_puts("\n[BOOT DEBUG] Initialise task contexts for vspace ");1583 boot_puts(vspace[vspace_id].name);1584 boot_puts("\n");1720 boot_puts("\n[BOOT DEBUG] Initialise task contexts for vspace "); 1721 boot_puts(vspace[vspace_id].name); 1722 boot_puts("\n"); 1585 1723 #endif 1586 1724 // We must set the PTPR depending on the vspace, because the start_vector … … 1781 1919 1782 1920 #if BOOT_DEBUG_SCHED 1783 boot_puts("\nTask ");1784 boot_puts(task[task_id].name);1785 boot_puts(" (");1786 boot_putd(task_id);1787 boot_puts(") allocated to processor ");1788 boot_putd(gpid);1789 boot_puts("\n - ctx[LTID] = ");1790 boot_putd(ltid);1791 boot_puts("\n - ctx[SR] = ");1792 boot_putx(ctx_sr);1793 boot_puts("\n - ctx[SR] = ");1794 boot_putx(ctx_sp);1795 boot_puts("\n - ctx[RA] = ");1796 boot_putx(ctx_ra);1797 boot_puts("\n - ctx[EPC] = ");1798 boot_putx(ctx_epc);1799 boot_puts("\n - ctx[PTPR] = ");1800 boot_putx(ctx_ptpr);1801 boot_puts("\n - ctx[TTY] = ");1802 boot_putd(ctx_tty);1803 boot_puts("\n - ctx[NIC] = ");1804 boot_putd(ctx_nic);1805 boot_puts("\n - ctx[CMA] = ");1806 boot_putd(ctx_cma);1807 boot_puts("\n - ctx[IOC] = ");1808 boot_putd(ctx_ioc);1809 boot_puts("\n - ctx[TIM] = ");1810 boot_putd(ctx_tim);1811 boot_puts("\n - ctx[DMA] = ");1812 boot_putd(ctx_dma);1813 boot_puts("\n - ctx[PTAB] = ");1814 boot_putx(ctx_ptab);1815 boot_puts("\n - ctx[GTID] = ");1816 boot_putd(task_id);1817 boot_puts("\n - ctx[VSID] = ");1818 boot_putd(vspace_id);1819 boot_puts("\n");1921 boot_puts("\nTask "); 1922 boot_puts(task[task_id].name); 1923 boot_puts(" ("); 1924 boot_putd(task_id); 1925 boot_puts(") allocated to processor "); 1926 boot_putd(gpid); 1927 boot_puts("\n - ctx[LTID] = "); 1928 boot_putd(ltid); 1929 boot_puts("\n - ctx[SR] = "); 1930 boot_putx(ctx_sr); 1931 boot_puts("\n - ctx[SR] = "); 1932 boot_putx(ctx_sp); 1933 boot_puts("\n - ctx[RA] = "); 1934 boot_putx(ctx_ra); 1935 boot_puts("\n - ctx[EPC] = "); 1936 boot_putx(ctx_epc); 1937 boot_puts("\n - ctx[PTPR] = "); 1938 boot_putx(ctx_ptpr); 1939 boot_puts("\n - ctx[TTY] = "); 1940 boot_putd(ctx_tty); 1941 boot_puts("\n - ctx[NIC] = "); 1942 boot_putd(ctx_nic); 1943 boot_puts("\n - ctx[CMA] = "); 1944 boot_putd(ctx_cma); 1945 boot_puts("\n - ctx[IOC] = "); 1946 boot_putd(ctx_ioc); 1947 boot_puts("\n - ctx[TIM] = "); 1948 boot_putd(ctx_tim); 1949 boot_puts("\n - ctx[DMA] = "); 1950 boot_putd(ctx_dma); 1951 boot_puts("\n - ctx[PTAB] = "); 1952 boot_putx(ctx_ptab); 1953 boot_puts("\n - ctx[GTID] = "); 1954 boot_putd(task_id); 1955 boot_puts("\n - ctx[VSID] = "); 1956 boot_putd(vspace_id); 1957 boot_puts("\n"); 1820 1958 #endif 1821 1959 … … 1848 1986 boot_check_mapping(); 1849 1987 1850 // pseg allocators initialisation1851 boot_psegs_init();1852 1853 1988 // page table building 1854 1989 boot_pt_init(); 1855 1990 1856 // mmu activation ( with page table [0])1991 // mmu activation (with page table [0]) 1857 1992 boot_set_mmu_ptpr((unsigned int) (boot_ptabs_paddr[0] >> 13)); 1858 1993 boot_set_mmu_mode(0xF); … … 1864 1999 // vobjs initialisation 1865 2000 boot_vobjs_init(); 2001 2002 // reset ptpr with page table 0 2003 boot_set_mmu_ptpr((unsigned int) (boot_ptabs_paddr[0] >> 13)); 1866 2004 1867 2005 // peripherals initialisation
Note: See TracChangeset
for help on using the changeset viewer.