Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> Let us add a bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t
> t2) for implementation in MD code

That's generally OK. (We have this in pthread_equal().)

>return memcpy(&t1, &t2, sizeof(t1)) == 0;
> That will work even if bus_space_tag_t is a struct.

I hope you don't really consider to pass structs as arguments to
functions. Int-alikes and pointers make sense, but I doubt anything
else does. But then, a bus_space_is_equal() doesn't buy us much,
it only adds bloat.

best regards
Matthias






Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




Re: CVS commit: src/sys

2010-03-23 Thread David Holland
On Sat, Mar 20, 2010 at 11:31:31PM +, Chuck Silvers wrote:
 > fix copy{in,out}{,str}() to return the error returned by uvm_fault().
 > fixes PR 41813.

Do you know if/how this will affect PR 11904? What happens now on EIO
in a memory-mapped file?

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread David Young
On Tue, Mar 23, 2010 at 11:39:54AM +0100, Matthias Drochner wrote:
> dyo...@pobox.com said:
> > Can the two tags that pcdisplay_is_console() compared ever come from
> > different spaces?
> 
> Yes, if there are independant ISA buses they are distinguished
> by their tags.

Good to know.  I did not know that this ever occurred.

I would not expect for comparing tags with == to work reliably, now,
based on my reading of bus_space(9).  I do not expect for it to work for
very much longer.

Let us add a bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t
t2) for implementation in MD code.  kern_stub.c can provide a default
implementation that will work for now:

return memcpy(&t1, &t2, sizeof(t1)) == 0;

That will work even if bus_space_tag_t is a struct.

(BTW, it was only by making bus_space_tag_t a struct that I got the
compiler to stop on some cases of bus_space_tag_t misuse.)

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> How many pcdisplay at isa can there be one machine?

Iirc, this code is originating from alpha where you can have
multiple independant PCI/ISA/EISA hierarchies and thus
multiple pcdisplay/ega/vga devices.

> Can the two tags that pcdisplay_is_console() compared ever come from
> different spaces?

Yes, if there are independant ISA buses they are distinguished
by their tags.

> pcdisplay_is_console does not compare tag-handle tuples, it compares
> only tags.  Can it tell two instances of pcdisplay apart in that way?

I think this is just a simplification -- since you can have only one
pcdisplay per bus hierarchy you can have only one per tag.

> > MI code needs to be able to check for equality at least.
> I don't see the need.
This is done at other places as well, eg in com.c, which is used
by many (also embedded) architectures. (In this case, tag _and_
handle are compared -- one can have multiple com devices in any
of multiple address spaces.)
Not understanding some code is no excuse for breaking it.

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread Matthias Drochner

dyo...@pobox.com said:
> How many pcdisplay at isa can there be one machine?

Iirc, this code is originating from alpha where you can have
multiple independant PCI/ISA/EISA hierarchies and thus
multiple pcdisplay/ega/vga devices.

> Can the two tags that pcdisplay_is_console() compared ever come from
> different spaces?

Yes, if there are independant ISA buses they are distinguished
by their tags.

> pcdisplay_is_console does not compare tag-handle tuples, it compares
> only tags.  Can it tell two instances of pcdisplay apart in that way?

I think this is just a simplification -- since you can have only one
pcdisplay per bus hierarchy you can have only one per tag.

> > MI code needs to be able to check for equality at least.
> I don't see the need.

This is done at other places as well, eg in com.c, which is used
by many (also embedded) architectures. (In this case, tag _and_
handle are compared -- one can have multiple com devices in any
of multiple address spaces.)

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt




Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread Matthias Drochner

[reposting, was sent to s-c first]

> Module Name:src
> Committed By:   dyoung
> Date:   Mon Mar 22 22:30:58 UTC 2010
> Modified Files:
> src/sys/dev/isa: isadma.c pcdisplay.c
> Log Message:
> [...]
> pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
> in order to see if pcdisplay0 is console.  It does not seem to
> be helpful to compare the tags; maybe the author intended to
> compare some other bus property?

What you are doing is rather destructive.
This is not about bus properties but to find out whether a specific
device is the same (which means it is located at the same base address)
as the console device which was established before all the device tree.
A base address is defined by a tag-handle tuple. MI code needs to be
able to check for equality at least.
This has been fine all the time -- what are you trying to accomplish?
Even if you turn the tag into a pointer, it should be fine for MI
code to compare this to other tags.

best regards
Matthias





Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt