Deleted Added
full compact
cvmx-ebt3000.c (232812) cvmx-ebt3000.c (242273)
1/***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
21 * permission.
22
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
39
40
41
42
43
44
45
46/**
47 * @file
48 *
49 * Interface to the EBT3000 specific devices
50 *
51 * <hr>$Revision: 70030 $<hr>
52 *
53 */
54
1/***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
21 * permission.
22
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
39
40
41
42
43
44
45
46/**
47 * @file
48 *
49 * Interface to the EBT3000 specific devices
50 *
51 * <hr>$Revision: 70030 $<hr>
52 *
53 */
54
55#if !defined(__FreeBSD__) || !defined(_KERNEL)
55#include "cvmx-config.h"
56#include "cvmx-config.h"
57#endif
56#include "cvmx.h"
58#include "cvmx.h"
59#include "cvmx-ebt3000.h"
57#include "cvmx-sysinfo.h"
58
59
60void ebt3000_char_write(int char_position, char val)
61{
62 /* Note: phys_to_ptr won't work here, as we are most likely going to access the boot bus. */
60#include "cvmx-sysinfo.h"
61
62
63void ebt3000_char_write(int char_position, char val)
64{
65 /* Note: phys_to_ptr won't work here, as we are most likely going to access the boot bus. */
63 void *led_base = CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, cvmx_sysinfo_get()->led_display_base_addr));
66 char *led_base = CASTPTR(char , CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, cvmx_sysinfo_get()->led_display_base_addr));
64 if (!led_base)
65 return;
66 if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_EBT3000 && cvmx_sysinfo_get()->board_rev_major == 1)
67 {
68 /* Rev 1 board */
69 char *ptr = (char *)(led_base + 4);
70 char_position &= 0x3; /* only 4 chars */
71 ptr[3 - char_position] = val;
72 }
73 else
74 {
75 /* rev 2 or later board */
76 char *ptr = (char *)(led_base);
77 char_position &= 0x7; /* only 8 chars */
78 ptr[char_position] = val;
79 }
80}
81
82void ebt3000_str_write(const char *str)
83{
84 /* Note: phys_to_ptr won't work here, as we are most likely going to access the boot bus. */
67 if (!led_base)
68 return;
69 if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_EBT3000 && cvmx_sysinfo_get()->board_rev_major == 1)
70 {
71 /* Rev 1 board */
72 char *ptr = (char *)(led_base + 4);
73 char_position &= 0x3; /* only 4 chars */
74 ptr[3 - char_position] = val;
75 }
76 else
77 {
78 /* rev 2 or later board */
79 char *ptr = (char *)(led_base);
80 char_position &= 0x7; /* only 8 chars */
81 ptr[char_position] = val;
82 }
83}
84
85void ebt3000_str_write(const char *str)
86{
87 /* Note: phys_to_ptr won't work here, as we are most likely going to access the boot bus. */
85 void *led_base;
88 char *led_base;
86 if (!cvmx_sysinfo_get()->led_display_base_addr)
87 return;
89 if (!cvmx_sysinfo_get()->led_display_base_addr)
90 return;
88 led_base = CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, cvmx_sysinfo_get()->led_display_base_addr));
91 led_base = CASTPTR(char, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, cvmx_sysinfo_get()->led_display_base_addr));
89 if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_EBT3000 && cvmx_sysinfo_get()->board_rev_major == 1)
90 {
91 char *ptr = (char *)(led_base + 4);
92 int i;
93 for (i=0; i<4; i++)
94 {
95 if (*str)
96 ptr[3 - i] = *str++;
97 else
98 ptr[3 - i] = ' ';
99 }
100 }
101 else
102 {
103 /* rev 2 board */
104 char *ptr = (char *)(led_base);
105 int i;
106 for (i=0; i<8; i++)
107 {
108 if (*str)
109 ptr[i] = *str++;
110 else
111 ptr[i] = ' ';
112 }
113 }
114}
92 if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_EBT3000 && cvmx_sysinfo_get()->board_rev_major == 1)
93 {
94 char *ptr = (char *)(led_base + 4);
95 int i;
96 for (i=0; i<4; i++)
97 {
98 if (*str)
99 ptr[3 - i] = *str++;
100 else
101 ptr[3 - i] = ' ';
102 }
103 }
104 else
105 {
106 /* rev 2 board */
107 char *ptr = (char *)(led_base);
108 int i;
109 for (i=0; i<8; i++)
110 {
111 if (*str)
112 ptr[i] = *str++;
113 else
114 ptr[i] = ' ';
115 }
116 }
117}