Пример #1
0
void InitBootConfig(struct BootConfig *bootcfg, APTR BootLoaderBase)
{
    struct VesaInfo *vi;

    bootcfg->self = bootcfg;
    bootcfg->boot = NULL;
    strcpy(bootcfg->defaultgfx.libname,    "vgah.hidd");
    strcpy(bootcfg->defaultgfx.hiddname,   "hidd.gfx.vga");
    strcpy(bootcfg->defaultkbd.libname,    "kbd.hidd");
    strcpy(bootcfg->defaultkbd.hiddname,   "hidd.kbd.hw");
    strcpy(bootcfg->defaultmouse.libname,  "mouse.hidd");
    strcpy(bootcfg->defaultmouse.hiddname, "hidd.bus.mouse");

    if (!BootLoaderBase)
	return;

    if ((vi = (struct VesaInfo *)GetBootInfo(BL_Video)) != NULL)
    {
        if (vi->ModeNumber != 3)
        {
            strcpy(bootcfg->defaultgfx.libname, "vesagfx.hidd");
            strcpy(bootcfg->defaultgfx.hiddname, "hidd.gfx.vesa");
        }
    }
}
Пример #2
0
bool StepAllocator::Alloc(PhysAddr & addr, PhysSize size, PhysSize align) {
  const RegionList & regions = GetBootInfo()->GetRegions();
  
  const ANAlloc::Region * reg = regions.FindRegion(lastAddr);
  if (!reg) {
    if (!(reg = regions.FindRegion(lastAddr - 1))) {
      return false;
    }
  }

  if (lastAddr % align) {
    lastAddr += align - (lastAddr % align);
  }
  
  if (lastAddr > (PhysAddr)reg->GetEnd()) {
    lastAddr = (PhysAddr)reg->GetEnd() - 1;
  }

  while (lastAddr + size > (PhysAddr)reg->GetEnd()) {
    reg = regions.NextRegion(reg);
    if (!reg) return false;
    
    lastAddr = (PhysAddr)reg->GetStart();
    if (lastAddr % align) {
      lastAddr += align - (lastAddr % align);
    }
    if (lastAddr > (PhysAddr)reg->GetEnd()) {
      lastAddr = (PhysAddr)reg->GetEnd() - 1;
    }
  }

  addr = lastAddr;
  lastAddr += size;
  return true;
}
void TestVFATCase1()
	{
	test.Next(_L("Test Without VFAT entry, but DOS entry uses CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	GetBootInfo();

   	RFile file;
  	TFileName fn = _L("\\ABCD");
  	
  	TInt r=file.Create(TheFs,fn,EFileRead);
  	testAndLog(r==KErrNone);
  	file.Close();
  
  	//	Assume this file is the first entry in the root directory
  	r=TheDisk.Open(TheFs,CurrentDrive());
  	testAndLog(r==KErrNone);

    //-- read the 1st dir entry, it should be a DOS entry 
    const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
      
    TFatDirEntry fatEntry1;
 	TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
	testAndLog(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone); 
	testAndLog(!fatEntry1.IsVFatEntry());

	// Manually modify the short name into unicode characters
	// 	Unicode: 	0x(798F 5C71 96C5 6CBB)
	//	Shift-JIS: 	0x(959F 8E52 89EB 8EA1)

	TBuf8<8> unicodeSN = _L8("ABCD1234");
	unicodeSN[0] = 0x95;
	unicodeSN[1] = 0x9F;
	unicodeSN[2] = 0x8E;
	unicodeSN[3] = 0x52;
	unicodeSN[4] = 0x89;
	unicodeSN[5] = 0xEB;
	unicodeSN[6] = 0x8E;
	unicodeSN[7] = 0xA1;

	fatEntry1.SetName(unicodeSN);
	testAndLog(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
	TheDisk.Close();

  	// The Unicode file name of the file that is created
  	fn = _L("\\ABCD");
  	fn[1] = 0x798F;
  	fn[2] = 0x5C71;
  	fn[3] = 0x96C5;
  	fn[4] = 0x6CBB;
  	
  	// Access the file using its unicode file name without the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
  	TEntry entry;
  	TInt err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNotFound);
  	
      // Access the file using its unicode file name with the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);  	
	test_KErrNone(r);
 	r = UserSvr::ChangeLocale(KTestLocale);  	
	test_KErrNone(r);
  
  	err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNone);
  	
  	//file is no more required,delete it.
  	err = TheFs.Delete(fn);
  	testAndLog(err==KErrNone);
  	
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
 	r=TheFs.SessionPath(gSessionPath);
  	test_KErrNone(r);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
Пример #4
0
/*
    Here shall we start. Make function static as it shouldn't be visible from
    outside.
*/
static int ata_init(struct ataBase *ATABase)
{
    OOP_Object *storageRoot;
    struct BootLoaderBase	*BootLoaderBase;

    D(bug("[ATA--] ata_init: ata.device Initialization\n"));

    ATABase->ata_UtilityBase = OpenLibrary("utility.library", 36);
    if (!ATABase->ata_UtilityBase)
        return FALSE;

    /*
     * I've decided to use memory pools again. Alloc everything needed from 
     * a pool, so that we avoid memory fragmentation.
     */
    ATABase->ata_MemPool = CreatePool(MEMF_CLEAR | MEMF_PUBLIC | MEMF_SEM_PROTECTED , 8192, 4096);
    if (ATABase->ata_MemPool == NULL)
        return FALSE;

    D(bug("[ATA--] ata_init: MemPool @ %p\n", ATABase->ata_MemPool));

    if (OOP_ObtainAttrBasesArray(&ATABase->unitAttrBase, attrBaseIDs))
        return FALSE;

    /* This is our own method base, so no check needed */
    if (OOP_ObtainMethodBasesArray(&ATABase->hwMethodBase, &attrBaseIDs[ATA_METHOD_ID_START]))
        return FALSE;

    storageRoot = OOP_NewObject(NULL, CLID_Hidd_Storage, NULL);
    if (!storageRoot)
        storageRoot = OOP_NewObject(NULL, CLID_HW_Root, NULL);
    if (!storageRoot)
        return FALSE;

    if (!HW_AddDriver(storageRoot, ATABase->ataClass, NULL))
        return FALSE;

    /* Set default ata.device config options */
    ATABase->ata_32bit   = FALSE;
    ATABase->ata_NoMulti = FALSE;
    ATABase->ata_NoDMA   = FALSE;
    ATABase->ata_Poll    = FALSE;

    /*
     * start initialization: 
     * obtain kernel parameters
     */
    BootLoaderBase = OpenResource("bootloader.resource");
    D(bug("[ATA--] ata_init: BootloaderBase = %p\n", BootLoaderBase));
    if (BootLoaderBase != NULL)
    {
        struct List *list;
        struct Node *node;

        list = (struct List *)GetBootInfo(BL_Args);
        if (list)
        {
            ForeachNode(list, node)
            {
                if (strncmp(node->ln_Name, "ATA=", 4) == 0)
                {
                    const char *CmdLine = &node->ln_Name[4];

                    if (strstr(CmdLine, "32bit"))
                    {
                        D(bug("[ATA  ] ata_init: Using 32-bit IO transfers\n"));
                        ATABase->ata_32bit = TRUE;
                    }
		    if (strstr(CmdLine, "nomulti"))
		    {
			D(bug("[ATA  ] ata_init: Disabled multisector transfers\n"));
			ATABase->ata_NoMulti = TRUE;
		    }
                    if (strstr(CmdLine, "nodma"))
                    {
                        D(bug("[ATA  ] ata_init: Disabled DMA transfers\n"));
                        ATABase->ata_NoDMA = TRUE;
                    }
                    if (strstr(CmdLine, "poll"))
                    {
                        D(bug("[ATA  ] ata_init: Using polling to detect end of busy state\n"));
                        ATABase->ata_Poll = TRUE;
                    }
                }
            }
        }
    }

    /* Try to setup daemon task looking for diskchanges */
    NEWLIST(&ATABase->Daemon_ios);
    InitSemaphore(&ATABase->DaemonSem);
    InitSemaphore(&ATABase->DetectionSem);
    ATABase->daemonParent = FindTask(NULL);
    SetSignal(0, SIGF_SINGLE);

    if (!NewCreateTask(TASKTAG_PC, DaemonCode,
                       TASKTAG_NAME       , "ATA.daemon",
                       TASKTAG_STACKSIZE  , STACK_SIZE,
                       TASKTAG_TASKMSGPORT, &ATABase->DaemonPort,
                       TASKTAG_PRI        , TASK_PRI - 1,	/* The daemon should have a little bit lower Pri than handler tasks */
                       TASKTAG_ARG1       , ATABase,
                       TAG_DONE))
    {
        D(bug("[ATA  ] Failed to start up daemon!\n"));
        return FALSE;
    }

    /* Wait for handshake */
    Wait(SIGF_SINGLE);
    D(bug("[ATA  ] Daemon task set to 0x%p\n", ATABase->ata_Daemon));

    return ATABase->ata_Daemon ? TRUE : FALSE;
}