Locating PCI BIOS service through BIOS32
Posted: Mon Oct 25, 2004 2:27 pm
I'm trying to locate the PCI BIOS entry point. <a href="http://www.acos.34sp.com/docs/itemview.php?sectionid=1§ionname=Hardware&groupid=2&groupname=Interconnect%20Buses&subgroupid=19&subgroupname=PCI&itemid=28">the PCI BIOS Specification</a> says that the way to do this is to use the bios32 service directory, and in order to use that, you have to scan for a 16byte structure located within the physical address range 0E0000h to 0FFFF0h. I'm trying to do this on a Windows 2000 machine (don't run please, I have to). I wrote the following function:
bool SetBSDLocationValues()
{ //TODO
/*--------------------------------------------------------------------------------------
search physical address range 0E0000h - 0FFFFFh for a 16-byte data structure,
on a 16-byte boundary, described as follows:
Offset Size Description
0 4 bytes The String "_32_".
4 4 bytes 32 bit physical address (BIOS32 Entry Point)
8 1 byte Revision Level (00h)
9 1 byte Length (01h)
0Ah 1 byte Checksum of complete 16-byte structure(must==0 )
0Bh 5 bytes Reserved, must be 0
----------------------------------------------------------------------------------------*/
UCHAR* pStart =(UCHAR*)0x0E0000;
ULONG pEnd =0x100000;
void* pBIOS32 =NULL;
UCHAR Checksum =0;
while((ULONG)pStart<pEnd) {
if( (pStart[0] == '_')
&& (pStart[1] == '3')
&& (pStart[2] == '2')
&& (pStart[3] == '_')
&& (pBIOS32=(void*)pStart[4])
&& (pStart[8] == 0x00)
&& (pStart[9] == 0x01)
&& (Checksum=(UCHAR)pStart[10])
&& (pStart[11] == 0)
&& (pStart[12] == 0)
&& (pStart[13] == 0)
&& (pStart[14] == 0)
&& (pStart[15] == 0)
)
{
for(int i=0;i<16;++i)
Checksum+=pStart;
if(Checksum==0)
{
SG2Control::BSD_EntryPoint=pBIOS32;
return true;
}
}
pStart+=16;
}
return false;
}
and obviously, it gives me a memory exception. I expected this to happen for one or both of the two reasons:
1)pStart could be treated as an offset from the virtual address space my programs running in, instead of the physical address,
2)Windows might not just let me access the physical memory that I want to, without some sort of formal request.
If anyone's ever had to use the PCI BIOS under windows 2000, or if you know how, any help would be greatly appreciated.
Thanks,
Peter
bool SetBSDLocationValues()
{ //TODO
/*--------------------------------------------------------------------------------------
search physical address range 0E0000h - 0FFFFFh for a 16-byte data structure,
on a 16-byte boundary, described as follows:
Offset Size Description
0 4 bytes The String "_32_".
4 4 bytes 32 bit physical address (BIOS32 Entry Point)
8 1 byte Revision Level (00h)
9 1 byte Length (01h)
0Ah 1 byte Checksum of complete 16-byte structure(must==0 )
0Bh 5 bytes Reserved, must be 0
----------------------------------------------------------------------------------------*/
UCHAR* pStart =(UCHAR*)0x0E0000;
ULONG pEnd =0x100000;
void* pBIOS32 =NULL;
UCHAR Checksum =0;
while((ULONG)pStart<pEnd) {
if( (pStart[0] == '_')
&& (pStart[1] == '3')
&& (pStart[2] == '2')
&& (pStart[3] == '_')
&& (pBIOS32=(void*)pStart[4])
&& (pStart[8] == 0x00)
&& (pStart[9] == 0x01)
&& (Checksum=(UCHAR)pStart[10])
&& (pStart[11] == 0)
&& (pStart[12] == 0)
&& (pStart[13] == 0)
&& (pStart[14] == 0)
&& (pStart[15] == 0)
)
{
for(int i=0;i<16;++i)
Checksum+=pStart;
if(Checksum==0)
{
SG2Control::BSD_EntryPoint=pBIOS32;
return true;
}
}
pStart+=16;
}
return false;
}
and obviously, it gives me a memory exception. I expected this to happen for one or both of the two reasons:
1)pStart could be treated as an offset from the virtual address space my programs running in, instead of the physical address,
2)Windows might not just let me access the physical memory that I want to, without some sort of formal request.
If anyone's ever had to use the PCI BIOS under windows 2000, or if you know how, any help would be greatly appreciated.
Thanks,
Peter