NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

INCREASE PCI BAR WINDOW SIZE

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

This document describes how to increase the BAR window size of a TI PCI DSP.

Overview[edit]

Default BAR window size for TI DSP is 8MB for DSP DDR memory, however this can be increase to expose 32MB.

Details[edit]

PCI Devices exposes its internal memory to the HOST via BAR windows. These memory window is used to read and write card's internal memory. But PCI card puts a limitation on the size of these windows using some default values. However, these window sizes are configurable to expose a wider range of memory through one BAR. But it requires a E2PROM with new size value programmed, so that whenever PCI card's is enumerated it gets wider memory range.
As you see the above method requires a E2PROM and also does not change the window size dynamically. The following text describes how to do it dynamically.

 1 	 struct pci_device * dev = null ;
 2   struct pci_bus * dev_bus       ;
 3   Int32            dev_fn        ;
 4   Int32            irq           ;
 5	
 6  if ((dev = pci_get_device (PCI_TI_VENDOR, PCI_TI_DEVICE, dev)) != NULL) {
 7  	PCI_device = dev ;
 8  }
 9
10  dev_bus = PCI_device->bus ;
11  dev_fn  = PCI_device->devfn ;
12  irq     = PCI_device->irq ;
13  
14  /* Patching the BAR0 size and initial address, as follows:
15   * 1. Change the TRL for BAR0 and MASK register for BAR0.
16   * 2. Remove the Device for Linux.
17   * 3. Rescan the device and attach it Linux list of devices.
18   * note: BAR2 points to CFG register.
19   */
20  /* MAP CFG area */
21  bar2Start = pci_resource_start (PCI_device, 2u) ;
22  bar2Len   = pci_resource_len   (PCI_device, 2u) ;
23  request_mem_region (bar2Start, bar2Len, "PCIDRV") ;
24  regVirtPtr = ioremap (bar2Start, bar2Len) ;
25
26  if (regVirtPtr != NULL) {
27      /* 32M for BAR0, MASK register is at 110u offset */
28      *((Uint32 *) ((Uint32)regVirtPtr + 0x1A110u)) = 0xFE000008u ;
29      /* Initial start address is 0x80000000,
30       * TRL register is at 1C0u offset
31       */
32      *((Uint32 *) ((Uint32)regVirtPtr + 0x1A1C0u)) = 0x80000000u ;
33  }
34
35  /* Unmap CFG area */
36  if (regVirtPtr != NULL) {
37      iounmap (regVirtPtr) ;
38      release_mem_region (bar2Start, bar2Len);
39  }
40
51  /* Release the dev structure */
52  pci_dev_put (PCI_device) ;
53
54  /* Release the device */
55  for (i = 0 ; i < 8 ; i++) {
56      struct pci_dev * dev = pci_get_slot (dev_bus, dev_fn + i) ;
57      if (dev) {
58          pci_remove_bus_device (dev) ;
59          pci_dev_put (dev) ;
60      }
71  }
72
73  /* Rescan the device */
74  pci_scan_slot (dev_bus, dev_fn) ;
75  pci_bus_assign_resources (dev_bus) ;
76  /* Fix the IRQ */
77  dev = pci_get_slot (dev_bus, dev_fn) ;
78  pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq) ;
79  pci_dev_put(dev) ;
80  pci_bus_add_devices (dev_bus) ;
81  
82  /* Find the device again */

Line 6 : gets the device structure.
Line 10-12: read the required information from the device structure.
Line 20-24: maps the CFG register area (on DM6437 it is BAR2)
Line 27-32: programs the translation register for BAR0 to increase the window size to 32MB.
Line 37-39: unmaps the BAR2
Line 58-59: releases the device from kernel.
Line 74-75: rescans the bus containing the device.
Line 77-78: programs the irq line/number back to original value i.e. value got without rescanning.
Line 79-80: adds the device found to kernel data structures.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article INCREASE PCI BAR WINDOW SIZE here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article INCREASE PCI BAR WINDOW SIZE here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article INCREASE PCI BAR WINDOW SIZE here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity