Hi,
I am developing KITL Ethernet driver for Windows CE 6.0. There are two
binaries 1) eboot.bin 2) KITL.dll .

Eboot.bin initialized my Network card correctly and I can transfer OS image
from debug to target machine. However, once OS gets loaded into target
machine, KITL.dll gets invoked on behalf of OS. Because KITL.dll is loaded
into virtual space, I need to convert bus address into virtual address. I am
doing that by calling two functions as below
HalTranslateBusAddress which returns 0x0 in â??AddressSpaceâ?? and system
physical address in â??TranslatedAddressâ??. Because I am using memory base I
need to call MmMapIoSpace with TranslatedAddress returned in
HalTranslateBusAddress call to get the system virtual address. Somehow
MmMapIoSPace return same virtual address as physical address. And when I use
that returned virtual address accessing my hardware(NIC) it cause my machine
to reboot.

I have seen sample code for KITL and found that all KITL driver uses IO base
and not memory base for accessing PCI/PCIe hardwares. I am not sure where I
am going wrong?

Kindly suggest me.

Thanks

Sincerely,
Tushar Dave

Re: KITL ethernet driver in windows CE 6.0 fails by Joel

Joel
Thu Jun 12 10:48:56 PDT 2008

Generally the addressing for EBOOT is setup as Physical is Virtual,
and once the kernel boots everything becomes Virtual addressing.

So if all is well with EBOOT, and up until your KITL tx/rx are used in
the kernel, most likely your MMU kernel map is not correct, or your
KITL routines are hardcoded to use Physical addresses.

Good Luck,
Joel


On Jun 9, 2:05=A0pm, Tushar <Tus...@discussions.microsoft.com> wrote:
> Hi,
> I am developing KITL Ethernet driver for Windows CE 6.0. There are two
> binaries 1) eboot.bin 2) KITL.dll .
>
> =A0Eboot.bin initialized my Network card correctly and I can transfer OS i=
mage
> from debug to target machine. However, once OS gets loaded into target
> machine, KITL.dll gets invoked on behalf of OS. Because KITL.dll is loaded=

> into virtual space, I need to convert bus address into virtual address. I =
am
> doing that by calling two functions as below
> HalTranslateBusAddress which returns 0x0 in =93AddressSpace=94 and system
> physical address in =93TranslatedAddress=94. Because I am using memory bas=
e I
> need to call MmMapIoSpace with TranslatedAddress returned in
> HalTranslateBusAddress call to get the system virtual address. Somehow
> MmMapIoSPace return same virtual address as physical address. And when I u=
se
> that returned virtual address accessing my hardware(NIC) it cause my machi=
ne
> to reboot.
>
> I have seen sample code for KITL and found that all KITL driver uses IO ba=
se
> and not memory base for accessing PCI/PCIe hardwares. I am not sure where =
I
> am going wrong?
>
> Kindly suggest me.
>
> Thanks
>
> Sincerely,
> Tushar Dave


Re: KITL ethernet driver in windows CE 6.0 fails by Tushar

Tushar
Thu Jun 12 11:21:00 PDT 2008

Hi Joel,
Thanks for your answer. But is there any way I can map 0x50100000 physical
address to virtual address (any Virtual addr thats not already used) . I am
using memory base to access my hardware. BIOS mapped the Hw to 0x50100000
memory address (PCIe BAR [0])

(I am using 512 MB RAM and CEPC BSP)
Based on my OEMAddressTable, physical address 0x00000000 - 0x20000000
mapped to virtual address 0x80000000 - 0xA0000000 . Also I tried adding
mapping in OEMAddressTable (startup.asm) .......(see line below)

dd 0x70000000, 0x50100000, 0x00040000 ; 128KBytes memory

but this doesn't work.


Below is fraction from 3 files that hepls understanding OS memory mappings.

1. file : startup.asm
_OEMAddressTable:

dd 80000000h, 0, 20000000h
dd 0, 0, 0

------------------------------------------------------


2. file : boot.bib

MEMORY

EBOOT 00130000 00040000 RAMIMAGE
RAM 00170000 00070000 RAM
ETH_DMA 00200000 00020000 RESERVED

dwReservedArea 00000000 00220000 FIXUPVAR


3. file :config.bib

NK 80220000 009E0000 RAMIMAGE
RAM 80C00000 1E000000 RAM
nk.exe :dwOEMTotalRAM 0 20000000 FIXUPVAR

