public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it
@ 2011-09-28  9:09 RdrouterUboot Router
  2011-09-29 13:04 ` Detlev Zundel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: RdrouterUboot Router @ 2011-09-28  9:09 UTC (permalink / raw)
  To: u-boot

Hi all,

MIPS Uboot works OK.Part of the code is as below.

And my questions:
1.read status register($12) and save value to $10,but don't use the value in
$10 to do anything.
Because uboot overwrite $10.

2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.

Thanks.

Bruce


# Initialize Misc. Cop0 state

    # Read status register
    mfc0    $10, $12  //Can I delete this code?

    # Set up Status register:
    # Disable Coprocessor Usable bits
    # Turn off Reduce Power bit
    # Turn off reverse endian
    # Turn off BEV (use normal exception vectors)
    # Clear TS, SR, NMI bits
    # Clear Interrupt masks
    # Clear User Mode
    # Clear ERL
    # Set EXL
    # Clear Interrupt Enable
    # modify by Bruce
    #li    $11, 0x0000ff02
    li    $11, 0x00000004
    mtc0    $11, $12


    # Disable watch exceptions
    mtc0    $0, $18

    # Clear Watch Status bits
    li    $11, 0x3
    mtc0    $11, $19

    # Clear WP bit to avoid watch exception upon user code entry
    # Clear IV bit - Interrupts go to general exception vector
    # Clear software interrupts
    mtc0    $0, $13

    # Set KSeg0 to cacheable
    # Config.K0
    mfc0    $10, $16    //Overwrite $10 register.Why uboot read status
register($12) and save value to $10,but don't use $10.

    li    $11, 0x7
    not    $11
    and    $10, $11
    or    $10, 0x3
    mtc0    $10, $16

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

* [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it
  2011-09-28  9:09 [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it RdrouterUboot Router
@ 2011-09-29 13:04 ` Detlev Zundel
  2011-09-29 16:15 ` Marek Vasut
  2011-10-01  3:59 ` Shinya Kuribayashi
  2 siblings, 0 replies; 4+ messages in thread
From: Detlev Zundel @ 2011-09-29 13:04 UTC (permalink / raw)
  To: u-boot

Hi Bruce,

> MIPS Uboot works OK.Part of the code is as below.

Congratulations.  Although I'm not sure what I'm congratulating on ;)

> And my questions:
> 1.read status register($12) and save value to $10,but don't use the value in
> $10 to do anything.
> Because uboot overwrite $10.
>
> 2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.

I'm sorry, but I don;t know what to make of this. Can you tell us if
this code is from U-Boot and if so, in which file?  Also can't you try
for yourself if U-Boot still works after removing this instruction?

What exactly do you want us to tell you?

Cheers
  Detlev

-- 
If I could ask a  genie to grant me one wish for free software, it would not
be about the  popularity of the GNU Hurd,  or even the popularity of the GNU
system.  I would wish for all software users to have  reedom and value free-
dom.               -- Richard Stallman <E1OiPAB-00016E-2v@fencepost.gnu.org>
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

* [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it
  2011-09-28  9:09 [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it RdrouterUboot Router
  2011-09-29 13:04 ` Detlev Zundel
@ 2011-09-29 16:15 ` Marek Vasut
  2011-10-01  3:59 ` Shinya Kuribayashi
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2011-09-29 16:15 UTC (permalink / raw)
  To: u-boot

On Wednesday, September 28, 2011 11:09:05 AM RdrouterUboot Router wrote:
> Hi all,
> 
> MIPS Uboot works OK.Part of the code is as below.
> 
> And my questions:
> 1.read status register($12) and save value to $10,but don't use the value
> in $10 to do anything.
> Because uboot overwrite $10.
> 
> 2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.
> 
> Thanks.
> 
> Bruce
> 

I don't see this code in uboot at all ... what version do you use ?

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

* [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it
  2011-09-28  9:09 [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it RdrouterUboot Router
  2011-09-29 13:04 ` Detlev Zundel
  2011-09-29 16:15 ` Marek Vasut
@ 2011-10-01  3:59 ` Shinya Kuribayashi
  2 siblings, 0 replies; 4+ messages in thread
From: Shinya Kuribayashi @ 2011-10-01  3:59 UTC (permalink / raw)
  To: u-boot

On 09/28/2011 06:09 PM, RdrouterUboot Router wrote:
> 2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.

You can delete that MFC0 instruction in this case and save one word.
Presumably the original code used to update the Status register value
in read-modify-write manner, and at some point someone modified into
current shape.

By the way, since the first MIPS implementation of U-Boot was merged
into the tree (by wdenk), we've been using k0($26) or t0($8) register
as a scratch pad when modifying the Status register, while your example
code uses t2($10).  So it would be a custom U-Boot we don't know of.

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

end of thread, other threads:[~2011-10-01  3:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28  9:09 [U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it RdrouterUboot Router
2011-09-29 13:04 ` Detlev Zundel
2011-09-29 16:15 ` Marek Vasut
2011-10-01  3:59 ` Shinya Kuribayashi

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