LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Current git very broken on the Dreamcast
@ 2008-02-16 18:38 Adrian McMenamin
  2008-02-16 19:48 ` Adrian McMenamin
  2008-02-17 19:40 ` Kristoffer Ericson
  0 siblings, 2 replies; 8+ messages in thread
From: Adrian McMenamin @ 2008-02-16 18:38 UTC (permalink / raw)
  To: linux-sh, LKML

Will seek to bisect this, but I have just updated my sources to the
latest git and it is not booting at all on the Dreamcast.

With early printk on, I get nothing more than this before an instant
reboot:

[    0.000000] Linux version 2.6.25-rc2-10953-g52065cd
(adrian@bossclass) (gcc version 3.4.6) #511 PREEMPT Sat Feb 16 18:31:43
GMT 2008
[    0.000000] console [sercon0] enabled
[    0.000000] Booting machvec: Sega Dreamcast



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 18:38 Current git very broken on the Dreamcast Adrian McMenamin
@ 2008-02-16 19:48 ` Adrian McMenamin
  2008-02-16 19:59   ` Adrian McMenamin
  2008-02-18  8:57   ` Magnus Damm
  2008-02-17 19:40 ` Kristoffer Ericson
  1 sibling, 2 replies; 8+ messages in thread
From: Adrian McMenamin @ 2008-02-16 19:48 UTC (permalink / raw)
  To: linux-sh, Paul Mundt, Magnus Damm, matsi; +Cc: LKML


On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> Will seek to bisect this, but I have just updated my sources to the
> latest git and it is not booting at all on the Dreamcast.
> 
> With early printk on, I get nothing more than this before an instant
> reboot:
> 
> [    0.000000] Linux version 2.6.25-rc2-10953-g52065cd
> (adrian@bossclass) (gcc version 3.4.6) #511 PREEMPT Sat Feb 16 18:31:43
> GMT 2008
> [    0.000000] console [sercon0] enabled
> [    0.000000] Booting machvec: Sega Dreamcast


adrian@bossclass:~/gdrom-dev$ git bisect good
e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
commit e036eaa681a17f71b64f6d9040fe605555623919
Author: Magnus Damm <magnus.damm@gmail.com>
Date:   Thu Feb 14 13:52:43 2008 +0900

    sh: use ctrl_in/out for on chip pci access
    
    This patch makes sure ctrl_inN/outN are used instead of inN/outN for
on chip
    pci registers. Without this patch addresses may be adjusted using
the value
    in generic_io_base. This patch makes it possible to set
generic_io_base and
    have pci without reading and writing all over the place.
    
    Signed-off-by: Magnus Damm <damm@igel.co.jp>
    Acked-by: Katsuya MATSUBARA <matsu@igel.co.jp>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>

:040000 040000 17a9f8181301e3a082d8a1a2fdef9b13ff1185e4
87e4a2e912be56b0d12e8a92db9489d6615c31f7 M      arch


I'll now try reverting this and seeing what happens....


Adrian


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 19:48 ` Adrian McMenamin
@ 2008-02-16 19:59   ` Adrian McMenamin
  2008-02-17 19:42     ` Kristoffer Ericson
  2008-02-17 19:55     ` Kristoffer Ericson
  2008-02-18  8:57   ` Magnus Damm
  1 sibling, 2 replies; 8+ messages in thread
From: Adrian McMenamin @ 2008-02-16 19:59 UTC (permalink / raw)
  To: linux-sh; +Cc: Paul Mundt, Magnus Damm, matsu, LKML


On Sat, 2008-02-16 at 19:48 +0000, Adrian McMenamin wrote:
> On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> > Will seek to bisect this, but I have just updated my sources to the
> > latest git and it is not booting at all on the Dreamcast.
> > 

> adrian@bossclass:~/gdrom-dev$ git bisect good
> e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
> commit e036eaa681a17f71b64f6d9040fe605555623919
> Author: Magnus Damm <magnus.damm@gmail.com>
> Date:   Thu Feb 14 13:52:43 2008 +0900
> 

Reverting this commit *will* let my Dreamcast boot - can it be rolled
back pending further testing for a patch please?

Adrian


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 18:38 Current git very broken on the Dreamcast Adrian McMenamin
  2008-02-16 19:48 ` Adrian McMenamin