-------------------------------------------------------------------

I appreciate your help.

Thanks.


Sincerely,
Tushar Dave




"Joel Winarske" wrote:

> Generally the addressing for EBOOT is setup as Physical is Virtual,
> and once the kernel boots everything becomes Virtual addressing.
>
> So if all is well with EBOOT, and up until your KITL tx/rx are used in
> the kernel, most likely your MMU kernel map is not correct, or your
> KITL routines are hardcoded to use Physical addresses.
>
> Good Luck,
> Joel
>
>
> On Jun 9, 2:05 pm, Tushar <Tus...@discussions.microsoft.com> wrote:
> > Hi,
> > I am developing KITL Ethernet driver for Windows CE 6.0. There are two
> > binaries 1) eboot.bin 2) KITL.dll .
> >
> > Eboot.bin initialized my Network card correctly and I can transfer OS image
> > from debug to target machine. However, once OS gets loaded into target
> > machine, KITL.dll gets invoked on behalf of OS. Because KITL.dll is loaded
> > into virtual space, I need to convert bus address into virtual address. I am
> > doing that by calling two functions as below
> > HalTranslateBusAddress which returns 0x0 in â??AddressSpaceâ?? and system
> > physical address in â??TranslatedAddressâ??. Because I am using memory base I
> > need to call MmMapIoSpace with TranslatedAddress returned in
> > HalTranslateBusAddress call to get the system virtual address. Somehow
> > MmMapIoSPace return same virtual address as physical address. And when I use
> > that returned virtual address accessing my hardware(NIC) it cause my machine
> > to reboot.
> >
> > I have seen sample code for KITL and found that all KITL driver uses IO base
> > and not memory base for accessing PCI/PCIe hardwares. I am not sure where I
> > am going wrong?
> >
> > Kindly suggest me.
> >
> > Thanks
> >
> > Sincerely,
> > Tushar Dave
>
>

Re: KITL ethernet driver in windows CE 6.0 fails by Dean

Dean
Thu Jun 12 12:59:42 PDT 2008

Restrict yourself to the range between 0x80000000-0x9FFFFFFF. That means
you can't map in the entire 512MB of RAM.

--
Dean Ramsier - eMVP
BSQUARE Corporation


"Tushar" <Tushar@discussions.microsoft.com> wrote in message
news:4DFA9B8B-5938-407D-AE02-B1738323C98F@microsoft.com...
> Hi Joel,
> Thanks for your answer. But is there any way I can map 0x50100000 physical
> address to virtual address (any Virtual addr thats not already used) . I
> am
> using memory base to access my hardware. BIOS mapped the Hw to 0x50100000
> memory address (PCIe BAR [0])
>
> (I am using 512 MB RAM and CEPC BSP)
> Based on my OEMAddressTable, physical address 0x00000000 - 0x20000000
> mapped to virtual address 0x80000000 - 0xA0000000 . Also I tried adding
> mapping in OEMAddressTable (startup.asm) .......(see line below)
>
> dd 0x70000000, 0x50100000, 0x00040000 ; 128KBytes memory
>
> but this doesn't work.
>
>
> Below is fraction from 3 files that hepls understanding OS memory
> mappings.
>
> 1. file : startup.asm
> _OEMAddressTable:
>
> dd 80000000h, 0, 20000000h
> dd 0, 0, 0
>
> ------------------------------------------------------
>
>
> 2. file : boot.bib
>
> MEMORY
>
> EBOOT 00130000 00040000 RAMIMAGE
> RAM 00170000 00070000 RAM
> ETH_DMA 00200000 00020000 RESERVED
>
> dwReservedArea 00000000 00220000 FIXUPVAR
>
>
> 3. file :config.bib
>
> NK 80220000 009E0000 RAMIMAGE
> RAM 80C00000 1E000000 RAM
> nk.exe :dwOEMTotalRAM 0 20000000 FIXUPVAR
>
> -------------------------------------------------------------------
>
> I appreciate your help.
>
> Thanks.
>
>
> Sincerely,
> Tushar Dave
>
>
>
>
> "Joel Winarske" wrote:
>
>> Generally the addressing for EBOOT is setup as Physical is Virtual,
>> and once the kernel boots everything becomes Virtual addressing.
>>
>> So if all is well with EBOOT, and up until your KITL tx/rx are used in
>> the kernel, most likely your MMU kernel map is not correct, or your
>> KITL routines are hardcoded to use Physical addresses.
>>
>> Good Luck,
>> Joel
>>
>>
>> On Jun 9, 2:05 pm, Tushar <Tus...@discussions.microsoft.com> wrote:
>> > Hi,
>> > I am developing KITL Ethernet driver for Windows CE 6.0. There are two
>> > binaries 1) eboot.bin 2) KITL.dll .
>> >
>> > Eboot.bin initialized my Network card correctly and I can transfer OS
>> > image
>> > from debug to target machine. However, once OS gets loaded into target
>> > machine, KITL.dll gets invoked on behalf of OS. Because KITL.dll is
>> > loaded
>> > into virtual space, I need to convert bus address into virtual address.
>> > I am
>> > doing that by calling two functions as below
>> > HalTranslateBusAddress which returns 0x0 in "AddressSpace" and system
>> > physical address in "TranslatedAddress". Because I am using memory base
>> > I
>> > need to call MmMapIoSpace with TranslatedAddress returned in
>> > HalTranslateBusAddress call to get the system virtual address. Somehow
>> > MmMapIoSPace return same virtual address as physical address. And when
>> > I use
>> > that returned virtual address accessing my hardware(NIC) it cause my
>> > machine
>> > to reboot.
>> >
>> > I have seen sample code for KITL and found that all KITL driver uses IO
>> > base
>> > and not memory base for accessing PCI/PCIe hardwares. I am not sure
>> > where I
>> > am going wrong?
>> >
>> > Kindly suggest me.
>> >
>> > Thanks
>> >
>> > Sincerely,
>> > Tushar Dave
>>
>>



Re: KITL ethernet driver in windows CE 6.0 fails by Joel

Joel
Thu Jun 12 13:39:12 PDT 2008

On Jun 12, 11:21=A0am, Tushar <Tus...@discussions.microsoft.com> wrote:
> Hi Joel,
> Thanks for your answer. But is there any way I can map 0x50100000 physical=

> address to virtual address (any Virtual addr thats not already used) . I a=
m
> using memory base to access my hardware. BIOS mapped the =A0Hw to 0x501000=
00
> memory address (PCIe BAR [0])
>
> (I am using 512 MB RAM and CEPC BSP)



You might acquire a cheap PCI NE2000 card to test with. This might
help, as it has a working driver. They're cheap.

What are you doing that is different than the CEPC code?

Does your BIOS map PCI addresses differently than the CEPC reference
platform?

Re: KITL ethernet driver in windows CE 6.0 fails by Michel

Michel
Thu Jun 12 16:58:54 PDT 2008

A bit more info on that:

You will never be able to use the entire 512 MB of physical RAM. The 512
MB address space is shared with any IO you want to map, the 512 MB of
RAM support is "theoretical". In real life you can't map it all if you
need to map some IO as well.

See:

http://msdn.microsoft.com/en-us/library/bb331824.aspx
http://msdn.microsoft.com/en-us/library/aa914933.aspx
http://msdn.microsoft.com/en-us/library/aa909199.aspx



Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE Ltd.
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

Dean Ramsier wrote:
> Restrict yourself to the range between 0x80000000-0x9FFFFFFF. That means
> you can't map in the entire 512MB of RAM.
>

Re: KITL ethernet driver in windows CE 6.0 fails by Tushar

Tushar
Mon Jun 16 15:57:02 PDT 2008

Hi,
Thanks for answer. I got your point. Although my head is not getting quite
clear with this bizarre!!

In my case, BIOS map the network card at memory address 0x50100000 ( that is
BAR[0] of of PCIe config space) , If I want to access my hardware (NIC) from
Windows CE using this (0x50100000) address then Do I need to map this
physical address to some virtual address ?

Because BAR[0] is my physical bus address. I am using HalTranslateBusAddress
function(that translate physical bus address to system physical address)
which in my case returned same 0x50100000. Then I am calling MmMapIoSpace
function (to translate physical address to virtual address) but it also
return same virtual address (in my case 0x50100000)

So finally I am using 0x50100000 address to access my device from windows
CE, and which cause error (might be page fault or some internal error which
reboot windows ce machine).

Hence, I think I need to map physical address to virtual address manually!!
Right?
Any address outside range 0x80000000 - 0x9FFFFFFF canâ??t handle by WinCE
(CEPC) because only those addresses are mapped (OEMAddressTable)

I hope I explained my question!

