COM port detection

Hi,

I am interested in the detection and driver (serial.sys) installation
procedure for COM ports in terms of the BIOS and the Windows XP OS.

Firstly regarding the BIOS. Would I be correct in thinking that the BIOS
itself looks at particular base addresses for UART devices and then sets its
BIOS data area accordingly with its findings (i.e. how many COM ports and
where they are).

Secondly when the OS starts up does it reply solely on the BIOS data area in
order to load and start COM ports drivers or does it perform any detection
procedure itself and then load drivers as appropriate?

Regards FarmerJo

  1. pretty much yes for ISA COM ports (e.g. not ones attached through a pci add in card) although it does not necessarily need to probe, it can just assume they are present sometimes, esp if the bios has a user setting which allows them to specify what com ports are present and where they are in io space

  2. pre ACPI the OS (ntdetect during boot) would probe for ports itself and use the bios data. In an acpi world, we let acpi enumerate the ports and since the acpi namespace is controlled by the bios, there is no additional detection for ports. Of course, if they are on the isa bus and are isa pnp enabled, the isapnp bus driver could find additional ports and enumerate them. Same for pci attached ports. But both of these actions are not specific to com ports, that is just how pnp enumeration works for all devices.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, June 03, 2008 11:20 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] COM port detection

Hi,

I am interested in the detection and driver (serial.sys) installation
procedure for COM ports in terms of the BIOS and the Windows XP OS.

Firstly regarding the BIOS. Would I be correct in thinking that the BIOS
itself looks at particular base addresses for UART devices and then sets its
BIOS data area accordingly with its findings (i.e. how many COM ports and
where they are).

Secondly when the OS starts up does it reply solely on the BIOS data area in
order to load and start COM ports drivers or does it perform any detection
procedure itself and then load drivers as appropriate?

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Thanks Doron.

Just to clarify.

The BIOS only probes for the standard COM ports that are located on the ISA
bus which are all are I/O mapped. The BIOS provides settings that allow both
the base address and IRQ for each COM port to be selected from a list of
possibles. Given the detection process and user settings the BIOS data area
is written accordingly.

When a ACPI OS starts it does not probe for the standard ISA COM ports that
the BIOS has already detected but instead uses the BIOS data area instead to
determine if serial.sys needs to be loaded. For a non-ACPI OS even the ISA
COM ports are probed.

For other COM ports, such as those located on a PCI card, the OS will itself
detect itself.

Regards FarmerJo

There assumptions are not absolutes, but are pretty close to the normal

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, June 03, 2008 1:26 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] COM port detection

Thanks Doron.

Just to clarify.

The BIOS only probes for the standard COM ports that are located on the ISA
bus which are all are I/O mapped. The BIOS provides settings that allow both
the base address and IRQ for each COM port to be selected from a list of
possibles. Given the detection process and user settings the BIOS data area
is written accordingly.

When a ACPI OS starts it does not probe for the standard ISA COM ports that
the BIOS has already detected but instead uses the BIOS data area instead to
determine if serial.sys needs to be loaded. For a non-ACPI OS even the ISA
COM ports are probed.

For other COM ports, such as those located on a PCI card, the OS will itself
detect itself.

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

One last question on this subject if I may.

I touched on this some time ago but never got the full picture so here goes
again.

How would I configure my PC so that serial.sys is not loaded at startup even
when the BIOS says there is a COM port present?

In other words I would like to get the device manager to show that a COM
port is present but no driver has been loaded for it even when the PC has
been power cycled.

Regards FarmerJo

Disable the device in Device Manager? That setting is persistent across
reboots.

Good Luck,
-dave

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, June 03, 2008 4:56 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:COM port detection

One last question on this subject if I may.

I touched on this some time ago but never got the full picture so here goes
again.

How would I configure my PC so that serial.sys is not loaded at startup even

when the BIOS says there is a COM port present?

In other words I would like to get the device manager to show that a COM
port is present but no driver has been loaded for it even when the PC has
been power cycled.

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Hi,

Eventually I want to use an alternative driver for the COM port so I thought
as a first step towards this I would stop serial.sys from geting the port.

Regards FarmerJo

Serial.sys does not ‘get the port’. PnP assigns Serial.sys to the device
because the Serial Port (*PNP50x) driver matched the Device ID (Compatible
ID). Serial.sys is *told* to load on the port.

Install your own driver on the device. Create and INF that indicates your
driver is an alternative for *PNP50x (or whatever the device/compatible ID
is of your serial port). Then use Device Manager, devcon, whatever to
install your driver on the device. Serial.sys will absolutely leave your
port alone since PnP will never tell it to load as the FDO for the device.

Good Luck,
-dave

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, June 03, 2008 5:29 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:COM port detection

Hi,

Eventually I want to use an alternative driver for the COM port so I thought

as a first step towards this I would stop serial.sys from geting the port.

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

To come back to your original question, all of the bios enumeration/hand off/detection stuff is to find a device and identify it (with a set of hardware ids and such) and NOT to install a driver. The installed driver is done by pnp at a later stage after enumeration. So how it was found makes no difference as to which driver is loaded, what makes a difference is the IDs assigned to the device. Like david said, just disable the device in device manager to prevent serial from loading (note that uninstall will also do this but the best matched driver will then be reinstalled on reenumeration). From there you can try to reenable the device and point the installation to your driver via your own INF.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of David R. Cattley
Sent: Tuesday, June 03, 2008 2:34 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Re:COM port detection

Serial.sys does not ‘get the port’. PnP assigns Serial.sys to the device
because the Serial Port (*PNP50x) driver matched the Device ID (Compatible
ID). Serial.sys is *told* to load on the port.

Install your own driver on the device. Create and INF that indicates your
driver is an alternative for *PNP50x (or whatever the device/compatible ID
is of your serial port). Then use Device Manager, devcon, whatever to
install your driver on the device. Serial.sys will absolutely leave your
port alone since PnP will never tell it to load as the FDO for the device.

Good Luck,
-dave

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, June 03, 2008 5:29 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:COM port detection

Hi,

Eventually I want to use an alternative driver for the COM port so I thought

as a first step towards this I would stop serial.sys from geting the port.

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Hi,

Thanks for the information. Is it the BIOS then that assigns device IDs as
and when devices are found and these IDs are then used by the OS PnP
mechansim to match a driver to a device?

Where are the BIOS device IDs stored? Just for my own information, where can
I find out more about the BIOS device detection and how device IDs are
constructed?

Regards FarmerJo

Standard PC serial ports have well-known *PNPxxxx device IDs.

The BIOS just determines the fact that the serial port is present.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“FarmerJo” wrote in message news:xxxxx@ntdev…
> Hi,
>
> Thanks for the information. Is it the BIOS then that assigns device IDs as
> and when devices are found and these IDs are then used by the OS PnP
> mechansim to match a driver to a device?
>
> Where are the BIOS device IDs stored? Just for my own information, where can
> I find out more about the BIOS device detection and how device IDs are
> constructed?
>
> Regards FarmerJo
>
>
>

A pre ACPI bios will not report the hardware IDs. For an acpi machine, the device’s hardware IDs can be described in the bios through an acpi property (IIRC, it is _HID())

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Wednesday, June 04, 2008 2:59 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:COM port detection

Hi,

Thanks for the information. Is it the BIOS then that assigns device IDs as
and when devices are found and these IDs are then used by the OS PnP
mechansim to match a driver to a device?

Where are the BIOS device IDs stored? Just for my own information, where can
I find out more about the BIOS device detection and how device IDs are
constructed?

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Does this mean then that for an ACPI BIOS that the OS reads device IDs from
the BIOS and does not read the BIOS data area as I thought?

What does the OS read when it is not an ACPI BIOS?

FarmerJo

FarmerJo wrote:

Does this mean then that for an ACPI BIOS that the OS reads device IDs from
the BIOS and does not read the BIOS data area as I thought?

What does the OS read when it is not an ACPI BIOS?

For COM ports? It probes all of the “well known I/O ports” to see which
of them responds when tickled.

What else could it do? There is no central inventory of devices anywhere.


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

But thats not the whole story is it. Irrespective of ACPI the BIOS can still
be used to disable a COM port completely. If you do this then windows does
not load a driver for it.

So my question is what does the OS read, in terms of the BIOS, to determine
if the COM port is enabled or not?

FarmerJo

> But thats not the whole story is it. Irrespective of ACPI the BIOS can still

be used to disable a COM port completely. If you do this then windows does
not load a driver for it.

Are you sure? on non-ACPI machine (though I last used it in 2001) Windows will
IIRC ignore this BIOS setting.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Can’t say that I am 100% sure but I do remember long ago in the distant past
having to visit the BIOS in order to enable COM2. That was on a PC that ran
Windows NT Doesn’tWorkstation.

Given that the BIOS contains user settings that enable/disable COM ports in
addition to specifying its I/O and interrupts, how does Windows read these
settings?

I can see that Windows itself could probe specific addresses to see if there
was a COM port there but how would it known what IRQ it was connected to?

FarmerJo

Maxim S. Shatskih wrote:

> But thats not the whole story is it. Irrespective of ACPI the BIOS can still
> be used to disable a COM port completely. If you do this then windows does
> not load a driver for it.
>

Are you sure? on non-ACPI machine (though I last used it in 2001) Windows will
IIRC ignore this BIOS setting.

It depends on how it is done. Virtually every computer made today
exposes its parallel and serial ports through a Super I/O chip. If the
BIOS disables a COM port by tweaking a register in the Super I/O chip,
then the I/O port won’t respond when Windows tickles it.

If the BIOS disables the port just by making an entry in the data area
in 40:xxxx, then Windows could still find it.


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

…and the BIOS fun goes on!

Assuming that we have an ACPI compliant Windows XP PC what is the sequence
of events that result in serial.sys being loaded in terms of root
enumerators and PnP etc?

FarmerJo

If the end goal is to prevent serial.sys from being loaded, none of this really matters. Is this just to know how it works? Or is there some other end goal outside of getting your driver to load?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Wednesday, June 04, 2008 11:08 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Re:COM port detection

…and the BIOS fun goes on!

Assuming that we have an ACPI compliant Windows XP PC what is the sequence
of events that result in serial.sys being loaded in terms of root
enumerators and PnP etc?

FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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