Access to Memory mapped port

Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.

See your other question. Doron answered it nicely. You need to put a
filter in the stack.

  • Jake
    “veera jothi” wrote in message
    news:xxxxx@ntdev…
    Hi All,

    I have a PCI card with VGA support and it comes with a VGA driver. The card
    has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for
    the device is done by the VGA driver.

    Now my work is to map the BAR1 address of the PCI device for performing
    basic Read/Write. Can any one tell me how to access the allocated
    resource(BAR1) for Read/Write operation to be performed?

    Regards,
    Jothi.R

    Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
    starting at 1¢/min.

Hi All,

As Jake and Doron say, I have written a Filter driver.

  1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

  2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R

---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Stay in the know. Pulse on the new Yahoo.com. Check it out.

You need to install your driver as an upper or lower filter with pnp. You will not explicitly open the device and attach to it, rather you AddDevice() routine will be called when you have properly setup your driver in the pnp stack…but it sounds like in case 1) you did just that. After you AddDevice() routine is called in case 1) and you have created your devobj and attached to the stack, break into the debugger (the command __debugbreak() in the code works well for this) and run !devstack with your newly created device object and send the output.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,
?
As Jake and Doron say, I have written a Filter driver.
?

  1. Load my driver as lower filter driver. In this case?I can attach my driver to the driver stack and I am able to read the Configuration space. But?I couldnt access the allocated resource. My start device routine is never triggered.?I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.
    ?
  2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.
    ?
    I am assigned to Read/Write to the BAR1 address register.
    ?
    Can any one tell me which filter driver method(upper filter/ lower filter driver)?should i follow?
    Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?
    ?
    Thanks and Regards,
    Jothi.R

veera jothi wrote:
Hi All,
?
I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and?BAR1)?and one IO port. The resource allocation for the device is done by the VGA driver.
?
Now?my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?
?
Regards,
Jothi.R
?

Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1?/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Jothi,

I’m a little bit confused about 2 scenarios you mentioned. If you attach as an PNP filter, then why you would do it differently in UpperFilter and LowerFilter cases? You should have attached your device object in AddDevice callback regardless upper or lower. Why do you need to open the video’s device object to get the PDO in #2? How exactly you attach to the stack in both cases?

Keep in mind that video miniport’s FDO is created for exclusive access. The only client – win32k will claim it before any session init, way before a PDEV is created. If you somehow won the ownership, then win32k will fail to init and the desktop won’t show up.

You mentioned that “it comes with a VGA driver”. When I made a living of writing video driver, the word “VGA driver” has special meaning – MSFT’s vga.sys. VGA driver only kicks in if OS can not load vendor’s display driver. This is important because a vga.sys is different from a vendor miniport driver, in terms of the way they initialize (it’s not pnp) and how the resources are managed. What VGA driver do you mean?

If it’s a Longhorn native display miniport driver (LDDM or WDDM), you need to pay more attention. I would go into more detail if this is your case.

Even you manage to get access to BAR1, you need to make sure your access to the device is not interfering the normal operation of the video driver.

Calvin Guan (DDK MVP)
Sr. Staff Engineer
NetXtreme NTX Miniport
Broadcom Corporation, Irvine CA 92618
Connecting Everything(r)


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,
?
As Jake and Doron say, I have written a Filter driver.
?

  1. Load my driver as lower filter driver. In this case?I can attach my driver to the driver stack and I am able to read the Configuration space. But?I couldnt access the allocated resource. My start device routine is never triggered.?I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.
    ?
  2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.
    ?
    I am assigned to Read/Write to the BAR1 address register.
    ?
    Can any one tell me which filter driver method(upper filter/ lower filter driver)?should i follow?
    Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?
    ?
    Thanks and Regards,
    Jothi.R

veera jothi wrote:
Hi All,
?
I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and?BAR1)?and one IO port. The resource allocation for the device is done by the VGA driver.
?
Now?my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?
?
Regards,
Jothi.R
?

Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1?/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Doron,

