It’s getting stuck in a reboot loop.
Not enough time to investigate at the moment, but I’ll dig into this soon.
It may be my build environment.
On Nov 25, 2014, at 5:54 AM, Jonathan Gray j...@jsg.id.au wrote:
On Mon, Nov 24, 2014 at 08:12:33PM -0600, Edwin Amsler wrote:
Here are the changes needed to make SATA drives available on the Cubieboard
A10. It consists of a DMA workaround and fiddling with some register
assignments. I?ve successfully built the RAMDISK kernel via an external
drive using this driver patch, so it?s been through what I?m hoping is a
valid smoke test.
This patch was based off work done by others.
Let me know what needs changing.
dlg would prefer this to be done with a callback rather than a flag.
So here's an attempt to handle it that way.
Doesn't seem to break anything on an amd64 machine with ahci.
Index: dev/ic/ahci.c
===
RCS file: /cvs/src/sys/dev/ic/ahci.c,v
retrieving revision 1.16
diff -u -p -r1.16 ahci.c
--- dev/ic/ahci.c 13 Jul 2014 23:10:23 - 1.16
+++ dev/ic/ahci.c 25 Nov 2014 10:52:15 -
@@ -75,7 +75,7 @@ int ahci_port_alloc(struct ahci_softc
void ahci_port_free(struct ahci_softc *, u_int);
int ahci_port_init(struct ahci_softc *, u_int);
-int ahci_port_start(struct ahci_port *, int);
+int ahci_default_port_start(struct ahci_port *, int);
int ahci_port_stop(struct ahci_port *, int);
int ahci_port_clo(struct ahci_port *);
int ahci_port_softreset(struct ahci_port *);
@@ -175,6 +175,9 @@ ahci_attach(struct ahci_softc *sc)
u_int32_t pi;
int i;
+ if (sc-sc_port_start == NULL)
+ sc-sc_port_start = ahci_default_port_start;
+
if (ahci_init(sc) != 0) {
/* error already printed by ahci_init */
goto unmap;
@@ -832,7 +835,7 @@ reterr:
}
int
-ahci_port_start(struct ahci_port *ap, int fre_only)
+ahci_default_port_start(struct ahci_port *ap, int fre_only)
{
u_int32_t r;
Index: dev/ic/ahcivar.h
===
RCS file: /cvs/src/sys/dev/ic/ahcivar.h,v
retrieving revision 1.8
diff -u -p -r1.8 ahcivar.h
--- dev/ic/ahcivar.h 14 Apr 2014 04:42:22 - 1.8
+++ dev/ic/ahcivar.h 25 Nov 2014 10:50:20 -
@@ -137,9 +137,12 @@ struct ahci_softc {
u_int32_t sc_ccc_ports;
u_int32_t sc_ccc_ports_cur;
#endif
+
+ int (*sc_port_start)(struct ahci_port *, int);
};
#define DEVNAME(_s) ((_s)-sc_dev.dv_xname)
+#define ahci_port_start(_p, _f) ((_p)-ap_sc-sc_port_start((_p), (_f)))
int ahci_attach(struct ahci_softc *);
int ahci_detach(struct ahci_softc *, int);
Index: arch/armv7/sunxi/sxiahci.c
===
RCS file: /cvs/src/sys/arch/armv7/sunxi/sxiahci.c,v
retrieving revision 1.6
diff -u -p -r1.6 sxiahci.c
--- arch/armv7/sunxi/sxiahci.c14 Apr 2014 04:42:22 - 1.6
+++ arch/armv7/sunxi/sxiahci.c25 Nov 2014 11:37:56 -
@@ -1,6 +1,7 @@
/*$OpenBSD*/
/*
* Copyright (c) 2013 Patrick Wildt patr...@blueri.se
+ * Copyright (c) 2013,2014 Artturi Alm
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -44,13 +45,21 @@
#define SXIAHCI_TIMEOUT 0x10
#define SXIAHCI_PWRPIN40
+#define SXIAHCI_PREG_DMA 0x70
+#define SXIAHCI_PREG_DMA_MASK (0xff8)
+#define SXIAHCI_PREG_DMA_INIT (0x448)
+
void sxiahci_attach(struct device *, struct device *, void *);
int sxiahci_detach(struct device *, int);
int sxiahci_activate(struct device *, int);
+int sxiahci_port_start(struct ahci_port *, int);
extern int ahci_intr(void *);
extern u_int32_t ahci_read(struct ahci_softc *, bus_size_t);
extern void ahci_write(struct ahci_softc *, bus_size_t, u_int32_t);
+extern u_int32_t ahci_pread(struct ahci_port *, bus_size_t);
+extern void ahci_pwrite(struct ahci_port *, bus_size_t, u_int32_t);
+extern int ahci_default_port_start(struct ahci_port *, int);
struct sxiahci_softc {
struct ahci_softc sc;
@@ -75,18 +84,15 @@ sxiahci_attach(struct device *parent, st
struct armv7_attach_args *aa = args;
struct sxiahci_softc *sxisc = (struct sxiahci_softc *)self;
struct ahci_softc *sc = sxisc-sc;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
uint32_t timo;
- sc-sc_iot = iot = aa-aa_iot;
+ sc-sc_iot = aa-aa_iot;
sc-sc_ios = aa-aa_dev-mem[0].size;
sc-sc_dmat = aa-aa_dmat;
if (bus_space_map