j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Hi,
I wanted to do the below (based on the nvram code in the same file), but it doesn't work (I always get zero). Can anyone explain what I'm doing wrong?
(This isn't a suggested fix/patch, I'm just wondering what I'm missing.)
- Alyssa
@@ -162,6 +162,7 @@ macio_nvram_get(char *buf) static void openpic_init(const char *path, phys_addr_t addr) { + phandle_t chosen; phandle_t dnode; int props[2]; char buf[128]; @@ -186,6 +187,11 @@ openpic_init(const char *path, phys_addr_t addr) set_int_property(dnode, "clock-frequency", 4166666);
fword("finish-device"); + + chosen = find_dev("/chosen"); + push_str(buf); + fword("open-dev"); + set_int_property(chosen, "interrupt-controller", POP()); }
DECLARE_NODE(ob_macio, INSTALL_OPEN, sizeof(int), "Tmac-io");
On 2016-Feb-6 17:02 , Alyssa Milburn wrote:
chosen = find_dev("/chosen");
push_str(buf);
fword("open-dev");
set_int_property(chosen, "interrupt-controller", POP());
/chosen won't have an "open" method, so the open-dev will fail. You probably don't need the open-dev anyway, you should be able to call set_int_property with the chosen phandle without doing an open on it. That is, delete the 3rd line of the above, it probably works.
On Sat, Feb 06, 2016 at 05:12:19PM -0500, Tarl Neustaedter wrote:
On 2016-Feb-6 17:02 , Alyssa Milburn wrote:
chosen = find_dev("/chosen");
push_str(buf);
fword("open-dev");
set_int_property(chosen, "interrupt-controller", POP());
/chosen won't have an "open" method, so the open-dev will fail. You probably don't need the open-dev anyway, you should be able to call set_int_property with the chosen phandle without doing an open on it. That is, delete the 3rd line of the above, it probably works.
I'm trying to open the openpic (at the path in 'buf'), but you're right, it doesn't have an open..!
I added these at a global scope:
DECLARE_UNNAMED_NODE( ob_openpic, INSTALL_OPEN, 0 ); NODE_METHODS(ob_openpic) = { };
And this after creating the device:
REGISTER_NODE_METHODS(ob_openpic, buf);
And it works now (I hope).
Thanks,
- Alyssa
On Sat, Feb 06, 2016 at 10:23:33PM +0000, Alyssa Milburn wrote:
On Sat, Feb 06, 2016 at 05:12:19PM -0500, Tarl Neustaedter wrote:
On 2016-Feb-6 17:02 , Alyssa Milburn wrote:
chosen = find_dev("/chosen");
push_str(buf);
fword("open-dev");
set_int_property(chosen, "interrupt-controller", POP());
/chosen won't have an "open" method, so the open-dev will fail. You probably don't need the open-dev anyway, you should be able to call set_int_property with the chosen phandle without doing an open on it. That is, delete the 3rd line of the above, it probably works.
I'm trying to open the openpic (at the path in 'buf'), but you're right, it doesn't have an open..!
"interrupt-controller" in /chosen is supposed to contain a phandle, not an ihandle. Try something like
chosen = find_dev("/chosen"); ic = find_dev(buf); set_int_property(chosen, "interrupt-controller", ic);
Segher