Skip to contentSkip to conversation

mem_pdc_call: how using it exactly.

parisc-linux Bruno Vidal 3 participants 5 messages Jul 5, 2002

lore
Share & tools
lore
#0 lore raw

Hi
I'm fighting with pdc calls since two weeks now. And I think I've nearly succeded to understand how it works. But now I have a problem. I've retrieve the modules hpa, so before using it, I need to retrieve the spa and io_entry code in order to use it. For doing it I've wrote this, it is nearly the same thing than the function pdc_iodc_read():

static unsigned long pdc_result[32] __attribute__ ((aligned (8))); static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));

/* Get spa for this module */
hpa=dump_parms->hpa;
index=0;
iodc_data_size=32;

ret = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa, index, __pa(pdc_result2), iodc_data_size); convert_to_wide(pdc_result);
bytecnt = pdc_result[0];
memcpy(dump_iodc_data, pdc_result2, iodc_data_size);

The result is always "ret = -3" -> cannot complete call without error.
Do I forget anything (probably). Do I have to prevent interruption ? Do I have to modify PSW ?

thanks.

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#1 lore raw
Quoted 8 lines · Bruno Vidal

static unsigned long pdc_result[32] __attribute__ ((aligned (8))); static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));

/* Get spa for this module */
hpa=dump_parms->hpa;
index=0;
iodc_data_size=32;

Quoted 7 lines

ret = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa, index, __pa(pdc_result2), iodc_data_size); convert_to_wide(pdc_result);
bytecnt = pdc_result[0];
memcpy(dump_iodc_data, pdc_result2, iodc_data_size);

The result is always "ret = -3" -> cannot complete call without error.
Do I forget anything (probably). Do I have to prevent interruption ? Do I have to modify PSW ?

more prosaically, i think iodc_data_size should be 32 * sizeof(long), ie size in bytes, not number of longs.

but why code this up yourself rather than use pdc_iodc_read?

Signature · 1 line
Revolutions do not require corporate support.
#2 lore raw

About the iodc_data_size, in the documentation it is describe as: "count bytes in length". For example in drivers/scsi/zalon7xx.c:
status = pdc_iodc_read(&pdc_result, hpa, 0, &iodc_data, 32 );
-> it is 32.
So If I want the 32 first bytes, it should be 32.
Now why doing it myself, because I don't want to use spinlock while dumping, and pdc_iodc_read use spinlock. Perhaps, it is not a good solution, what do you think about using spinlock while dumping ?

Quoted 25 lines · Matthew Wilcox
Quoted 8 lines · Bruno Vidal

static unsigned long pdc_result[32] __attribute__ ((aligned (8))); static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));

/* Get spa for this module */
hpa=dump_parms->hpa;
index=0;
iodc_data_size=32;

Quoted 7 lines

ret = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa, index, __pa(pdc_result2), iodc_data_size); convert_to_wide(pdc_result);
bytecnt = pdc_result[0];
memcpy(dump_iodc_data, pdc_result2, iodc_data_size);

The result is always "ret = -3" -> cannot complete call without error.
Do I forget anything (probably). Do I have to prevent interruption ? Do I have to modify PSW ?

more prosaically, i think iodc_data_size should be 32 * sizeof(long), ie size in bytes, not number of longs.

but why code this up yourself rather than use pdc_iodc_read?

--
Revolutions do not require corporate support.

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#3 lore raw

Hi
I've just read that PDC call need some specific PSW state. But I didnt' find any function to manipulate PSW (easely). Does exit any function to change some bits in the PSW ?

Thanks.

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#4 lore raw
In reply to Bruno Vidal
Quoted 2 lines · Bruno Vidal

About the iodc_data_size, in the documentation it is describe as: "count byte
s in length".

Yes. Gecko ERS says ARG6 is "size of memaddr in bytes".

Quoted 4 lines

For example in drivers/scsi/zalon7xx.c:
status = pdc_iodc_read(&pdc_result, hpa, 0, &iodc_data, 32 ); -> it is 32.
So If I want the 32 first bytes, it should be 32.

        status = pdc_iodc_read(&pdc_result, hpa, 0, &iodc_data, 32 );
	if (status == PDC_RET_OK) {
		clock = (int) pdc_result[16];
	} else {
	....

This looks wrong. pdc_result[16] probably contains garbage.

Quoted 3 lines

Now why doing it myself, because I don't want to use spinlock while dumping, and pdc_iodc_read use spinlock. Perhaps, it is not a good solution, what do you think about using spinlock while dumping ?

I would rather see the dump code avoid the spinlock and replicate the pdc calls. ie assume PDC calls can crash the system too. But if this is a PITA, re-initialize the lock and use the regular calls.

grant