* fix some license headers

* add generic lib.h header for lib/ prototypes
* fix some prototypes
* put back return value parsing of stage2

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>




git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@91 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-02-23 11:03:56 +00:00
parent 592d34e1fc
commit 15dfcd2198
6 changed files with 112 additions and 64 deletions

View file

@ -19,13 +19,13 @@
#include <arch/types.h>
#include <arch/io.h>
#include <console/console.h>
#include <console/loglevel.h>
#include <lar.h>
#include "config.h"
/* these prototypes should go into headers */
void uart_init(void);
int printk(int msg_level, const char *fmt, ...);
void console_init(void);
void die(const char *msg);
int find_file(struct mem_file *archive, char *filename, struct mem_file *result);
@ -200,7 +200,9 @@ printk(BIOS_INFO, "Start search at 0x%x, size %d\n", archive.start, archive.len)
#endif
);
(void) run_file(&archive, "normal/stage2", (void *)0x1000);
ret = run_file(&archive, "normal/stage2", (void *)0x1000);
if (ret)
die("FATAL: Failed in stage2 code");
printk(BIOS_INFO, "Done stage2 code\n");

View file

@ -1,24 +1,25 @@
/*
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* (c) 1999--2000 Martin Mares <mj@suse.cz>
* (c) 2003 Eric Biederman <ebiederm@xmission.com>
* (c) 2003 Linux Networx
* This file is part of the LinuxBIOS project.
*
* (c) 1999--2000 Martin Mares <mj@suse.cz>
* (c) 2003 Eric Biederman <ebiederm@xmission.com>
* (c) 2003 Linux Networx
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* lots of mods by ron minnich (rminnich@lanl.gov), with
* the final architecture guidance from Tom Merritt (tjm@codegen.com)
* In particular, we changed from the one-pass original version to
@ -38,6 +39,7 @@
#include <device/pci_ids.h>
#include <stdlib.h>
#include <string.h>
#include <lib.h>
//#include <smp/spinlock.h>
/** Linked list of ALL devices */

View file

@ -44,4 +44,8 @@ extern struct console_driver econsole_drivers[];
extern int console_loglevel;
//
int printk(int msg_level, const char *fmt, ...);
#endif /* CONSOLE_CONSOLE_H_ */

View file

@ -1,19 +1,21 @@
/*
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 file is part of the LinuxBIOS 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DEVICE_H
#define DEVICE_H
@ -64,7 +66,7 @@ struct device_operations {
void (*phase5)(struct device * dev);
/* phase 6: any post-setup device initialization that might be needed */
void (*phase6)();
void (*phase6)(struct device * dev);
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
@ -131,26 +133,26 @@ extern struct device *all_devices; /* list of all devices */
/* Generic device interface functions */
extern struct device * alloc_dev(struct bus *parent, struct device_path *path);
extern void dev_enumerate(void);
extern void dev_configure(void);
extern void dev_enable(void);
extern void dev_initialize(void);
extern void dev_optimize(void);
struct device * alloc_dev(struct bus *parent, struct device_path *path);
void dev_enumerate(void);
void dev_configure(void);
void dev_enable(void);
void dev_initialize(void);
void dev_optimize(void);
/* Generic device helper functions */
extern int reset_bus(struct bus *bus);
extern unsigned int scan_bus(struct device *bus, unsigned int max);
extern void compute_allocate_resource(struct bus *bus, struct resource *bridge,
int reset_bus(struct bus *bus);
unsigned int scan_bus(struct device *bus, unsigned int max);
void compute_allocate_resource(struct bus *bus, struct resource *bridge,
unsigned long type_mask, unsigned long type);
extern void assign_resources(struct bus *bus);
extern void enable_resources(struct device *dev);
extern void enumerate_static_device(void);
extern void enumerate_static_devices(void);
extern const char *dev_path(struct device * dev);
void assign_resources(struct bus *bus);
void enable_resources(struct device *dev);
void enumerate_static_device(void);
void enumerate_static_devices(void);
const char *dev_path(struct device * dev);
const char *bus_path(struct bus *bus);
extern void dev_set_enabled(struct device * dev, int enable);
extern void disable_children(struct bus *bus);
void dev_set_enabled(struct device * dev, int enable);
void disable_children(struct bus *bus);
/* Helper functions */
struct device * find_dev_path(struct bus *parent, struct device_path *path);
@ -167,13 +169,25 @@ struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr);
#define DEVICE_IO_ALIGN 16
#define DEVICE_MEM_ALIGN 4096
struct device_operations default_dev_ops_root;
extern void root_dev_read_resources(struct device * dev);
extern void root_dev_set_resources(struct device * dev);
extern unsigned int scan_static_bus(struct device * bus, unsigned int max);
extern void enable_childrens_resources(struct device * dev);
extern void root_dev_enable_resources(struct device * dev);
extern unsigned int root_dev_scan_bus(struct device * root, unsigned int max);
extern void root_dev_init(struct device * dev);
extern void dev_init(void);
extern struct device_operations default_dev_ops_root;
void root_dev_read_resources(struct device * dev);
void root_dev_set_resources(struct device * dev);
unsigned int scan_static_bus(struct device * bus, unsigned int max);
void enable_childrens_resources(struct device * dev);
void root_dev_enable_resources(struct device * dev);
unsigned int root_dev_scan_bus(struct device * root, unsigned int max);
void root_dev_init(struct device * dev);
void dev_init(void);
void dev_phase1(void);
void dev_phase2(void);
void dev_root_phase3(void);
void dev_phase4(void);
void dev_root_phase5(void);
void dev_phase6(void);
void phase4_assign_resources(struct bus *bus);
unsigned int dev_phase3(struct device * bus, unsigned int max);
void dev_phase5(struct device *dev);
#endif /* DEVICE_H */

25
include/lib.h Normal file
View file

@ -0,0 +1,25 @@
/*
* This file is part of the LinuxBIOS project.
*
* Copyright (C) 2007 coresystems GmbH <stepan@coresystems.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIB_H
#define LIB_H
unsigned long log2(unsigned long x);
#endif

View file

@ -47,8 +47,9 @@ it with the version available from LANL.
#include <arch/types.h>
#include <string.h>
#include <lar.h>
#include <console/console.h>
#include <console/loglevel.h>
#include <device/device.h>
/**
* @brief Main function of the DRAM part of LinuxBIOS.
@ -61,7 +62,7 @@ it with the version available from LANL.
* Device Enumeration:
* In the dev_enumerate() phase,
*/
void stage2(void)
int stage2(void)
{
struct lb_memory *lb_mem;
@ -102,6 +103,6 @@ void stage2(void)
elfboot(lb_mem);
#endif
return 0;
}