LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: snd-aoa status update / automatic driver loading
From: Dean Hamstead @ 2006-05-17 22:30 UTC (permalink / raw)
  To: debian-powerpc; +Cc: linuxppc-dev list
In-Reply-To: <20060517215412.GA4504@localhost>

perhaps a comprehensive sound test would be in order, akin perhaps to 
the one the winehq chaps are doing right now

Dean

Wolfgang Pfeiffer wrote:
> Hi Johannes
> 
> Thanks for the update .. :)
> 
> I loaded the new drivers, and they work, as it seems. In the end it
> will probably need a bit more use of this driver before i can give a
> reliable test report ... :)
> 
> Below a few first notes ..
> 
> On Wed, May 17, 2006 at 12:09:24PM +0200, Johannes Berg wrote:
>> Hey,
>>
>> Currently snd-aoa is known to work on the following machines:
>> * PowerBook5,8
> 
> I use snd-aoa on the latter
> 
>> People with those machines are encouraged to use and stress-test it,
> 
> 
> I compiled/installed your (old) snd-aoa files at about last (Tuesday)
> night , and got these errors when re-booting the machine today:
> 
> -------------------------
> # zgrep mismatch /var/log/boot.*gz [following op slightly edited for readability]
> 
> /var/log/boot.2.gz:Wed May 17 16:14:04 2006: ^[[9;0]^[[14;0]Setting up
> ALSA...warning: 'alsactl restore' failed with error message 'alsactl:
> set_control:894: warning: name mismatch (Line-out Switch/Headphone
> Switch) for control #2
> 
> /var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:896:
> warning: index mismatch (0/0) for control #2
> 
> /var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:894:
> warning: name mismatch (Master Playback Volume/Capture Source) for
> control #3
> 
> /var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:896:
> warning: index mismatch (0/0) for control #3
> --------------------------
> 
> This error seems to be *gone* after updating ('git pull') snd-aoa,
> compiling and installing it at about 16:00 UTC today (Wednesday)...
> 
> # modinfo snd-aoa
> filename:       /lib/modules/2.6.17-rc3-gf358166a-dirty/kernel/sound/aoa/snd-aoa.ko
> description:    Apple Onboard Audio Sound Driver
> author:         Johannes Berg <johannes@sipsolutions.net>
> license:        GPL
> vermagic:       2.6.17-rc3-gf358166a-dirty mod_unload gcc-4.1
> depends:        snd
> srcversion:     C4332AD34674ECE97C7BF91
> 
> Notes:
> 
> 1:
> 
> I removed snd-powermac from /etc/modules to prevent the module from
> being loaded when booting ... only today .. Sound still works ... :)
> 
> 2:
> 
> Took me some reboots/'alsactl store' to have sound switched on
> automatically after logging in to KDE ... not being sure what was
> going on .. 
> 
> 
> 3:
> 
> I have a kmix Volume slider now ... this is new on *this* kmix applet
> (i.e. the one I have to load via Multimedia --> KMix from the KDE
> kicker)
> 
> So: Nice ... is this the solution you like, too ? ... ;) .. 
> 
> 4:
> 
> I can hear two sound files at the same time: Didn't work at the first
> try. I then installed again /etc/asound.conf, that I copied from my
> old ti-IV-Book (Not being sure tho' whether this really is such a good
> idea .... : 
> 
> -------------------------------
> pcm.!default {
> 	type plug
> 	slave.pcm asymer
> }
> 
> pcm.dmixer {
> 	type dmix
> 	ipc_key 1977
> 	ipc_perm 666
> #	ipc_key_add_uid true
> 	slowptr true
> 	slave {
> 		pcm "hw:0"
> 		period_time 0
> 		period_size 1024
> 		buffer_size 8192
> 		rate 44100
> 	}
> }
> 
> pcm.dsnooper {
> 	type dsnoop
> 	ipc_key 1978
> 	ipc_perm 666
> #	ipc_key_add_uid true
> 	slave.pcm "hw:0"
> }
> 
> pcm.asymer {
> 	type asym
> 	playback.pcm "dmixer"
> 	capture.pcm "dsnooper"
> }
> 
> pcm.jack {
> 	type jack
> 	playback_ports {
> 		0 alsa_pcm:playback_1
> 		1 alsa_pcm:playback_2
> 	}
> 	capture_ports {
> 		0 alsa_pcm:capture_1
> 		1 alsa_pcm:capture_2
> 	}
> }
> 
> # These are for alsa-oss
> pcm.dsp0 pcm.default
> ctl.mixer0 "hw:0"
> ------------------------------
> 
> 5:
> 
> Ooops: Alsaplayer just disappeared while playing somem Internet radio
> station:
> 
> /var/log/kern.log from about the time of the crash:
> 
> May 17 23:34:11 debby1-6 kernel: [15962.091766] i2sbus: stop/suspend
> 
> [nothing more, as it seems .. Sorry]
> 
> No problem restarting alsa-player after this little crash .. :) 
> 
> 
> 
>> Now, when you boot, mac-io is already built-in so provides the i2s
>> device, which my i2sbus module binds to. Since udev synthesizes events,
>> i2sbus gets loaded automatically. Now, i2sbus creates uevents on its
>> own, with the layout number given as the MODALIAS. Hence, the layout
>> fabric module is loaded because it has an alias for all the layouts it
>> handles, and it in turn requests all the codec modules that it requires.
>> Also, this means that 'modprobe i2sbus' will suffice to get the driver
>> up and running without a reboot, 
> 
> ... didn't try this so far, but I'll keep that in mind for
> /etc/modules ... :)
> 
> The problem I had so far after installing the new snd-aoa drivers was
> to first unload them (before reloading) without the need to reboot
> ... it seems the KDE panel (kicker) is using the drivers, thus
> preventing them from being unloadable ... I'll see into that later on
> ... 
> 
> Just in case it helps:
> 
> 
> # lsmod | grep -i snd   [again slightly edited]
> snd_aoa_codec_onyx     12736  2 
> snd_aoa_fabric_layout     7716  2 
> snd_aoa                 8076  2 snd_aoa_codec_onyx,snd_aoa_fabric_layout
> snd_pcm_oss            45824  0 
> snd_mixer_oss          19392  1 snd_pcm_oss
> snd_pcm                89060  2 i2sbus,snd_pcm_oss
> snd_timer              22468  1 snd_pcm
> snd_page_alloc          8744  1 snd_pcm
> soundbus                6436  2 snd_aoa_fabric_layout,i2sbus
> snd                    60148  12 snd_aoa_codec_onyx,
> 				 snd_aoa_fabric_layout,snd_aoa,i2sbus,
> 				 snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
> soundcore               8612  1 snd
> 
> 
> [do you see modules that are not needed anymore with the new snd-aoa,
> with the hardware I have?]
> 
> 
> /etc/modules:
> -------------------------
> # /etc/modules: kernel modules to load at boot time.
> #
> # This file contains the names of kernel modules that should be loaded
> # at boot time, one per line. Lines beginning with "#" are ignored.
> 
> apm_emu
> ide-cd
> #ide-disk
> #ide-generic
> sbp2
> i2c-powermac
> #snd-powermac
> 
> #snd-aoa:
> soundbus
> i2sbus
> snd-aoa
> snd-aoa-fabric-layout
> snd-aoa-codec-onyx
> # End snd-aoa
> 
> cpufreq_performance
> cpufreq_powersave
> sr_mod
> therm_adt746x
> 
> ------------------------
> 
> Thanks for your work .. :)
> 
> And please let me know if you need to know more ..
> 
> Best Regards
> Wolfgang
> 

^ permalink raw reply

* Re: snd-aoa status update / automatic driver loading
From: Wolfgang Pfeiffer @ 2006-05-17 22:19 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, debian-powerpc
In-Reply-To: <20060517215412.GA4504@localhost>

On Wed, May 17, 2006 at 11:54:12PM +0200, Wolfgang Pfeiffer wrote:
> 
> 
> # lsmod | grep -i snd   [again slightly edited]
> snd_aoa_codec_onyx     12736  2 
> snd_aoa_fabric_layout     7716  2 
> snd_aoa                 8076  2 snd_aoa_codec_onyx,snd_aoa_fabric_layout
> snd_pcm_oss            45824  0 
> snd_mixer_oss          19392  1 snd_pcm_oss
> snd_pcm                89060  2 i2sbus,snd_pcm_oss
> snd_timer              22468  1 snd_pcm
> snd_page_alloc          8744  1 snd_pcm
> soundbus                6436  2 snd_aoa_fabric_layout,i2sbus
> snd                    60148  12 snd_aoa_codec_onyx,
> 				 snd_aoa_fabric_layout,snd_aoa,i2sbus,
> 				 snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
> soundcore               8612  1 snd
> 
> 
> [do you see modules that are not needed anymore with the new snd-aoa,
> with the hardware I have?]

Update:

changed /etc/modules to explicitly load only i2sbus:

--------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

apm_emu
ide-cd
#ide-disk
#ide-generic
sbp2
i2c-powermac
#snd-powermac

#snd-aoa:
#soundbus
i2sbus
#snd-aoa
#snd-aoa-fabric-layout
#snd-aoa-codec-onyx
# End snd-aoa

cpufreq_performance
cpufreq_powersave
sr_mod
therm_adt746x
-------------------

.. which seems enough to load the rest of the needed snd modules:
After the change above [following op. slightly edited]:

---------------------
# lsmod | grep -i snd
snd_aoa_codec_onyx     12736  2 
snd_aoa_fabric_layout     7716  1 
snd_aoa                 8076  2 snd_aoa_codec_onyx,snd_aoa_fabric_layout
snd_pcm_oss            45824  0 
snd_mixer_oss          19392  1 snd_pcm_oss
snd_pcm                89060  2 i2sbus,snd_pcm_oss
snd_timer              22468  1 snd_pcm
snd_page_alloc          8744  1 snd_pcm
soundbus                6436  2 snd_aoa_fabric_layout,i2sbus

snd                    60148  10 snd_aoa_codec_onyx,
				 snd_aoa_fabric_layout,snd_aoa,i2sbus,
				 snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer


soundcore               8612  1 snd

---------------------


> 
> 
> /etc/modules:
> -------------------------
> # /etc/modules: kernel modules to load at boot time.
> #
> # This file contains the names of kernel modules that should be loaded
> # at boot time, one per line. Lines beginning with "#" are ignored.
> 
> apm_emu
> ide-cd
> #ide-disk
> #ide-generic
> sbp2
> i2c-powermac
> #snd-powermac
> 
> #snd-aoa:
> soundbus
> i2sbus
> snd-aoa
> snd-aoa-fabric-layout
> snd-aoa-codec-onyx
> # End snd-aoa
> 
> cpufreq_performance
> cpufreq_powersave
> sr_mod
> therm_adt746x
> 
> ------------------------

HTH

Regards
Wolfgang
-- 
Wolfgang Pfeiffer: /ICQ: 286585973/ + + +  /AIM: crashinglinux/
http://profiles.yahoo.com/wolfgangpfeiffer

Key ID: E3037113
http://keyserver.mine.nu/pks/lookup?search=0xE3037113&fingerprint=on

^ permalink raw reply

* Re: snd-aoa status update / automatic driver loading
From: Wolfgang Pfeiffer @ 2006-05-17 21:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, debian-powerpc
In-Reply-To: <1147860564.14395.6.camel@johannes>

Hi Johannes

Thanks for the update .. :)

I loaded the new drivers, and they work, as it seems. In the end it
will probably need a bit more use of this driver before i can give a
reliable test report ... :)

Below a few first notes ..

On Wed, May 17, 2006 at 12:09:24PM +0200, Johannes Berg wrote:
> Hey,
> 
> Currently snd-aoa is known to work on the following machines:
> * PowerBook5,8

I use snd-aoa on the latter

> 
> People with those machines are encouraged to use and stress-test it,


I compiled/installed your (old) snd-aoa files at about last (Tuesday)
night , and got these errors when re-booting the machine today:

-------------------------
# zgrep mismatch /var/log/boot.*gz [following op slightly edited for readability]