Thank you very much for your time and help. I appreciate your responses.

Sincerely,
Tushar Dave




"Dean Ramsier" wrote:

> Restrict yourself to the range between 0x80000000-0x9FFFFFFF. That means
> you can't map in the entire 512MB of RAM.
>
> --
> Dean Ramsier - eMVP
> BSQUARE Corporation
>
>
> "Tushar" <Tushar@discussions.microsoft.com> wrote in message
> news:4DFA9B8B-5938-407D-AE02-B1738323C98F@microsoft.com...
> > Hi Joel,
> > Thanks for your answer. But is there any way I can map 0x50100000 physical
> > address to virtual address (any Virtual addr thats not already used) . I
> > am
> > using memory base to access my hardware. BIOS mapped the Hw to 0x50100000
> > memory address (PCIe BAR [0])
> >
> > (I am using 512 MB RAM and CEPC BSP)
> > Based on my OEMAddressTable, physical address 0x00000000 - 0x20000000
> > mapped to virtual address 0x80000000 - 0xA0000000 . Also I tried adding
> > mapping in OEMAddressTable (startup.asm) .......(see line below)
> >
> > dd 0x70000000, 0x50100000, 0x00040000 ; 128KBytes memory
> >
> > but this doesn't work.
> >
> >
> > Below is fraction from 3 files that hepls understanding OS memory
> > mappings.
> >
> > 1. file : startup.asm
> > _OEMAddressTable:
> >
> > dd 80000000h, 0, 20000000h
> > dd 0, 0, 0
> >
> > ------------------------------------------------------
> >
> >
> > 2. file : boot.bib
> >
> > MEMORY
> >
> > EBOOT 00130000 00040000 RAMIMAGE
> > RAM 00170000 00070000 RAM
> > ETH_DMA 00200000 00020000 RESERVED
> >
> > dwReservedArea 00000000 00220000 FIXUPVAR
> >
> >
> > 3. file :config.bib
> >
> > NK 80220000 009E0000 RAMIMAGE
> > RAM 80C00000 1E000000 RAM
> > nk.exe :dwOEMTotalRAM 0 20000000 FIXUPVAR
> >
> > -------------------------------------------------------------------
> >
> > I appreciate your help.
> >
> > Thanks.
> >
> >
> > Sincerely,
> > Tushar Dave
> >
> >
> >
> >
> > "Joel Winarske" wrote:
> >
> >> Generally the addressing for EBOOT is setup as Physical is Virtual,
> >> and once the kernel boots everything becomes Virtual addressing.
> >>
> >> So if all is well with EBOOT, and up until your KITL tx/rx are used in
> >> the kernel, most likely your MMU kernel map is not correct, or your
> >> KITL routines are hardcoded to use Physical addresses.
> >>
> >> Good Luck,
> >> Joel
> >>
> >>
> >> On Jun 9, 2:05 pm, Tushar <Tus...@discussions.microsoft.com> wrote:
> >> > Hi,
> >> > I am developing KITL Ethernet driver for Windows CE 6.0. There are two
> >> > binaries 1) eboot.bin 2) KITL.dll .
> >> >
> >> > Eboot.bin initialized my Network card correctly and I can transfer OS
> >> > image
> >> > from debug to target machine. However, once OS gets loaded into target
> >> > machine, KITL.dll gets invoked on behalf of OS. Because KITL.dll is
> >> > loaded
> >> > into virtual space, I need to convert bus address into virtual address.
> >> > I am
> >> > doing that by calling two functions as below
> >> > HalTranslateBusAddress which returns 0x0 in "AddressSpace" and system
> >> > physical address in "TranslatedAddress". Because I am using memory base
> >> > I
> >> > need to call MmMapIoSpace with TranslatedAddress returned in
> >> > HalTranslateBusAddress call to get the system virtual address. Somehow
> >> > MmMapIoSPace return same virtual address as physical address. And when
> >> > I use
> >> > that returned virtual address accessing my hardware(NIC) it cause my
> >> > machine
> >> > to reboot.
> >> >
> >> > I have seen sample code for KITL and found that all KITL driver uses IO
> >> > base
> >> > and not memory base for accessing PCI/PCIe hardwares. I am not sure
> >> > where I
> >> > am going wrong?
> >> >
> >> > Kindly suggest me.
> >> >
> >> > Thanks
> >> >
> >> > Sincerely,
> >> > Tushar Dave
> >>
> >>
>
>
>