Documentation changes
Use a log2 that has an author. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@112 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
5a65718dcc
commit
b9aa556977
2 changed files with 168 additions and 38 deletions
|
|
@ -324,15 +324,6 @@ boot area
|
|||
(C)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Stage 2:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Note, currently at least part 1 of this is in the current stage 1 code ...
|
||||
we need to figure this out.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Enumerate
|
||||
Examine the flash.
|
||||
Look in DTB option node, normal property for directory named by the boot
|
||||
|
|
@ -351,6 +342,124 @@ In that directory, need 'initram', 'payload.ext', and others.
|
|||
(C)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Stage 2: Device tree
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Run the standard device tree code.
|
||||
This code runs in 6 phases.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 1
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
These are any functions that are required to make printk operational.
|
||||
No other code should be run in Phase 1.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x20
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x2f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 2
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
These are functions that are required before any PCI operations of any kind
|
||||
are run.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x30
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x3f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 3
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x40
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x4f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 4
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x50
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x5f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 5
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x60
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x6f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Phase 6
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Post codes:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Entry: 0x70
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Exit: 0x7f
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Stage 3: elf boot
|
||||
\end_layout
|
||||
|
|
|
|||
79
lib/clog2.c
79
lib/clog2.c
|
|
@ -1,39 +1,60 @@
|
|||
/*
|
||||
* clog2 -- get a log2 in C.
|
||||
*
|
||||
/* log 2 in c, from mozilla, from jscpucfg.c */
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* Author(s) unknown, but this classic code was found by
|
||||
* Ronald G. Minnich somewhere.
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* 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; version 2 of the License.
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* 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.
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
* Contributor(s):
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* Assume 8 bits per byte */
|
||||
#define CHAR_BIT 8
|
||||
|
||||
unsigned long log2(unsigned long x)
|
||||
int log2(unsigned int n)
|
||||
{
|
||||
unsigned long i = 1ULL << (sizeof(x)* CHAR_BIT - 1ULL);
|
||||
unsigned long pow = sizeof(x) * CHAR_BIT - 1ULL;
|
||||
int log2 = 0;
|
||||
|
||||
if (! x) {
|
||||
return -1;
|
||||
}
|
||||
for(; i > x; i >>= 1, pow--)
|
||||
;
|
||||
|
||||
return pow;
|
||||
if (n & (n-1))
|
||||
log2++;
|
||||
if (n >> 16)
|
||||
log2 += 16, n >>= 16;
|
||||
if (n >> 8)
|
||||
log2 += 8, n >>= 8;
|
||||
if (n >> 4)
|
||||
log2 += 4, n >>= 4;
|
||||
if (n >> 2)
|
||||
log2 += 2, n >>= 2;
|
||||
if (n >> 1)
|
||||
log2++;
|
||||
return log2;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue