Home
Explore
Submit Search
Upload
Login
Signup
Advertisement
PCI Drivers
Report
Anil Kumar Pugalia
Follow
Linux Geek and Open Source Hardware & Software Freak, Corporate Trainer, Entrepreneur in Automation
Jun. 21, 2010
•
0 likes
21 likes
×
Be the first to like this
Show More
•
43,876 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Check these out next
Linux Kernel Booting Process (1) - For NLKB
shimosawa
Audio Drivers
Anil Kumar Pugalia
SPI Drivers
SysPlay eLearning Academy for You
linux device driver
Rahul Batra
Spi drivers
pradeep_tewani
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
Introduction to Linux Drivers
Anil Kumar Pugalia
Jagan Teki - U-boot from scratch
linuxlab_conf
1
of
16
Top clipped slide
PCI Drivers
Jun. 21, 2010
•
0 likes
21 likes
×
Be the first to like this
Show More
•
43,876 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Report
Technology
Business
Anil Kumar Pugalia
Follow
Linux Geek and Open Source Hardware & Software Freak, Corporate Trainer, Entrepreneur in Automation
Advertisement
Advertisement
Advertisement
Recommended
Pcie drivers basics
Venkatesh Malla
798 views
•
34 slides
USB Drivers
Anil Kumar Pugalia
42.4K views
•
31 slides
I2C Drivers
SysPlay eLearning Academy for You
28.4K views
•
28 slides
I2C Subsystem In Linux-2.6.24
Varun Mahajan
12.4K views
•
15 slides
Linux device drivers
Emertxe Information Technologies Pvt Ltd
40.4K views
•
114 slides
Arm device tree and linux device drivers
Houcheng Lin
17.4K views
•
19 slides
More Related Content
Slideshows for you
(20)
Linux Kernel Booting Process (1) - For NLKB
shimosawa
•
12.4K views
Audio Drivers
Anil Kumar Pugalia
•
20.4K views
SPI Drivers
SysPlay eLearning Academy for You
•
13.1K views
linux device driver
Rahul Batra
•
11.4K views
Spi drivers
pradeep_tewani
•
310 views
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
•
2.7K views
Introduction to Linux Drivers
Anil Kumar Pugalia
•
64.1K views
Jagan Teki - U-boot from scratch
linuxlab_conf
•
634 views
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Adrian Huang
•
716 views
用Raspberry Pi 學Linux I2C Driver
艾鍗科技
•
42.6K views
Linux Device Tree
艾鍗科技
•
4.3K views
Bootloaders (U-Boot)
Omkar Rane
•
507 views
Network Drivers
Anil Kumar Pugalia
•
38.6K views
Pcie basic
Saifuddin Kaijar
•
10.5K views
Embedded_Linux_Booting
Rashila Rr
•
486 views
Linux I2C
KaidenYu
•
701 views
Linux Ethernet device driver
艾鍗科技
•
2.6K views
Character Drivers
Anil Kumar Pugalia
•
56.3K views
Introduction to Modern U-Boot
GlobalLogic Ukraine
•
1.8K views
Bootloaders
Anil Kumar Pugalia
•
9.7K views
Similar to PCI Drivers
(20)
Low-level Accesses
Anil Kumar Pugalia
•
24.9K views
SPI Drivers
SysPlay eLearning Academy for You
•
9.8K views
BeagleBone Black Bootloaders
SysPlay eLearning Academy for You
•
3.9K views
BeagleBone Black Bootloaders
SysPlay eLearning Academy for You
•
4.4K views
Slideshare - PCIe
Jin Wu
•
12.1K views
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN
•
104 views
Linux PCI device driver
艾鍗科技
•
2.3K views
PCI_Express_Basics_Background.pdf
zahixdd
•
4 views
101 1.1 hardware settings
Acácio Oliveira
•
1.2K views
Kernel Debugging & Profiling
Anil Kumar Pugalia
•
18.8K views
haifux-pcie.pdf
ssuser0ceb13
•
2 views
Linux Network Management
Anil Kumar Pugalia
•
11.1K views
Revisit DCA, PCIe TPH and DDIO
Hisaki Ohara
•
8.5K views
Embedded I/O Management
Anil Kumar Pugalia
•
5.1K views
Linux Porting
Anil Kumar Pugalia
•
17.3K views
Kernel Debugging & Profiling
Anil Kumar Pugalia
•
5.8K views
101 1.1 hardware settings v2
Acácio Oliveira
•
380 views
Track c-High speed transaction-based hw-sw coverification -eve
chiportal
•
1.2K views
Slimline Open Firmware
Heiko Joerg Schick
•
2.1K views
Block Drivers
Anil Kumar Pugalia
•
37.9K views
Advertisement
More from Anil Kumar Pugalia
(20)
File System Modules
Anil Kumar Pugalia
•
20.4K views
Processes
Anil Kumar Pugalia
•
6.8K views
System Calls
Anil Kumar Pugalia
•
4K views
Introduction to Linux
Anil Kumar Pugalia
•
3.8K views
Embedded C
Anil Kumar Pugalia
•
25.6K views
Embedded Software Design
Anil Kumar Pugalia
•
6.9K views
Playing with R L C Circuits
Anil Kumar Pugalia
•
2.8K views
Video Drivers
Anil Kumar Pugalia
•
23K views
Mobile Hacking using Linux Drivers
Anil Kumar Pugalia
•
5.9K views
Shell Scripting
Anil Kumar Pugalia
•
6.1K views
References
Anil Kumar Pugalia
•
21.7K views
Functional Programming with LISP
Anil Kumar Pugalia
•
6.1K views
Power of vi
Anil Kumar Pugalia
•
2.9K views
gcc and friends
Anil Kumar Pugalia
•
14.2K views
"make" system
Anil Kumar Pugalia
•
4.1K views
Hardware Design for Software Hackers
Anil Kumar Pugalia
•
1.7K views
RPM Building
Anil Kumar Pugalia
•
4K views
Linux User Space Debugging & Profiling
Anil Kumar Pugalia
•
6.4K views
System Calls
Anil Kumar Pugalia
•
9.7K views
Timers
Anil Kumar Pugalia
•
6.3K views
Recently uploaded
(20)
GAAD_EVENT_V3.pptx
SumanDamera1
•
0 views
在哪里可以办英国大学文凭《英博夏尔大学毕业证成绩单仿制》
nukotk
•
0 views
Business, Strategy, Funding _ Matchmaking .pptx
FIWARE
•
0 views
Wilab-NWDAF-datasheet.pdf
FabianToh2
•
0 views
Multicore Stranded Conductor and Sheathed 450-750 V Fire Resistant Cables by ...
Karupaswamy1
•
0 views
Biking on the edge - Jerome Mies - SRD23
SURF Events
•
0 views
IntroCommandLine.ppt
GowthamRaju15
•
0 views
在哪里可以办新西兰大学文凭《奥克兰理工大学毕业证成绩单仿制》
nukotk
•
0 views
在哪里可以办意大利大学文凭《博洛尼亚大学毕业证成绩单仿制》
nukotk
•
0 views
The Industrialist: Trends & Innovations - May 2023
accenture
•
0 views
Unleash Business Potential 10 Reasons to Embrace DID Numbers.pptx
BridgeVoice
•
0 views
EU opportunities inputs for FIWARE summit.pptx
FIWARE
•
0 views
Stay Ahead of the Competition: The Advantages of Hiring a Digital Marketing E...
AlisonTaylor86
•
0 views
在哪里可以办加拿大大学文凭《温哥华社区学院毕业证成绩单仿制》
nukotk
•
0 views
Spacemesh, Tomer Afek, ICC conf, May 2023.pptx
Tomer Afek
•
0 views
gravimeter.pptx
AlMamun560346
•
0 views
Cybersecurity jobs abnd job architecture
SFIA User Forum
•
0 views
Nest.js Introduction
Takuya Tejima
•
0 views
PB-503R Wireless alarm keypad
Vedard Security Alarm System Store
•
0 views
Plugg Session.pptx
FIWARE
•
0 views
Advertisement
PCI Drivers
© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Peripheral Component Interconnect (PCI) Drivers
2© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? PCI Subsystem Coding Details of a PCI Device Driver Browsing Sample Code
3© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. PCI Prologue Developed by Intel as a replacement for ISA More of a processor (specific) bus for x86 architectures Replacing Features Plug n Play Platform independent Fast Hardware Addressing Through South Bridge (PCI Controller) Buses (upto 256) → Devices (upto 32) → Functions (upto 8)
4© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Kernel Aspect Organized as PCI Core (driver of the PCI Controller) PCI Drivers (device drivers) Kernel Windows for PCI /proc/bus/pci/devices (Try cat) /sys/bus/pci/devices (Try tree) Command: lspci
5© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Dynamic Device Configuration What Configuration? Device Base Address(es) Register Space(s) Memory(s) Interrupt Vectors ... Done during Bootup by BIOS, Or PCI Core (Bootloader or Kernel) Configured by the time, driver comes up But, where is this configuration stored?
6© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. PCI Device Configuration Space Vendor ID BIST Header Type Lat Timer Cache Line Class Code Rev ID Status Register Command Register Device ID 0x0 0xF Base Address 0 CardBus CIS pointerBase Address 5Base Address 4 Base Address 3Base Address 2Base Address 1 Subsystem Vendor ID Subsystem Device ID Expansion ROM Base Address IRQ Line IRQ Pin Min Gnt Max Lat 0x00 0x30 0x20 0x10 Reserved
7© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. PCI Device Config Space Access Header: <linux/pci.h> APIs int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val); int pci_read_config_word(struct pci_dev *dev, int where, u16 *val); int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val); int pci_write_config_byte(struct pci_dev *dev, int where, u8 *val); int pci_write_config_word(struct pci_dev *dev, int where, u16 *val); int pci_write_config_dword(struct pci_dev *dev, int where, u32 *val); NB struct pci_dev *dev would be available as parameter to probe()
8© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Standard PCI Device Access API Upto 6 Memory or I/O regions Header: <linux/pci.h> APIs unsigned long pci_resource_start(dev, bar); unsigned long pci_resource_len(dev, bar); unsigned long pci_resource_flags(dev, bar); Flags IORESOURCE_IO IORESOURCE_MEM IORESOURCE_PREFETCH
9© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. PCI Driver Registration int pci_register_driver(struct pci_driver *drv); int pci_unregister_driver(struct pci_driver *drv); struct pci_driver const char *name const struct pci_dev_id *id_table; PCI_DEVICE(vendor, device); PCI_DEVICE_CLASS(dev_class, dev_class_mask); int (*probe)(pci_dev, id_table); void (*remove)(pci_dev); Header: <linux/pci.h>
10© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Typical 'probe' Function int probe(struct pci_dev *dev, struct pci_dev_id *id) { /* Enable the PCI Device */ pci_enable_device(dev); ... /* Acquire PCI Device's regions */ pci_request_regions(dev, “label”); ... /* Possibly map I/Os */ ... pci_set_drvdata(dev, <pvt_data_ptr>); // Optional ... /* Register the vertical */ ... return 0; /* Claimed. Negative for not Claimed */ }
11© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Typical 'remove' Function void remove(struct pci_dev *dev) { /* Unregister the vertical */ ... pci_set_drvdata(dev, NULL); // Optional ... /* Possibly unmap I/Os */ ... /* Release PCI Device's regions */ pci_release_regions(dev); ... /* Disable the PCI Device */ pci_disable_device(dev); }
12© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Old-style PCI Probing & Getting struct pci_dev *pci_find_*(vendor, device, from); struct pci_dev *pci_get_device(v, d, from); struct pci_dev *pci_get_subsys(v, d, ssv, ssd, f); struct pci_dev *pci_get_slot(bus, devfn); pci_dev_put(pci_dev);
© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. DMA Mapping APIs dma_addr_t pci_map_single(struct pci_dev *, void *, size_t, int dir); void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int dir); Directions PCI_DMA_BIDIRECTIONAL PCI_DMA_TODEVICE PCI_DMA_FROMDEVICE Header: <linux/pci.h> To Device PM VM PA VA From Device
© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. DMA Allocation PM VM APIs void *pci_alloc_consistent(struct pci_dev *, size_t, dma_addr_t *); void pci_free_consistent(struct pci_dev *, size_t, void *, dma_addr_t); int pci_set_dma_mask(struct pci_dev *, u64 mask); Header: <linux/pci.h> PA VA
15© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. What all have we learnt? PCI Subsystem Coding Details of a PCI Device Driver Browsing Sample Code DMA with PCI
16© 2010-17 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?
Advertisement