To install the driver with PNP I should make use of the INF driver. I am making use of the Kbfilter.inf file available in the ddk. I am using the same hardware ID used by the VGA driver. When I try to install my driver, the Finish wizard ends with the error.

The error displayed is “The wizard could not find a better match for your hardware than the software you currently have installed”.

I am using “Update Driver” in the device manager to install the driver. INF file is given below.

; kbfiltr.inf
;
; Installation inf for the Device that needs filtering adapter.
;
; (c) Copyright 1999 Microsoft
;
[Version]
Signature=“$Windows NT$”
Provider=%DDK_Ex%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
;CatalogFile=kbfiltr.cat
DriverVer=07/20/1999
[DestinationDirs]
DefaultDestDir = 12
;
; Driver information
;
[Manufacturer]
%DDK_Ex% = DDK_Ex.Mfg
[DDK_Ex.Mfg]
%DDK_Ex% = kbfiltr, pci\ven_1a03&dev_2000&subsys_20001a03&rev_00

;
; General installation section
;
[kbfiltr]
; perform port related actions from keyboard.inf
Include=Oem22.inf
Needs=AST
; Copy the driver over
CopyFiles=kbfiltr.CopyFiles

;
; File sections
;
[kbfiltr.CopyFiles]
devlower.sys

;
; Service Installation
;
[kbfiltr.Services]
AddService = kbfiltr, , kbfiltr_Service_Inst
; Install the port driver and mouclass from keyboard.inf
Include=oem22.inf
Needs=AST.Services
[kbfiltr_Service_Inst]
DisplayName = %kbfiltr.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
;LoadOrderGroup = Keyboard Port
ServiceBinary = %12%\devlower.sys
[kbfiltr.HW]
; Add the device upper filter
AddReg = kbfiltr.HW.AddReg
; run the directives need by the port driver
Include=oem22.inf
Needs=AST.SoftwareSettings
[kbfiltr.HW.AddReg]
HKR,“lowerFilters”,0x00010000,“kbfiltr”

;
; Source file information
;
; use [SourceDisksNames.x86] for x86 only installs
; use [SourceDisksNames.alpha] for alpha only installs
[SourceDisksNames]
1 = %DiskId1%,
[SourceDisksFiles]
devlower.sys = 1,

[Strings]
;
; Non-Localizable Strings
;
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = “System\CurrentControlSet\Services”
;
; Localizable Strings
;
DiskId1 = “DDK Example Installation Disk #1 (Keyboard)”
DDK_Ex = “DDK Example Device that needs filtering”
kbfiltr.SvcDesc=“Keyboard Filter Example”

Thanks and Regards,
Jothi.R

Doron Holan wrote:
You need to install your driver as an upper or lower filter with pnp. You will not explicitly open the device and attach to it, rather you AddDevice() routine will be called when you have properly setup your driver in the pnp stack…but it sounds like in case 1) you did just that. After you AddDevice() routine is called in case 1) and you have created your devobj and attached to the stack, break into the debugger (the command __debugbreak() in the code works well for this) and run !devstack with your newly created device object and send the output.

d

________________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,

As Jake and Doron say, I have written a Filter driver.

1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Do you Yahoo!?
Get on board. You’re invited to try the new Yahoo! Mail.

Hi Sir,

Since I have problem with the INF file method of installation, I am trying to install as a service created at the application side. At the driver side I am creating my own driver object and symbolic link for the same. Then I am using IoGetDeviceObjectPointer() to get the PDO of the lower driver. Then I am attaching my driver to the lower driver using IoAttachDeviceToDeviceStack() to attach the device to the device stack.

The VGA driver is a vendor’s own driver and not VGA.sys. The resource allocation is done by the vendor’s VGA driver. I dont have much idea about display driver. How will I find if the given display driver is a LDDM or WDDM.

Thanks and Regards,
Jothi.R

“Calvin (Hao) Guan” wrote:
Jothi,

I’m a little bit confused about 2 scenarios you mentioned. If you attach as an PNP filter, then why you would do it differently in UpperFilter and LowerFilter cases? You should have attached your device object in AddDevice callback regardless upper or lower. Why do you need to open the video’s device object to get the PDO in #2? How exactly you attach to the stack in both cases?

