Blame view

common/lynxkdi.c 1.88 KB
1f4bb37d6   wdenk   * Patch by Scott ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  /*
   * Copyright (c) Orbacom Systems, Inc <www.orbacom.com>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms are freely
   * permitted provided that the above copyright notice and this
   * paragraph and the following disclaimer are duplicated in all
   * such forms.
   *
   * This software is provided "AS IS" and without any express or
   * implied warranties, including, without limitation, the implied
   * warranties of merchantability and fitness for a particular
   * purpose.
   */
  
  #include <common.h>
  #include <asm/processor.h>
  #include <image.h>
d2567be91   Wolfgang Denk   Fix implicit decl...
19
  #include <net.h>
1f4bb37d6   wdenk   * Patch by Scott ...
20

1f4bb37d6   wdenk   * Patch by Scott ...
21
  #include <lynxkdi.h>
d87080b72   Wolfgang Denk   GCC-4.x fixes: cl...
22
  DECLARE_GLOBAL_DATA_PTR;
846b0dd2d   Stefan Roese   Changed CONFIG_44...
23
  #if defined(CONFIG_MPC8260) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
712fbcf38   Stephen Warren   checkpatch whites...
24
  void lynxkdi_boot(image_header_t *hdr)
1f4bb37d6   wdenk   * Patch by Scott ...
25
  {
712fbcf38   Stephen Warren   checkpatch whites...
26
  	void (*lynxkdi)(void) = (void(*)(void))image_get_ep(hdr);
1f4bb37d6   wdenk   * Patch by Scott ...
27
28
  	lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020;
  	bd_t *kbd;
712fbcf38   Stephen Warren   checkpatch whites...
29
  	u32 *psz = (u32 *)(image_get_load(hdr) + 0x0204);
1f4bb37d6   wdenk   * Patch by Scott ...
30

712fbcf38   Stephen Warren   checkpatch whites...
31
  	memset(parms, 0, sizeof(*parms));
1f4bb37d6   wdenk   * Patch by Scott ...
32
33
34
  	kbd = gd->bd;
  	parms->clock_ref = kbd->bi_busfreq;
  	parms->dramsz = kbd->bi_memsize;
501353346   Mike Frysinger   lynxkdi: get mac ...
35
  	eth_getenv_enetaddr("ethaddr", parms->ethaddr);
712fbcf38   Stephen Warren   checkpatch whites...
36
  	mtspr(SPRN_SPRG2, 0x0020);
1f4bb37d6   wdenk   * Patch by Scott ...
37
38
39
40
  
  	/* Do a simple check for Bluecat so we can pass the
  	 * kernel command line parameters.
  	 */
712fbcf38   Stephen Warren   checkpatch whites...
41
42
  	/* FIXME: NOT SURE HERE ! */
  	if (le32_to_cpu(*psz) == image_get_data_size(hdr)) {
1ee1180b6   Marian Balakowicz   [new uImage] Clea...
43
  		char *args;
712fbcf38   Stephen Warren   checkpatch whites...
44
  		char *cmdline = (char *)(image_get_load(hdr) + 0x020c);
1ee1180b6   Marian Balakowicz   [new uImage] Clea...
45
  		int len;
1f4bb37d6   wdenk   * Patch by Scott ...
46

712fbcf38   Stephen Warren   checkpatch whites...
47
48
49
50
  		printf("Booting Bluecat KDI ...
  ");
  		udelay(200*1000); /* Allow serial port to flush */
  		if ((args = getenv("bootargs")) == NULL)
1ee1180b6   Marian Balakowicz   [new uImage] Clea...
51
52
  			args = "";
  		/* Prepend the cmdline */
712fbcf38   Stephen Warren   checkpatch whites...
53
54
55
56
57
  		len = strlen(args);
  		if (len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) {
  			memmove(cmdline + strlen(args) + 1, cmdline,
  				strlen(cmdline));
  			strcpy(cmdline, args);
1ee1180b6   Marian Balakowicz   [new uImage] Clea...
58
59
  			cmdline[len] = ' ';
  		}
1f4bb37d6   wdenk   * Patch by Scott ...
60
61
  	}
  	else {
712fbcf38   Stephen Warren   checkpatch whites...
62
63
  		printf("Booting LynxOS KDI ...
  ");
1f4bb37d6   wdenk   * Patch by Scott ...
64
  	}
712fbcf38   Stephen Warren   checkpatch whites...
65
  	lynxkdi();
1f4bb37d6   wdenk   * Patch by Scott ...
66
67
68
69
  }
  #else
  #error "Lynx KDI support not implemented for configured CPU"
  #endif