0

I'm developing an application for DOS. I need to communicate via parallel port.

Currently I'm stuck at how can I determine which of the PCI function's BAR(Base address registers) contain the base address(ie data port address) for that parallel port? :?

Precisely, is there a industry convention or standard or de-facto standard that a particular BAR will always contain the base address for that parallel port ?

If not, then how can I determine the base address for that PCI parallel port(whether on pci expansion card or integrated on mobo)?

Actually I'm concerned with parallel ports on PCI expansion cards. AFAIK, BIOS doesn't know about these. BIOS will only allocate resources to the pci card(s) and that's it. So, there might not be the entries for such parallel ports in BDA, as BIOS manufacturer knows only about ALL the devices their mobo has.

For eg, say on a PC, I installed 4 parallel ports on pci expansion card(s) , and there is 1 parallel port integrated\embedded on mobo. Now where does the entry for other 2 parallel ports go?

That's why it seems that the BIOS has entries only for three parallel ports integrated \ embedded on chipset or motherboard. So, I think we must read PCI BARs to get the base address for any parallel port on pci expansion card installed on mobo.

Thanks

jacks
  • 294
  • 3
  • 15
  • What is the manufacturer / model # of the PCI-to-LPT chip on your board? – myron-semack Aug 30 '12 at 13:39
  • @msemack- Actually, I'm trying to write a generic driver, that is independent of vendor and product type - something like we have PCI IDE controller spec. But till now it seems that such a universalisaton is *impossible* due to varying implementations b/w different vendors. Only one's practical experience with such cards can guide him/her.After searching over, I realized, that many such cards implement both parallel port and serial port in a single PCI function, and the base addresses of these parallel port and serial port are of course in different bars. I wonder, ... – jacks Sep 01 '12 at 04:21
  • ...what is the Subclass code of such a PCI function? I guess it would be either 02h or 80h. If that is the case, then I can't search for all parallel ports present in the system by simply searching for a parallel port subclass 01h. Even if the card contains either all parallel ports or all serial ports, then in some cards, two or more serial(or parallel) ports may share a *single BAR*. One is at offset 0 and other is at offset 0x08 say, and so on. :( – jacks Sep 01 '12 at 04:22
  • Yeah, this would be chip-specific. That's why I asked for the Manufacturer of the chip. The Mfr datasheet will tell you what you need to know. – myron-semack Sep 04 '12 at 13:06

2 Answers2

2

The memory based list of parallel ports (including serial ports) is limited to only three entries (originally was 4 in IBM PC). It's designed for old ISA based systems when Plug an Play (PnP) technology doesn't exist yet.

On newer systems, the BIOS PnP functions should be used to detect any PCI based parallel port devices. This involves scanning through all PCI devices to find the one that is a Communication Device class with sub-class of Parallel Port. Get the Intel's Plug and Play BIOS Specification directly from Intel website (PDF file) or from ACPI website. You'll find in that document how to access the PnP BIOS functions.

Note that since some systems may still have an onboard parallel port(s), you'll still need to also detect its presence using BIOS memory. If there are less than three onboard parallel ports, additional PCI based parallel ports should also be listed in that memory. However, it's recommended to assume that they aren't, since there might be a bug in the BIOS. So combine the detection result from both the memory and PnP BIOS, then remove any duplicate.

If you want to detect the actual parallel port to make sure it exists and working, check the VirtualBox's BIOS assembly source code (originally from Bochs' BIOS). Specifically, the detect_parport function.

EDIT: More details on current configuration of PCI devices.

The current configurations of PCI devices are stored in Extended System Configuration Data (ESCD). This is also referred as NVRAM by some BIOSes. The method for retrieving its data is described in PnP BIOS specs' function 0x41 and 0x42. However, the ESCD specs is separate from PnP BIOS specs. You can get it here (PDF file).

I couldn't find the link from Intel's website, sorry. They used to provide these old specs and also searchable from their website, but they're difficult to find now. I had mine still in RTF formats. That PDF ESCD specs seems to be the last version and same as mine, which is version 1.02A.

Jay
  • 4,627
  • 1
  • 21
  • 30
  • Thanks for the information and links. :) I went through all that and realized that the problem still persists. Well, I am reading the PCI BARS of a PCI parallel port controller, but the point is *which of these BARs contain the base address of that parallel port or is there a way to detect the base address in such a case?* After I get the base address, then I don't need to detect whether the parallel port actually exists or not. The BIOS *only* probes at standard addresses and thats' why it need to know the existence of a parallel port. Bios is not responsible for probing any ... – jacks Aug 24 '12 at 05:24
  • ... external pci card based parallel port. As far as *Plug and Play BIOS Specification* is concerned , it is only for ISA/EISA devices , as they *don't* have PnP capability by design, so require bios support to *emulate* PnP. The PCI devices, on the other hand, don't require such support from bios, as they *have* PnP capability by design. – jacks Aug 24 '12 at 05:26
  • I've add more details to the answer. – Jay Aug 24 '12 at 08:58
  • Thanks for that link. It is really difficult to find old docs now a days. I'll go through this doc and see if I can find some clue. – jacks Aug 24 '12 at 10:00
  • Thank your for the directions you showed. All the links you mentioned gave me very good info and broadened my thoughts; +1 for that. :) Now I know that there is no such standard, neither for pci parallel ports nor even for pci serial ports. Though based on practical experience many of them can be categorized /generalized. For that we need to either experiment with various cards or it would be better if the datasheet for the corresponding controller is publicly available. ESCD spec might not help, as it ... – jacks Aug 27 '12 at 08:50
  • ... is dependent on bios implementation and thus their approach for dealing with pci cards/controllers that are on expansion bus, may vary, and at least for PCI *expansion* cards, it would not be a good idea to rely on ESCD. Though if could find a clue or more elaboration I will post it. – jacks Aug 27 '12 at 08:51
0

afaik you cannot send data to the pci parallel port via base address if there is a built in parallel port configured in bios, one way to send to that pci parallel is by disabling the parallel port in the bios...

I already tested this scenario and it works fine in my side.

but if you want to use many ports, like the built in and the pci parallel ports, for built in port you can use the io base address, but for pci parallel port, you need to know the driver provided by the pci parallel port's manufacturer... if it is a system supplied driver, maybe there is a way to hook their driver via public ioctl or via accessing the driver as normal file..

I used generic port running on windows 7.

tongy
  • 31
  • 1
  • 11
  • Do you mean to say that if a built in parallel port is present already on a PC, and I installed a parallel port on a pci expansion card, then I will not be able to use pci parallel port by default. Which base address are you talking about? Base addresses for both parallel ports in this scenario will be different(assuming we know the base address of the pci parallel port too), so I didn't get what has bios to do with that? Are you talking about this scenario wrt windows? I do agree with you that to get base address(of pci one), we need to use a driver on windows or any other platform. – jacks Sep 07 '12 at 03:06
  • >> Do you mean to say that if a built in parallel port is present already on a PC, and I installed a parallel port on a pci expansion card, then I will not be able to use pci parallel port by default. - Yes, I mean, you cannot use directly the PCI parallel port unless via the dedicated driver for the PCI parallel port. – tongy Sep 21 '12 at 06:58
  • i am not expert on this thing, it is only base on experience. in my side, I want to use 4 parallel ports. then I have one built in + 2 pci with two ports in each pci device. in my side Windows 7 installed the driver automatically and assigned an address which we can see in device manager. but when I use that PCI parallel ports with built in enabled, I cannot successfully send data out. but when I disabled the built in parallel ports. I can already send a data out base on that OS given address via a generic port driver. I don't know really whats happening but that's what I do. – tongy Sep 21 '12 at 07:12
  • That is really strange. Did you installed manufacturer provided rivers or let win7 install its own ones? Afaik, this configuration should work, even if you enabled the built in parallel port from bios setup. Did you noticed the addresses assigned to pci parallel ports, from device manager. Were they standard addresses (ie < 0x400 )? – jacks Sep 21 '12 at 08:19
  • sorry for late response...I just let win7 install on its own. actually it is strange why i should need to disable it in bios, i think it is depends on machine. coz i am using ibm thinkpads....yes addresses are assigned in device manager... – tongy Nov 29 '12 at 01:59