summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-07-21 20:36:13 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-07-21 20:36:13 +0000
commit5c0622bec9f8ff5eab32e92654cbba7aa8a56e7b (patch)
tree9e34e19d3242128c89a0115d638b14e8d82ae0f0 /sys
parent4f21040bd80dae12b7880094486abf09eff0a164 (diff)
Support for the eBenton EBT-700 netbook, which is similar to the Lemote
Yeeloong, but with a 7" display with a 800x480 resolution, and no webcam. There are still problems to get it booting from disk from PMON (colour me unsurprised), which are being looked at. Loading the boot blocks from a FAT USB stick, to then boot the kernel from the disk, is a reliable workaround in the meantime. Tested by Ban Keong Yee (bankeong dot yee on gmail) who is the ``lucky'' owner of such a machine, thanks for your time!
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/loongson/dev/kb3310.c3
-rw-r--r--sys/arch/loongson/dev/smfb.c22
-rw-r--r--sys/arch/loongson/loongson/machdep.c156
-rw-r--r--sys/arch/loongson/loongson/yeeloong_machdep.c30
-rw-r--r--sys/arch/mips64/include/archtype.h3
5 files changed, 151 insertions, 63 deletions
diff --git a/sys/arch/loongson/dev/kb3310.c b/sys/arch/loongson/dev/kb3310.c
index 3a5eafa4642..692a10790e2 100644
--- a/sys/arch/loongson/dev/kb3310.c
+++ b/sys/arch/loongson/dev/kb3310.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kb3310.c,v 1.16 2010/10/14 21:23:04 pirofti Exp $ */
+/* $OpenBSD: kb3310.c,v 1.17 2011/07/21 20:36:12 miod Exp $ */
/*
* Copyright (c) 2010 Otto Moerbeek <otto@drijf.net>
*
@@ -132,6 +132,7 @@ ykbec_match(struct device *parent, void *match, void *aux)
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
+ /* XXX maybe allow LOONGSON_EBT700 ??? */
if (sys_platform->system_type != LOONGSON_YEELOONG)
return (0);
diff --git a/sys/arch/loongson/dev/smfb.c b/sys/arch/loongson/dev/smfb.c
index 62b24eac0c5..2a29b337a89 100644
--- a/sys/arch/loongson/dev/smfb.c
+++ b/sys/arch/loongson/dev/smfb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smfb.c,v 1.12 2011/05/25 21:15:46 miod Exp $ */
+/* $OpenBSD: smfb.c,v 1.13 2011/07/21 20:36:12 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -20,13 +20,16 @@
* SiliconMotion SM502 and SM712 frame buffer driver.
*
* Assumes its video output is an LCD panel, in 5:6:5 mode, and fixed
- * 1024x600 resolution.
+ * 1024x600 or 800x480 resolution, depending on the system model.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <mips64/include/archtype.h>
+
+#include <machine/autoconf.h>
#include <machine/bus.h>
#include <machine/cpu.h>
@@ -364,8 +367,19 @@ smfb_setup(struct smfb *fb, bus_space_tag_t memt, bus_space_handle_t memh,
int rc;
ri = &fb->ri;
- ri->ri_width = 1024;
- ri->ri_height = 600;
+ switch (sys_platform->system_type) {
+ case LOONGSON_EBT700:
+ ri->ri_width = 800;
+ ri->ri_height = 480;
+ break;
+ default:
+ case LOONGSON_GDIUM:
+ case LOONGSON_LYNLOONG:
+ case LOONGSON_YEELOONG:
+ ri->ri_width = 1024;
+ ri->ri_height = 600;
+ break;
+ }
ri->ri_depth = 16;
ri->ri_stride = (ri->ri_width * ri->ri_depth) / 8;
ri->ri_flg = RI_CENTER | RI_CLEAR | RI_FULLCLEAR;
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 1c5d116dd5d..8b631db101b 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.32 2011/06/26 22:39:59 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.33 2011/07/21 20:36:12 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -76,6 +76,10 @@
#include <dev/cons.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
#include <mips64/archtype.h>
/* The following is used externally (sysctl_hw) */
@@ -124,6 +128,7 @@ static void dobootopts(int);
void dumpsys(void);
void dumpconf(void);
extern void parsepmonbp(void);
+const struct platform *loongson_identify(const char *);
vaddr_t mips_init(int32_t, int32_t, int32_t, int32_t, char *);
extern void loongson2e_setup(u_long, u_long);
@@ -152,6 +157,7 @@ struct bonito_flavour {
const struct platform *platform;
};
+extern const struct platform ebenton_platform;
extern const struct platform fuloong_platform;
extern const struct platform gdium_platform;
extern const struct platform generic2e_platform;
@@ -159,8 +165,11 @@ extern const struct platform lynloong_platform;
extern const struct platform yeeloong_platform;
const struct bonito_flavour bonito_flavours[] = {
+ /* eBenton EBT700 netbook */
+ { "EBT700", &ebenton_platform }, /* prefix added by user */
/* Lemote Fuloong 2F mini-PC */
- { "LM6002", &fuloong_platform }, /* dual Ethernet, no prefix */
+ { "LM6002", &fuloong_platform }, /* dual Ethernet,
+ prefix added by user */
{ "LM6003", &fuloong_platform },
{ "LM6004", &fuloong_platform },
/* EMTEC Gdium Liberty 1000 */
@@ -176,6 +185,95 @@ const struct bonito_flavour bonito_flavours[] = {
};
/*
+ * Try to figure out what particular machine we run on, depending on the
+ * scarce PMON version information and whatever else we can figure.
+ */
+const struct platform *
+loongson_identify(const char *version)
+{
+ const struct bonito_flavour *f;
+
+ if (version == NULL) {
+ /*
+ * If there is no `Version' variable, we expect to be running
+ * on a 2E system, use the generic code and hope for the best.
+ */
+ if (loongson_ver == 0x2e) {
+ return &generic2e_platform;
+ } else {
+ pmon_printf("Unable to figure out model!\n");
+ return NULL;
+ }
+ }
+
+ for (f = bonito_flavours; f->prefix != NULL; f++)
+ if (strncmp(version, f->prefix, strlen(f->prefix)) == 0)
+ return f->platform;
+
+ /*
+ * Early Lemote designs shipped without a model prefix.
+ *
+ * We can reasonably expect these to be close enough to either the
+ * first generation Fuloong 2F design (LM6002), or the 7 inch
+ * first netbook model; we can tell them apart by looking at which
+ * video chip they embed.
+ *
+ * Note that this is only worth doing if the version string is
+ * 1.2.something (1.3 onwards are expected to have a model prefix,
+ * and there are currently no reports of 1.1 and
+ * below being 2F systems).
+ *
+ * LM6002 users are encouraged to add the system model prefix to
+ * the `Version' variable.
+ */
+ if (strncmp(version, "1.2.", 4) == 0) {
+ const struct platform *p = NULL;
+ pcitag_t tag;
+ pcireg_t id, class;
+ int dev;
+
+ pmon_printf("No model prefix in version string \"%s\".\n",
+ version);
+
+ for (dev = 0; dev < 32; dev++) {
+ tag = pci_make_tag_early(0, dev, 0);
+ id = pci_conf_read_early(tag, PCI_ID_REG);
+ if (id == 0 || PCI_VENDOR(id) == PCI_VENDOR_INVALID)
+ continue;
+
+ /* no need to check for DEVICE_IS_VGA_PCI here
+ since we expect a linear framebuffer */
+ class = pci_conf_read_early(tag, PCI_CLASS_REG);
+ if (PCI_CLASS(class) != PCI_CLASS_DISPLAY ||
+ (PCI_SUBCLASS(class) != PCI_SUBCLASS_DISPLAY_VGA &&
+ PCI_SUBCLASS(class) != PCI_SUBCLASS_DISPLAY_MISC))
+ continue;
+
+ switch (id) {
+ case PCI_ID_CODE(PCI_VENDOR_SIS,
+ PCI_PRODUCT_SIS_315PRO_VGA):
+ p = &fuloong_platform;
+ break;
+ case PCI_ID_CODE(PCI_VENDOR_SMI,
+ PCI_PRODUCT_SMI_SM712):
+ p = &ebenton_platform;
+ break;
+ }
+
+ if (p != NULL) {
+ pmon_printf("Attempting to match as %s %s\n",
+ p->vendor, p->product);
+ return p;
+ }
+ }
+ }
+
+ pmon_printf("This kernel doesn't support model \"%s\"." "\n", version);
+ return NULL;
+}
+
+
+/*
* Do all the stuff that locore normally does before calling main().
* Reset mapping and set up mapping to hardware and init "wired" reg.
*/
@@ -189,7 +287,6 @@ mips_init(int32_t argc, int32_t argv, int32_t envp, int32_t cv,
vaddr_t xtlb_handler;
const char *envvar;
int i;
- const struct bonito_flavour *f;
extern char start[], edata[], end[];
extern char exception[], e_exception[];
@@ -299,57 +396,8 @@ mips_init(int32_t argc, int32_t argv, int32_t envp, int32_t cv,
* on the PMON version information.
*/
- envvar = pmon_getenv("Version");
- if (envvar == NULL) {
- /*
- * If this is a 2E system, use the generic code and hope
- * for the best.
- */
- if (loongson_ver == 0x2e) {
- sys_platform = &generic2e_platform;
- } else {
- pmon_printf("Unable to figure out model!\n");
- goto unsupported;
- }
- } else {
- for (f = bonito_flavours; f->prefix != NULL; f++)
- if (strncmp(envvar, f->prefix, strlen(f->prefix)) ==
- 0) {
- sys_platform = f->platform;
- break;
- }
-
- if (sys_platform == NULL) {
- /*
- * Early Lemote designs shipped without a model prefix.
- * Hopefully these well be close enough to the first
- * generation Fuloong 2F design (LM6002); let's warn
- * the user and try this if version is 1.2.something
- * (1.3 onwards are expected to have a model prefix,
- * and there are currently no reports of 1.1 and
- * below being 2F systems).
- *
- * Note that this could be handled by adding a
- * "1.2." machine type entry to the flavours table,
- * but I prefer have it stand out.
- * LM6002 users are encouraged to add the system
- * model prefix to the `Version' variable.
- */
- if (strncmp(envvar, "1.2.", 4) == 0) {
- pmon_printf("No model prefix in version"
- " string \"%s\".\n"
- "Attempting to match as Lemote Fuloong\n",
- envvar);
- sys_platform = &fuloong_platform;
- }
- }
-
- if (sys_platform == NULL) {
- pmon_printf("This kernel doesn't support model \"%s\"."
- "\n", envvar);
- goto unsupported;
- }
- }
+ if ((sys_platform = loongson_identify(pmon_getenv("Version"))) == NULL)
+ goto unsupported;
hw_vendor = sys_platform->vendor;
hw_prod = sys_platform->product;
diff --git a/sys/arch/loongson/loongson/yeeloong_machdep.c b/sys/arch/loongson/loongson/yeeloong_machdep.c
index eca1b5ce4d7..08baf14833b 100644
--- a/sys/arch/loongson/loongson/yeeloong_machdep.c
+++ b/sys/arch/loongson/loongson/yeeloong_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yeeloong_machdep.c,v 1.16 2011/04/15 20:40:06 deraadt Exp $ */
+/* $OpenBSD: yeeloong_machdep.c,v 1.17 2011/07/21 20:36:12 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -17,8 +17,9 @@
*/
/*
- * Lemote {Fu,Lyn,Yee}loong specific code and configuration data.
- * (this file really ought to be named lemote_machdep.c by now)
+ * eBenton EBT700 and Lemote {Fu,Lyn,Yee}loong specific code and
+ * configuration data.
+ * (this file probably ought to be named lemote_machdep.c by now)
*/
#include <sys/param.h>
@@ -203,6 +204,29 @@ const struct platform yeeloong_platform = {
#endif
};
+/* eBenton EBT700 is similar to Lemote Yeeloong, except for a smaller screen */
+const struct platform ebenton_platform = {
+ .system_type = LOONGSON_EBT700,
+ .vendor = "eBenton",
+ .product = "EBT700",
+
+ .bonito_config = &lemote_bonito,
+ .isa_chipset = &lemote_isa_chipset,
+ .legacy_io_ranges = yeeloong_legacy_ranges,
+
+ .setup = NULL,
+ .device_register = lemote_device_register,
+
+ .powerdown = yeeloong_powerdown,
+ .reset = lemote_reset,
+#ifdef notyet
+#if NYKBEC > 0
+ .suspend = ykbec_suspend,
+ .resume = ykbec_resume
+#endif
+#endif
+};
+
/*
* PCI model specific routines
*/
diff --git a/sys/arch/mips64/include/archtype.h b/sys/arch/mips64/include/archtype.h
index 907c413e268..9fb7768b2d2 100644
--- a/sys/arch/mips64/include/archtype.h
+++ b/sys/arch/mips64/include/archtype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archtype.h,v 1.13 2011/03/23 16:54:36 pirofti Exp $ */
+/* $OpenBSD: archtype.h,v 1.14 2011/07/21 20:36:12 miod Exp $ */
/*
* Copyright (c) 1997-2004 Opsycon AB, Sweden (www.opsycon.se)
*
@@ -83,6 +83,7 @@
#define LOONGSON_GDIUM 0x0062 /* EMTEC Gdium Liberty */
#define LOONGSON_FULOONG 0x0063 /* Lemote Fuloong */
#define LOONGSON_LYNLOONG 0x0064 /* Lemote Lynloong */
+#define LOONGSON_EBT700 0x0065 /* eBenton EBT700 */
#define MISC_CLASS 0x00f0 /* Misc machines... */
#define LAGUNA 0x00f1 /* Heurikon Laguna VME board */