]>
Commit | Line | Data |
---|---|---|
1f4bb37d WD |
1 | /* |
2 | * Copyright (c) Orbacom Systems, Inc <www.orbacom.com> | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms are freely | |
6 | * permitted provided that the above copyright notice and this | |
7 | * paragraph and the following disclaimer are duplicated in all | |
8 | * such forms. | |
9 | * | |
10 | * This software is provided "AS IS" and without any express or | |
11 | * implied warranties, including, without limitation, the implied | |
12 | * warranties of merchantability and fitness for a particular | |
13 | * purpose. | |
14 | */ | |
15 | ||
16 | #include <common.h> | |
17 | #include <asm/processor.h> | |
18 | #include <image.h> | |
d2567be9 | 19 | #include <net.h> |
1f4bb37d | 20 | |
1f4bb37d WD |
21 | #include <lynxkdi.h> |
22 | ||
d87080b7 WD |
23 | DECLARE_GLOBAL_DATA_PTR; |
24 | ||
846b0dd2 | 25 | #if defined(CONFIG_MPC8260) || defined(CONFIG_440EP) || defined(CONFIG_440GR) |
712fbcf3 | 26 | void lynxkdi_boot(image_header_t *hdr) |
1f4bb37d | 27 | { |
712fbcf3 | 28 | void (*lynxkdi)(void) = (void(*)(void))image_get_ep(hdr); |
1f4bb37d WD |
29 | lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020; |
30 | bd_t *kbd; | |
712fbcf3 | 31 | u32 *psz = (u32 *)(image_get_load(hdr) + 0x0204); |
1f4bb37d | 32 | |
712fbcf3 | 33 | memset(parms, 0, sizeof(*parms)); |
1f4bb37d WD |
34 | kbd = gd->bd; |
35 | parms->clock_ref = kbd->bi_busfreq; | |
36 | parms->dramsz = kbd->bi_memsize; | |
50135334 | 37 | eth_getenv_enetaddr("ethaddr", parms->ethaddr); |
712fbcf3 | 38 | mtspr(SPRN_SPRG2, 0x0020); |
1f4bb37d WD |
39 | |
40 | /* Do a simple check for Bluecat so we can pass the | |
41 | * kernel command line parameters. | |
42 | */ | |
712fbcf3 SW |
43 | /* FIXME: NOT SURE HERE ! */ |
44 | if (le32_to_cpu(*psz) == image_get_data_size(hdr)) { | |
1ee1180b | 45 | char *args; |
712fbcf3 | 46 | char *cmdline = (char *)(image_get_load(hdr) + 0x020c); |
1ee1180b | 47 | int len; |
1f4bb37d | 48 | |
712fbcf3 SW |
49 | printf("Booting Bluecat KDI ...\n"); |
50 | udelay(200*1000); /* Allow serial port to flush */ | |
51 | if ((args = getenv("bootargs")) == NULL) | |
1ee1180b MB |
52 | args = ""; |
53 | /* Prepend the cmdline */ | |
712fbcf3 SW |
54 | len = strlen(args); |
55 | if (len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) { | |
56 | memmove(cmdline + strlen(args) + 1, cmdline, | |
57 | strlen(cmdline)); | |
58 | strcpy(cmdline, args); | |
1ee1180b MB |
59 | cmdline[len] = ' '; |
60 | } | |
1f4bb37d WD |
61 | } |
62 | else { | |
712fbcf3 | 63 | printf("Booting LynxOS KDI ...\n"); |
1f4bb37d WD |
64 | } |
65 | ||
712fbcf3 | 66 | lynxkdi(); |
1f4bb37d WD |
67 | } |
68 | #else | |
69 | #error "Lynx KDI support not implemented for configured CPU" | |
70 | #endif |