/var/log/boot.2.gz:Wed May 17 16:14:04 2006: ^[[9;0]^[[14;0]Setting up
ALSA...warning: 'alsactl restore' failed with error message 'alsactl:
set_control:894: warning: name mismatch (Line-out Switch/Headphone
Switch) for control #2

/var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:896:
warning: index mismatch (0/0) for control #2

/var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:894:
warning: name mismatch (Master Playback Volume/Capture Source) for
control #3

/var/log/boot.2.gz:Wed May 17 16:14:05 2006: alsactl: set_control:896:
warning: index mismatch (0/0) for control #3
--------------------------

This error seems to be *gone* after updating ('git pull') snd-aoa,
compiling and installing it at about 16:00 UTC today (Wednesday)...

# modinfo snd-aoa
filename:       /lib/modules/2.6.17-rc3-gf358166a-dirty/kernel/sound/aoa/snd-aoa.ko
description:    Apple Onboard Audio Sound Driver
author:         Johannes Berg <johannes@sipsolutions.net>
license:        GPL
vermagic:       2.6.17-rc3-gf358166a-dirty mod_unload gcc-4.1
depends:        snd
srcversion:     C4332AD34674ECE97C7BF91

Notes:

1:

I removed snd-powermac from /etc/modules to prevent the module from
being loaded when booting ... only today .. Sound still works ... :)

2:

Took me some reboots/'alsactl store' to have sound switched on
automatically after logging in to KDE ... not being sure what was
going on .. 


3:

I have a kmix Volume slider now ... this is new on *this* kmix applet
(i.e. the one I have to load via Multimedia --> KMix from the KDE
kicker)

So: Nice ... is this the solution you like, too ? ... ;) .. 

4:

I can hear two sound files at the same time: Didn't work at the first
try. I then installed again /etc/asound.conf, that I copied from my
old ti-IV-Book (Not being sure tho' whether this really is such a good
idea .... : 

-------------------------------
pcm.!default {
	type plug
	slave.pcm asymer
}

pcm.dmixer {
	type dmix
	ipc_key 1977
	ipc_perm 666
#	ipc_key_add_uid true
	slowptr true
	slave {
		pcm "hw:0"
		period_time 0
		period_size 1024
		buffer_size 8192
		rate 44100
	}
}

pcm.dsnooper {
	type dsnoop
	ipc_key 1978
	ipc_perm 666
#	ipc_key_add_uid true
	slave.pcm "hw:0"
}

pcm.asymer {
	type asym
	playback.pcm "dmixer"
	capture.pcm "dsnooper"
}

pcm.jack {
	type jack
	playback_ports {
		0 alsa_pcm:playback_1
		1 alsa_pcm:playback_2
	}
	capture_ports {
		0 alsa_pcm:capture_1
		1 alsa_pcm:capture_2
	}
}

# These are for alsa-oss
pcm.dsp0 pcm.default
ctl.mixer0 "hw:0"
------------------------------

5:

Ooops: Alsaplayer just disappeared while playing somem Internet radio
station:

/var/log/kern.log from about the time of the crash:

May 17 23:34:11 debby1-6 kernel: [15962.091766] i2sbus: stop/suspend

[nothing more, as it seems .. Sorry]

No problem restarting alsa-player after this little crash .. :) 



> Now, when you boot, mac-io is already built-in so provides the i2s
> device, which my i2sbus module binds to. Since udev synthesizes events,
> i2sbus gets loaded automatically. Now, i2sbus creates uevents on its
> own, with the layout number given as the MODALIAS. Hence, the layout
> fabric module is loaded because it has an alias for all the layouts it
> handles, and it in turn requests all the codec modules that it requires.
> Also, this means that 'modprobe i2sbus' will suffice to get the driver
> up and running without a reboot, 

... didn't try this so far, but I'll keep that in mind for
/etc/modules ... :)

The problem I had so far after installing the new snd-aoa drivers was
to first unload them (before reloading) without the need to reboot
... it seems the KDE panel (kicker) is using the drivers, thus
preventing them from being unloadable ... I'll see into that later on
... 

Just in case it helps:


# lsmod | grep -i snd   [again slightly edited]
snd_aoa_codec_onyx     12736  2 
snd_aoa_fabric_layout     7716  2 
snd_aoa                 8076  2 snd_aoa_codec_onyx,snd_aoa_fabric_layout
snd_pcm_oss            45824  0 
snd_mixer_oss          19392  1 snd_pcm_oss
snd_pcm                89060  2 i2sbus,snd_pcm_oss
snd_timer              22468  1 snd_pcm
snd_page_alloc          8744  1 snd_pcm
soundbus                6436  2 snd_aoa_fabric_layout,i2sbus
snd                    60148  12 snd_aoa_codec_onyx,
				 snd_aoa_fabric_layout,snd_aoa,i2sbus,
				 snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
soundcore               8612  1 snd


[do you see modules that are not needed anymore with the new snd-aoa,
with the hardware I have?]


/etc/modules:
-------------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

apm_emu
ide-cd
#ide-disk
#ide-generic
sbp2
i2c-powermac
#snd-powermac

#snd-aoa:
soundbus
i2sbus
snd-aoa
snd-aoa-fabric-layout
snd-aoa-codec-onyx
# End snd-aoa

cpufreq_performance
cpufreq_powersave
sr_mod
therm_adt746x

------------------------

Thanks for your work .. :)

And please let me know if you need to know more ..

Best Regards
Wolfgang

-- 
Wolfgang Pfeiffer: /ICQ: 286585973/ + + +  /AIM: crashinglinux/
http://profiles.yahoo.com/wolfgangpfeiffer

Key ID: E3037113
http://keyserver.mine.nu/pks/lookup?search=0xE3037113&fingerprint=on

^ permalink raw reply

* Re: [Alsa-devel] [RFC] alsa integer control ranges
From: Benjamin Herrenschmidt @ 2006-05-17 21:41 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linuxppc-dev list, Johannes Berg, ALSA development, Benjamin Berg
In-Reply-To: <s5hd5ec4yn7.wl%tiwai@suse.de>

On Wed, 2006-05-17 at 14:35 +0200, Takashi Iwai wrote:

> The question is where to implement a huge table or a complex
> conversion function -- whether in the driver or in alsa-lib.

The lib of course

Ben.

^ permalink raw reply

* Re: [PATCH 1/5] powerpc: Make early xmon logic immune to location of early parsing
From: Tom Rini @ 2006-05-17 21:29 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Kumar Gala, Paul Mackerras
In-Reply-To: <1147852841.148164.91320074069.qpush@concordia>

On Wed, May 17, 2006 at 06:00:41PM +1000, Michael Ellerman wrote:

> Currently early_xmon() calls directly into debugger() if xmon=early is passed.
> This ties the invocation of early xmon to the location of parse_early_param(),
> which might change.
> 
> Tested on P5 LPAR and F50.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Please no, parse_early_param() is there so things like xmon or kgdb can
be dropped into as soon as we're able to parse any params that might be
usable early on.

-- 
Tom Rini

^ permalink raw reply

* Re: PowerMac7,3 sound (was: PowerBook5,4 -- no sound?)
From: Andreas Schwab @ 2006-05-17 20:14 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev
In-Reply-To: <je3bf85twf.fsf@sykes.suse.de>

Andreas Schwab <schwab@suse.de> writes:

> Johannes Berg <johannes@sipsolutions.net> writes:
>
>> Andreas, you'll probably be able to get a bit further by inserting the
>> following code in front of the loop in i2sbus-core.c line 162, and
>> removing the of_address_to_resource call inside the loop.
>>
>>   dev->resources[0].start = 0x80010000;
>>   dev->resources[0].end   = 0x80010fff;
>>   dev->resources[1].start = 0x80008000;
>>   dev->resources[1].end   = 0x800080ff;
>>   dev->resources[2].start = 0x80008100;
>>   dev->resources[2].end   = 0x800081ff;
>>
>> But I'm not sure that is correct on all machines (in fact, I'm not
>> perfectly sure it is correct on your machine).
>
> I have the following sound resources in /proc/iomem:
>
>         80008000-800083ff : 0.00010000:i2s
>           80008000-800083ff : Sound DMA
>         80010000-80010fff : 0.00010000:i2s
>           80010000-80010fff : Sound Control
>
> I'm not sure whether the first mapping should be split, but I don't know
> much about how resource mappings work.

It definitely didn't work.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* Re: [PATCH] Fix do_mlock so page alignment is to hugepage boundries when needed
From: Eric Paris @ 2006-05-17 19:59 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: discuss, linux-kernel, wli, linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0605171840310.14529@blonde.wat.veritas.com>

On Wed, 2006-05-17 at 18:42 +0100, Hugh Dickins wrote:
> On Wed, 17 May 2006, Eric Paris wrote:
> > sys_m{,un}lock and do_mlock all align memory references and the length
> > of the mlock given by userspace to page boundaries.  If the page being
> > mlocked is a hugepage instead of a normal page the start and finish of
> > the mlock will still only be aligned to normal page boundaries.
> > Ultimately upon the process exiting we will eventually call unmap_vmas
> > which will call unmap_hugepage_range for all of the ranges.
> > unmap_hugepage_range checks to make sure the beginning and the end of
> > the range are actually hugepage aligned and if not will BUG().  Since we
> > only aligned to a normal page boundary the end of the first range and
> > the beginning of the second will likely (unless userspace passed of
> > values already hugepage aligned) not be hugepage aligned and thus we
> > bomb.
> 
> When did you test this?  It should have been fixed in 2.6.11 onwards
> by split_vma()'s simple:
> 
> 	if (is_vm_hugetlb_page(vma) && (addr & ~HPAGE_MASK))
> 		return -EINVAL;
> 
> Hugh

You're right.  My initial BUG() problem was on pre 2.6.11.  I wrote this
patch and tested that it worked on 2.6.16 to allow the test program I
described to run successfully.  Admittedly this is the first time I
tested on unpatched 2.6.16 and as you said the mlock will fail with
"Invalid Argument" instead of BUG().  So the panic is gone post 2.6.11,
but the problem remains.  We still are rounding incorrectly for
hugepages in the sys_mlock and do_mlock functions.

This patch still solves the problem of the kernel currently being more
restrictive on what we accept from userspace for the length of the mlock
if it is a hugepage rather than a regular page.  With a regular page we
will round the value from userspace and happily go about our business of
mlocking.  For a hugepage it just rejects it if userspace doesn't align
it themselves.  This allows the kernel to do the same work for hugepages
that it does for normal pages.

-Eric

^ permalink raw reply

* Re: snd-aoa status update / automatic driver loading
From: Tony Vroon @ 2006-05-17 18:57 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, debian-powerpc
In-Reply-To: <1147860564.14395.6.camel@johannes>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johannes Berg wrote:
> Hey,
> 
> Currently snd-aoa is known to work on the following machines:
> * PowerBook5,8
> * PowerBook5,7
> * PowerMac8,1
> * PowerMac8,2
> * 17" October 2005 PowerBook (don't know the number)

That would be the PowerBook 5,9 (confirmed working, that's what I have).

> * PowerMac11,2
> * PowerBook6,8
> and my
> * PowerBook5,6

> People with those machines are encouraged to use and stress-test it, it
> also provides much better hardware support than snd-powermac, for
> example it can actually reprogram the hardware if you have a 48KHz file
> instead of having to digitally downsample it to 44.1KHz like required
> with snd-powermac in most cases.

When writing documentation, you might want to add that the ALSA-plugin
in XMMS & Audacious requires a period time of 100ms instead of the
default of 50ms, as otherwise the sou*click*nd is n*click*ot ver*click*y
good.
(A look at the current code of that plugin, to see how the volume
control code can be fixed would be highly appreciated)

> There are apparently some cases where it loses interrupts and then the
> sound is garbled, my brother's investigating that at the moment, it
> doesn't happen with my powerbook nor with my powermac.

Not seen this, although I must say it does not resume from sleep as
gracefully as I have seen you describe it.

> But the other reason for writing this mail is that I finally found the
> last remaining bug that prevented sound module autoloading! :)

Much appreciated, thank you :)

> Now, when you boot, mac-io is already built-in so provides the i2s
> device, which my i2sbus module binds to. Since udev synthesizes events,
> i2sbus gets loaded automatically. Now, i2sbus creates uevents on its
> own, with the layout number given as the MODALIAS. Hence, the layout
> fabric module is loaded because it has an alias for all the layouts it
> handles, and it in turn requests all the codec modules that it requires.
> Also, this means that 'modprobe i2sbus' will suffice to get the driver
> up and running without a reboot, provided that all modules are
> installed.
> 
> Have fun,
> johannes

Regards,
Tony V.
(Chainsaw)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3-ecc0.1.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEa3Icp5vW4rUFj5oRAuFXAJwMgzHiZLal33irvZt6qtDbo1L+rQCbBb4d
KF5TAISi/CUHYj+ZqJjPpFE=
=ptuO
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: snd-aoa status update / automatic driver loading
From: Andreas Schwab @ 2006-05-17 19:53 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, debian-powerpc
In-Reply-To: <1147860564.14395.6.camel@johannes>

Johannes Berg <johannes@sipsolutions.net> writes:

> Hey,
>
> Currently snd-aoa is known to work on the following machines:
> * PowerBook5,8
> * PowerBook5,7
> * PowerMac8,1
> * PowerMac8,2
> * 17" October 2005 PowerBook (don't know the number)
> * PowerMac11,2
> * PowerBook6,8
> and my
> * PowerBook5,6

For PowerBook6,7:

	/* PowerBook6,7 */
	{ .layout_id = 92,
	  .codecs[0] = {
		.name = "tas",
		.connections = tas_connections_nolineout,
	  },
	},

Appears to work fine, apart from the missing features.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* Re: PowerMac7,3 sound (was: PowerBook5,4 -- no sound?)
From: Andreas Schwab @ 2006-05-17 19:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev
In-Reply-To: <1147862072.14395.25.camel@johannes>

Johannes Berg <johannes@sipsolutions.net> writes:

> Andreas, you'll probably be able to get a bit further by inserting the
> following code in front of the loop in i2sbus-core.c line 162, and
> removing the of_address_to_resource call inside the loop.
>
>   dev->resources[0].start = 0x80010000;
>   dev->resources[0].end   = 0x80010fff;
>   dev->resources[1].start = 0x80008000;
>   dev->resources[1].end   = 0x800080ff;
>   dev->resources[2].start = 0x80008100;
>   dev->resources[2].end   = 0x800081ff;
>
> But I'm not sure that is correct on all machines (in fact, I'm not
> perfectly sure it is correct on your machine).

I have the following sound resources in /proc/iomem:

        80008000-800083ff : 0.00010000:i2s
          80008000-800083ff : Sound DMA
        80010000-80010fff : 0.00010000:i2s
          80010000-80010fff : Sound Control

I'm not sure whether the first mapping should be split, but I don't know
much about how resource mappings work.

> After that, you'll probably still not have usable sound though because I
> know nothing about the layout-id of your machine. If I have support for
> your codec already, that should be easy though.

The layout id is 36, and it has both line out and headphone, detected as a
Snapper.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* [PATCH][resend] udbg_printf() formatting attribute
From: jimix @ 2006-05-17 16:00 UTC (permalink / raw)
  To: linuxppc-dev

Sorry, Previous patch was munged by MTA.

This patch allows the compiler to catch any printf-like mismatches for
udbg_printf().  After some brute force building I've only found issues
with my own code and lparcfg.c It could break some developers, but
IMHO that would be goodness.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>

---

diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
--- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
+++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 11:55:21 2006 -0400
@@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
 
 	current_weight = (resource >> 5 * 8) & 0xFF;
 
-	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
+	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
 		 __FUNCTION__, current_entitled, current_weight);
 
-	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
+	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
 		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
 
 	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
diff -r 0163968f7fce include/asm-powerpc/udbg.h
--- a/include/asm-powerpc/udbg.h	Tue May 16 15:55:19 2006 -0400
+++ b/include/asm-powerpc/udbg.h	Wed May 17 11:55:21 2006 -0400
@@ -23,7 +23,8 @@ extern int udbg_read(char *buf, int bufl
 extern int udbg_read(char *buf, int buflen);
 
 extern void register_early_udbg_console(void);
-extern void udbg_printf(const char *fmt, ...);
+extern void udbg_printf(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
 extern void udbg_progress(char *s, unsigned short hex);
 
 extern void udbg_init_uart(void __iomem *comport, unsigned int speed,

^ permalink raw reply

* Re: [patch] udb_printf() formatting attribute
From: Jimi Xenidis @ 2006-05-17 18:30 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev
In-Reply-To: <20060517160053.GE10310@localdomain>


On May 17, 2006, at 12:00 PM, Nathan Lynch wrote:

> Jimi Xenidis wrote:
>> This patch allows the compiler to catch any printf-like mismatches
>> for udbg_printf().
>> After some brute force building I've only found issues with my own
>> code and lparcfg.c
>> It could break some developers, but IMHO that would be goodness.
>>
>> Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
>> ---
>> diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
>> --- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
>> +++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 10:43:55 2006 -0400
>> @@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
>> 	current_weight = (resource >> 5 * 8) & 0xFF;
>> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
>> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
>> 		 __FUNCTION__, current_entitled, current_weight);
>> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
>> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
>> 		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
>> 	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
>
> Does this really fix a bug?  What warnings are you able to get gcc to
> emit?
>
My sniff test that resulted in this patch was a manual build of all  
arch/powerpc dirs with -DDEBUG added to CFLAGS.
To see these particular warnings simply add a #define DEBUG before  
the includes of this file you will get:
.../linux-2.6/arch/powerpc/kernel/lparcfg.c: In function  
`lparcfg_write':
.../linux-2.6/arch/powerpc/kernel/lparcfg.c:524: warning: long  
unsigned int format, different type arg (arg 4)
.../linux-2.6/arch/powerpc/kernel/lparcfg.c:527: warning: long  
unsigned int format, different type arg (arg 4)

^ permalink raw reply

* Re: [patch] udb_printf() formatting attribute
From: Jimi Xenidis @ 2006-05-17 18:31 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev
In-Reply-To: <20060517160053.GE10310@localdomain>


On May 17, 2006, at 12:00 PM, Nathan Lynch wrote:

> Jimi Xenidis wrote:
>> This patch allows the compiler to catch any printf-like mismatches
>> for udbg_printf().
>> After some brute force building I've only found issues with my own
>> code and lparcfg.c
>> It could break some developers, but IMHO that would be goodness.
>>
>> Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
>> ---
>> diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
>> --- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
>> +++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 10:43:55 2006 -0400
>> @@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
>> 	current_weight = (resource >> 5 * 8) & 0xFF;
>> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
>> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
>> 		 __FUNCTION__, current_entitled, current_weight);
>> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
>> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
>> 		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
>> 	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
>
> Does this really fix a bug?  What warnings are you able to get gcc to
> emit?
>
My sniff test that resulted in this patch was a manual build of all  
arch/powerpc dirs with -DDEBUG added to CFLAGS.
To see these particular warnings simply add a #define DEBUG before  
the includes of this file you will get:
.../linux-2.6/arch/powerpc/kernel/lparcfg.c: In function  
`lparcfg_write':
.../linux-2.6/arch/powerpc/kernel/lparcfg.c:524: warning: long  
unsigned int format, different type arg (arg 4)
.../linux-2.6/arch/powerpc/kernel/lparcfg.c:527: warning: long  
unsigned int format, different type arg (arg 4)

^ permalink raw reply

* Re: [PATCH] Fix do_mlock so page alignment is to hugepage boundries when needed
From: Eric Paris @ 2006-05-17 18:20 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: discuss, linux-kernel, wli, linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0605171020390.13767@schroedinger.engr.sgi.com>

On Wed, 2006-05-17 at 10:24 -0700, Christoph Lameter wrote:
> On Wed, 17 May 2006, Eric Paris wrote:
> 
> > --- linux-2.6.16.14/include/asm-sparc64/page.h.paris
> > +++ linux-2.6.16.14/include/asm-sparc64/page.h
> > @@ -104,6 +104,8 @@ typedef unsigned long pgprot_t;
> >  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
> >  #define ARCH_HAS_SETCLEAR_HUGE_PTE
> >  #define ARCH_HAS_HUGETLB_PREFAULT_HOOK
> > +/* to align the pointer to the (next) page boundary when dealing with hugepages*/
> > +#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
> >  #endif
> 
> Could you put the definition of HPAGE_ALIGN into include/linux/hugetlb.h 
> to avoid modifying all the page.h files?

I could, I was just following the example of PAGE_ALIGN which was in all
the page.h files.  But since it really is a nonarch specific hugepage
only macro maybe that is a better place for it.

If other results come back positive I'll repost with that change if
others think it best.

-Eric

^ permalink raw reply

* Re: [PATCH] Fix do_mlock so page alignment is to hugepage boundries when needed
From: Hugh Dickins @ 2006-05-17 17:42 UTC (permalink / raw)
  To: Eric Paris; +Cc: discuss, linux-kernel, wli, linuxppc-dev
In-Reply-To: <1147885316.26468.15.camel@localhost.localdomain>

On Wed, 17 May 2006, Eric Paris wrote:
> sys_m{,un}lock and do_mlock all align memory references and the length
> of the mlock given by userspace to page boundaries.  If the page being
> mlocked is a hugepage instead of a normal page the start and finish of
> the mlock will still only be aligned to normal page boundaries.
> Ultimately upon the process exiting we will eventually call unmap_vmas
> which will call unmap_hugepage_range for all of the ranges.
> unmap_hugepage_range checks to make sure the beginning and the end of
> the range are actually hugepage aligned and if not will BUG().  Since we
> only aligned to a normal page boundary the end of the first range and
> the beginning of the second will likely (unless userspace passed of
> values already hugepage aligned) not be hugepage aligned and thus we
> bomb.

When did you test this?  It should have been fixed in 2.6.11 onwards
by split_vma()'s simple:

	if (is_vm_hugetlb_page(vma) && (addr & ~HPAGE_MASK))
		return -EINVAL;

Hugh

^ permalink raw reply

* Re: [RFC PATCH 00/09] robust VM per_cpu variables
From: Christoph Lameter @ 2006-05-17 17:40 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Andrew Morton, linux-mips, David Mosberger-Tang, linux-ia64,
	Martin Mares, spyro, Joe Taylor, Andi Kleen, linuxppc-dev,
	Paul Mackerras, benedict.gaster, sam, bjornw, kenneth.w.chen,
	Ingo Molnar, kiran, Nick Piggin, grundler, arnd, Rusty Russell,
	starvik, Linus Torvalds, Thomas Gleixner, rth, Chris Zankel,
	tony.luck, LKML, ralf, Marc Gauthier, lethal, schwidefsky,
	linux390, davem, parisc-linux
In-Reply-To: <Pine.LNX.4.58.0605171152190.15798@gandalf.stny.rr.com>

On Wed, 17 May 2006, Steven Rostedt wrote:

> > Well I'd like to see a comprehensive solution including a fix for the
> > problems with allocper_cpu() allocations (allocper_cpu has to allocate
> > memory for potential processors... which could be a lot on
> > some types of systems and its allocated somewhere not on the nodes of the
> > processor since they may not yet be online).
> 
> OK, now you're beyond what I'm working with ;)  No hot plug CPUs for me.
> Well, at least not yet!

You need to at least consider how this could be handled by the per_cpu 
memory manangement. The VM thingie with dynamic per cpu memory would allow 
a fixup of allocpercpu.

^ permalink raw reply

* Re: [PATCH] Fix do_mlock so page alignment is to hugepage boundries when needed
From: Christoph Lameter @ 2006-05-17 17:24 UTC (permalink / raw)
  To: Eric Paris; +Cc: discuss, linux-kernel, wli, linuxppc-dev
In-Reply-To: <1147885316.26468.15.camel@localhost.localdomain>

On Wed, 17 May 2006, Eric Paris wrote:

> --- linux-2.6.16.14/include/asm-sparc64/page.h.paris
> +++ linux-2.6.16.14/include/asm-sparc64/page.h
> @@ -104,6 +104,8 @@ typedef unsigned long pgprot_t;
>  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
>  #define ARCH_HAS_SETCLEAR_HUGE_PTE
>  #define ARCH_HAS_HUGETLB_PREFAULT_HOOK
> +/* to align the pointer to the (next) page boundary when dealing with hugepages*/
> +#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
>  #endif

Could you put the definition of HPAGE_ALIGN into include/linux/hugetlb.h 
to avoid modifying all the page.h files?

^ permalink raw reply

* Re: Bigphysarea vs. kernel 2.4.32 and PPC405GPr
From: Stephen Williams @ 2006-05-17 17:07 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <200605150835.48745.jgeissel@gmx.net>


That works nicely, thanks. I was under the mistaken impression that
the bigphysarea routines returned a physical address.

So now I can report that the bigphysarea patch works great on PPC
kernels 2.4.32+

Arno Geissel wrote:
> Try
> 
>       rc = remap_page_range(vma->vm_start,
>  			    virt_to_phys(heap_map_base),
>  			    npages*PAGE_SIZE,
>  			    vma->vm_page_prot);
> 
> Arno
> 
>> I'm trying to use the bigphysarea patch to help me allocate big
>> physical chunks of memory for use by some custom embedded devices.
>> I've applied the bigphysarea-2.4.20 patch and built, no trouble,
>> and I've got it to config for my PPC. I can see at boot time that
>> the bigphysarea is getting its pages.
>>
>> I'm trying to use a mmap call to the driver to map a chunk of this
>> memory into the process. The mmap for the driver has this:
>>
>>       pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
>>       vma->vm_flags |= VM_RESERVED;
>>
>>       npages = (vma->vm_end - vma->vm_start) / PAGE_SIZE;
>>       heap_map_base = bigphysarea_alloc_pages(npages, 1, GFP_KERNEL);
>>
>>       printk("XXXX Map base=%p, %ld pages\n", heap_map_base, npages);
>>
>>       rc = remap_page_range(vma->vm_start,
>> 			    (unsigned long)heap_map_base,
>> 			    npages*PAGE_SIZE,
>> 			    vma->vm_page_prot);
>>
>> The mmap returns without an error, but any access to the mapped
>> region gets me an immediate "Oops: machine check, sig: 7". I don't
>> see it. Where is the stupid mistake that I'm invariably making?


-- 
Steve Williams                "The woods are lovely, dark and deep.
steve at icarus.com           But I have promises to keep,
http://www.icarus.com         and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."

^ permalink raw reply

* [PATCH] Fix do_mlock so page alignment is to hugepage boundries when needed
From: Eric Paris @ 2006-05-17 17:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: discuss, wli, linuxppc-dev

sys_m{,un}lock and do_mlock all align memory references and the length
of the mlock given by userspace to page boundaries.  If the page being
mlocked is a hugepage instead of a normal page the start and finish of
the mlock will still only be aligned to normal page boundaries.
Ultimately upon the process exiting we will eventually call unmap_vmas
which will call unmap_hugepage_range for all of the ranges.
unmap_hugepage_range checks to make sure the beginning and the end of
the range are actually hugepage aligned and if not will BUG().  Since we
only aligned to a normal page boundary the end of the first range and
the beginning of the second will likely (unless userspace passed of
values already hugepage aligned) not be hugepage aligned and thus we
bomb.

To recreate (on any arch with hugepages) just create a hugepage and
allow shared memory segments to be at least as large as a hugepage.
Attach to that hugepage and then mlock on a non hugepage aligned
boundary when you call exit() the kernel will panic with a BUG() in
unmap_hugepage_range because the end of the range being unmapped is not
aligned properly.  Part of a quick reproducer program for i686 where
PAGE_SIZE=1024*4 and HPAGE_SIZE=4*1024*1024 is below.  

shmflg = SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W;
shmid = shmget (IPC_PRIVATE, 4*1024*1024, shmflg);
a = shmat(shmid, NULL, shmflg);
ret = mlock(a, 1024*4); // 1024*4 is PAGE_ALIGN'ed but this is a hugepage
exit(0)

This will panic because the end of the area to be unmapped will be 4k
(the regular pace boundary) not 4M (the hugepage page boundary on this
arch)

To fix this I created 2 new macros in mlock.c and a new macro in all of
the page.h files that defined HPAGE_SIZE.  I also had to move the
resource limit checks from sys_mlock to do_mlock.  The reason for this
is that we can't tell if it is a hugepage unless we have the vma.  And
so we don't know how long the mlock length will be unless we know how to
round the length to the correct page length.  Thus resource checking
can't be done until after we have the vma in question.

The two macros in mlock.c will, only on systems compiled with
CONFIG_HUGETLB_PAGE, check if the page being locked or unlocked is a
hugepage and if so ALIGN it to hugepage boundaries rather than normal
page boundaries.  If the vma is not for a hugepage it will use the same
methods as before for alignment.  The macro addition to page.h copies
the PAGE_ALIGN macro but uses HPAGE_SIZE and HPAGE_MASK.  I created this
HPAGE_ALIGN macro on the i386, x86_64, ia64, sh, sh64, sparc64, parisc
and powerpc archs.  Since they appear to be the all arches that
implement HPAGE_SIZE.  Two points of oddity, x86_64 seems to have
HPAGE_SIZE defined irrespective of CONFIG_HUGETLB_PAGE so my new
HPAGE_ALIGN macro is always defined as well.  It will still only get
used if CONFIG_HUGETLB_PAGE is set.

The other point of oddity that I don't know if it is right is the
definition on powerpc.  include/asm-powerpc/page_64.h does not quite
follow the same layout as the other arches so I think it's in the right
place but don't have a good place to test.  So if a person with power pc
is willing to test for me please just let me know if it is either fixed
or if it doesn't compile correctly.  I think it's right, but I'm not
100%.

Signed-off-by: Eric Paris <eparis@redhat.com>

 include/asm-i386/page.h       |    2 +
 include/asm-ia64/page.h       |    2 +
 include/asm-parisc/page.h     |    2 +
 include/asm-powerpc/page_64.h |    2 +
 include/asm-sh/page.h         |    2 +
 include/asm-sh64/page.h       |    2 +
 include/asm-sparc64/page.h    |    2 +
 include/asm-x86_64/page.h     |    2 +
 mm/mlock.c                    |   54 ++++++++++++++++++++++++------------------
 9 files changed, 48 insertions(+), 22 deletions(-)

--- linux-2.6.16.14/include/asm-sparc64/page.h.paris
+++ linux-2.6.16.14/include/asm-sparc64/page.h
@@ -104,6 +104,8 @@ typedef unsigned long pgprot_t;
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 #define ARCH_HAS_SETCLEAR_HUGE_PTE
 #define ARCH_HAS_HUGETLB_PREFAULT_HOOK
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif
 
 #define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_32BIT) ? \
--- linux-2.6.16.14/include/asm-i386/page.h.paris
+++ linux-2.6.16.14/include/asm-i386/page.h
@@ -68,6 +68,8 @@ typedef struct { unsigned long pgprot; }
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif
 
 #define pgd_val(x)	((x).pgd)
--- linux-2.6.16.14/include/asm-sh64/page.h.paris
+++ linux-2.6.16.14/include/asm-sh64/page.h
@@ -42,6 +42,8 @@
 #define HPAGE_MASK		(~(HPAGE_SIZE-1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT-PAGE_SHIFT)
 #define ARCH_HAS_SETCLEAR_HUGE_PTE
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif
 
 #ifdef __KERNEL__
--- linux-2.6.16.14/include/asm-sh/page.h.paris
+++ linux-2.6.16.14/include/asm-sh/page.h
@@ -32,6 +32,8 @@
 #define HPAGE_MASK		(~(HPAGE_SIZE-1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT-PAGE_SHIFT)
 #define ARCH_HAS_SETCLEAR_HUGE_PTE
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif
 
 #ifdef __KERNEL__
--- linux-2.6.16.14/include/asm-x86_64/page.h.paris
+++ linux-2.6.16.14/include/asm-x86_64/page.h
@@ -40,6 +40,8 @@
 #define HPAGE_SIZE	((1UL) << HPAGE_SHIFT)
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
--- linux-2.6.16.14/include/asm-parisc/page.h.paris
+++ linux-2.6.16.14/include/asm-parisc/page.h
@@ -140,6 +140,8 @@ extern int npmem_ranges;
 #define HPAGE_SIZE      	((1UL) << HPAGE_SHIFT)
 #define HPAGE_MASK		(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif
 
 #define virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
--- linux-2.6.16.14/include/asm-ia64/page.h.paris
+++ linux-2.6.16.14/include/asm-ia64/page.h
@@ -57,6 +57,8 @@
 
 # define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 # define ARCH_HAS_HUGEPAGE_ONLY_RANGE
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 #endif /* CONFIG_HUGETLB_PAGE */
 
 #ifdef __ASSEMBLY__
--- linux-2.6.16.14/include/asm-powerpc/page_64.h.paris
+++ linux-2.6.16.14/include/asm-powerpc/page_64.h
@@ -85,6 +85,8 @@ extern unsigned int HPAGE_SHIFT;
 #define HPAGE_SIZE		((1UL) << HPAGE_SHIFT)
 #define HPAGE_MASK		(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
+/* to align the pointer to the (next) page boundary when dealing with hugepages*/
+#define HPAGE_ALIGN(addr)       (((addr)+HPAGE_SIZE-1)&HPAGE_MASK)
 
 #endif /* __ASSEMBLY__ */
 
--- linux-2.6.16.14/mm/mlock.c.paris
+++ linux-2.6.16.14/mm/mlock.c
@@ -11,6 +11,13 @@
 #include <linux/mempolicy.h>
 #include <linux/syscalls.h>
 
+#ifdef CONFIG_HUGETLB_PAGE
+#define MLOCK_PAGE_ALIGN(len,vma) (((vma)->vm_flags & VM_HUGETLB) ?  HPAGE_ALIGN(len) : PAGE_ALIGN(len))
+#define MLOCK_PAGE_MASK(vma) (((vma)->vm_flags & VM_HUGETLB) ?  HPAGE_MASK : PAGE_MASK)
+#else
+#define MLOCK_PAGE_ALIGN(len,vma) PAGE_ALIGN(len)
+#define MLOCK_PAGE_MASK(vma) PAGE_MASK
+#endif
 
 static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
 	unsigned long start, unsigned long end, unsigned int newflags)
@@ -78,19 +85,37 @@ static int do_mlock(unsigned long start,
 	struct vm_area_struct * vma, * prev;
 	int error;
 
-	len = PAGE_ALIGN(len);
-	end = start + len;
-	if (end < start)
-		return -EINVAL;
-	if (end == start)
-		return 0;
 	vma = find_vma_prev(current->mm, start, &prev);
 	if (!vma || vma->vm_start > start)
 		return -ENOMEM;
 
+	len = MLOCK_PAGE_ALIGN((len + (start & ~MLOCK_PAGE_MASK(vma))), vma);
+	start = start & MLOCK_PAGE_MASK(vma);
+
 	if (start > vma->vm_start)
 		prev = vma;
 
+	end = start + len;
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+
+	if (on) {
+		unsigned long locked;
+		unsigned long lock_limit;
+
+		locked = len >> PAGE_SHIFT;
+		locked += current->mm->locked_vm;
+
+		lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
+		lock_limit >>= PAGE_SHIFT;
+
+		/* check against resource limits */
+		if ((locked > lock_limit) && !capable(CAP_IPC_LOCK))
+			return -ENOMEM;
+	}
+
 	for (nstart = start ; ; ) {
 		unsigned int newflags;
 
@@ -123,26 +148,13 @@ static int do_mlock(unsigned long start,
 
 asmlinkage long sys_mlock(unsigned long start, size_t len)
 {
-	unsigned long locked;
-	unsigned long lock_limit;
 	int error = -ENOMEM;
 
 	if (!can_do_mlock())
 		return -EPERM;
 
 	down_write(&current->mm->mmap_sem);
-	len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
-	start &= PAGE_MASK;
-
-	locked = len >> PAGE_SHIFT;
-	locked += current->mm->locked_vm;
-
-	lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
-	lock_limit >>= PAGE_SHIFT;
-
-	/* check against resource limits */
-	if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
-		error = do_mlock(start, len, 1);
+	error = do_mlock(start, len, 1);
 	up_write(&current->mm->mmap_sem);
 	return error;
 }
@@ -152,8 +164,6 @@ asmlinkage long sys_munlock(unsigned lon
 	int ret;
 
 	down_write(&current->mm->mmap_sem);
-	len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
-	start &= PAGE_MASK;
 	ret = do_mlock(start, len, 0);
 	up_write(&current->mm->mmap_sem);
 	return ret;

^ permalink raw reply

* Re: [patch] udb_printf() formatting attribute
From: Nathan Lynch @ 2006-05-17 16:00 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev
In-Reply-To: <4025245D-6BAB-41D3-ADB6-2748741F223E@watson.ibm.com>

Jimi Xenidis wrote:
> This patch allows the compiler to catch any printf-like mismatches  
> for udbg_printf().
> After some brute force building I've only found issues with my own  
> code and lparcfg.c
> It could break some developers, but IMHO that would be goodness.
> 
> Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
> ---
> diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
> --- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
> +++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 10:43:55 2006 -0400
> @@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
> 	current_weight = (resource >> 5 * 8) & 0xFF;
> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
> 		 __FUNCTION__, current_entitled, current_weight);
> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
> 		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
> 	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,

Does this really fix a bug?  What warnings are you able to get gcc to
emit?

^ permalink raw reply

* Re: [PATCH/2.6.17-rc4 7/10] Powerpc: workaround for tsi108 pci confi g read exception
From: Kumar Gala @ 2006-05-17 16:07 UTC (permalink / raw)
  To: Zang Roy-r61911
  Cc: linuxppc-dev list, Yang Xin-Xin-r48390, Paul Mackerras,
	Alexandre.Bounine
In-Reply-To: <9FCDBA58F226D911B202000BDBAD46730626D624@zch01exm40.ap.freescale.net>


On May 17, 2006, at 5:14 AM, Zang Roy-r61911 wrote:

> Workaround for Tundra Semiconductor tsi108 host bridge pci config read
> exception

Can you explain further why this is needed?


>
> Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
> Signed-off-by: Roy Zang	<tie-fei.zang@freescale.com>
>
> ---
>
>  arch/powerpc/kernel/traps.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
>
> 0575fbe21e4f1045528bb91ec4b34bb7955c4a92
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 064a525..7468d76 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -262,6 +262,19 @@ #if defined(CONFIG_PPC_PMAC) && defined(
>  		}
>  	}
>  #endif /* CONFIG_PPC_PMAC && CONFIG_PPC32 */
> +
> +#ifdef CONFIG_TSI108_BRIDGE
> +	extern void tsi108_clear_pci_cfg_error(void);
> +	const struct exception_table_entry *entry;
> +
> +	/* Are we prepared to handle this fault?  */
> +	if ((entry = search_exception_tables(regs->nip)) != NULL) {
> +		tsi108_clear_pci_cfg_error();
> +		regs->msr |= MSR_RI;
> +		regs->nip = entry->fixup;
> +		return 1;
> +	}
> +#endif /* CONFIG_TSI108_BRIDGE */
>  	return 0;
>  }
>
> -- 
> 1.3.0
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH/2.6.17-rc4 4/10]Powerpc:  Add tsi108 pic support
From: Kumar Gala @ 2006-05-17 16:05 UTC (permalink / raw)
  To: Zang Roy-r61911
  Cc: linuxppc-dev list, Yang Xin-Xin-r48390, Paul Mackerras,
	Alexandre.Bounine