Keep in mind that video miniport’s FDO is created for exclusive access. The only client – win32k will claim it before any session init, way before a PDEV is created. If you somehow won the ownership, then win32k will fail to init and the desktop won’t show up.

You mentioned that “it comes with a VGA driver”. When I made a living of writing video driver, the word “VGA driver” has special meaning – MSFT’s vga.sys. VGA driver only kicks in if OS can not load vendor’s display driver. This is important because a vga.sys is different from a vendor miniport driver, in terms of the way they initialize (it’s not pnp) and how the resources are managed. What VGA driver do you mean?

If it’s a Longhorn native display miniport driver (LDDM or WDDM), you need to pay more attention. I would go into more detail if this is your case.

Even you manage to get access to BAR1, you need to make sure your access to the device is not interfering the normal operation of the video driver.

Calvin Guan (DDK MVP)
Sr. Staff Engineer
NetXtreme NTX Miniport
Broadcom Corporation, Irvine CA 92618
Connecting Everything(r)


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,

As Jake and Doron say, I have written a Filter driver.

1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

________________________________________
Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Get your email and more, right on the new Yahoo.com

See comment inline.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Wednesday, August 30, 2006 1:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Access to Memory mapped port

Hi Doron,

To install the driver with PNP I should make use of the INF driver. I am making use of the Kbfilter.inf file available in the ddk. I am using the same hardware ID used by the VGA driver. When I try to install my driver, the Finish wizard ends with the error.

The error displayed is “The wizard could not find a better match for your hardware than the software you currently have installed”.

I am using “Update Driver” in the device manager to install the driver. INF file is given below.

; kbfiltr.inf
;
; Installation inf for the Device that needs filtering adapter.
;
; (c) Copyright 1999 Microsoft
;

[Version]
Signature=“$Windows NT$”
Provider=%DDK_Ex%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
;CatalogFile=kbfiltr.cat
DriverVer=07/20/1999

[DestinationDirs]
DefaultDestDir = 12

;
; Driver information
;

[Manufacturer]
%DDK_Ex% = DDK_Ex.Mfg

[DDK_Ex.Mfg]
%DDK_Ex% = kbfiltr, pci\ven_1a03&dev_2000&subsys_20001a03&rev_00

;
; General installation section
;

[kbfiltr]
; perform port related actions from keyboard.inf
Include=Oem22.inf
Needs=AST

; Copy the driver over
CopyFiles=kbfiltr.CopyFiles

;
; File sections
;

[kbfiltr.CopyFiles]
devlower.sys

;
; Service Installation
;

[kbfiltr.Services]
AddService = kbfiltr, , kbfiltr_Service_Inst
; Install the port driver and mouclass from keyboard.inf
Include=oem22.inf
Needs=AST.Services

[kbfiltr_Service_Inst]
DisplayName = %kbfiltr.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
;LoadOrderGroup = Keyboard Port
ServiceBinary = %12%\devlower.sys

[kbfiltr.HW]
; Add the device upper filter
AddReg = kbfiltr.HW.AddReg

; run the directives need by the port driver
Include=oem22.inf
Needs=AST.SoftwareSettings

[CG]

Are you sure the AST.SoftwareSettings is in the driver’s .HW section? It’s very unusual a miniport driver would put registry key in the .HW section since videoprt doesn’t have API to read data from that location. Miniport driver’s inf would put registry values in a special location( don’t recall where exactly it was), the display classinstaller will append an instance GUID to the path.

[kbfiltr.HW.AddReg]
HKR,“lowerFilters”,0x00010000,“kbfiltr”

;
; Source file information
;

; use [SourceDisksNames.x86] for x86 only installs
; use [SourceDisksNames.alpha] for alpha only installs

[SourceDisksNames]
1 = %DiskId1%,

[SourceDisksFiles]
devlower.sys = 1,

[Strings]

;
; Non-Localizable Strings
;

REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = “System\CurrentControlSet\Services”

;
; Localizable Strings
;

DiskId1 = “DDK Example Installation Disk #1 (Keyboard)”
DDK_Ex = “DDK Example Device that needs filtering”
kbfiltr.SvcDesc=“Keyboard Filter Example”

Thanks and Regards,

Jothi.R

Doron Holan wrote:

You need to install your driver as an upper or lower filter with pnp. You will not explicitly open the device and attach to it, rather you AddDevice() routine will be called when you have properly setup your driver in the pnp stack…but it sounds like in case 1) you did just that. After you AddDevice() routine is called in case 1) and you have created your devobj and attached to the stack, break into the debugger (the command __debugbreak() in the code works well for this) and run !devstack with your newly created device object and send the output.

d

________________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,

As Jake and Doron say, I have written a Filter driver.

1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1?/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

________________________________

Do you Yahoo!?
Get on board. You’re invited http: to try the new Yahoo! Mail. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

If this is the error you are getting, when you go through the update device wizard you must explicitly pick your INF (browse your computer, let me pick the driver, Have Disk…)

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Wednesday, August 30, 2006 2:14 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Access to Memory mapped port

Hi Sir,
?
Since?I have problem with the INF file method of installation, I am trying to install as a service created at the application side. At the driver side I am creating my own driver object and symbolic link for the same.?Then?I am using IoGetDeviceObjectPointer() to get the PDO of the lower driver. Then?I am attaching my driver to the lower driver using IoAttachDeviceToDeviceStack() to attach the device to the device stack.
?
The?VGA?driver is a vendor’s own driver and not VGA.sys. ?The resource allocation is done by the vendor’s VGA driver. I dont have much idea about display driver.?How will?I find if the given?display driver is a LDDM or WDDM.
?
Thanks and Regards,
Jothi.R

“Calvin (Hao) Guan” wrote:
Jothi,

I’m a little bit confused about 2 scenarios you mentioned. If you attach as an PNP filter, then why you would do it differently in UpperFilter and LowerFilter cases? You should have attached your device object in AddDevice callback regardless upper or lower. Why do you need to open the video’s device object to get the PDO in #2? How exactly you attach to the stack in both cases?

Keep in mind that video miniport’s FDO is created for exclusive access. The only client – win32k will claim it before any session init, way before a PDEV is created. If you somehow won the ownership, then win32k will fail to init and the desktop won’t show up.

You mentioned that “it comes with a VGA driver”. When I made a living of writing video driver, the word “VGA driver” has special meaning – MSFT’s vga.sys. VGA driver only kicks in if OS can not load vendor’s display driver. This is important because a vga.sys is different from a vendor miniport driver, in terms of the way they initialize (it’s not pnp) and how the resources are managed. What VGA driver do you mean?

If it’s a Longhorn native display miniport driver (LDDM or WDDM), you need to pay more attention. I would go into more detail if this is your case.

Even you manage to get access to BAR1, you need to make sure your access to the device is not interfering the normal operation of the video driver.

Calvin Guan (DDK MVP)
Sr. Staff Engineer
NetXtreme NTX Miniport
Broadcom Corporation, Irvine CA 92618
Connecting Everything(r)


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,
?
As Jake and Doron say, I have written a Filter driver.
?
1. Load my driver as lower filter driver. In this case?I can attach my driver to the driver stack and I am able to read the Configuration space. But?I couldnt access the allocated resource. My start device routine is never triggered.?I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.
?
2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.
?
I am assigned to Read/Write to the BAR1 address register.
?
Can any one tell me which filter driver method(upper filter/ lower filter driver)?should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?
?
Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,
?
I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and?BAR1)?and one IO port. The resource allocation for the device is done by the VGA driver.
?
Now?my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?
?
Regards,
Jothi.R
?

Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1?/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Get your email and more, right on the new Yahoo.com — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

veera jothi wrote:

Hi Sir,

