physical disk operation in EDK NT32 platform
在EDK source中提供了对physical 和vitural disk的operation参数设置:EDK_SOURCE\sample\platform\NT32\build中的system.cmd文件
set EFI_WIN_NT_PHYSICAL_DISKS=a:RW;2880;512!//设置一个软盘,大小为1.44M,block size=512
当我们在跑EDK的时候,可以去访问该软盘。其实在EDK中去追踪该代码的时候,会发现,其实质上是在WinNtBlockIoDriver中调用WIN api进行读写,源代码如下:
// set disk type,Physical or Virtual disk? and get the name
if (DiskType == EfiWinNtVirtualDisks) {
WinNtIo->WinNtThunk->SPrintf (
Buffer,
L"Diskfile%d",
WinNtIo->InstanceNumber
);
} else {
if (*Str >= 'A' && *Str <= 'Z' || *Str >= 'a' && *Str <= 'z') {
WinNtIo->WinNtThunk->SPrintf (Buffer, L"\\\\.\\%c:", *Str);
} else {
WinNtIo->WinNtThunk->SPrintf (Buffer, L"\\\\.\\PHYSICALDRIVE%c", *Str);
}
//create mapping
Status = WinNtBlockIoCreateMapping (
WinNtIo,
Handle,
Buffer,
WriteProtected,
RemovableMedia,
NumberOfBlocks,
BlockSize,
DiskType
);
//register read or write blocks function
BlockIo->ReadBlocks = WinNtBlockIoReadBlocks;
BlockIo->WriteBlocks = WinNtBlockIoWriteBlocks;
//in the WinNtBlockIoReadBlocks,read file API
Flag = Private->WinNtThunk->ReadFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesRead, NULL);
问题如下:
EDK 的NT32下应该是不能对物理设备进行访问的,但是现在却可以访问一个物理disk,试问当connect controller to driver的时候,物理disk controller handle是怎么得到?希望高手解释一下啊
[ 本帖最后由 libeili 于 2009-3-23 18:01 编辑 ] 没有物理disk controller handle,Win NT bus driver为所有virtual NT thunk device创建device handle.
参见 WinNtBusDriverBindingStart()
页:
[1]