@ 2008-02-17 19:40 ` Kristoffer Ericson
  1 sibling, 0 replies; 8+ messages in thread
From: Kristoffer Ericson @ 2008-02-17 19:40 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: linux-sh, LKML

On Sat, 16 Feb 2008 18:38:00 +0000
Adrian McMenamin <adrian@newgolddream.dyndns.info> wrote:

> Will seek to bisect this, but I have just updated my sources to the
> latest git and it is not booting at all on the Dreamcast.
> 
> With early printk on, I get nothing more than this before an instant
> reboot:

I haven't tested anything after 2.6.24 vanilla which works fine. A bisect sounds like a good idea since you
got pretty much zero clues.

> 
> [    0.000000] Linux version 2.6.25-rc2-10953-g52065cd
> (adrian@bossclass) (gcc version 3.4.6) #511 PREEMPT Sat Feb 16 18:31:43
> GMT 2008
> [    0.000000] console [sercon0] enabled
> [    0.000000] Booting machvec: Sega Dreamcast
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 19:59   ` Adrian McMenamin
@ 2008-02-17 19:42     ` Kristoffer Ericson
  2008-02-17 19:55     ` Kristoffer Ericson
  1 sibling, 0 replies; 8+ messages in thread
From: Kristoffer Ericson @ 2008-02-17 19:42 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: linux-sh, Paul Mundt, Magnus Damm, matsu, LKML

On Sat, 16 Feb 2008 19:59:48 +0000
Adrian McMenamin <adrian@newgolddream.dyndns.info> wrote:

> 
> On Sat, 2008-02-16 at 19:48 +0000, Adrian McMenamin wrote:
> > On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> > > Will seek to bisect this, but I have just updated my sources to the
> > > latest git and it is not booting at all on the Dreamcast.
> > > 
> 
> > adrian@bossclass:~/gdrom-dev$ git bisect good
> > e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
> > commit e036eaa681a17f71b64f6d9040fe605555623919
> > Author: Magnus Damm <magnus.damm@gmail.com>
> > Date:   Thu Feb 14 13:52:43 2008 +0900
> > 
> 
> Reverting this commit *will* let my Dreamcast boot - can it be rolled
> back pending further testing for a patch please?

Since you know the cause I'm sure Magnus will have some ideas about why it broke, so just hold on for him to reply.

> 
> Adrian
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 19:59   ` Adrian McMenamin
  2008-02-17 19:42     ` Kristoffer Ericson
@ 2008-02-17 19:55     ` Kristoffer Ericson
  1 sibling, 0 replies; 8+ messages in thread
From: Kristoffer Ericson @ 2008-02-17 19:55 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: linux-sh, Paul Mundt, Magnus Damm, matsu, LKML

On Sat, 16 Feb 2008 19:59:48 +0000
Adrian McMenamin <adrian@newgolddream.dyndns.info> wrote:

> 
> On Sat, 2008-02-16 at 19:48 +0000, Adrian McMenamin wrote:
> > On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> > > Will seek to bisect this, but I have just updated my sources to the
> > > latest git and it is not booting at all on the Dreamcast.
> > > 
> 
> > adrian@bossclass:~/gdrom-dev$ git bisect good
> > e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
> > commit e036eaa681a17f71b64f6d9040fe605555623919
> > Author: Magnus Damm <magnus.damm@gmail.com>
> > Date:   Thu Feb 14 13:52:43 2008 +0900
> > 
> 
> Reverting this commit *will* let my Dreamcast boot - can it be rolled
> back pending further testing for a patch please?
> 

Just had a look at the patch. If that patch made your dreamcast not boot then you had somekind of
io_base that was used in in/out. Perhaps its better to adjust your PORT defines than work around the issue?

> Adrian
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-16 19:48 ` Adrian McMenamin
  2008-02-16 19:59   ` Adrian McMenamin
@ 2008-02-18  8:57   ` Magnus Damm
  2008-02-18 20:11     ` Adrian McMenamin
  1 sibling, 1 reply; 8+ messages in thread
From: Magnus Damm @ 2008-02-18  8:57 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: linux-sh, Paul Mundt, matsu, LKML

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

Hi Adrian,

[fixed up Matsubara-sans address]

On Feb 17, 2008 4:48 AM, Adrian McMenamin
<adrian@newgolddream.dyndns.info> wrote:
> On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> > Will seek to bisect this, but I have just updated my sources to the
> > latest git and it is not booting at all on the Dreamcast.
> >
> > With early printk on, I get nothing more than this before an instant
> > reboot:
> >
> > [    0.000000] Linux version 2.6.25-rc2-10953-g52065cd
> > (adrian@bossclass) (gcc version 3.4.6) #511 PREEMPT Sat Feb 16 18:31:43
> > GMT 2008
> > [    0.000000] console [sercon0] enabled
> > [    0.000000] Booting machvec: Sega Dreamcast
>
>
> adrian@bossclass:~/gdrom-dev$ git bisect good
> e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
> commit e036eaa681a17f71b64f6d9040fe605555623919
> Author: Magnus Damm <magnus.damm@gmail.com>
> Date:   Thu Feb 14 13:52:43 2008 +0900
>
>     sh: use ctrl_in/out for on chip pci access
>
>     This patch makes sure ctrl_inN/outN are used instead of inN/outN for
> on chip
>     pci registers. Without this patch addresses may be adjusted using
> the value
>     in generic_io_base. This patch makes it possible to set
> generic_io_base and
>     have pci without reading and writing all over the place.
>
>     Signed-off-by: Magnus Damm <damm@igel.co.jp>
>     Acked-by: Katsuya MATSUBARA <matsu@igel.co.jp>
>     Signed-off-by: Paul Mundt <lethal@linux-sh.org>
>
> :040000 040000 17a9f8181301e3a082d8a1a2fdef9b13ff1185e4
> 87e4a2e912be56b0d12e8a92db9489d6615c31f7 M      arch

Thanks for tracking this down and sorry for breaking the dreamcast pci driver.

Most code for the dreamcast currently do direct register access using
ctrl_inN/outN or readN/writeN. Only a few places use inN/outN and
depend on the value of generic_io_base. Doing inN/outN is ok (but
outdated, use ioreadN/iowriteN instead) in a portable pci/isa driver,
but it doesn't make sense for any dreamcast specific code to rely on
generic_io_base. For the dreamcast we already know the address at
compile time so doing adjustment during runtime is just unnecessary
overhead.

It is of course possible to revert the dreamcast-specific bits of the
commit you pointed out, but I think the change for the dreamcast makes
sense since it makes the code both faster and more uniform.

However, at this point it is broken. Sorry about that. I just looked
through all upstream dreamcast-specific code I could find and irq.c is
now the only file that does inN/outN. I've attached a patch that makes
the irq code independent of generic_io_base. There is also another
patch attached that adjusts the addresses of the pci register.
Together they should solve the problem you are seeing. Please try them
on top of 2.6.25-rc2.

With these patches io ports count from 0 -> 8k-1 instead of being a
pointer. We currently rely on generic_io_base logic but that will be
changed in the future.

Please let me know the results. Thank you.

/ magnus

[-- Attachment #2: linux-2.6.25-rc2-sh-dreamcast-irq-20080218.patch --]
[-- Type: application/octet-stream, Size: 2260 bytes --]

--- 0001/arch/sh/boards/dreamcast/irq.c
+++ work/arch/sh/boards/dreamcast/irq.c	2008-02-18 17:02:08.000000000 +0900
@@ -12,6 +12,7 @@
 #include <linux/irq.h>
 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/addrspace.h>
 #include <asm/dreamcast/sysasic.h>
 
 /* Dreamcast System ASIC Hardware Events -
@@ -40,8 +41,8 @@
 
 */
 
-#define ESR_BASE 0x005f6900    /* Base event status register */
-#define EMR_BASE 0x005f6910    /* Base event mask register */
+#define ESR_BASE P2SEGADDR(0x005f6900)    /* Base event status register */
+#define EMR_BASE P2SEGADDR(0x005f6910)    /* Base event mask register */
 
 /* Helps us determine the EMR group that this event belongs to: 0 = 0x6910,
    1 = 0x6920, 2 = 0x6930; also determine the event offset */
@@ -59,9 +60,9 @@ static inline void disable_systemasic_ir
         __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
         __u32 mask;
 
-        mask = inl(emr);
+        mask = ctrl_inl(emr);
         mask &= ~(1 << EVENT_BIT(irq));
-        outl(mask, emr);
+        ctrl_outl(mask, emr);
 }
 
 /* Enable the hardware event by setting its bit in its EMR */
@@ -70,9 +71,9 @@ static inline void enable_systemasic_irq
         __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
         __u32 mask;
 
-        mask = inl(emr);
+        mask = ctrl_inl(emr);
         mask |= (1 << EVENT_BIT(irq));
-        outl(mask, emr);
+        ctrl_outl(mask, emr);
 }
 
 /* Acknowledge a hardware event by writing its bit back to its ESR */
@@ -80,7 +81,7 @@ static void ack_systemasic_irq(unsigned 
 {
         __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
         disable_systemasic_irq(irq);
-        outl((1 << EVENT_BIT(irq)), esr);
+        ctrl_outl((1 << EVENT_BIT(irq)), esr);
 }
 
 /* After a IRQ has been ack'd and responded to, it needs to be renabled */
@@ -137,8 +138,8 @@ int systemasic_irq_demux(int irq)
         esr = ESR_BASE + (level << 2);
 
         /* Mask the ESR to filter any spurious, unwanted interrupts */
-        status = inl(esr);
-        status &= inl(emr);
+        status = ctrl_inl(esr);
+        status &= ctrl_inl(emr);
 
         /* Now scan and find the first set bit as the event to map */
         for (bit = 1, j = 0; j < 32; bit <<= 1, j++) {

[-- Attachment #3: linux-2.6.25-rc2-sh-dreamcast-pci-20080218b.patch --]
[-- Type: application/octet-stream, Size: 1668 bytes --]

--- 0001/arch/sh/boards/dreamcast/setup.c
+++ work/arch/sh/boards/dreamcast/setup.c	2008-02-18 17:05:45.000000000 +0900
@@ -43,8 +43,6 @@ static void __init dreamcast_setup(char 
 	/* Acknowledge any previous events */
 	/* XXX */
 
-	__set_io_port_base(0xa0000000);
-
 	/* Assign all virtual IRQs to the System ASIC int. handler */
 	for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++)
 		irq_desc[i].chip = &systemasic_int;
--- 0001/arch/sh/drivers/pci/ops-dreamcast.c
+++ work/arch/sh/drivers/pci/ops-dreamcast.c	2008-02-18 17:06:19.000000000 +0900
@@ -29,8 +29,8 @@
 
 static struct resource gapspci_io_resource = {
 	.name	= "GAPSPCI IO",
-	.start	= GAPSPCI_BBA_CONFIG,
-	.end	= GAPSPCI_BBA_CONFIG + GAPSPCI_BBA_CONFIG_SIZE - 1,
+	.start	= 0,
+	.end	= GAPSPCI_BBA_CONFIG_SIZE - 1,
 	.flags	= IORESOURCE_IO,
 };
 
@@ -158,6 +158,8 @@ int __init gapspci_init(void)
 	ctrl_outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10);
 	ctrl_outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14);
 
+	__set_io_port_base(GAPSPCI_BBA_CONFIG);
+
 	return 0;
 }
 
--- 0001/include/asm-sh/dreamcast/pci.h
+++ work/include/asm-sh/dreamcast/pci.h	2008-02-18 17:18:10.000000000 +0900
@@ -11,12 +11,13 @@
 #ifndef __ASM_SH_DREAMCAST_PCI_H
 #define __ASM_SH_DREAMCAST_PCI_H
 
+#include <asm/addrspace.h>
 #include <asm/mach/sysasic.h>
 
-#define	GAPSPCI_REGS		0x01001400
-#define GAPSPCI_DMA_BASE	0x01840000
+#define GAPSPCI_REGS		P2SEGADDR(0x01001400)
+#define GAPSPCI_DMA_BASE	P2SEGADDR(0x01840000)
 #define GAPSPCI_DMA_SIZE	32768
-#define GAPSPCI_BBA_CONFIG	0x01001600
+#define GAPSPCI_BBA_CONFIG	P2SEGADDR(0x01001600)
 #define GAPSPCI_BBA_CONFIG_SIZE	0x2000
 
 #define	GAPSPCI_IRQ		HW_EVENT_EXTERNAL

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Current git very broken on the Dreamcast
  2008-02-18  8:57   ` Magnus Damm
@ 2008-02-18 20:11     ` Adrian McMenamin
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian McMenamin @ 2008-02-18 20:11 UTC (permalink / raw)
  To: Magnus Damm; +Cc: linux-sh, Paul Mundt, matsu, LKML


On Mon, 2008-02-18 at 17:57 +0900, Magnus Damm wrote:
> Hi Adrian,
> 
> [fixed up Matsubara-sans address]
> 
> On Feb 17, 2008 4:48 AM, Adrian McMenamin
> <adrian@newgolddream.dyndns.info> wrote:
> > On Sat, 2008-02-16 at 18:38 +0000, Adrian McMenamin wrote:
> > > Will seek to bisect this, but I have just updated my sources to the
> > > latest git and it is not booting at all on the Dreamcast.
> > >
> > > With early printk on, I get nothing more than this before an instant
> > > reboot:
> > >
> > > [    0.000000] Linux version 2.6.25-rc2-10953-g52065cd
> > > (adrian@bossclass) (gcc version 3.4.6) #511 PREEMPT Sat Feb 16 18:31:43
> > > GMT 2008
> > > [    0.000000] console [sercon0] enabled
> > > [    0.000000] Booting machvec: Sega Dreamcast
> >
> >
> > adrian@bossclass:~/gdrom-dev$ git bisect good
> > e036eaa681a17f71b64f6d9040fe605555623919 is first bad commit
> > commit e036eaa681a17f71b64f6d9040fe605555623919
> > Author: Magnus Damm <magnus.damm@gmail.com>
> > Date:   Thu Feb 14 13:52:43 2008 +0900
> >
> >     sh: use ctrl_in/out for on chip pci access
> >
> >     This patch makes sure ctrl_inN/outN are used instead of inN/outN for
> > on chip
> >     pci registers. Without this patch addresses may be adjusted using
> > the value
> >     in generic_io_base. This patch makes it possible to set
> > generic_io_base and
> >     have pci without reading and writing all over the place.
> >
> >     Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >     Acked-by: Katsuya MATSUBARA <matsu@igel.co.jp>
> >     Signed-off-by: Paul Mundt <lethal@linux-sh.org>
> >
> > :040000 040000 17a9f8181301e3a082d8a1a2fdef9b13ff1185e4
> > 87e4a2e912be56b0d12e8a92db9489d6615c31f7 M      arch
> 
> Thanks for tracking this down and sorry for breaking the dreamcast pci driver.
> 
> Most code for the dreamcast currently do direct register access using
> ctrl_inN/outN or readN/writeN. Only a few places use inN/outN and
> depend on the value of generic_io_base. Doing inN/outN is ok (but
> outdated, use ioreadN/iowriteN instead) in a portable pci/isa driver,
> but it doesn't make sense for any dreamcast specific code to rely on
> generic_io_base. For the dreamcast we already know the address at
> compile time so doing adjustment during runtime is just unnecessary
> overhead.
> 
> It is of course possible to revert the dreamcast-specific bits of the
> commit you pointed out, but I think the change for the dreamcast makes
> sense since it makes the code both faster and more uniform.
> 
> However, at this point it is broken. Sorry about that. I just looked
> through all upstream dreamcast-specific code I could find and irq.c is
> now the only file that does inN/outN. I've attached a patch that makes
> the irq code independent of generic_io_base. There is also another
> patch attached that adjusts the addresses of the pci register.
> Together they should solve the problem you are seeing. Please try them
> on top of 2.6.25-rc2.
> 
> With these patches io ports count from 0 -> 8k-1 instead of being a
> pointer. We currently rely on generic_io_base logic but that will be
> changed in the future.
> 
Magnus,

This fixed the original problem but re-introduced the problem I had
before with not having a a working nic - so it's stole broken atm:

[    2.220263] NET: Registered protocol family 17
[    2.224976] RPC: Registered udp transport module.
[    2.228064] RPC: Registered tcp transport module.
[    2.740995] IP-Config: Failed to open eth0
[    2.744076] IP-Config: No network devices available.
[    2.748232] Looking up port of RPC 100003/2 on 192.168.61.50



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-18 20:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-16 18:38 Current git very broken on the Dreamcast Adrian McMenamin
2008-02-16 19:48 ` Adrian McMenamin
2008-02-16 19:59   ` Adrian McMenamin
2008-02-17 19:42     ` Kristoffer Ericson
2008-02-17 19:55     ` Kristoffer Ericson
2008-02-18  8:57   ` Magnus Damm
2008-02-18 20:11     ` Adrian McMenamin
2008-02-17 19:40 ` Kristoffer Ericson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).