Ignore:
Timestamp:
2008-11-11T08:00:42Z (16 years ago)
Author:
Jakub Vana <jakub.vana@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f3c4a26
Parents:
a2a5529
Message:

Alfa of SMP support on IA64

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/loader/gefi/HelenOS/hello.c

    ra2a5529 r59e4864  
    22#include <efilib.h>
    33
     4#include <../../../../../../kernel/arch/ia64/include/bootinfo.h>
     5
    46#define KERNEL_LOAD_ADDRESS 0x4400000
     7
     8//Link image as a data array into hello - usefull with network boot
     9//#define IMAGE_LINKED
     10
     11bootinfo_t *bootinfo=(bootinfo_t *)BOOTINFO_ADDRESS;
     12
     13
     14#ifdef IMAGE_LINKED
     15extern char HOSimage[];
     16extern int HOSimagesize;
     17#endif
     18
    519
    620
     
    1630        return mem;
    1731}
    18 char HEX[256];
    19 
    20 char hexs[]="0123456789ABCDEF";
    21 /*
    22 void to_hex(unsigned long long num)
    23 {
    24     int a;
    25     for(a=15;a>=0;a--)   
    26     {
    27         char c=num - (num & 0xfffffffffffffff0LL);
    28         num/=16;
    29         c=hexs[c];
    30         HEX[a]=c;
    31     }
    32 
    33 }
    34 */
    3532
    3633EFI_STATUS
     
    7370
    7471        BS->HandleProtocol(LoadedImage->DeviceHandle, &FileSystemProtocol, &Vol);
    75         Vol->OpenVolume (Vol, &CurDir);
    7672
    7773        char FileName[1024];
    7874        char *OsKernelBuffer;
    7975        int i;
     76        int defaultLoad;
     77        int imageLoad;
    8078        UINTN Size;
    8179
     
    9896        while(LoadOptions[i]==L' ') if(LoadOptions[i++]==0) break;
    9997       
    100         if(LoadOptions[i++]==0)
     98        if(LoadOptions[i++]==0){
    10199                StrCat(FileName,L"\\image.bin");
     100                defaultLoad=1;
     101        }       
    102102        else{
    103103                CHAR16 buf[1024];
     
    109109                buf[j+1]=0;
    110110                StrCat(FileName,buf);
    111         }
    112        
    113         //Print(L"%s\n",FileName);
    114 
    115         EFI_STATUS stat;
    116         stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
    117         if(EFI_ERROR(stat)){
    118                 Print(L"Error Opening Image %s\n",FileName);
    119                 return 0;
     111                defaultLoad=0;
     112        }
     113
     114        imageLoad=1;
     115#ifdef IMAGE_LINKED
     116        if(defaultLoad) {
     117            Print(L"Using Linked Image\n");
     118            imageLoad=0;
    120119        }   
    121         Size = 0x00400000;
    122         BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);
    123         FileHandle->Read(FileHandle, &Size, OsKernelBuffer);
    124         FileHandle->Close(FileHandle);
    125 
    126         if(Size<1) return 0;
    127 
    128 
    129         char *  HOS = OsKernelBuffer; 
     120#endif 
     121       
     122
     123        char *  HOS;
     124        if(imageLoad)
     125        {
     126                Size = 0x00400000;
     127
     128                Vol->OpenVolume (Vol, &CurDir);
     129
     130                EFI_STATUS stat;
     131                stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
     132                if(EFI_ERROR(stat)){
     133                        Print(L"Error Opening Image %s\n",FileName);
     134                        return 0;
     135                }
     136                BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);
     137                FileHandle->Read(FileHandle, &Size, OsKernelBuffer);
     138                FileHandle->Close(FileHandle);
     139                HOS = OsKernelBuffer; 
     140                if(Size<1) return 0;
     141
     142        }           
     143#ifdef IMAGE_LINKED
     144        else {
     145            HOS = HOSimage; 
     146            Size = HOSimagesize;
     147            Print(L"Image start %llX\n",(long long)HOS);
     148            Print(L"Image size %llX\n",(long long)Size);
     149            Print(L"Image &size %llX\n",(long long)&Size);
     150        }
     151#endif 
    130152        int HOSSize = Size; 
     153
     154
     155        rArg rSAL;
     156        //Setup AP's wake up address
     157
     158        LibSalProc(0x01000000,2,0x4400200,0,0,0,0,0,&rSAL);
     159
     160
     161        UINT64 sapic;
     162        LibGetSalIpiBlock(&sapic);
     163        Print (L"SAPIC:%X\n", sapic);
     164        bootinfo->sapic=sapic;
     165
     166
     167        int wakeup_intno;
     168        wakeup_intno=0xf0;
     169        Print (L"WAKEUP INTNO:%X\n", wakeup_intno);
     170        bootinfo->wakeup_intno=wakeup_intno;
     171
     172
     173
    131174
    132175
     
    168211            ((char *)(0x4400000))[a]=HOS[a];
    169212        }
     213        bootinfo->sapic=(unsigned long *)sapic;
     214        bootinfo->wakeup_intno=wakeup_intno;
    170215       
    171216        //Run Kernel
     
    178223           
    179224       
    180         while(1){
    181             ((volatile int *)(0x80000000000b8000))[0]++;
    182         }
     225        //Not reached     
    183226        return EFI_SUCCESS;
    184227}
Note: See TracChangeset for help on using the changeset viewer.