I'm trying to find the base (memory) address of a parallel port I have connected to my laptop via a PCI express card. Running lspci -v shows that my computer recognizes the parallel port and gives the I/O ports (1000 and 1008) but not the memory address (other entries have both ports and memory locationsā¦this card is the only entry without a memory address). Also, when I look in /proc/ioports I get the same ports given in lspci. However, when I try to use either of those addresses in the program I'm running (EMC2 to control stepper motors), it does not find a parallel port at that address.
What would be really great is if there were an analogue to the Windows Device Manager -> Ports -> Resources. Is there any way to do this in Ubuntu? Is there a standard memory location for PCIe devices?
Edit:
The output from lspci -v
04:00.0 Parallel controller: Oxford Semiconductor Ltd Device c110 (prog-if 02)
Subsystem: Oxford Semiconductor Ltd Device c110
Flags: bus master, fast devsel, latency 0, IRQ 18
I/O ports at 1000 [size=8]
I/O ports at 1008 [size=4]
Capabilities: [40] Power Management version 3
Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
Capabilities: [70] Express Legacy Endpoint, MSI 00
Capabilities: [100] Device Serial Number 10-01-00-11-11-e0-30-00
Capabilities: [110] Power Budgeting <?>
Kernel driver in use: parport_pc
Kernel modules: parport_pc
And for reference, another entry that shows the memory location:
0c:03.0 FireWire (IEEE 1394): Agere Systems FW322/323 (rev 61) (prog-if 10)
Subsystem: Agere Systems FW322/323
Flags: bus master, fast Back2Back, medium devsel, latency 248, IRQ 19
Memory at 8c000000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [44] Power Management version 2
Kernel driver in use: ohci1394
Kernel modules: firewire-ohci, ohci1394
Try cat /proc/ioports | grep parport to filter the output of ioports.
Quick answer: there is no memory location for the parallel port. Parallel ports only ever have IO ports allocated to them. This is the way parallel port interfaces have worked for decades, and nobody has felt the need to make an incompatible memory mapped interface that would need special drivers.
Now I must ask, why are you intent on finding the port's memory location? What do you want to do with it?
Related
I've recently been learning to write an x86 operating system, but I've run into a few problems.
Is the PCI bus an IO device that is connected to the south bridge chip?
I know I can read and write to the hard disk by in/out instructions to 0x1f0~0x1f7 registers, is the hard disk connected to the Southbridge chip?
Nowadays, many IO devices seem to be PCI devices, which are inserted into slots on the PCI bus, and through the PCI configuration space, the CPU can access the PCI devices through the MMIO or IO port, right?
Nowadays, graphics cards seem to be PCI interface, inserted into the PCI card slot, before the emergence of the PCI bus graphics card is connected to the South Bridge chip?
thanks!!!š
I have intel system. running linux. On my system when I run sudo lspci -v command it gives me something like this for wireless network card
In the image it says for wireless network card something like this Memory at c0700000 (64-bit, non-prefetchable) [size=8K]
I want to know is this the memory location for Memory-Mapped-IO for pci wireless network card?
and the lines afterwards says something like Capabilities: [c8] Power Management version 3
and Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit. Can any one please tell is c8 and d0 respectively are the offset address values from base value of c0700000 (from above) for setting these capabilities to wireless network card. I have pci based wireless in my laptop.
I am having trouble getting bus-mastering DMA working on a device driver in Ubuntu with kernel 5.3.0-68-generic.
I have enabled bus mastering with pci_set_master (when using lspci -v, the PCIe device will have the bus_master flag) and I am allocating a DMA buffer with dma_alloc_coherent.
I take the dma_addr_t returned by the dma alloc and pass that to the device and then I use the kernel virtual address with a chrdev mmap driver to map the address into userspace (using remap_pfn_range) where a userspace driver can populate the DMA memory region.
It doesn't appear that the the PCIe device can see the memory updates in the DMA region, is there perhaps some dma, iommu, or pci settings I need to enable to allow the PCIe device to read back into system memory as the bus master?
Objective
I'm trying to programmatically find out on which physical slot a particular PCIe device is connected. The premise is that I have the PCI-ID of a card that is surely occupying a slot, and the solution would be finding out which one.
Note that I'm only interested in working on the PCI Express bus, although the device identification/enumeration process I think is the same as the old PCI.
Attempt
The SMBIOS contains information about the motherboard slots available. It is possible to examine this information from the linux command line:
$ sudo dmidecode -t slot
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x003A, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_1
Type: x16 PCI Express x16
Current Usage: In Use
Length: Short
ID: 1
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:03:02.0
Handle 0x003B, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_2
Type: x8 PCI Express x8
Current Usage: In Use
Length: Short
ID: 2
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:04:02.2
Handle 0x003C, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_3
Type: x16 PCI Express x16
Current Usage: In Use
Length: Short
ID: 3
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:05:03.0
However, I can't find any device in the PCI bus (lspci) that has a PCI ID of 0000:03:02.0, 0000:04:02.2 or 0000:05:03.0. What I know by manual inspection is the following:
Card 0000:03:00.0 is in the first slot. The PCI bridge appears to be 0000:00:02.0
Card 0000:04:00.0 is in the second slot. The PCI bridge appears to be 0000:00:02.2
Card 0000:05:00.0 is in the third slot. The PCI bridge appears to be 0000:00:03.0
So a pattern emerges here. From the SMBIOS structure, the bus number is the one given to the card that is plugged in but the device/function numbers are the same as the corresponding PCI bridge.
Is this pattern just a coincidence in my motherboard or there is a rationale behind? It is an Asus motherboard, with an AMI BIOS. I've read that some BIOSes do not provide accurate information about their slots so I would like to know how much generality I can achieve.
Any hint or pointer to reference documentation is also greatly appreciated.
You may find the lspci command helpful. Here's a sample output:
# lspci -v -t
-[0000:00]-+-00.0 Intel Corporation 5500 I/O Hub to ESI Port
+-01.0-[01]--+-00.0 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
| \-00.1 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
+-03.0-[02]--+-00.0 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
| \-00.1 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
+-07.0-[04]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-09.0-[05]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-14.0 Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers
+-14.1 Intel Corporation 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers
+-14.2 Intel Corporation 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers
+-1a.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4
+-1a.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5
+-1a.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2
+-1c.0-[03]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-1d.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1
+-1d.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2
+-1d.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1
+-1e.0-[06]----03.0 Matrox Electronics Systems Ltd. MGA G200eW WPCM450
+-1f.0 Intel Corporation 82801IB (ICH9) LPC Interface Controller
\-1f.2 Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode]
Is there a simple way to detect nic and associated ports on systems loaded with linux.
From my study on this, i found lshw -C network would help me to some extent, by giving details on ports and interfaces.
But i didn't get clear differentiation done with nic and associated ports.
Say if i have 2 nic cards with one 4 ports and other nic with 2 ports, how to i detect this information using lshw or any way!!.
lshw -C network ( only portion of the information pasted here)
Using lshw -C network, we can use the serial number for example:
*-network:0
description: Ethernet interface
product: 82575EB Gigabit Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci#0000:01:00.0
logical name: eth0
version: 02
serial: 00:14:4f:e7:40:e0
*-network:1
description: Ethernet interface
product: 82575EB Gigabit Network Connection
vendor: Intel Corporation
physical id: 0.1
bus info: pci#0000:01:00.1
logical name: eth1
version: 02
serial: 00:14:4f:e7:40:e1
*-network:0 DISABLED
description: Ethernet interface
product: 82571EB Gigabit Ethernet Controller (Copper)
vendor: Intel Corporation
physical id: 0
bus info: pci#0000:2b:00.0
logical name: eth6
version: 06
serial: 00:15:17:be:e6:75
*-network:1 DISABLED
description: Ethernet interface
product: 82571EB Gigabit Ethernet Controller (Copper)
vendor: Intel Corporation
physical id: 0.1
bus info: pci#0000:2b:00.1
logical name: eth4
version: 06
serial: 00:15:17:be:e6:74
serial number kind of helps, the first five tuples help me to distinguish the nics and the last tuple in the serial number seems to be in sequence when in comes to different ports on given nic.
-Thanks
Harish
I'm not entirely sure what information you want to know. I'm guessing you want to know which ethernet interfaces are on the same board. One quick way to detect is via the sysfs directory which contains information about devices and drivers. This information can also be correlated to lspci.
Example:
find /sys/devices/ -type d | grep eth
Which outputs data on my system in the format of:
/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0
Where pci0000:00 is the bus, and the last number is the card (0000:02:00.0).
Then if I run lspci I can look up the card identifier to get more information
lspci | grep 02:00
Nets me:
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)
On your system, you should have multiple eth* mapped to each card. This should tell you the mapping of which eth to which card and more information about each specific card.