In-Reply-To: <9FCDBA58F226D911B202000BDBAD46730626D61F@zch01exm40.ap.freescale.net>


On May 17, 2006, at 5:14 AM, Zang Roy-r61911 wrote:

> Add Tundra Semiconductor tsi108 host bridge interrupt controller  
> support.
>
> Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
> Signed-off-by: Roy Zang	<tie-fei.zang@freescale.com>
>
> ---

The TSI 108 looks like an OpenPIC derivative you should look at using  
mpic for this instead of introducing new pic code.

- k

>
>  arch/powerpc/sysdev/tsi108_pic.c |  813 +++++++++++++++++++++++++++ 
> +++++++++++
>  include/asm-powerpc/tsi108_pic.h |  232 +++++++++++
>  2 files changed, 1045 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/sysdev/tsi108_pic.c
>  create mode 100644 include/asm-powerpc/tsi108_pic.h
>
> 7d23f6a0984cd54ca787f880a57067330900abe8
> diff --git a/arch/powerpc/sysdev/tsi108_pic.c b/arch/powerpc/sysdev/ 
> tsi108_pic.c
> new file mode 100644
> index 0000000..bbca587
> --- /dev/null
> +++ b/arch/powerpc/sysdev/tsi108_pic.c
> @@ -0,0 +1,813 @@
> +/*
> + * (C) Copyright 2005 Tundra Semiconductor Corp.
> + * Alex Bounine, <alexandreb@tundra.com).
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +/*
> + * Tsi108 Interrupt Controller Handling
> + */
> +
> +#include <linux/config.h>
> +#include <linux/types.h>
> +#include <linux/kernel.h>
> +#include <linux/sched.h>
> +#include <linux/init.h>
> +#include <linux/irq.h>
> +#include <linux/interrupt.h>
> +#include <linux/sysdev.h>
> +#include <asm/ptrace.h>
> +#include <asm/signal.h>
> +#include <asm/io.h>
> +#include <asm/irq.h>
> +#include <asm/prom.h>
> +#include <asm/sections.h>
> +#include <asm/hardirq.h>
> +#include <asm/machdep.h>
> +
> +#include <asm/tsi108.h>
> +#include <asm/tsi108_irq.h>
> +#include <asm/tsi108_pic.h>
> +#undef DEBUG
> +
> +#ifdef DEBUG
> +#define DBG(fmt...) do { printk(fmt); } while(0)
> +#else
> +#define DBG(fmt...) do { } while(0)
> +#endif
> +
> +extern u32 get_vir_csrbase(void);
> +extern u32 tsi108_read_reg(u32 reg_offset);
> +extern void tsi108_write_reg(u32 reg_offset, u32 val);
> +
> +static phys_addr_t tsi108_pic_phy_addr;
> +static u32 tsi108_pic_vir_addr;
> +
> +static int tsi108_pic_cascade_irq = -1;
> +static int (*tsi108_pic_cascade_fn) (struct pt_regs *);
> +
> +/* Global Operations */
> +static void tsi108_pic_set_task_priority(u_int pri);
> +static void tsi108_pic_set_spurious(u_int vector);
> +void tsi108_pic_mask_all(void);
> +
> +/* Timer Interrupts */
> +static void tsi108_pic_inittimer(u_int timer, u_int pri, u_int  
> vector);
> +static void tsi108_pic_maptimer(u_int timer, u_int cpumask);
> +
> +/* Interrupt Sources */
> +static void tsi108_pic_enable_irq(u_int irq);
> +static void tsi108_pic_disable_irq(u_int irq);
> +static void tsi108_pic_initirq(u_int irq, u_int pri, u_int vector,  
> int polarity,
> +			       int is_level);
> +static void tsi108_pic_mapirq(u_int irq, u_int cpumask, u_int  
> keepmask);
> +static void init_pci_source(void);
> +static inline int get_pci_source(int vector);
> +int tsi108_pic_set_irq_sense(int irq, int pol, int sense);
> +
> +/*
> + * tsi108_pic interface routines
> + */
> +static void tsi108_pic_end_irq(unsigned int irq_nr);
> +static void tsi108_pic_ack_irq(unsigned int irq_nr);
> +void tsi108_pic_set_affinity(unsigned int irq_nr, unsigned long  
> cpumask);
> +
> +static struct hw_interrupt_type tsi108_pic_irq = {
> +	"tsi108_pic",
> +	NULL,
> +	NULL,
> +	tsi108_pic_enable_irq,
> +	tsi108_pic_disable_irq,
> +	tsi108_pic_ack_irq,
> +	tsi108_pic_end_irq,
> +	NULL
> +};
> +
> +static void tsi108_pci_irq_enable(u_int irq);
> +static void tsi108_pci_irq_disable(u_int irq);
> +static void tsi108_pci_irq_ack(u_int irq);
> +static void tsi108_pci_irq_end(u_int irq);
> +
> +static struct hw_interrupt_type tsi108_pci_irq = {
> +	"tsi108_PCI_int",
> +	NULL,
> +	NULL,
> +	tsi108_pci_irq_enable,
> +	tsi108_pci_irq_disable,
> +	tsi108_pci_irq_ack,
> +	tsi108_pci_irq_end,
> +	NULL
> +};
> +
> +#ifdef DBG_TSI108_INTERRUPT
> +#define ASSERT(expr)	if (!(expr)) { \
> +				printk("tsi108pic :" \
> +					"assertion failed! %s[%d]: %s\n", \
> +					__FUNCTION__, __LINE__, #expr); \
> +				dump_stack(); \
> +			}
> +#else
> +#define ASSERT(expr)	do {} while (0)
> +#endif
> +
> +static inline u_int get_vector_offset(u_int irq)
> +{
> +	u_int offset;
> +
> +	if (irq < TSI108_IRQ_BASE || irq >= IRQ_PCI_INTAD_BASE)
> +		return 0;
> +
> +	if (irq < IRQ_TSI108_MBOX0)
> +		offset = TSI108_INT_IVPR(irq - TSI108_IRQ_BASE);
> +	else if (irq < IRQ_TSI108_DBELL0)
> +		offset = TSI108_INT_MBVPR(irq - IRQ_TSI108_MBOX0);
> +	else if (irq < IRQ_TSI108_TIMER0)
> +		offset = TSI108_INT_DVPR(irq - IRQ_TSI108_DBELL0);
> +	else
> +		offset = TSI108_INT_GTVPR(irq - IRQ_TSI108_TIMER0);
> +
> +	return offset;
> +}
> +
> +static inline u_int tsi108_pic_read_reg(u_int reg_offset)
> +{
> +	return in_be32((volatile u32 *)(tsi108_pic_vir_addr + reg_offset));
> +}
> +
> +static inline void tsi108_pic_write_reg(u_int reg_offset, u_int val)
> +{
> +	out_be32((volatile u32 *)(tsi108_pic_vir_addr + reg_offset), val);
> +}
> +
> +void tsi108_pic_reset(void)
> +{
> +	tsi108_pic_write_reg(TSI108_INT_GCR, TSI108PIC_INT_GCR_R);
> +	while (tsi108_pic_read_reg(TSI108_INT_GCR) & TSI108PIC_INT_GCR_R)
> +		mb();
> +}
> +
> +void tsi108_pic_set_output(int dest_num, u32 sense, u32 polarity)
> +{
> +	u32 temp = 0;
> +	temp |= (IRQ_SENSE_LEVEL == sense) ?
> +	    (TSI108PIC_INT_CSR_S_LEVEL) : (TSI108PIC_INT_CSR_S_EDGE);
> +	temp |= (IRQ_POLARITY_POSITIVE == polarity) ?
> +	    (TSI108PIC_INT_CSR_P_HIGH) : (TSI108PIC_INT_CSR_P_LOW);
> +	tsi108_pic_write_reg(TSI108_INT_CSR(dest_num), temp);
> +	mb();
> +}
> +
> +int tsi108_pic_source_cfg(int src_num,	/* interrupt source number */
> +			  u32 sense,	/* interrupt source Sense */
> +			  u32 polarity,	/* interrupt source Polarity */
> +			  TSI108_IRQ_MODE mode	/* interrupt delivery Mode */
> +    )
> +{
> +	unsigned temp;
> +
> +	temp = tsi108_pic_read_reg(TSI108_INT_IVPR(src_num));
> +
> +	if (temp & TSI108PIC_ACTIVITY)	/* error if source is active */
> +		return -1;
> +
> +	if (0 == (temp & TSI108PIC_MASK)) {
> +		temp |= TSI108PIC_MASK;	/* mask IRQ prior making changes */
> +		tsi108_pic_write_reg(TSI108_INT_IVPR(src_num), temp);
> +	}
> +
> +	temp &= ~(TSI108PIC_INT_IVPR_MODE |
> +		  TSI108PIC_INT_IVPR_S | TSI108PIC_INT_IVPR_P);
> +
> +	temp |= (IRQ_SENSE_LEVEL == sense) ?
> +	    (TSI108PIC_INT_CSR_S_LEVEL) : (TSI108PIC_INT_CSR_S_EDGE);
> +	temp |= (IRQ_POLARITY_POSITIVE == polarity) ?
> +	    (TSI108PIC_INT_CSR_P_HIGH) : (TSI108PIC_INT_CSR_P_LOW);
> +
> +	tsi108_pic_write_reg(TSI108_INT_IVPR(src_num),
> +			     TSI108PIC_MASK | (mode << 29) | temp);
> +	return (0);
> +}
> +
> +int tsi108_pic_set_vector(int src_num,	/* source number */
> +			  int vect,	/* vector number */
> +			  int prio	/* interrupt source priority */
> +    )
> +{
> +	unsigned tmp;
> +
> +	tmp = tsi108_pic_read_reg(TSI108_INT_IVPR(src_num));
> +
> +	if (tmp & TSI108PIC_ACTIVITY)	/* error if source is active */
> +		return -1;
> +
> +	if (0 == (tmp & TSI108PIC_MASK)) {
> +		tmp |= TSI108PIC_MASK;	/* mask IRQ prior making changes */
> +		tsi108_pic_write_reg(TSI108_INT_IVPR(src_num), tmp);
> +	}
> +
> +	/* clear bits to be changed */
> +	tmp &= ~(TSI108PIC_VECTOR_MASK | TSI108PIC_PRIORITY_MASK);
> +
> +	tmp |= (prio << 16) | vect;
> +	tsi108_pic_write_reg(TSI108_INT_IVPR(src_num), tmp);
> +	return 0;
> +}
> +
> +void tsi108_pic_mask_all()
> +{
> +	int i;
> +	unsigned int vp;
> +
> +	/* Mask all external and internal interrupt sources */
> +	for (i = 0; i < TSI108PIC_MAX_SOURCES; i++) {
> +		vp = tsi108_pic_read_reg(TSI108_INT_IVPR(i));
> +		tsi108_pic_write_reg(TSI108_INT_IVPR(i), vp | TSI108PIC_MASK);
> +		mb();
> +
> +		/* Make sure that irq is masked */
> +		do {
> +			vp = tsi108_pic_read_reg(TSI108_INT_IVPR(i));
> +		} while ((vp & TSI108PIC_ACTIVITY) && !(vp & TSI108PIC_MASK));
> +	}
> +
> +	/* Mask all timer interrupts */
> +	for (i = 0; i < TSI108PIC_NUM_TIMERS; i++) {
> +		vp = tsi108_pic_read_reg(TSI108_INT_GTVPR(i));
> +		tsi108_pic_write_reg(TSI108_INT_GTVPR(i), vp | TSI108PIC_MASK);
> +		mb();
> +
> +		do {
> +			vp = tsi108_pic_read_reg(TSI108_INT_GTVPR(i));
> +		} while ((vp & TSI108PIC_ACTIVITY) && !(vp & TSI108PIC_MASK));
> +	}
> +
> +	/* Mask all doorbell interrupts */
> +	for (i = 0; i < TSI108PIC_NUM_DBELLS; i++) {
> +		vp = tsi108_pic_read_reg(TSI108_INT_DVPR(i));
> +		tsi108_pic_write_reg(TSI108_INT_IVPR(i), vp | TSI108PIC_MASK);
> +		mb();
> +
> +		do {
> +			vp = tsi108_pic_read_reg(TSI108_INT_DVPR(i));
> +		} while ((vp & TSI108PIC_ACTIVITY) && !(vp & TSI108PIC_MASK));
> +	}
> +
> +	/* Mask all mailbox interrupts */
> +	for (i = 0; i < 4; i++) {
> +		vp = tsi108_pic_read_reg(TSI108_INT_MBVPR(i));
> +		tsi108_pic_write_reg(TSI108_INT_MBVPR(i), vp | TSI108PIC_MASK);
> +		mb();
> +
> +		do {
> +			vp = tsi108_pic_read_reg(TSI108_INT_MBVPR(i));
> +		} while ((vp & TSI108PIC_ACTIVITY) && !(vp & TSI108PIC_MASK));
> +	}
> +}
> +
> +/*
> + * The Tsi108 PC initialization routine.
> + * A caller routine (usually from platform-specific code has to  
> provide
> + * sense/polarity configuration information for four external  
> interrupt
> + * sources INT0 - INT3. This should be done in form of four-byte  
> array
> + * (one byte per source ) that contains combination of sensitivity/ 
> polarity
> + * flags defined in asm-ppc/irq.h.
> + *
> + * Example of PIC initialization call is shown below:
> + *
> + *   u_char your_board_pic_initsenses[] __initdata = {
> + *	    (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),  // INT[0]
> + *	    (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),  // INT[1]
> + *	    (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),  // INT[2]
> + *	    (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE)   // INT[3]
> + *          };
> + *
> + * tsi108_pic_init(your_board_pic_initsenses);
> + */
> +
> +void __init tsi108_pic_init(u_char * board_init_senses)
> +{
> +	u_int i;
> +	u32 sense;
> +
> +	struct device_node *tsi_pic;
> +	tsi_pic = of_find_node_by_type(NULL, "open-pic");
> +	if (tsi_pic) {
> +		unsigned int size;
> +		void *prop = get_property(tsi_pic, "reg", &size);
> +		tsi108_pic_phy_addr = of_translate_address(tsi_pic, prop);
> +	}
> +
> +	DBG("%s: Tsi108 pic phy addr = 0x%x\n", __FUNCTION__,
> +	    (u32) tsi108_pic_phy_addr);
> +	if (tsi108_pic_phy_addr == 0) {
> +		printk("No tsi108 PIC found !\n");
> +		return;
> +	}
> +
> +	tsi108_pic_vir_addr = (u32) ioremap(tsi108_pic_phy_addr, 0x400);
> +
> +	tsi108_pic_reset();
> +
> +	if (ppc_md.progress)
> +		ppc_md.progress("tsi108_pic_init: enter", 0x122);
> +
> +	/* Initialize timer interrupts */
> +	for (i = 0; i < TSI108PIC_NUM_TIMERS; i++) {
> +		/* Disabled, Priority 0 */
> +		tsi108_pic_inittimer(i, 0, IRQ_TSI108_TIMER0 + i);
> +		/* No processor */
> +		tsi108_pic_maptimer(i, 0);
> +	}
> +
> +	/* Init board-specific external sources */
> +	for (i = 0; i < 4; i++) {
> +		sense = board_init_senses[i];
> +
> +		if (sense & IRQ_SENSE_MASK)
> +			irq_desc[TSI108_IRQ(i)].status |= IRQ_LEVEL;
> +
> +		/* Enabled, Priority 8 */
> +		tsi108_pic_initirq(i, 8, TSI108_IRQ(i),
> +				   (sense & IRQ_POLARITY_MASK),
> +				   (sense & IRQ_SENSE_MASK));
> +		/* Map to CPU #0 */
> +		tsi108_pic_mapirq(TSI108_IRQ(i), 1 << 0, 0);
> +	}
> +
> +	/* Init remaining internal sources. */
> +	for (; i < TSI108PIC_MAX_SOURCES; i++) {
> +		/* Disabled, Priority 8, by default - Positive Edge */
> +		tsi108_pic_initirq(i, 8, TSI108_IRQ(i),
> +				   IRQ_POLARITY_POSITIVE, IRQ_SENSE_EDGE);
> +		/* Map to CPU #0 */
> +		tsi108_pic_mapirq(TSI108_IRQ(i), (1 << 0), 0);
> +	}
> +
> +	/*
> +	 * Change sensitivity to level for sources that require it.
> +	 */
> +
> +	irq_desc[IRQ_TSI108_GIGE0].status |= IRQ_LEVEL;
> +	irq_desc[IRQ_TSI108_GIGE1].status |= IRQ_LEVEL;
> +	irq_desc[IRQ_TSI108_PCI].status |= IRQ_LEVEL;
> +
> +	/* Init descriptors */
> +	for (i = 0; i < TSI108PIC_MAX_SOURCES; i++)
> +		irq_desc[i + TSI108_IRQ_BASE].handler = &tsi108_pic_irq;
> +
> +	for (i = 0; i < NUM_PCI_IRQS; i++) {
> +		irq_desc[i + IRQ_PCI_INTAD_BASE].handler = &tsi108_pci_irq;
> +		irq_desc[i + IRQ_PCI_INTAD_BASE].status |= IRQ_LEVEL;
> +	}
> +
> +	/* Initialize the spurious interrupt */
> +	tsi108_pic_set_spurious(TSI108_IRQ_SPURIOUS);
> +	tsi108_pic_set_task_priority(0);
> +
> +	init_pci_source();
> +	tsi108_pic_enable_irq(IRQ_TSI108_PCI);
> +
> +	i = tsi108_pic_read_reg(TSI108_INT_VECTOR(0));
> +	tsi108_pic_write_reg(TSI108_INT_EOI(0), 0);
> +
> +	if (ppc_md.progress)
> +		ppc_md.progress("tsi108_pic_init: exit", 0x222);
> +}
> +
> +/*
> + *  Find out the current interrupt
> + */
> +static u_int tsi108_pic_get_vect(void)
> +{
> +	u_int vec;
> +
> +	vec = tsi108_pic_read_reg(TSI108_INT_VECTOR(0)) &  
> TSI108PIC_VECTOR_MASK;
> +
> +#ifdef DBG_TSI108_INTERRUPT
> +	if (vec == TSI108_IRQ_SPURIOUS)
> +		printk("TSI108: SPURIOUS vec=0x%08x\n", vec);
> +	else
> +		printk("TSI108: read vec=0x%08x\n", vec);
> +#endif
> +	return (vec);
> +}
> +
> +static inline void tsi108_pic_eoi(void)
> +{
> +	tsi108_pic_write_reg(TSI108_INT_EOI(0), 0);
> +	mb();
> +}
> +
> +static void __init tsi108_pic_set_task_priority(u_int pri)
> +{
> +	ASSERT(pri >= 0 && pri < TSI108PIC_NUM_PRI);
> +
> +	tsi108_pic_write_reg(TSI108_INT_TASKP(0),
> +			     pri & TSI108PIC_INT_TASKP_TASKP);
> +	mb();
> +}
> +
> +static void tsi108_pic_set_spurious(u_int vec)
> +{
> +	ASSERT(vec == TSI108_IRQ_SPURIOUS);
> +	tsi108_pic_write_reg(TSI108_INT_SVR, vec);
> +	mb();
> +}
> +
> +#ifdef CONFIG_SMP
> +/*
> + * Convert a cpu mask from logical to physical cpu numbers.
> + */
> +static inline u32 physmask(u32 cpumask)
> +{
> +	int i;
> +	u32 mask = 0;
> +
> +	for (i = 0; i < NR_CPUS; ++i, cpumask >>= 1)
> +		if (cpu_online(i))
> +			mask |= (cpumask & 1) << smp_hw_index[i];
> +	return mask;
> +}
> +#else
> +#define physmask(cpumask)	(cpumask)
> +#endif
> +
> +/*
> + *  Initialize a timer interrupt (and disable it)
> + *
> + *  timer: timer number
> + *  pri:   interrupt source priority
> + *  vec:   the vector it will produce
> + */
> +static void __init tsi108_pic_inittimer(u_int timer, u_int pri,  
> u_int vec)
> +{
> +	unsigned int gtvpr;
> +
> +	ASSERT(timer >= 0 && timer < TSI108PIC_NUM_TIMERS);
> +	ASSERT(pri >= 0 && pri < TSI108PIC_NUM_PRI);
> +	ASSERT(vec >= 0 && vec < TSI108PIC_NUM_VECTORS);
> +
> +	gtvpr = tsi108_pic_read_reg(TSI108_INT_GTVPR(timer));
> +	gtvpr &= ~(TSI108PIC_PRIORITY_MASK | TSI108PIC_VECTOR_MASK);
> +	gtvpr |= (pri << 16) | vec;
> +	tsi108_pic_write_reg(TSI108_INT_GTVPR(timer), gtvpr |  
> TSI108PIC_MASK);
> +	mb();
> +}
> +
> +/*
> + *  Map a timer interrupt to one or more CPUs
> + */
> +static void __init tsi108_pic_maptimer(u_int timer, u_int cpumask)
> +{
> +	ASSERT(timer >= 0 && timer < TSI108PIC_NUM_TIMERS);
> +
> +	tsi108_pic_write_reg(TSI108_INT_GTDR(timer), physmask(cpumask));
> +	mb();
> +}
> +
> +/*
> + * Initalize the interrupt source which will generate an NMI.
> + * This raises the interrupt's priority from 8 to 9.
> + *
> + * irq: The logical IRQ which generates an NMI.
> + */
> +void __init tsi108_pic_init_nmi_irq(u_int irq)
> +{
> +	u_int offset = get_vector_offset(irq);
> +	u_int vpr = tsi108_pic_read_reg(offset);
> +	vpr &= ~TSI108PIC_PRIORITY_MASK;
> +	tsi108_pic_write_reg(offset, vpr | (9 << 16));
> +	mb();
> +}
> +
> +/*
> + *
> + * All functions below take an offset'ed irq argument
> + *
> + */
> +
> +/*
> + * Hookup a cascade to the tsi108 PIC.
> + */
> +void __init
> +tsi108_pic_hookup_cascade(u_int irq, char *name,
> +			  int (*cascade_fn) (struct pt_regs *))
> +{
> +	tsi108_pic_cascade_irq = irq;
> +	tsi108_pic_cascade_fn = cascade_fn;
> +	if (request_irq(irq, no_action, SA_INTERRUPT, name, NULL))
> +		printk("Unable to get Tsi108 PIC IRQ %d for cascade\n",
> +		       irq - TSI108_IRQ_BASE);
> +}
> +
> +/*
> + *  Enable/disable an external interrupt source
> + *
> + *  Externally called, irq is an offseted system-wide interrupt  
> number
> + */
> +static void tsi108_pic_enable_irq(u_int irq)
> +{
> +	u32 offset = get_vector_offset(irq);
> +	u32 vpr = tsi108_pic_read_reg(offset);
> +
> +	/*
> +	 * Undo sensitivity change (see tsi108_pic_disable_irq())
> +	 */
> +	if (irq_desc[irq].status & IRQ_LEVEL)
> +		vpr |= TSI108PIC_INT_IVPR_S;
> +
> +	tsi108_pic_write_reg(offset, vpr & ~TSI108PIC_MASK);
> +	mb();
> +}
> +
> +static void tsi108_pic_disable_irq(u_int irq)
> +{
> +	u32 offset = get_vector_offset(irq);
> +	u32 vpr = tsi108_pic_read_reg(offset);
> +
> +	/*
> +	 * Switch level interrupt to edge sensitivity to avoid generation
> +	 * of spurious interrupt request. See design note in Tsi108 PIC
> +	 * section of Tsi108 manual.
> +	 */
> +	if (irq_desc[irq].status & IRQ_LEVEL)
> +		vpr &= ~TSI108PIC_INT_IVPR_S;
> +
> +	tsi108_pic_write_reg(offset, vpr | TSI108PIC_MASK);
> +	mb();
> +	vpr = tsi108_pic_read_reg(offset);
> +	if (!(vpr & TSI108PIC_MASK))
> +		printk("TSI108_PIC: Error - Unable disable IRQ %d\n", irq);
> +}
> +
> +/*
> + *  Initialize an interrupt source (and disable it!)
> + *
> + *  irq: Tsi108 PIC interrupt source number
> + *  pri: interrupt source priority
> + *  vec: the vector it will produce
> + *  pol: polarity (1 for positive, 0 for negative)
> + *  sense: 1 for level, 0 for edge
> + */
> +static void __init
> +tsi108_pic_initirq(u_int irq, u_int pri, u_int vec, int pol, int  
> sense)
> +{
> +	unsigned int ivpr;
> +
> +	ivpr = TSI108PIC_MASK | (pri << 16) | vec;
> +	ivpr |= (IRQ_SENSE_LEVEL == sense) ?
> +	    TSI108PIC_INT_IVPR_S_LEVEL : TSI108PIC_INT_IVPR_S_EDGE;
> +	ivpr |= (IRQ_POLARITY_POSITIVE == pol) ?
> +	    TSI108PIC_INT_IVPR_P_HIGH : TSI108PIC_INT_IVPR_P_LOW;
> +	tsi108_pic_write_reg(TSI108_INT_IVPR(irq), ivpr);
> +	mb();
> +}
> +
> +int tsi108_pic_set_irq_sense(int irq,	/* PIC source number */
> +			     int pol,	/* interrupt source polarity */
> +			     int sense	/* interrupt source sense */
> +    )
> +{
> +	unsigned int ivpr;
> +
> +	ivpr = tsi108_pic_read_reg(TSI108_INT_IVPR(irq));
> +
> +	if (ivpr & TSI108PIC_ACTIVITY)	/* error if source is active */
> +		return -1;
> +
> +	if (0 == (ivpr & TSI108PIC_MASK)) {
> +		ivpr |= TSI108PIC_MASK;	/* mask IRQ prior making changes */
> +		tsi108_pic_write_reg(TSI108_INT_IVPR(irq), ivpr);
> +	}
> +
> +	/* clear bits to be changed */
> +	ivpr &= ~(TSI108PIC_INT_IVPR_P | TSI108PIC_INT_IVPR_S);
> +
> +	ivpr |= (IRQ_SENSE_LEVEL == sense) ?
> +	    TSI108PIC_INT_IVPR_S_LEVEL : TSI108PIC_INT_IVPR_S_EDGE;
> +	ivpr |= (IRQ_POLARITY_POSITIVE == pol) ?
> +	    TSI108PIC_INT_IVPR_P_HIGH : TSI108PIC_INT_IVPR_P_LOW;
> +
> +	tsi108_pic_write_reg(TSI108_INT_IVPR(irq), ivpr);
> +	return 0;
> +}
> +
> +/*
> + *  Map an interrupt source to one or more CPUs
> + */
> +static void tsi108_pic_mapirq(u_int irq, u_int physmask, u_int  
> keepmask)
> +{
> +	u_int offset = get_vector_offset(irq);
> +
> +	if (0 == offset)
> +		return;
> +	if (keepmask != 0)
> +		physmask |= tsi108_pic_read_reg(offset + 4);
> +	tsi108_pic_write_reg(offset + 4, physmask);
> +	mb();
> +}
> +
> +/* No spinlocks, should not be necessary with the Tsi108 PIC
> + * (1 register = 1 interrupt and we have the desc lock).
> + */
> +static void tsi108_pic_ack_irq(unsigned int irq_nr)
> +{
> +	if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
> +		tsi108_pic_eoi();
> +}
> +
> +static void tsi108_pic_end_irq(unsigned int irq_nr)
> +{
> +	if ((irq_desc[irq_nr].status & IRQ_LEVEL) != 0)
> +		tsi108_pic_eoi();
> +}
> +
> +void tsi108_pic_set_affinity(unsigned int irq_nr, unsigned long  
> cpumask)
> +{
> +	tsi108_pic_mapirq(irq_nr, physmask(cpumask), 0);
> +}
> +
> +int tsi108_pic_get_irq(struct pt_regs *regs)
> +{
> +	int vector = tsi108_pic_get_vect();
> +
> +	if (vector == TSI108_IRQ_SPURIOUS) {
> +		vector = -1;
> +	}
> +
> +	if (vector == IRQ_TSI108_PCI) {
> +		vector = get_pci_source(vector);
> +	}
> +
> +	if (vector == -1) {
> +		tsi108_pic_write_reg(TSI108_INT_EOI(0), 0);
> +	}
> +
> +	return vector;
> +}
> +
> +static void tsi108_pci_int_mask(u_int irq)
> +{
> +	u_int irp_cfg;
> +	int int_line = (irq - IRQ_PCI_INTAD_BASE);
> +
> +	irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET +  
> TSI108_PCI_IRP_CFG_CTL);
> +	mb();
> +	irp_cfg |= (1 << int_line);	/* INTx_DIR = output */
> +	irp_cfg &= ~(3 << (8 + (int_line * 2)));	/* INTx_TYPE = unused */
> +	tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL,  
> irp_cfg);
> +	mb();
> +	irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET +  
> TSI108_PCI_IRP_CFG_CTL);
> +}
> +
> +static void tsi108_pci_int_unmask(u_int irq)
> +{
> +	u_int irp_cfg;
> +	int int_line = (irq - IRQ_PCI_INTAD_BASE);
> +
> +	irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET +  
> TSI108_PCI_IRP_CFG_CTL);
> +	mb();
> +	irp_cfg &= ~(1 << int_line);
> +	irp_cfg |= (3 << (8 + (int_line * 2)));
> +	tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL,  
> irp_cfg);
> +	mb();
> +}
> +
> +static void tsi108_pci_irq_enable(u_int irq)
> +{
> +	tsi108_pci_int_unmask(irq);
> +}
> +
> +static void tsi108_pci_irq_disable(u_int irq)
> +{
> +	tsi108_pci_int_mask(irq);
> +}
> +
> +static void tsi108_pci_irq_ack(u_int irq)
> +{
> +	tsi108_pci_int_mask(irq);
> +}
> +
> +static void tsi108_pci_irq_end(u_int irq)
> +{
> +	tsi108_pic_eoi();	/* eoi IRQ_TSI108_PCI */
> +	tsi108_pci_int_unmask(irq);
> +}
> +
> +static inline int get_pci_source(int vector)
> +{
> +	u_int temp = 0;
> +	int irq = -1;
> +	int i;
> +	u_int pci_irp_stat;
> +	static int mask = 0;
> +
> +	/* Read PCI/X block interrupt status register */
> +	pci_irp_stat = tsi108_read_reg(TSI108_PCI_OFFSET +  
> TSI108_PCI_IRP_STAT);
> +	mb();
> +
> +	if (pci_irp_stat & TSI108_PCI_IRP_STAT_P_INT) {
> +		/* Process Interrupt from PCI bus INTA# - INTD# lines */
> +		temp =
> +		    tsi108_read_reg(TSI108_PCI_OFFSET +
> +				    TSI108_PCI_IRP_INTAD) & 0xf;
> +		mb();
> +		for (i = 0; i < 4; i++, mask++) {
> +			if (temp & (1 << mask % 4)) {
> +				irq = IRQ_PCI_INTA + mask % 4;
> +				mask++;
> +				break;
> +			}
> +		}
> +	}
> +#ifdef DBG_TSI108_INTERRUPT
> +	else {
> +		printk("TSI108_PIC: error in TSI108_PCI_IRP_STAT\n");
> +		pci_irp_stat =
> +		    tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_STAT);
> +		temp =
> +		    tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_INTAD);
> +		mb();
> +		printk(">> stat=0x%08x intad=0x%08x ", pci_irp_stat, temp);
> +		temp =
> +		    tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL);
> +		mb();
> +		printk("cfg_ctl=0x%08x ", temp);
> +		temp =
> +		    tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE);
> +		mb();
> +		printk("irp_enable=0x%08x\n", temp);
> +	}
> +#endif				/* DBG_TSI108_INTERRUPT */
> +
> +	return irq;
> +}
> +
> +static void init_pci_source(void)
> +{
> +	tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL,
> +			0x0000ff00);
> +	tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE,
> +			0x00400000);
> +	mb();
> +}
> +
> +static struct sysdev_class tsi108_pic_sysclass = {
> +	set_kset_name("tsi108_pic"),
> +};
> +
> +static struct sys_device device_tsi108_pic = {
> +	.id = 0,
> +	.cls = &tsi108_pic_sysclass,
> +};
> +
> +static struct sysdev_driver driver_tsi108_pic = {
> +#ifdef CONFIG_PM		/* FIXME: placeholder for future development */
> +	.suspend = &tsi108_pic_suspend,
> +	.resume = &tsi108_pic_resume,
> +#endif				/* CONFIG_PM */
> +};
> +
> +static int __init init_tsi108_pic_sysfs(void)
> +{
> +	int rc;
> +
> +	if (!get_csrbase())
> +		return -ENODEV;
> +	printk(KERN_DEBUG "Registering tsi108_pic with sysfs...\n");
> +	rc = sysdev_class_register(&tsi108_pic_sysclass);
> +	if (rc) {
> +		printk(KERN_ERR "Failed registering tsi108_pic sys class\n");
> +		return -ENODEV;
> +	}
> +	rc = sysdev_register(&device_tsi108_pic);
> +	if (rc) {
> +		printk(KERN_ERR "Failed registering tsi108_pic sys device\n");
> +		return -ENODEV;
> +	}
> +	rc = sysdev_driver_register(&tsi108_pic_sysclass,  
> &driver_tsi108_pic);
> +	if (rc) {
> +		printk(KERN_ERR "Failed registering tsi108_pic sys driver\n");
> +		return -ENODEV;
> +	}
> +	return 0;
> +}
> +
> +subsys_initcall(init_tsi108_pic_sysfs);
> diff --git a/include/asm-powerpc/tsi108_pic.h b/include/asm-powerpc/ 
> tsi108_pic.h
> new file mode 100644
> index 0000000..7b23352
> --- /dev/null
> +++ b/include/asm-powerpc/tsi108_pic.h
> @@ -0,0 +1,232 @@
> +/*
> + * (C) Copyright 2005 Tundra Semiconductor Corp.
> + * Alex Bounine, <alexandreb@tundra.com).
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +/*
> + *  arch/ppc/syslib/tsi108_pic.h - Tsi108 Interrupt Controller  
> definitions
> + */
> +
> +#ifndef _LINUX_TSI108_PIC_H
> +#define _LINUX_TSI108_PIC_H
> +
> +#include <asm/tsi108_irq.h>
> +
> +#ifdef __KERNEL__
> +
> +/*
> + *  Tsi108 PIC supports up to 24 interrupt sources and up to 4  
> processors
> + */
> +
> +#define TSI108PIC_MAX_SOURCES		24
> +#define TSI108PIC_MAX_PROCESSORS	4
> +
> +#define TSI108PIC_NUM_TIMERS	4
> +#define TSI108PIC_NUM_DBELLS	4
> +#define TSI108PIC_NUM_PROC   	4
> +#define TSI108PIC_NUM_PRI	16
> +#define TSI108PIC_NUM_VECTORS	256
> +
> +/*
> + * Tsi108 PIC Register offsets within block.
> + */
> +
> +/* Registers controlling sources */
> +#define TSI108_INT_FRR		(0x000)
> +#define TSI108_INT_GCR		(0x004)
> +#define TSI108_INT_SVR		(0x010)
> +#define TSI108_INT_GTVPR(n)	(0x38 + 0x10*(n))
> +#define TSI108_INT_GTDR(n)	(0x3C + 0x10*(n))
> +#define TSI108_INT_IVPR(n)	(0x100 + 0x8*(n))
> +#define TSI108_INT_IDR(n)	(0x104 + 0x8*(n))
> +#define TSI108_INT_DVPR(n)	(0x204 + 0xC*(n))
> +#define TSI108_INT_DDR(n)	(0x208 + 0xC*(n))
> +#define TSI108_INT_MBVPR(n)	(0x284 + 0x10*(n))
> +#define TSI108_INT_MBDR(n)	(0x288 + 0x10*(n))
> +
> +/* Registers controlling destinations */
> +#define TSI108_INT_TASKP(n)	(0x300 + 0x40*(n))
> +#define TSI108_INT_VECTOR(n)	(0x304 + 0x40*(n))
> +#define TSI108_INT_EOI(n)	(0x308 + 0x40*(n))
> +#define TSI108_INT_CSR(n)	(0x30C + 0x40*(n))
> +
> +/*
> + * Generic definitions common for different types of interrupt
> + * sources.
> + */
> +
> +#define TSI108PIC_MASK		(0x80000000)
> +#define TSI108PIC_ACTIVITY	(0x40000000)
> +#define TSI108PIC_PRIORITY_MASK	(0x000f0000)
> +#define TSI108PIC_VECTOR_MASK	(0x000000ff)
> +
> +/**********************************************************
> + * Register Bit Masks definitions for every register
> + */
> +
> +/* TSI108PIC_INT_FRR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_FRR_VID			(0x000000ff)
> +#define TSI108PIC_INT_FRR_NCPU			(0x00001f00)
> +#define TSI108PIC_INT_FRR_NITM			(0x0000e000)
> +#define TSI108PIC_INT_FRR_NIRQ			(0x07ff0000)
> +#define TSI108PIC_INT_FRR_NIDOOR		(0xe0000000)
> +#define TSI108PIC_INT_FRR_RESERVED		(0x18000000)
> +
> +/* TSI108PIC_INT_GCR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_GCR_R			(0x80000000)
> +#define TSI108PIC_INT_GCR_RESERVED		(0x7fffffff)
> +
> +/* TSI108PIC_INT_ICR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_ICR_R			(0x0000000f)
> +#define TSI108PIC_INT_ICR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_MVI : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_MVI_VID			(0x000000ff)
> +#define TSI108PIC_INT_MVI_DID			(0x0000ff00)
> +#define TSI108PIC_INT_MVI_STEP			(0x00ff0000)
> +#define TSI108PIC_INT_MVI_RESERVED		(0xff000000)
> +
> +/* TSI108PIC_INT_SVR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_SVR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_SVR_RESERVED		(0xffffff00)
> +
> +/* TSI108PIC_INT_TFRR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_TFRR_TIME_FREQ		(0xffffffff)
> +
> +/* TSI108PIC_INT_SOFT_SET : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_SOFT_SET_S		(0x00ffffff)
> +#define TSI108PIC_INT_SOFT_SET_RESERVED		(0xff000000)
> +
> +/* TSI108PIC_INT_SOFT_ENABLE : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_SOFT_ENABLE_EN		(0x00ffffff)
> +#define TSI108PIC_INT_SOFT_ENABLE_RESERVED	(0xff000000)
> +
> +/* TSI108PIC_INT_GTCCR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_GTCCR_COUNT		(0x7fffffff)
> +#define TSI108PIC_INT_GTCCR_T			(0x80000000)
> +
> +/* TSI108PIC_INT_GTBCR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_GTBCR_B_COUNT		(0x7fffffff)
> +#define TSI108PIC_INT_GTBCR_CI			(0x80000000)
> +
> +/* TSI108PIC_INT_GTVPR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_GTVPR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_GTVPR_PRIORITY		(0x000f0000)
> +#define TSI108PIC_INT_GTVPR_PRESCALE		(0x00f00000)
> +#define TSI108PIC_INT_GTVPR_A			(0x40000000)
> +#define TSI108PIC_INT_GTVPR_M			(0x80000000)
> +#define TSI108PIC_INT_GTVPR_RESERVED		(0x3f00ff00)
> +
> +/* TSI108PIC_INT_GTDR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_GTDR_SEL_OUT		(0x0000000f)
> +#define TSI108PIC_INT_GTDR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_IVPR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_IVPR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_IVPR_PRIORITY		(0x000f0000)
> +
> +#define TSI108PIC_INT_IVPR_P			(0x01000000)
> +#define TSI108PIC_INT_IVPR_P_LOW		(0 << 24)
> +#define TSI108PIC_INT_IVPR_P_HIGH		(1 << 24)
> +
> +#define TSI108PIC_INT_IVPR_S			(0x02000000)
> +#define TSI108PIC_INT_IVPR_S_EDGE		(0 << 25)
> +#define TSI108PIC_INT_IVPR_S_LEVEL		(1 << 25)
> +
> +#define TSI108PIC_INT_IVPR_MODE			(0x20000000)
> +#define TSI108PIC_INT_IVPR_A			(0x40000000)
> +#define TSI108PIC_INT_IVPR_M			(0x80000000)
> +#define TSI108PIC_INT_IVPR_RESERVED		(0x1cf0ff00)
> +
> +/* TSI108PIC_INT_IDR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_IDR_SEL_OUT		(0x0000000f)
> +#define TSI108PIC_INT_IDR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_DAR : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_DAR_A			(0x0000000f)
> +#define TSI108PIC_INT_DAR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_DVPR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_DVPR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_DVPR_PRIORITY		(0x000f0000)
> +#define TSI108PIC_INT_DVPR_A			(0x40000000)
> +#define TSI108PIC_INT_DVPR_M			(0x80000000)
> +#define TSI108PIC_INT_DVPR_RESERVED		(0x3ff0ff00)
> +
> +/* TSI108PIC_INT_DDR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_DDR_SEL_OUT		(0x0000000f)
> +#define TSI108PIC_INT_DDR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_DMR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_DMR_M			(0xffffffff)
> +
> +/* TSI108PIC_INT_MBR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_MBR_M			(0xffffffff)
> +
> +/* TSI108PIC_INT_MBVPR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_MBVPR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_MBVPR_PRIORITY		(0x000f0000)
> +#define TSI108PIC_INT_MBVPR_A			(0x40000000)
> +#define TSI108PIC_INT_MBVPR_M			(0x80000000)
> +#define TSI108PIC_INT_MBVPR_RESERVED		(0x3ff0ff00)
> +
> +/* TSI108PIC_INT_MBDR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_MBDR_SEL_OUT		(0x0000000f)
> +#define TSI108PIC_INT_MBDR_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_TASKP(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_TASKP_TASKP		(0x0000000f)
> +#define TSI108PIC_INT_TASKP_RESERVED		(0xfffffff0)
> +
> +/* TSI108PIC_INT_VECTOR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_VECTOR_VECTOR		(0x000000ff)
> +#define TSI108PIC_INT_VECTOR_LS_VECTOR		(0xff000000)
> +#define TSI108PIC_INT_VECTOR_RESERVED		(0x00ffff00)
> +
> +/* TSI108PIC_INT_EOI(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_EOI_EOI			(0x000000ff)
> +#define TSI108PIC_INT_EOI_RESERVED		(0xffffff00)
> +
> +/* TSI108PIC_INT_CSR(X) : Register Bits Masks Definitions */
> +#define TSI108PIC_INT_CSR_RESERVED		(0xfffffffc)
> +
> +#define TSI108PIC_INT_CSR_P			(1 << 0)
> +#define TSI108PIC_INT_CSR_P_LOW			(0 << 0)
> +#define TSI108PIC_INT_CSR_P_HIGH		(1 << 0)
> +
> +#define TSI108PIC_INT_CSR_S			(1 << 1)
> +#define TSI108PIC_INT_CSR_S_EDGE		(0 << 1)
> +#define TSI108PIC_INT_CSR_S_LEVEL		(1 << 1)
> +
> +extern void tsi108_pic_init(u_char * board_init_senses);
> +extern void tsi108_pic_reset(void);
> +extern void tsi108_pic_set_output(int dest_num, u32 sense, u32  
> polarity);
> +extern int tsi108_pic_source_cfg(int src_num, u32 sense,
> +				 u32 polarity, TSI108_IRQ_MODE mode);
> +extern int tsi108_pic_set_vector(int src_num, int vect, int prio);
> +extern void tsi108_pic_init_nmi_irq(u_int irq);
> +extern void tsi108_pic_hookup_cascade(u_int irq, char *name,
> +				      int (*cascade_fn) (struct pt_regs *));
> +extern int tsi108_pic_get_irq(struct pt_regs *regs);
> +
> +#endif				/* __KERNEL__ */
> +
> +#endif				/* _LINUX_TSI108_PIC_H */
> -- 
> 1.3.0
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH/2.6.17-rc4 6/10]  Add  Tundra pci vendor and device ID
From: Kumar Gala @ 2006-05-17 16:04 UTC (permalink / raw)
  To: Zang Roy-r61911
  Cc: linuxppc-dev list, Yang Xin-Xin-r48390, Paul Mackerras,
	Alexandre.Bounine
In-Reply-To: <9FCDBA58F226D911B202000BDBAD46730626D623@zch01exm40.ap.freescale.net>


On May 17, 2006, at 5:14 AM, Zang Roy-r61911 wrote:

> Add Tundra Semiconductor pci host bridge vendor ID and device ID
>
> Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
> Signed-off-by: Roy Zang	<tie-fei.zang@freescale.com>

Did you guys submit http://pciids.sourceforge.net/ ?

- k

> ---
>
>  include/linux/pci_ids.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> 14bddf6670ca982d5cee57afa472d2199e2170fc
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index d6fe048..c39fcfc 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2276,3 +2276,7 @@ #define PCI_DEVICE_ID_RME_DIGI32	0x9896
>  #define PCI_DEVICE_ID_RME_DIGI32_PRO	0x9897
>  #define PCI_DEVICE_ID_RME_DIGI32_8	0x9898
>
> +#define PCI_VENDOR_ID_TUNDRA		0x10e3
> +#define PCI_DEVICE_ID_TUNDRA_CA91C042	0x0000
> +#define PCI_DEVICE_ID_TUNDRA_TSI108	0x0108
> +#define PCI_DEVICE_ID_TUNDRA_TSI109	0xA108
> -- 
> 1.3.0
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [RFC PATCH 00/09] robust VM per_cpu variables
From: Steven Rostedt @ 2006-05-17 15:56 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Andrew Morton, linux-mips, David Mosberger-Tang, linux-ia64,
	Martin Mares, spyro, Joe Taylor, Andi Kleen, linuxppc-dev,
	Paul Mackerras, benedict.gaster, sam, bjornw, kenneth.w.chen,
	Ingo Molnar, kiran, Nick Piggin, grundler, arnd, Rusty Russell,
	starvik, Linus Torvalds, Thomas Gleixner, rth, Chris Zankel,
	tony.luck, LKML, ralf, Marc Gauthier, lethal, schwidefsky,
	linux390, davem, parisc-linux
In-Reply-To: <Pine.LNX.4.64.0605170846190.13337@schroedinger.engr.sgi.com>

On Wed, 17 May 2006, Christoph Lameter wrote:

> On Wed, 17 May 2006, Steven Rostedt wrote:
>
> > OK, now I'm just rambling. I don't know,  have any other ideas on making
> > this more robust?  Or is this all in vain, and I should spend my evenings
> > walking around this beautiful town of Karlsruhe ;)
>
> Well I'd like to see a comprehensive solution including a fix for the
> problems with allocper_cpu() allocations (allocper_cpu has to allocate
> memory for potential processors... which could be a lot on
> some types of systems and its allocated somewhere not on the nodes of the
> processor since they may not yet be online).

OK, now you're beyond what I'm working with ;)  No hot plug CPUs for me.
Well, at least not yet!

>
> Wish I could be back home in Germany to talk a walk with you. Are you
> coming to the OLS?

I'm just here on business. Will be back home in the States on Saturday.

Yep, I'll be at OLS.  Hopefully we can get a group together to do some
brainstorming.

Thanks,

-- Steve

^ permalink raw reply

* Re: [RFC PATCH 00/09] robust VM per_cpu variables
From: Christoph Lameter @ 2006-05-17 15:49 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Andrew Morton, linux-mips, David Mosberger-Tang, linux-ia64,
	Martin Mares, spyro, Joe Taylor, Andi Kleen, linuxppc-dev,
	Paul Mackerras, benedict.gaster, sam, bjornw, kenneth.w.chen,
	Ingo Molnar, kiran, Nick Piggin, grundler, arnd, Rusty Russell,
	starvik, Linus Torvalds, Thomas Gleixner, rth, Chris Zankel,
	tony.luck, LKML, ralf, Marc Gauthier, lethal, schwidefsky,
	linux390, davem, parisc-linux
In-Reply-To: <Pine.LNX.4.58.0605171104100.13160@gandalf.stny.rr.com>

On Wed, 17 May 2006, Steven Rostedt wrote:

> OK, now I'm just rambling. I don't know,  have any other ideas on making
> this more robust?  Or is this all in vain, and I should spend my evenings
> walking around this beautiful town of Karlsruhe ;)

Well I'd like to see a comprehensive solution including a fix for the 
problems with allocper_cpu() allocations (allocper_cpu has to allocate 
memory for potential processors... which could be a lot on 
some types of systems and its allocated somewhere not on the nodes of the 
processor since they may not yet be online).

Wish I could be back home in Germany to talk a walk with you. Are you 
coming to the OLS?

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox