board.c (225394) | board.c (233542) |
---|---|
1/*- 2 * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights 3 * reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * --- 14 unchanged lines hidden (view full) --- 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * NETLOGIC_BSD */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights 3 * reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * --- 14 unchanged lines hidden (view full) --- 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * NETLOGIC_BSD */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/mips/nlm/board.c 225394 2011-09-05 10:45:29Z jchandra $"); | 31__FBSDID("$FreeBSD: head/sys/mips/nlm/board.c 233542 2012-03-27 12:25:47Z jchandra $"); |
32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bus.h> 35#include <sys/kernel.h> 36#include <sys/lock.h> 37#include <sys/mutex.h> 38 | 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bus.h> 35#include <sys/kernel.h> 36#include <sys/lock.h> 37#include <sys/mutex.h> 38 |
39#include <net/ethernet.h> 40 |
|
39#include <mips/nlm/hal/mips-extns.h> 40#include <mips/nlm/hal/haldefs.h> 41#include <mips/nlm/hal/iomap.h> 42#include <mips/nlm/hal/fmn.h> 43#include <mips/nlm/hal/pic.h> | 41#include <mips/nlm/hal/mips-extns.h> 42#include <mips/nlm/hal/haldefs.h> 43#include <mips/nlm/hal/iomap.h> 44#include <mips/nlm/hal/fmn.h> 45#include <mips/nlm/hal/pic.h> |
46#include <mips/nlm/hal/sys.h> |
|
44#include <mips/nlm/hal/uart.h> 45 | 47#include <mips/nlm/hal/uart.h> 48 |
49#include <mips/nlm/xlp.h> |
|
46#include <mips/nlm/board.h> 47 | 50#include <mips/nlm/board.h> 51 |
52static uint8_t board_eeprom_buf[EEPROM_SIZE]; 53static int board_eeprom_set; 54 |
|
48struct xlp_board_info xlp_board_info; 49 | 55struct xlp_board_info xlp_board_info; 56 |
50int nlm_setup_xlp_board(void); | 57static void 58nlm_print_processor_info(void) 59{ 60 uint32_t procid; 61 int prid, rev; 62 char *chip, *revstr; |
51 | 63 |
64 procid = mips_rd_prid(); 65 prid = (procid >> 8) & 0xff; 66 rev = procid & 0xff; 67 68 switch (prid) { 69 case CHIP_PROCESSOR_ID_XLP_8XX: 70 chip = "XLP 832"; 71 break; 72 case CHIP_PROCESSOR_ID_XLP_3XX: 73 chip = "XLP 3xx"; 74 break; 75 case CHIP_PROCESSOR_ID_XLP_432: 76 case CHIP_PROCESSOR_ID_XLP_416: 77 chip = "XLP 4xx"; 78 break; 79 default: 80 chip = "XLP ?xx"; 81 break; 82 } 83 switch (rev) { 84 case 0: 85 revstr = "A0"; break; 86 case 1: 87 revstr = "A1"; break; 88 case 2: 89 revstr = "A2"; break; 90 case 3: 91 revstr = "B0"; break; 92 default: 93 revstr = "??"; break; 94 } 95 96 printf("Processor info:\n"); 97 printf(" Netlogic %s %s [%x]\n", chip, revstr, procid); 98} 99 |
|
52/* | 100/* |
53 * All our knowledge of chip and board that cannot be detected by probing | 101 * All our knowledge of chip and board that cannot be detected by probing |
54 * at run-time goes here 55 */ | 102 * at run-time goes here 103 */ |
56 57int | 104static int |
58nlm_setup_xlp_board(void) 59{ 60 struct xlp_board_info *boardp; | 105nlm_setup_xlp_board(void) 106{ 107 struct xlp_board_info *boardp; |
61 int node; | 108 int rv; 109 uint8_t *b; |
62 63 /* start with a clean slate */ 64 boardp = &xlp_board_info; | 110 111 /* start with a clean slate */ 112 boardp = &xlp_board_info; |
65 memset(boardp, 0, sizeof(xlp_board_info)); | 113 memset(boardp, 0, sizeof(*boardp)); |
66 boardp->nodemask = 0x1; /* only node 0 */ | 114 boardp->nodemask = 0x1; /* only node 0 */ |
115 nlm_print_processor_info(); |
|
67 | 116 |
68 for (node = 0; node < XLP_MAX_NODES; node++) { 69 if ((boardp->nodemask & (1 << node)) == 0) 70 continue; 71 } 72 return 0; | 117 b = board_eeprom_buf; 118 rv = nlm_board_eeprom_read(0, EEPROM_I2CBUS, EEPROM_I2CADDR, 0, b, 119 EEPROM_SIZE); 120 if (rv == 0) { 121 board_eeprom_set = 1; 122 printf("Board info (EEPROM on i2c@%d at %#X):\n", 123 EEPROM_I2CBUS, EEPROM_I2CADDR); 124 printf(" Model: %7.7s %2.2s\n", &b[16], &b[24]); 125 printf(" Serial #: %3.3s-%2.2s\n", &b[27], &b[31]); 126 printf(" MAC addr: %02x:%02x:%02x:%02x:%02x:%02x\n", 127 b[2], b[3], b[4], b[5], b[6], b[7]); 128 } else 129 printf("Board Info: Error on EEPROM read (i2c@%d %#X).\n", 130 EEPROM_I2CBUS, EEPROM_I2CADDR); 131 132 return (0); |
73} 74 | 133} 134 |
75int nlm_board_info_setup() | 135int nlm_board_info_setup(void) |
76{ 77 nlm_setup_xlp_board(); | 136{ 137 nlm_setup_xlp_board(); |
78 return 0; | 138 return (0); |
79} | 139} |