All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@keyaccess.nl>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Rene Herman <rene.herman@gmail.com>, Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Adam Belay <ambx1@neo.rr.com>, Li Shaohua <shaohua.li@intel.com>,
	Matthieu Castet <castet.matthieu@free.fr>,
	Thomas Renninger <trenn@suse.de>,
	Jaroslav Kysela <perex@perex.cz>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 00/37] PNP resource_table cleanups, v2
Date: Thu, 03 Apr 2008 17:54:51 +0200	[thread overview]
Message-ID: <47F4FDCB.2000803@keyaccess.nl> (raw)
In-Reply-To: <200804021535.22011.bjorn.helgaas@hp.com>

On 02-04-08 23:35, Bjorn Helgaas wrote:

>>    By the way, the original isapnp_parse_id explicitly encodes the top _6_
>>    bits in str[0] (& 0x3f) which seems odd. Bit 31 had better be 0 indeed,
>>    but I wonder why the original didn't just assume such.
> 
> Yes, I wonder about that, too.  Including that bit would mean that
> the first character of PNP IDs could include characters at offsets
> 0x20-0x3f, i.e., "`a..z{|}~" and DEL.  I poked around and found
> some IDs that seem to depend on that, e.g., "nEC8241" in the 8250_pnp
> serial driver.

Oh well, PC hardware...

> I changed this to include six bits for the first character, and
> masked off the top bit in PNPBIOS.  I think that should preserve
> the previous behavior; see what you think.

Yes, it should. I checked the ISAPnP specification and it explicitly fixes 
bit 31 at 0 (and defines the "compressed ASCII" as 5 bits). Given what you 
describe you probably don't have a good place to stash a comment but with 6 
bits being non-spec something like "appease broken ISAPnP hardware" would 
probably be good.

>>    2: There are 4 tests for ACPI_READ_WRITE_MEMORY here which are turned
>>       into IORESOURCE_MEM_WRITEABLE or 0. Not sure, but should they be
>>       turned into IORESOURCE_MEM_WRITEABLE or IORESOURCE_READONLY?
> 
> One would expect that "mem.write_protect == 1" would mean read-only.
> Unfortunately, I'm too lazy to un-obfuscate the ACPI CA logic that
> deals with mem.write_protect, since it seems to be all table-driven.
> In the absence of understanding, I tried to preserve the existing
> behavior.  I think I did, i.e., if "write_protect == ACPI_READ_WRITE_MEMORY",
> we add in IORESOURCE_MEM_WRITEABLE, otherwise do nothing.  If I
> goofed that up, let me know.

No, you didn't, is fine.

> I have an ISA question here, too: previously isapnp_read_resources()
> set only res.start for IO and MMIO resources and left res.end unset
> (should be zero, I think).  I don't think ISA tells you the size, so
> I assumed "1", but I don't know if that's the right thing to do.  My
> reasoning was "zero is obviously wrong, two could be too big and
> generate bogus conflicts, so one is the only possible choice."

Yes, as far as I'm aware the actual value is of no consequence. The size is 
not a setable parameter; to hardware they're only base address registers, It 
used to be kept simply at -1 (in an unsigned sort of way) and as far as I'm 
aware, we're also not interested yet at this level.

However, now that you made me look closer and in context -- there's actually 
a possibly somewhat serious problem here.

isapnp_read_resources() stores the resources as read from the hardware at 
the index in the table that matches the actual index in the hardware and 
isapnp_set_resources() stores them back into those same hardware indices.

Now by using pnp_add_foo_resource() which just scans for the first _UNSET 
resource, the resources might not end up in the same linear position in 
table/list if intermediate resources were unset in hardware (!ret). A 
subsequent isapnp_set_resources() would them restore the value to the wrong 
hardware index.

The IORESOURCE_ flags currently reserve too few bits (IORESOURCE_BITS,  8) 
to be able to store the hardware index: IORESOURCE_MEM and IORESOURCE_DMA 
need 2 and 1 respectively and there are 1 and 0 available respectively. It's 
ofcourse possible to hijack a few more bits in IORESOURCE_ flags but you're 
turning this into a list. I suppose the idea is to make it a simple list of 
struct resource, but perhaps a resource-private "driver_data" sort of field 
comes in handy for more than this already? Swiping more of IORESOURCE_ is a 
bit ugly...

In any case, I missed this, but ISAPnP is still (at least in principle) 
broken with the current set therefore.

> I also made the _len() functions inlines and restructured the logic in
> both _len() and _valid() functions.  I couldn't stand the thought of all
> those extra list traversals in there :-)  I'd appreciate a double-check
> of that.

Will do.

Rene.

  reply	other threads:[~2008-04-03 15:53 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 15:16 [patch 00/37] PNP resource_table cleanups, v2 Bjorn Helgaas
2008-04-01 15:16 ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 01/37] ISAPNP: move config register addresses out of isapnp.h Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 02/37] PNPACPI: continue after _CRS and _PRS errors Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 03/37] PNP: make pnp_add_id() internal to PNP core Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 04/37] PNP: change pnp_add_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 05/37] PNP: add pnp_eisa_id_to_string() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 06/37] PNP: add pnp_alloc_dev() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 07/37] PNP: make pnp_add_card_id() internal to PNP core Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 08/37] PNP: change pnp_add_card_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 09/37] ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 10/37] PNP: add pnp_alloc_card() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 11/37] PNPACPI: pnpacpi_encode_ext_irq() wrongly set "irq" instead of "extended_irq" Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 12/37] PNPACPI: use temporaries to reduce repetition Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 13/37] PNPACPI: hoist dma_flags() out of pnpacpi_parse_allocated_dmaresource() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 14/37] PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 15/37] PNPACPI: pass pnp_dev instead of acpi_handle Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 16/37] PNP: remove pnp_resource_table from internal get/set interfaces Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 17/37] PNP: remove more pnp_resource_table arguments Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 18/37] PNP: add pnp_init_resources(struct pnp_dev *) interface Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 19/37] PNP: remove pnp_resource_table from internal pnp_clean_resource_table interface Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 20/37] PNP: make generic pnp_add_irq_resource() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 21/37] PNP: make generic pnp_add_dma_resource() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 22/37] PNP: make generic pnp_add_io_resource() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 23/37] PNP: make generic pnp_add_mem_resource() Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 24/37] PNP: use dev_printk when possible Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:16 ` [patch 25/37] PNPACPI: remove redundant warnings about _CRS/_PRS failures Bjorn Helgaas
2008-04-01 15:16   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 26/37] PNPACPI: remove some pnp_dbg calls Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 27/37] PNP: use conventional "i" for loop indices Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 28/37] PNP: add pnp_get_resource() interface Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 29/37] PNP: convert encoders to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 30/37] PNP: convert resource accessors " Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 31/37] PNP: convert resource checks " Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 32/37] PNP: convert resource assign functions " Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 33/37] PNP: remove PNP_MAX_* uses Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 34/37] PNP: remove unused interfaces using pnp_resource_table Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 35/37] rtc: dont reference pnp_resource_table directly Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 36/37] PNP: make pnp_resource_table private to PNP core Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 15:17 ` [patch 37/37] PNP: make interfaces private to the " Bjorn Helgaas
2008-04-01 15:17   ` Bjorn Helgaas
2008-04-01 23:43 ` [patch 00/37] PNP resource_table cleanups, v2 Rene Herman
2008-04-02 21:35   ` Bjorn Helgaas
2008-04-03 15:54     ` Rene Herman [this message]
2008-04-03 16:43       ` Bjorn Helgaas
2008-04-03 17:12         ` Rene Herman
2008-04-03 19:29           ` Rene Herman
2008-05-01 20:47       ` Bjorn Helgaas
2008-05-04 14:14         ` Rene Herman
2008-05-04 14:19           ` Rene Herman
2008-05-05 14:48             ` Bjorn Helgaas

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=47F4FDCB.2000803@keyaccess.nl \
    --to=rene.herman@keyaccess.nl \
    --cc=akpm@linux-foundation.org \
    --cc=ambx1@neo.rr.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=castet.matthieu@free.fr \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=rene.herman@gmail.com \
    --cc=shaohua.li@intel.com \
    --cc=trenn@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.