Since I have problem with the INF file method of installation, I am
trying to install as a service created at the application side. At the
driver side I am creating my own driver object and symbolic link for
the same. Then I am using IoGetDeviceObjectPointer() to get the PDO of
the lower driver. Then I am attaching my driver to the lower driver
using IoAttachDeviceToDeviceStack() to attach the device to the device
stack.

The VGA driver is a vendor’s own driver and not VGA.sys. The resource
allocation is done by the vendor’s VGA driver.

It’s not a VGA driver. That’s the point Calvin was trying to make. The
VGA was a graphics board produced by IBM in 1984. What the vendor has
provided is a display driver, or a display miniport.

I dont have much idea about display driver. How will I find if the
given display driver is a LDDM or WDDM.

LDDM is only used on Vista. If you aren’t running Vista, then don’t
worry about this.

If you don’t have much idean about display drivers, then what on earth
are you actually trying to do? You’ve told us several times what you
THINK you need to do to achieve your goal, but you’ve never told us what
the goal is. Saying that “I have to write to BAR1” is not the goal,
that’s just one possible step towards a goal.

If all you are trying to do is manipulate some of the registers on the
AST2000 for experimental purposes, you don’t need to go to all the
hassle of writing a filter driver for the display miniport. You can
write a non-PnP driver, find the PCI device, read the BAR, map it into
memory, and write the registers.

By the way, it’s a very bad idea to use “Includes=oem22.inf”. That name
applies ONLY to your computer, and ONLY to right now. The next time you
install, it might be oem23.inf.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thank u Sir.
My goal is to read/write to the BAR1 registers.
Using update driver, I am specfying the INF file location withe the help of browse button in the wizard. Even then it says the same error, “The wizard could not find a better match for your hardware than the software you currently have installed”.
Am I making mistake with the harware ID.
Here is the Display driver INF file.

; ASTGR.inf
; Installation inf for the AST1000/2000 Graphics Adapter.
;
[Version]
Signature=“$Windows NT$”
Provider=%Provider%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
DriverVer=05/26/2006,6.01.01.0081
CatalogFile=astgr.cat
[DestinationDirs]
DefaultDestDir = 11
ASTGR.Miniport = 12
ASTGR.Display = 11
;
; Driver information
;
[Manufacturer]
%Mfg% = AST.Mfg, NTx86
[AST.Mfg]
%Vendor.AST2000.Device1% = AST , PCI\VEN_1A03&DEV_2000
[AST.Mfg.NTx86]
%Vendor.AST2000.Device1% = AST , PCI\VEN_1A03&DEV_2000
;
; General installation section
;
[AST]
CopyFiles=ASTGR.Miniport, ASTGR.Display
;
; File sections
;
[ASTGR.Miniport]
astgrp.sys
[ASTGR.Display]
astgrv.dll
;
; Service Installation
;
[AST.Services]
AddService = ASTGraphics, 0x00000002, AST_Service_Inst, AST_EventLog_Inst
[AST_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%\astgrp.sys
[AST_EventLog_Inst]
AddReg = AST_EventLog_AddReg
[AST_EventLog_AddReg]
HKR,EventMessageFile,0x00020000,“%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\astgrp.sys”
HKR,TypesSupported,0x00010001,7
;
; Software Installation
;
[AST.SoftwareSettings]
AddReg = AST_SoftwareDeviceSettings
[AST_SoftwareDeviceSettings]
HKR, InstalledDisplayDrivers, %REG_MULTI_SZ%, ASTGRV
HKR, VgaCompatible, %REG_DWORD%, 0
;
; Source file information
;
[SourceDisksNames]
1 = %DiskId%,“”
[SourceDisksFiles]
astgrp.sys = 1
astgrv.dll = 1
[AST.GeneralConfigData]
MaximumDeviceMemoryConfiguration=512
MaximumNumberOfDevices=4
[Strings]
;
; Non-Localizable Strings
;
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = System\CurrentControlSet\Services
;
; Localizable Strings
;
DiskId = “ASPEED Technology Inc. Installation Disk”
Provider = “ASPEED”
Mfg = “AST”
Vendor.AST2000.Device1 = “AST1000/2000”

“Calvin (Hao) Guan” wrote:
v:* {behavior:url(#default#VML);} o:* {behavior:url(#default#VML);} w:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1:*{behavior:url(#default#ieooui) }
See comment inline.

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

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Wednesday, August 30, 2006 1:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Access to Memory mapped port

Hi Doron,

To install the driver with PNP I should make use of the INF driver. I am making use of the Kbfilter.inf file available in the ddk. I am using the same hardware ID used by the VGA driver. When I try to install my driver, the Finish wizard ends with the error.

The error displayed is “The wizard could not find a better match for your hardware than the software you currently have installed”.

I am using “Update Driver” in the device manager to install the driver. INF file is given below.

; kbfiltr.inf
;
; Installation inf for the Device that needs filtering adapter.
;
; (c) Copyright 1999 Microsoft
;

[Version]
Signature=“$Windows NT$”
Provider=%DDK_Ex%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
;CatalogFile=kbfiltr.cat
DriverVer=07/20/1999

[DestinationDirs]
DefaultDestDir = 12

;
; Driver information
;

[Manufacturer]
%DDK_Ex% = DDK_Ex.Mfg

[DDK_Ex.Mfg]
%DDK_Ex% = kbfiltr, pci\ven_1a03&dev_2000&subsys_20001a03&rev_00

;
; General installation section
;

[kbfiltr]
; perform port related actions from keyboard.inf
Include=Oem22.inf
Needs=AST

; Copy the driver over
CopyFiles=kbfiltr.CopyFiles

;
; File sections
;

[kbfiltr.CopyFiles]
devlower.sys

;
; Service Installation
;

[kbfiltr.Services]
AddService = kbfiltr, , kbfiltr_Service_Inst
; Install the port driver and mouclass from keyboard.inf
Include=oem22.inf
Needs=AST.Services

[kbfiltr_Service_Inst]
DisplayName = %kbfiltr.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
;LoadOrderGroup = Keyboard Port
ServiceBinary = %12%\devlower.sys

[kbfiltr.HW]
; Add the device upper filter
AddReg = kbfiltr.HW.AddReg

; run the directives need by the port driver
Include=oem22.inf
Needs=AST.SoftwareSettings
[CG]
Are you sure the AST.SoftwareSettings is in the driver’s .HW section? It’s very unusual a miniport driver would put registry key in the .HW section since videoprt doesn’t have API to read data from that location. Miniport driver’s inf would put registry values in a special location( don’t recall where exactly it was), the display classinstaller will append an instance GUID to the path.

[kbfiltr.HW.AddReg]
HKR,“lowerFilters”,0x00010000,“kbfiltr”

;
; Source file information
;

; use [SourceDisksNames.x86] for x86 only installs
; use [SourceDisksNames.alpha] for alpha only installs

[SourceDisksNames]
1 = %DiskId1%,

[SourceDisksFiles]
devlower.sys = 1,

[Strings]

;
; Non-Localizable Strings
;

REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = “System\CurrentControlSet\Services”

;
; Localizable Strings
;

DiskId1 = “DDK Example Installation Disk #1 (Keyboard)”
DDK_Ex = “DDK Example Device that needs filtering”
kbfiltr.SvcDesc=“Keyboard Filter Example”

Thanks and Regards,

Jothi.R

Doron Holan wrote:

You need to install your driver as an upper or lower filter with pnp. You will not explicitly open the device and attach to it, rather you AddDevice() routine will be called when you have properly setup your driver in the pnp stack…but it sounds like in case 1) you did just that. After you AddDevice() routine is called in case 1) and you have created your devobj and attached to the stack, break into the debugger (the command __debugbreak() in the code works well for this) and run !devstack with your newly created device object and send the output.

d

________________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,

As Jake and Doron say, I have written a Filter driver.

1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

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

Do you Yahoo!?
Get on board. You’re invited to try the new Yahoo! Mail. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Do you Yahoo!?
Get on board. You’re invited to try the new Yahoo! Mail.

Thank u Sir.
My goal is to read/write to the BAR1 registers.
Using update driver, I am specfying the INF file location withe the help of browse button in the wizard. Even then it says the same error, “The wizard could not find a better match for your hardware than the software you currently have installed”.
Am I making mistake with the harware ID.
Here is the Display driver INF file.

; ASTGR.inf
; Installation inf for the AST1000/2000 Graphics Adapter.
;
[Version]
Signature=“$Windows NT$”
Provider=%Provider%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
DriverVer=05/26/2006,6.01.01.0081
CatalogFile=astgr.cat
[DestinationDirs]
DefaultDestDir = 11
ASTGR.Miniport = 12
ASTGR.Display = 11
;
; Driver information
;
[Manufacturer]
%Mfg% = AST.Mfg, NTx86
[AST.Mfg]
%Vendor.AST2000.Device1% = AST , PCI\VEN_1A03&DEV_2000
[AST.Mfg.NTx86]
%Vendor.AST2000.Device1% = AST , PCI\VEN_1A03&DEV_2000
;
; General installation section
;
[AST]
CopyFiles=ASTGR.Miniport, ASTGR.Display
;
; File sections
;
[ASTGR.Miniport]
astgrp.sys
[ASTGR.Display]
astgrv.dll
;
; Service Installation
;
[AST.Services]
AddService = ASTGraphics, 0x00000002, AST_Service_Inst, AST_EventLog_Inst
[AST_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%\astgrp.sys
[AST_EventLog_Inst]
AddReg = AST_EventLog_AddReg
[AST_EventLog_AddReg]
HKR,EventMessageFile,0x00020000,“%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\astgrp.sys”
HKR,TypesSupported,0x00010001,7
;
; Software Installation
;
[AST.SoftwareSettings]
AddReg = AST_SoftwareDeviceSettings
[AST_SoftwareDeviceSettings]
HKR, InstalledDisplayDrivers, %REG_MULTI_SZ%, ASTGRV
HKR, VgaCompatible, %REG_DWORD%, 0
;
; Source file information
;
[SourceDisksNames]
1 = %DiskId%,“”
[SourceDisksFiles]
astgrp.sys = 1
astgrv.dll = 1
[AST.GeneralConfigData]
MaximumDeviceMemoryConfiguration=512
MaximumNumberOfDevices=4
[Strings]
;
; Non-Localizable Strings
;
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = System\CurrentControlSet\Services
;
; Localizable Strings
;
DiskId = “ASPEED Technology Inc. Installation Disk”
Provider = “ASPEED”
Mfg = “AST”
Vendor.AST2000.Device1 = “AST1000/2000”

“Calvin (Hao) Guan” wrote:
v:* {behavior:url(#default#VML);} o:* {behavior:url(#default#VML);} w:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1:*{behavior:url(#default#ieooui) }
See comment inline.

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

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Wednesday, August 30, 2006 1:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Access to Memory mapped port

Hi Doron,

To install the driver with PNP I should make use of the INF driver. I am making use of the Kbfilter.inf file available in the ddk. I am using the same hardware ID used by the VGA driver. When I try to install my driver, the Finish wizard ends with the error.

The error displayed is “The wizard could not find a better match for your hardware than the software you currently have installed”.

I am using “Update Driver” in the device manager to install the driver. INF file is given below.

; kbfiltr.inf
;
; Installation inf for the Device that needs filtering adapter.
;
; (c) Copyright 1999 Microsoft
;

[Version]
Signature=“$Windows NT$”
Provider=%DDK_Ex%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
;CatalogFile=kbfiltr.cat
DriverVer=07/20/1999

[DestinationDirs]
DefaultDestDir = 12

;
; Driver information
;

[Manufacturer]
%DDK_Ex% = DDK_Ex.Mfg

[DDK_Ex.Mfg]
%DDK_Ex% = kbfiltr, pci\ven_1a03&dev_2000&subsys_20001a03&rev_00

;
; General installation section
;

[kbfiltr]
; perform port related actions from keyboard.inf
Include=Oem22.inf
Needs=AST

; Copy the driver over
CopyFiles=kbfiltr.CopyFiles

;
; File sections
;

[kbfiltr.CopyFiles]
devlower.sys

;
; Service Installation
;

[kbfiltr.Services]
AddService = kbfiltr, , kbfiltr_Service_Inst
; Install the port driver and mouclass from keyboard.inf
Include=oem22.inf
Needs=AST.Services

[kbfiltr_Service_Inst]
DisplayName = %kbfiltr.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
;LoadOrderGroup = Keyboard Port
ServiceBinary = %12%\devlower.sys

[kbfiltr.HW]
; Add the device upper filter
AddReg = kbfiltr.HW.AddReg

; run the directives need by the port driver
Include=oem22.inf
Needs=AST.SoftwareSettings
[CG]
Are you sure the AST.SoftwareSettings is in the driver’s .HW section? It’s very unusual a miniport driver would put registry key in the .HW section since videoprt doesn’t have API to read data from that location. Miniport driver’s inf would put registry values in a special location( don’t recall where exactly it was), the display classinstaller will append an instance GUID to the path.

[kbfiltr.HW.AddReg]
HKR,“lowerFilters”,0x00010000,“kbfiltr”

;
; Source file information
;

; use [SourceDisksNames.x86] for x86 only installs
; use [SourceDisksNames.alpha] for alpha only installs

[SourceDisksNames]
1 = %DiskId1%,

[SourceDisksFiles]
devlower.sys = 1,

[Strings]

;
; Non-Localizable Strings
;

REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = “System\CurrentControlSet\Services”

;
; Localizable Strings
;

DiskId1 = “DDK Example Installation Disk #1 (Keyboard)”
DDK_Ex = “DDK Example Device that needs filtering”
kbfiltr.SvcDesc=“Keyboard Filter Example”

Thanks and Regards,

Jothi.R

Doron Holan wrote:

You need to install your driver as an upper or lower filter with pnp. You will not explicitly open the device and attach to it, rather you AddDevice() routine will be called when you have properly setup your driver in the pnp stack…but it sounds like in case 1) you did just that. After you AddDevice() routine is called in case 1) and you have created your devobj and attached to the stack, break into the debugger (the command __debugbreak() in the code works well for this) and run !devstack with your newly created device object and send the output.

d

________________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of veera jothi
Sent: Tuesday, August 29, 2006 11:45 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Access to Memory mapped port

Hi All,

As Jake and Doron say, I have written a Filter driver.

1. Load my driver as lower filter driver. In this case I can attach my driver to the driver stack and I am able to read the Configuration space. But I couldnt access the allocated resource. My start device routine is never triggered. I tried to get the resource list using IoGetDeviceProperty(). But IoGetDeviceProperty() returns error telling my device object is not a valid device object.

2. Then I tried to load my driver as a upper filter driver. In this case, I am trying to load my filter driver over the VGA driver. I have the device name i.e \Device\Video3. Using ZwOpenFile, I am opening the device with FILE_READ_ATTRIBUTES as access parameter. But ZwOpenFile returns 0xC0000022( Access denied error status). To attach my filter driver i need the PDO. But the VGA driver does not permit me to get the PDO.

I am assigned to Read/Write to the BAR1 address register.

Can any one tell me which filter driver method(upper filter/ lower filter driver) should i follow?
Also in both the cases i am facing problem as specified above. Any one please suggest me how to come over the problem?

Thanks and Regards,
Jothi.R

veera jothi wrote:
Hi All,

I have a PCI card with VGA support and it comes with a VGA driver. The card has two Memory(BAR0 and BAR1) and one IO port. The resource allocation for the device is done by the VGA driver.

Now my work is to map the BAR1 address of the PCI device for performing basic Read/Write. Can any one tell me how to access the allocated resource(BAR1) for Read/Write operation to be performed?

Regards,
Jothi.R


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Stay in the know. Pulse on the new Yahoo.com. Check it out. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

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

Do you Yahoo!?
Get on board. You’re invited to try the new Yahoo! Mail. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail.