17e0a1335a4773c00d4323988d885f0c7c8a58e7
[coreboot.git] / src / drivers / pci / onboard / onboard.c
1 /*
2  * Copyright 2004 Tyan Computer
3  *  by yhlu@tyan.com
4  */
5
6 #include <console/console.h>
7
8 #include <device/device.h>
9 #include <device/pci.h>
10 #include <device/pci_ids.h>
11 #include <device/pci_ops.h>
12 #include "chip.h"
13
14 /*
15  * How to use the onboard device driver for option rom execution:
16  *
17  * 1. You need to add the driver to your mainboard Config.lb:
18  *
19  *      chip drivers/pci/onboard
20  *          device pci x.0 on end
21  *          register "rom_address" = "0xfff80000"
22  *      end
23  * 2. Reduce the size of your normal (or fallback) image, by adding the
24  *    following lines to your target Config.lb, after romimage "normal"
25  *      # 48K for SCSI FW or ATI ROM
26  *      option ROM_SIZE = 512*1024-48*1024
27  * 3. Create your vgabios.bin, for example using awardeco and put it in the
28  *    directory of your target Config.lb. You can also read an option rom from
29  *    a running system, but this is unreliable, as some option roms are changed
30  *    during execution:
31  *      #  dd if=/dev/mem of=atix.rom skip=1536 count=96
32  * 4. After you built coreboot.rom, attach the option rom to your coreboot
33  *    image:
34  *      # cat ../atix.rom ./normal/coreboot.rom ./fallback/coreboot.rom > coreboot.rom
35  *
36  * Alternatively you can use the following script "nsxv" to build your image
37  * Usage:
38  * # ./nsxv s2850
39  *     
40  *     #!/bin/bash
41  *     MBVENDOR=tyan
42  *     MBMODEL=$1
43  *     LBROOT=/home/yhlu/xx/xx
44  *     
45  *     echo $1
46  *     date
47  *     
48  *     cd "$LBROOT/freebios2/targets"
49  *     rm -rf "$MBVENDOR/$MBMODEL/$MBMODEL"
50  *     ./buildtarget "$MBVENDOR/$MBMODEL" &> "$LBROOT/x_b.txt"
51  *     cd "$MBVENDOR/$MBMODEL/$MBMODEL"
52  *     #make clean
53  *     eval make &> "$LBROOT/x_m.txt"
54  *             if [ $? -eq 0 ]; then
55  *                     echo "ok."
56  *             else
57  *                     echo "FAILED! Log excerpt:"
58  *                     tail -n 15 "$LBROOT/x_m.txt"
59  *                     exit
60  *             fi
61  *     cat ../atix.rom ./normal/coreboot.rom ./fallback/coreboot.rom > "$LBROOT/rom/"$MBMODEL"_coreboot.rom"
62  *     cp -f "$LBROOT/rom/"$MBMODEL"_coreboot.rom" /home/yhlu/
63  *     
64  *     date
65  *     
66  */
67
68 static void onboard_enable(device_t dev) 
69 {
70         struct drivers_pci_onboard_config *conf;
71         conf = dev->chip_info;
72         dev->rom_address = conf->rom_address;
73 }
74
75 struct chip_operations drivers_pci_onboard_ops = {
76         CHIP_NAME("Onboard PCI")
77         .enable_dev = onboard_enable,
78 };