public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Donald White <dbwhite@asu.edu>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Please explain this code in drivers/pci.c
Date: Sun, 18 May 2003 16:39:38 -0700	[thread overview]
Message-ID: <3EC819BA.2030500@asu.edu> (raw)

Group,

Please help me to understand the following code.  It occurs in drivers/pci.c in the 
function pci_hose_config_device().  I have ported U-Boot 0.3.0 and HHL 2.0 to our 
custom MPC8265A board.  It has one device on the PCI bus.  The driver develop was 
wanting a specific memory space allocation for the device.  So I created a PCI 
configuration table with the memory base of 0x90000000.  The card wants 4 regions 0f 
0x8000 bytes in size.  The driver writer thinks this should be 0x90000000, 
0x90008000, 0x90010000 and 0x90018000.  This brings us to the code snippet:

	bar_size = ~(bar_response & PCI_BASE_ADDRESS_MEM_MASK) + 1;
	bar_value = mem;

	mem = ((mem - 1) | (bar_size - 1)) + 1;

The value of bar_response is 0xffff8008 which looks good.  This gives bar size of 
0x8000 which also looks good.  The value of mem is initially 0x90000000.  So,
(mem -  1) = 0x8fffffff and (bar_size - 1) = 0x7fff).  When these are or'd one gets 
0x8fffffff and adding 1 gives 0x90000000.  This result is that the card is given 4 
address bases all at 0x90000000.

Thanks for any help,

Don

             reply	other threads:[~2003-05-18 23:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-18 23:39 Donald White [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-19 15:19 [U-Boot-Users] Please explain this code in drivers/pci.c Rune Torgersen
2003-05-20  0:47 ` Donald White
     [not found]   ` <3EC9CCC5.4060006@bigfoot.com>
2003-05-21  3:14     ` Donald White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EC819BA.2030500@asu.edu \
    --to=dbwhite@asu.edu \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox