summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-01-25 02:37:44 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-01-25 02:37:44 +0000
commit5359ea379ef452d82cf4b9413508bcd9ea8f5888 (patch)
treef264e2977ee45426101489d459ef8677ef003403 /sys/arch
parent20a8b5f710ad7693bb65d0016ff45aa621034b05 (diff)
Add support for the "Magma 2+1HS Sp" (from NetBSD)
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/dev/magma.c101
-rw-r--r--sys/arch/sparc/dev/magmareg.h7
2 files changed, 61 insertions, 47 deletions
diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c
index a474ba5d421..cd8319692de 100644
--- a/sys/arch/sparc/dev/magma.c
+++ b/sys/arch/sparc/dev/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.9 2002/01/11 05:17:30 jason Exp $ */
+/* $OpenBSD: magma.c,v 1.10 2002/01/25 02:37:43 jason Exp $ */
/*
* magma.c
*
@@ -95,77 +95,82 @@
*/
static struct magma_board_info supported_cards[] = {
{
- "MAGMA,4_Sp", "Magma 4 Sp", 4, 0,
+ "MAGMA_Sp", "MAGMA,4_Sp", "Magma 4 Sp", 4, 0,
1, 0xa000, 0xc000, 0xe000, { 0x8000, 0, 0, 0 },
0, { 0, 0 }
},
{
- "MAGMA,8_Sp", "Magma 8 Sp", 8, 0,
+ "MAGMA_Sp", "MAGMA,8_Sp", "Magma 8 Sp", 8, 0,
2, 0xa000, 0xc000, 0xe000, { 0x4000, 0x6000, 0, 0 },
0, { 0, 0 }
},
{
- "MAGMA,_8HS_Sp", "Magma Fast 8 Sp", 8, 0,
+ "MAGMA_Sp", "MAGMA,_8HS_Sp", "Magma Fast 8 Sp", 8, 0,
2, 0x2000, 0x4000, 0x6000, { 0x8000, 0xa000, 0, 0 },
0, { 0, 0 }
},
{
- "MAGMA,_8SP_422", "Magma 8 Sp - 422", 8, 0,
+ "MAGMA_Sp", "MAGMA,_8SP_422", "Magma 8 Sp - 422", 8, 0,
2, 0x2000, 0x4000, 0x6000, { 0x8000, 0xa000, 0, 0 },
0, { 0, 0 }
},
{
- "MAGMA,12_Sp", "Magma 12 Sp", 12, 0,
+ "MAGMA_Sp", "MAGMA,12_Sp", "Magma 12 Sp", 12, 0,
3, 0xa000, 0xc000, 0xe000, { 0x2000, 0x4000, 0x6000, 0 },
0, { 0, 0 }
},
{
- "MAGMA,16_Sp", "Magma 16 Sp", 16, 0,
+ "MAGMA_Sp", "MAGMA,16_Sp", "Magma 16 Sp", 16, 0,
4, 0xd000, 0xe000, 0xf000, { 0x8000, 0x9000, 0xa000, 0xb000 },
0, { 0, 0 }
},
{
- "MAGMA,16_Sp_2", "Magma 16 Sp", 16, 0,
+ "MAGMA_Sp", "MAGMA,16_Sp_2", "Magma 16 Sp", 16, 0,
4, 0x2000, 0x4000, 0x6000, { 0x8000, 0xa000, 0xc000, 0xe000 },
0, { 0, 0 }
},
{
- "MAGMA,16HS_Sp", "Magma Fast 16 Sp", 16, 0,
+ "MAGMA_Sp", "MAGMA,16HS_Sp", "Magma Fast 16 Sp", 16, 0,
4, 0x2000, 0x4000, 0x6000, { 0x8000, 0xa000, 0xc000, 0xe000 },
0, { 0, 0 }
},
{
- "MAGMA,21_Sp", "Magma LC 2+1 Sp", 2, 1,
+ "MAGMA_Sp", "MAGMA,21_Sp", "Magma LC 2+1 Sp", 2, 1,
1, 0xa000, 0xc000, 0xe000, { 0x8000, 0, 0, 0 },
0, { 0, 0 }
},
{
- "MAGMA,21HS_Sp", "Magma 2+1 Sp", 2, 1,
+ "MAGMA_Sp", "MAGMA,21HS_Sp", "Magma 2+1 Sp", 2, 1,
1, 0xa000, 0xc000, 0xe000, { 0x4000, 0, 0, 0 },
1, { 0x6000, 0 }
},
{
- "MAGMA,41_Sp", "Magma 4+1 Sp", 4, 1,
+ "MAGMA_Sp", "MAGMA,41_Sp", "Magma 4+1 Sp", 4, 1,
1, 0xa000, 0xc000, 0xe000, { 0x4000, 0, 0, 0 },
1, { 0x6000, 0 }
},
{
- "MAGMA,82_Sp", "Magma 8+2 Sp", 8, 2,
+ "MAGMA_Sp", "MAGMA,82_Sp", "Magma 8+2 Sp", 8, 2,
2, 0xd000, 0xe000, 0xf000, { 0x8000, 0x9000, 0, 0 },
2, { 0xa000, 0xb000 }
},
{
- "MAGMA,P1_Sp", "Magma P1 Sp", 0, 1,
+ "MAGMA_Sp", "MAGMA,P1_Sp", "Magma P1 Sp", 0, 1,
0, 0, 0, 0, { 0, 0, 0, 0 },
1, { 0x8000, 0 }
},
{
- "MAGMA,P2_Sp", "Magma P2 Sp", 0, 2,
+ "MAGMA_Sp", "MAGMA,P2_Sp", "Magma P2 Sp", 0, 2,
0, 0, 0, 0, { 0, 0, 0, 0 },
2, { 0x4000, 0x8000 }
},
{
- NULL, NULL, 0, 0,
+ "MAGMA 2+1HS Sp", "", "Magma 2+1HS Sp", 2, 0,
+ 1, 0xa000, 0xc000, 0xe000, { 0x4000, 0, 0, 0 },
+ 1, { 0x8000, 0 }
+ },
+ {
+ NULL, NULL, NULL, 0, 0,
0, 0, 0, 0, { 0, 0, 0, 0 },
0, { 0, 0 }
}
@@ -312,15 +317,20 @@ register int s, srer;
int
magma_match(parent, vcf, args)
-struct device *parent;
-void *vcf, *args;
+ struct device *parent;
+ void *vcf, *args;
{
-register struct confargs *ca = args;
-register struct romaux *ra = &ca->ca_ra;
-
- /* is it a magma Sp card? */
- if( strcmp(ra->ra_name, "MAGMA_Sp") != 0 )
- return(0);
+ struct confargs *ca = args;
+ struct romaux *ra = &ca->ca_ra;
+ struct magma_board_info *card;
+
+ for (card = supported_cards; ; card++) {
+ if (card->mb_sbusname == NULL)
+ /* End of table: no match */
+ return (0);
+ if (strcmp(ra->ra_name, card->mb_sbusname) == 0)
+ break;
+ }
#if defined(MAGMA_DEBUG)
{
@@ -351,23 +361,36 @@ void *args;
struct confargs *ca = args;
struct romaux *ra = &ca->ca_ra;
struct magma_softc *sc = (struct magma_softc *)dev;
-struct magma_board_info *card = supported_cards;
-char *magma_prom = getpropstring(ra->ra_node, "magma_prom");
-int chip;
+struct magma_board_info *card;
+char *magma_prom, *clockstr;
+int chip, cd_clock;
void *base;
- /* find the card type */
- while( card->mb_name && strcmp(magma_prom, card->mb_name) )
- card++;
-
- dprintf((" addr 0x%x", sc));
- printf(" pri %d softpri %d:", ra->ra_intr[0].int_pri, PIL_TTY);
+ magma_prom = getpropstring(ra->ra_node, "magma_prom");
+ for (card = supported_cards; card->mb_name != NULL; card++) {
+ if (strcmp(ra->ra_name, card->mb_sbusname) != 0)
+ continue;
+ if (strcmp(magma_prom, card->mb_name) == 0)
+ break;
+ }
if( card->mb_name == NULL ) {
printf(" %s (unsupported)\n", magma_prom);
return;
}
+
+ clockstr = getpropstring(ra->ra_node, "clock");
+ if (strlen(clockstr) == 0)
+ cd_clock = 0;
+ else {
+ cd_clock = 0;
+ while (*clockstr != '\0')
+ cd_clock = cd_clock * 10 + *clockstr++ - '0';
+ }
+
+ dprintf((" addr 0x%x", sc));
+ printf(" pri %d softpri %d:", ra->ra_intr[0].int_pri, PIL_TTY);
printf(" %s\n", card->mb_realname);
sc->ms_board = card;
@@ -383,21 +406,11 @@ void *base;
/* init the cd1400 chips */
for( chip = 0 ; chip < card->mb_ncd1400 ; chip++ ) {
- char *str;
struct cd1400 *cd = &sc->ms_cd1400[chip];
cd->cd_reg = base + card->mb_cd1400[chip];
- str = getpropstring(ra->ra_node, "clock");
- if (strlen(str) == 0)
- cd->cd_clock = 25;
- else {
- char *cp = str;
-
- cd->cd_clock = 0;
- while (*cp != '\0')
- cd->cd_clock = cd->cd_clock * 10 + *cp++ - '0';
- }
+ cd->cd_clock = cd_clock;
/* getpropstring(ra->ra_node, "chiprev"); */
/* seemingly the Magma drivers just ignore the propstring */
diff --git a/sys/arch/sparc/dev/magmareg.h b/sys/arch/sparc/dev/magmareg.h
index 7dc14b20e9a..bf6280b47a9 100644
--- a/sys/arch/sparc/dev/magmareg.h
+++ b/sys/arch/sparc/dev/magmareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: magmareg.h,v 1.4 2001/07/04 08:43:28 niklas Exp $ */
+/* $OpenBSD: magmareg.h,v 1.5 2002/01/25 02:37:43 jason Exp $ */
/* magmareg.h
*
@@ -70,8 +70,9 @@
* Supported Card Types
*/
struct magma_board_info {
- char *mb_name; /* cardname to match against */
- char *mb_realname; /* english card name */
+ const char *mb_sbusname; /* sbus name */
+ const char *mb_name; /* cardname to match against */
+ const char *mb_realname; /* english card name */
int mb_nser; /* number of serial ports */
int mb_npar; /* number of parallel ports */
int mb_ncd1400; /* number of CD1400 chips */