开发者

How to determine the port numbers for peripheral devices?

I know that peripheral devices such as a hard driver, a floppy driver, etc are controlled by reading/writing certain control registers on their device controllers.

I am wondering about the following questions:

  • Is it true that when these peripheral devices are plugged onto the computer, the addresses(port numbers) of their control registers are thus determ开发者_JS百科ined by how they are attached to the address bus (i.e. the hard-wiring rules, not any soft things)?
  • Who makes the scheme of the port number assignment?
  • If I was given a naked computer(with no operating system and with many peripheral devices), how could I figure out the port number assignment so I can use them to control peripheral deveices.

At last and as usual, thanks for your patience and reply. 8^)


For a "naked computer" that is a relatively new PC compatible machine, you can find some answers in Conventional PCI description:

In a typical system, the firmware (or operating system) queries all PCI buses at startup time (via PCI Configuration Space) to find out what devices are present and what system resources (memory space, I/O space, interrupt lines, etc.) each needs. It then allocates the resources and tells each device what its allocation is.

The PCI configuration space also contains a small amount of device type information, which helps an operating system choose device drivers for it, or at least to have a dialogue with a user about the system configuration.

...

Finally, PCI configuration space provides access to 256 bytes of special configuration registers per PCI device. Each PCI slot gets its own configuration space address range. The registers are used to configure devices memory and I/O addresses ranges they should respond to from transaction initiators. When a computer is first turned on, all PCI devices respond only to their configuration space accesses. The computers BIOS scans for devices and assigns Memory and I/O address ranges to them.

Once you establish the I/O address(es) for a device, actual command codes are highly device-specific. Hopefully, some manufacturers provide relevant documentation online.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