summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-05-09 18:37:48 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-05-09 18:37:48 +0000
commita12483427162f5c1d48945cc29bd05f947258b9a (patch)
tree9b3d289a146c2d6a72089eaada79dadabbb789b1 /sys
parent5270753cb614f12a56f8e79ab86a1218786d1747 (diff)
Proper support for IP35 C-Brick types (i.e. Origin 3000): do not attach
a (missing) second serial port to ioc(4), read spdmem(4) records from the right index, and query the Ethernet address from the I-Brick eeprom instead of the C-Brick eeprom. Tested by Sebastian Reitenbach, thanks!
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sgi/pci/ioc.c41
-rw-r--r--sys/arch/sgi/sgi/ip27.h3
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c6
-rw-r--r--sys/arch/sgi/sgi/l1.c35
-rw-r--r--sys/arch/sgi/sgi/l1.h14
5 files changed, 74 insertions, 25 deletions
diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c
index e1f9a00707e..0e796d598a2 100644
--- a/sys/arch/sgi/pci/ioc.c
+++ b/sys/arch/sgi/pci/ioc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioc.c,v 1.34 2010/04/06 19:12:34 miod Exp $ */
+/* $OpenBSD: ioc.c,v 1.35 2010/05/09 18:37:45 miod Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -335,10 +335,7 @@ ioc_attach(struct device *parent, struct device *self, void *aux)
if (!ISSET(ioc_nodemask, 1UL << currentnasid)) {
SET(ioc_nodemask, 1UL << currentnasid);
- subdevice_mask = (1 << IOCDEV_SERIAL_A) |
- (1 << IOCDEV_SERIAL_B) | (1 << IOCDEV_LPT) |
- (1 << IOCDEV_KBC) | (1 << IOCDEV_RTC) |
- (1 << IOCDEV_EF);
+ switch (sys_config.system_subtype) {
/*
* Origin 300 onboard IOC3 do not have PS/2
* ports; since they can only be connected to
@@ -347,8 +344,34 @@ ioc_attach(struct device *parent, struct device *self, void *aux)
* regardless of the current nasid.
* XXX What about Onyx 300 though???
*/
- if (sys_config.system_subtype == IP35_O300)
- subdevice_mask &= ~(1 << IOCDEV_KBC);
+ case IP35_O300:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) |
+ (1 << IOCDEV_LPT) |
+ (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ break;
+ /*
+ * Origin 3000 I-Bricks have only one serial
+ * port, and no keyboard or parallel ports.
+ */
+ case IP35_CBRICK:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ break;
+ default:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) |
+ (1 << IOCDEV_LPT) |
+ (1 << IOCDEV_KBC) |
+ (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ break;
+ }
}
break;
default:
@@ -479,7 +502,9 @@ unknown:
IOC3_UARTB_SHADOW, 0);
ioc_attach_child(sc, "com", IOC3_UARTA_BASE, IOCDEV_SERIAL_A);
- ioc_attach_child(sc, "com", IOC3_UARTB_BASE, IOCDEV_SERIAL_B);
+ if (ISSET(subdevice_mask, 1 << IOCDEV_SERIAL_B))
+ ioc_attach_child(sc, "com", IOC3_UARTB_BASE,
+ IOCDEV_SERIAL_B);
}
if (ISSET(subdevice_mask, 1 << IOCDEV_KBC))
ioc_attach_child(sc, "iockbc", 0, IOCDEV_KBC);
diff --git a/sys/arch/sgi/sgi/ip27.h b/sys/arch/sgi/sgi/ip27.h
index 66c13d253b0..0cd129abda4 100644
--- a/sys/arch/sgi/sgi/ip27.h
+++ b/sys/arch/sgi/sgi/ip27.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27.h,v 1.3 2010/03/20 16:22:55 miod Exp $ */
+/* $OpenBSD: ip27.h,v 1.4 2010/05/09 18:37:47 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -40,6 +40,7 @@
/* IP35 Brick types */
+#define IP35_CBRICK 0x00
#define IP35_O350 0x02
#define IP35_FUEL 0x04
#define IP35_O300 0x08
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index 15d165dfadd..8260cccdca1 100644
--- a/sys/arch/sgi/sgi/ip27_machdep.c
+++ b/sys/arch/sgi/sgi/ip27_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27_machdep.c,v 1.50 2010/04/21 03:03:26 deraadt Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.51 2010/05/09 18:37:47 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -143,6 +143,10 @@ ip27_setup()
case IP35_O300: /* Speedo2 */
hw_prod = "Origin 300";
break;
+ case IP35_CBRICK:
+ /* regular C-Brick, must be an Origin 3000 system */
+ hw_prod = "Origin 3000";
+ break;
default:
snprintf(unknown_model, sizeof unknown_model,
"Unknown IP35 type %x", sys_config.system_subtype);
diff --git a/sys/arch/sgi/sgi/l1.c b/sys/arch/sgi/sgi/l1.c
index 06ec4321054..2f9e1df39e0 100644
--- a/sys/arch/sgi/sgi/l1.c
+++ b/sys/arch/sgi/sgi/l1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l1.c,v 1.5 2010/04/15 20:32:50 miod Exp $ */
+/* $OpenBSD: l1.c,v 1.6 2010/05/09 18:37:47 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -80,6 +80,7 @@ int l1_packet_get_binary(u_char **, size_t *, u_char **, size_t *);
size_t l1_command_build(u_char *, size_t, uint32_t, uint16_t, int, ...);
int l1_receive_response(int16_t, u_char *, size_t *);
int l1_response_to_errno(uint32_t);
+int l1_read_board_ia(int16_t, int, u_char **, size_t *);
static inline
size_t ia_skip(u_char *, size_t);
@@ -572,7 +573,7 @@ l1_response_to_errno(uint32_t response)
#define EEPROM_CHUNK 0x40
int
-l1_read_board_ia(int16_t nasid, u_char **ria, size_t *rialen)
+l1_read_board_ia(int16_t nasid, int type, u_char **ria, size_t *rialen)
{
u_char pkt[64 + EEPROM_CHUNK]; /* command and response packet buffer */
u_char *pktbuf, *chunk, *ia = NULL;
@@ -584,7 +585,7 @@ l1_read_board_ia(int16_t nasid, u_char **ria, size_t *rialen)
* Build a first packet, asking for 0 bytes to be read.
*/
pktlen = l1_command_build(pkt, sizeof pkt,
- L1_ADDRESS(L1_TYPE_L1, L1_ADDRESS_LOCAL | L1_TASK_GENERAL),
+ L1_ADDRESS(type, L1_ADDRESS_LOCAL | L1_TASK_GENERAL),
L1_REQ_EEPROM, 4,
L1_ARG_INT, (uint32_t)L1_EEP_LOGIC,
L1_ARG_INT, (uint32_t)L1_EEP_BOARD,
@@ -666,7 +667,7 @@ l1_read_board_ia(int16_t nasid, u_char **ria, size_t *rialen)
* Build a command packet, this time actually reading data.
*/
pktlen = l1_command_build(pkt, sizeof pkt,
- L1_ADDRESS(L1_TYPE_L1, L1_ADDRESS_LOCAL | L1_TASK_GENERAL),
+ L1_ADDRESS(type, L1_ADDRESS_LOCAL | L1_TASK_GENERAL),
L1_REQ_EEPROM, 4,
L1_ARG_INT, (uint32_t)L1_EEP_LOGIC,
L1_ARG_INT, (uint32_t)L1_EEP_BOARD,
@@ -850,10 +851,20 @@ l1_get_brick_ethernet_address(int16_t nasid, uint8_t *enaddr)
u_char *ia;
size_t iapos, ialen;
char hexaddr[18], *d, *s;
+ int type;
int rc;
+ /*
+ * If we are running on a C-Brick, the Ethernet address is stored
+ * in the matching I-Brick.
+ */
+ if (sys_config.system_subtype == IP35_CBRICK)
+ type = L1_TYPE_IOBRICK;
+ else
+ type = L1_TYPE_L1;
+
/* read the Board IA of this node */
- rc = l1_read_board_ia(nasid, &ia, &ialen);
+ rc = l1_read_board_ia(nasid, type, &ia, &ialen);
if (rc != 0)
return rc;
@@ -988,10 +999,18 @@ l1_get_brick_spd_record(int16_t nasid, int dimm, u_char **rspd, size_t *rspdlen)
* Since Fuel is also a single-node system, we can safely check for
* the system subtype to decide which address to use.
*/
- if (sys_config.system_subtype == IP35_FUEL)
+ switch (sys_config.system_subtype) {
+ case IP35_FUEL:
address = L1_EEP_DIMM_NOINTERLEAVE(dimm);
- else
- address = L1_EEP_DIMM_INTERLEAVE(dimm);
+ break;
+ case IP35_CBRICK:
+ address = L1_EEP_DIMM_INTERLEAVE(L1_EEP_DIMM_BASE_CBRICK, dimm);
+ break;
+ default:
+ address =
+ L1_EEP_DIMM_INTERLEAVE(L1_EEP_DIMM_BASE_CHIMERA, dimm);
+ break;
+ }
/*
* Build a first packet, asking for 0 bytes to be read.
diff --git a/sys/arch/sgi/sgi/l1.h b/sys/arch/sgi/sgi/l1.h
index 542052f14db..0257296fb3e 100644
--- a/sys/arch/sgi/sgi/l1.h
+++ b/sys/arch/sgi/sgi/l1.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: l1.h,v 1.4 2010/04/15 20:32:50 miod Exp $ */
+/* $OpenBSD: l1.h,v 1.5 2010/05/09 18:37:47 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -73,11 +73,12 @@
#define L1_EEP_LOGIC 0x01 /* logic board */
/* C-brick component */
#define L1_EEP_DIMM_NOINTERLEAVE_BASE 0x04
-#define L1_EEP_DIMM_INTERLEAVE_BASE 0x05
-#define L1_EEP_DIMM_NOINTERLEAVE(d) \
- (L1_EEP_DIMM_NOINTERLEAVE_BASE + (d))
-#define L1_EEP_DIMM_INTERLEAVE(d) \
- (L1_EEP_DIMM_INTERLEAVE_BASE + ((d) >> 1) + ((d) & 0x01 ? 4 : 0))
+#define L1_EEP_DIMM_BASE_CBRICK 0x03
+#define L1_EEP_DIMM_BASE_CHIMERA 0x05
+#define L1_EEP_DIMM_NOINTERLEAVE(dimm) \
+ (L1_EEP_DIMM_NOINTERLEAVE_BASE + (dimm))
+#define L1_EEP_DIMM_INTERLEAVE(base, dimm) \
+ ((base) + ((dimm) >> 1) + ((dimm) & 0x01 ? 4 : 0))
/* ia code */
#define L1_EEP_CHASSIS 0x01 /* chassis ia */
#define L1_EEP_BOARD 0x02 /* board ia */
@@ -94,4 +95,3 @@ struct spdmem_attach_args {
int l1_exec_command(int16_t, const char *);
int l1_get_brick_ethernet_address(int16_t, uint8_t *);
int l1_get_brick_spd_record(int16_t, int, u_char **, size_t *);
-int l1_read_board_ia(int16_t, u_char **, size_t *);