public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vernon Mauery <vernux@us.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Keith Mannthey <kmannth@us.ibm.com>
Subject: Re: [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v4
Date: Fri, 24 Sep 2010 13:45:20 -0700	[thread overview]
Message-ID: <20100924204520.GD10777@lucy> (raw)
In-Reply-To: <20100924182327.GC10777@lucy>

On 24-Sep-2010 11:23 AM, Vernon Mauery wrote:
>On 24-Sep-2010 07:40 PM, Arnd Bergmann wrote:
>>On Friday 24 September 2010 19:09:43 Vernon Mauery wrote:
>>>I looked into this and tested it on some hardware, but it doesn't work.
>>>After more digging and poking, it looks like the reason is that the port
>>>IO address is not within the x86 standard port IO range.
>>>
>>>I tried something like this:
>>>
>>>                        addr = ioread32(&rtl_table->cmd_port_address);
>>>                        plen = rtl_cmd_width/8;
>>>                        if (rtl_cmd_type == RTL_ADDR_TYPE_MMIO)
>>>                                rtl_cmd_addr = ioremap(addr, plen);
>>>                        else
>>>                                rtl_cmd_addr = ioport_map(addr, plen);
>>>                        RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
>>>
>>>It printed out that rtl_cmd_addr was 0, meaning the ioport_map failed.
>>>After more digging, it turns out that on at least one of the machines
>>>this code is targeted for, the port IO address (from the first line
>>>above) is 0x40000.  Even if this did get mapped, the IO_COND macro would
>>>target it for MMIO access instead of PIO access.  So I don't think I can
>>>use this method (even though it did make my code a lot nicer to read).
>>>
>>>Any suggestions?
>>
>>That seems really strange. I thought the inb/outb instructions could not
>>actually operate on addresses above 0x10000 at all, since they take a 16
>>bit address operand (DX register). Passing 0x40000 into inb should have the
>>same effect as zero AFAICT, which means that your existing code should not
>>work either.
>
>No, inb/outb have address as as unsigned long, which would explain 
>why 0x40000 works with PIO.  When doing inb/outb via the 
>ioread/iowrite macros, the port value is the address (minus the 
>offset) masked off to PIO_MASK, which is 16 bits on x86.
>
>So it looks like this really not going to work and I will have to go 
>back to how it was before.  Would it be tacky to write my own little 
>macro?

Okay.  I finally have it.  In one of my changes, I inadvertently changed 
the shape of the struct ibm_rtl_table, which is where I read the ioport 
address from.  This explains why the weird port.  Once I fixed my table 
so it was correct again, the port is 0x600, which is completely 
reasonable and will work just fine with the iowrite functions.  Thanks 
for bringing this up -- it greatly simplifies things.

--Vernon

      parent reply	other threads:[~2010-09-24 20:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 22:46 [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v3 Vernon Mauery
2010-09-23 21:38 ` Randy Dunlap
2010-09-23 22:12   ` Vernon Mauery
2010-09-23 22:53     ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v4 Vernon Mauery
2010-09-24 13:12       ` Arnd Bergmann
2010-09-24 14:14         ` Vernon Mauery
2010-09-24 14:24           ` Arnd Bergmann
2010-09-24 16:56           ` Randy Dunlap
2010-09-24 21:06             ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v5 Vernon Mauery
2010-09-24 21:20               ` Randy Dunlap
2010-09-24 21:30                 ` Vernon Mauery
2010-09-24 21:35                   ` Randy Dunlap
2010-09-24 21:58                     ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v6 Vernon Mauery
2010-09-25  2:07                   ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v5 Henrique de Moraes Holschuh
2010-09-25 14:42                     ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v6 Vernon Mauery
2010-09-24 17:09           ` [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v4 Vernon Mauery
2010-09-24 17:40             ` Arnd Bergmann
2010-09-24 18:23               ` Vernon Mauery
2010-09-24 20:40                 ` Arnd Bergmann
2010-09-24 20:45                 ` Vernon Mauery [this message]

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=20100924204520.GD10777@lucy \
    --to=vernux@us.ibm.com \
    --cc=arnd@arndb.de \
    --cc=kmannth@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /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