The BARs (Base Address Registers) corresponding to a storage device contains information about the memory ranges of the device. As per my understanding, the entire device memory is mapped into the memory and the driver operates on the mapped memory which is then reflected on the actual device (for e.g. A 40GB storage device should have 40GB of memory range mapped). The driver gets this information in ACCESS_RANGE structure which has members RangeStart (64 bit , Containing start of address range) and RangeLength(ULONG 32 bit, containing length). The driver uses these members to refer to the memory range.
The problem is, how can a 32-bit RangeLength accommodate memory range greater than 4GB.
> As per my understanding, the entire device memory is mapped into the memory and the driver > operates on the mapped memory which is then reflected on the actual device
You are much too optimistic…
(for e.g. A 40GB storage device should have 40GB of memory range mapped)
What about disks with storage space expressed in terms of terabytes??? Do you believe they should have all these terabytes mapped into RAM as well???
The problem is, how can a 32-bit RangeLength accommodate memory range
greater than 4GB.
You almost answered your own question - you have logically arrived to the conclusion that it just cannot work this way. The fact that device is mapped into the memory means that its registers are mapped into memory, rather than into IO space, so that you can access them as reads/writes with MOV, rather than port IO with IN and OUT…
Anton Bassov
> The BARs (Base Address Registers) corresponding to a storage
device
Do you mean “storage controller” like (S)ATA or SCSI controllers?
Storage devices like disk drives have no BARs.
The problem is, how can a 32-bit RangeLength accommodate
memory
range greater than 4GB.
I disbelieve the existence of storage controllers with >4GB register pools.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Maxim,
Do you mean “storage controller” like (S)ATA or SCSI controllers?
Storage devices like disk drives have no BARs.
Do you really think the OP can tell the difference between the storage device itself and (S)ATA or SCSI controller - in his opinion, the whole storage device may be mapped into RAM (apparently, he thinks BARs indicate the beginning and the end of the memory range into which device is mapped).Therefore, he may be well unaware of the controller’s very existence. Actually, if things worked the way the OP believes there would be just no need for a controller, in the first place - just write to memory, and the whole thing gets reflected on the disk…
Anton Bassov
xxxxx@yahoo.co.in wrote:
The BARs (Base Address Registers) corresponding to a storage device contains information about the memory ranges of the device. As per my understanding, the entire device memory is mapped into the memory and the driver operates on the mapped memory which is then reflected on the actual device (for e.g. A 40GB storage device should have 40GB of memory range mapped). The driver gets this information in ACCESS_RANGE structure which has members RangeStart (64 bit , Containing start of address range) and RangeLength(ULONG 32 bit, containing length). The driver uses these members to refer to the memory range.
The problem is, how can a 32-bit RangeLength accommodate memory range greater than 4GB.
Amid all the scoffing and sarcasm, I’m not sure anyone ever answered
your question.
A 40GB storage device is most certainly NOT mapped into memory.
Remember that disks are handled by disk controllers. It is the
controller that sits on the PCI bus. The controller has a small set of
registers and possibly a DMA queue of a few megabytes that will be
mapped into the virtual address space. When an application needs to
read sector 372, the disk controller driver figures out where that is on
the disk and where it has to go in memory, and sends a DMA command to
the controller to transfer the data.
Even a memory-mapped file is not mapped directly to the disk. Accesses
to the pages of a memory-mapped file end up calling the disk controller
driver, just like a ReadFile call, which will schedule a DMA transaction
to transfer the data.
Now, it is certainly possible to have a PCI device with 8GB of device
memory. Some very high-speed measurement devices do this kind of
thing. Since there is only a limited amount of virtual address space
available to kernel drivers, the driver for such a device must map and
unmap sections of that memory into virtual space, one piece at a time.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thanks a lot Tim for your inputs. My confusion is clear now. Otherwise people here try to show off more than to solve the problem.
xxxxx@yahoo.co.in wrote:
Thanks a lot Tim for your inputs. My confusion is clear now.
Otherwise people here try to show off more than to solve the problem.
Totally uncalled for statement ! People here are generally very friendly and helpful.
Vedvyas,
You are right. Even, I found here, a lot of people who are friendly and helpful. Actually , the statement in my last post was only for a few people in the community and was not generic.
> Otherwise people here try to show off more than to solve the problem.
Well, indeed, we can be a bit sarcastic from time to time - you should not take it as an offence. The problem is that quite often the questions are formulated improperly, so that they look a bit dumb to us…
Anton Bassov
xxxxx@yahoo.co.in wrote:
Otherwise people here try to show off more than to solve the problem.
No, they don’t. If you come a little bit prepared, you will learn a lot
and also get a lot of help here:
For any driver developer - you! - it is absolutely essential to know
“their” device and its architecture, e.g. basic principle of operation,
its components, how it is connected to the PC, etc.
Otherwise you will just never be able to develop a Windows driver for
it. Or for any other operating system.
Don’t forget that you - as far as “your” device is concerned - are the
only authoritative source of information for the people on this list!
Please remember, this here is not a “Windows programming 101” or
“Student assignment help” forum.
The quality of answers on NTDEV is usually extremely high, very often
given by “people here” who are professional driver developers, or
operating system developers working for Microsoft.
Their time is worth a lot of money, please do respect this.
“People here” are usually good-natured, competent, and will sometimes
even go the extra mile for you to help you solve a tough problem.
It helps you (more than anyone else) to have done your bit of learning
and exploration, too, and ask questions which show that you (1) know
your device, (2) know about Windows architecture and how to program for
it. If you write a driver, you (3) need to use the current WDK, (4) can
use a (kernel) debugger, (5) played around with the WDK sample drivers
that are most similar to your device. And it always helps if you (6)
know how to use the wealth of information available on MSDN, OSR and the
net.
Hagen,
If you come a little bit prepared, you will learn a lot and also get a lot of help here:
I am afraid posters who, indeed, did some research before asking questions in the NG are quite rare beasts (in fact, almost extinct ones). Unfortunately, what we normally see here are posters who are completely useless, helpless and lazy - they expect us to do all the work for them. When it gets pointed out to them, these posters normally turn aggressive and start playing victims - in their opinion, they are “mistreated” by us…
Anton Bassov
At 09:40 AM 2/8/2008, Hagen Patzke wrote:
Please remember, this here is not a “Windows programming 101” or
“Student assignment help” forum.The quality of answers on NTDEV is usually extremely high, very
often given by “people here” who are professional driver developers,
or operating system developers working for Microsoft.
Their time is worth a lot of money, please do respect this.“People here” are usually good-natured, competent, and will
sometimes even go the extra mile for you to help you solve a tough problem.It helps you (more than anyone else) to have done your bit of
learning and exploration, too, and ask questions which show that you
(1) know your device, (2) know about Windows architecture and how to
program for it. If you write a driver, you (3) need to use the
current WDK, (4) can use a (kernel) debugger, (5) played around with
the WDK sample drivers that are most similar to your device. And it
always helps if you (6) know how to use the wealth of information
available on MSDN, OSR and the net.
Be nice to see this spruced up and become part of the welcome message
when people sign up to the list. (Perhaps it is, but it’s a long
time since I signed up)
Sometimes the problems on the list are due to misunderstood
expectations. An inexperienced user can believe that this is a
support list and that there will be a guaranteed answer, even a
solution to their problem. This can raise temperatures with the very
people who so often normally go out of their way to help.