How retrieving HPA/SPA with the device node
Hi all.
I'm still looking for the HPA/SPA of the SCSI/IDE controler of a disk. I've found, and able to write the system tree (like ioscan). The starting point is "root". Now my problem is to find which controler for which disk. The pointer of the disk (/dev/sd??) is the node. Example:/dev/sda2 ->> sda2 -> 0x802 -> major:0x8 -> driver "sd" with minor:0x02 Now how can I link 0x802 to hardware path "2/0/1"
So where is the link between both ????? Do you have any idea ?????
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
Quoted 8 lines · Bruno Vidal
Hi all.
I'm still looking for the HPA/SPA of the SCSI/IDE controler of a disk. I've found, and able to write the system tree (like ioscan). The starting point is "root". Now my problem is to find which controler for which disk. The pointer of the disk (/dev/sd??) is the node. Example:/dev/sda2->> sda2 ->0x802-> major:0x8 -> driver "sd" with minor:0x02 Now how can I link0x802to hardware path "2/0/1"
So where is the link between both ????? Do you have any idea ?????
Hmm. If you can get to the pci_dev or parisc_device for a scsi disc, we have functions for returning the hwpath:
print_pci_hwpathget_pci_node_pathprint_pa_hwpathget_node_path
I'm not sure how to get from `sda2' to the pci_dev of the controlling device.
Signature · 1 line
Revolutions do not require corporate support.
It is my pb, I don't know how to retrieve the pci_dev or parisc_device from the sda2' (the device file). I'm pretty sure that the solution can comes from the sd' drivers (btw which is the name for the ide driver: ide ???). Because when using it, you have to give the device nodes, so it should translate it somewhere to a pci_dev or parisc_device.
Thanks to people who know how to handle this.
Quoted 10 lines · Matthew Wilcox
I'm not sure how to get from `sda2' to the
pci_devof the controlling device.--
Revolutions do not require corporate support._______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
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
Quoted 4 lines · Bruno Vidal
The pointer of the disk (
/dev/sd??) is the node. Example:/dev/sda2->> sda2 ->0x802-> major:0x8 -> driver "sd" with minor:0x02 Now how can I link0x802to hardware path "2/0/1"
So where is the link between both ????? Do you have any idea ?????
Well, there is a link. It's just not as obvious as the iotree.
drivers/scsi/sd.c:sd_open() finds the device:
target = DEVICE_NR(inode->i_rdev); if (target >= sd_template.dev_max || !rscsi_disks[target].device) return -ENXIO; /* No such device */
And sd.h has the definition for Scsi_Disk:
typedef struct scsi_disk {
unsigned capacity; /* size in blocks */
Scsi_Device *device;
unsigned char ready; /* flag ready for FLOPTICAL */
unsigned char write_prot; /* flag write_protect for rmvable dev */
unsigned char sector_bit_size; /* sector_size = 2 to the bit size power */
unsigned char sector_bit_shift; /* power of 2 sectors per FS block */
unsigned has_part_table:1; /* has partition table */
} Scsi_Disk;
Scsi_Device is *private*. It contains the ptr to Scsi_Host (defined in hosts.h), an instance of a SCSI controller driver. And finally, Scsi_Host has a pointer to pci_dev.
Since several of the data structures are intended to be private, I suggest adding a function to sd.c (or scsi.c) that finds and returns the pci_dev pointer:
struct pci_dev *sd_get_pci_dev(struct inode *inode)
{
int target = DEVICE_NR(inode->i_rdev);
Scsi_Device scsidev = rscsi_disks[target].device;
if (target >= sd_template.dev_max || !scsidev)
return NULL; /* No such device */
return (scsi_dev->host->pci_dev);
}It would be nice if SCSI were part of the IO tree but I can understand reasons for not doing it. In particular, SCSI over FC doesn't lend itself to an IO Tree arrangement since it's really a "net". Put a SAN, additional FC controllers from the same host, and a few thousand LUNs out there and the IO tree can become an ugly mess to.
hth,
grant
ps. I had no clue how this worked until I tracked this down starting
at sd_open().
Quoted 3 lines · Grant Grundler
Since several of the data structures are intended to be private, I suggest adding a function to
sd.c(orscsi.c) that finds and returns thepci_devpointer:
Well, looks like we *almost* have what we want in scsi_ioctl.c. scsi_ioctl_get_pci() does about the same thing.
Maybe the right answer is to write another ioctl call that does what you want. I don't know.
grant
Thanks a lot.
It solved my pb. Now I think I'll add a function in scsi.c. Because I need the pointer to pci_dev. And I don't think it can be usefull at user level.
Many thanks for your answers.
Quoted 17 lines · Grant Grundler
Quoted 3 lines · Grant Grundler
Since several of the data structures are intended to be private, I suggest adding a function to
sd.c(orscsi.c) that finds and returns thepci_devpointer:Well, looks like we *almost* have what we want in
scsi_ioctl.c.scsi_ioctl_get_pci()does about the same thing.
Maybe the right answer is to write another ioctl call that does what you want. I don't know.grant
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
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
Hi
I've finally found enought time to continu my long way to the HPA. So now I've build a function in sd.c in order to retrieve the scsi_host. But as it has been said, the pointer pci_dev in the structure scsi_host is not always pointing to a pci_dev. For my poor 712/100, it point to NULL :-( (it is normal, my scsi host is not a PCI one). So I'm still stuck at this point, now I'm able to retrieve the scsi_host and scsi_dev structures, but I'm still unable to go the parisc_device. Any idea ?
Thanks.
Quoted 61 lines · Grant Grundler
Quoted 4 lines · Bruno Vidal
The pointer of the disk (
/dev/sd??) is the node. Example:/dev/sda2->> sda2 ->0x802-> major:0x8 -> driver "sd" with minor:0x02 Now how can I link0x802to hardware path "2/0/1"
So where is the link between both ????? Do you have any idea ?????Well, there is a link. It's just not as obvious as the iotree.
drivers/scsi/sd.c:sd_open() finds the device:
target = DEVICE_NR(inode->i_rdev); if (target >= sd_template.dev_max || !rscsi_disks[target].device) return -ENXIO; /* No such device */And
sd.hhas the definition forScsi_Disk:
typedef structscsi_disk{
unsigned capacity; /* size in blocks */
Scsi_Device*device;
unsigned char ready; /* flag ready for FLOPTICAL */
unsigned charwrite_prot; /* flagwrite_protectfor rmvable dev */
unsigned charsector_bit_size; /*sector_size= 2 to the bit size power */
unsigned charsector_bit_shift; /* power of 2 sectors per FS block */
unsigned has_part_table:1; /* has partition table */
}Scsi_Disk;
Scsi_Deviceis *private*. It contains the ptr toScsi_Host(defined inhosts.h), an instance of a SCSI controller driver. And finally,Scsi_Hosthas a pointer topci_dev.Since several of the data structures are intended to be private, I suggest adding a function to
sd.c(orscsi.c) that finds and returns thepci_devpointer:struct
pci_dev*sd_get_pci_dev(struct inode *inode){ int target = DEVICE_NR(inode->i_rdev); Scsi_Device scsidev = rscsi_disks[target].device; if (target >= sd_template.dev_max || !scsidev) return NULL; /* No such device */ return (scsi_dev->host->pci_dev); }It would be nice if SCSI were part of the IO tree but I can understand reasons for not doing it. In particular, SCSI over FC doesn't lend itself to an IO Tree arrangement since it's really a "net". Put a SAN, additional FC controllers from the same host, and a few thousand LUNs out there and the IO tree can become an ugly mess to.
hth,
grantps. I had no clue how this worked until I tracked this down starting
at sd_open()._______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
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
Quoted 3 lines · Bruno Vidal
But as it has been said, the pointer
pci_devin the structurescsi_hostis not always pointing to apci_dev. For my poor 712/100, it point to NULL :-( (it is normal, my scsi host is not a PCI one).
The best idea we came up with was to require the dump partition be on boot device and pull the HPA from page zero. Matthew Wilcox was mentioning that this problem will be solved in 2.5 kernel since it will get an IO tree similar to HPUX's.
TBH, I'm personally not interested in chasing down solutions for boxes that don't have PCI.
hth,
grant
Hi
Can someone can explain what is the difference between the
"hpa" of a scsi card (pci or not) and the "base" in the structure Scsi_Host ?
....
/* These parameters should be set by the detect routine */
unsigned long base;
unsigned long io_port;
unsigned char n_io_port;
unsigned char dma_channel;
unsigned int irq; ....
I'm pretty sure that it is the same, can someone say if it is wrong or not ?
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
Quoted 10 lines · Bruno Vidal
Hi
Can someone can explain what is the difference between the
"hpa" of a scsi card (pci or not) and the "base" in the structureScsi_Host?
..../* These parameters should be set by the detect routine */ unsigned long base; unsigned long io_port; unsigned char n_io_port; unsigned char dma_channel; unsigned int irq;
Quoted 3 lines
....
I'm pretty sure that it is the same, can someone say if it is wrong or not ?
I'm no expert in the SCSI layer, but it could be that base is the base of the _chip_ and hpa is the base of the _device_. For example, the hpa of the serial device is 0xffd05000 but the chip itself is at 0xffd05800. According to drivers/scsi/lasi700.c:
unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
[...]
hostdata->base = base;so base != hpa. Sorry...
Signature · 1 line
Revolutions do not require corporate support.
Quoted 2 lines · Bruno Vidal
Can someone can explain what is the difference between the
"hpa" of a scsi card (pci or not) and the "base" in the structureScsi_Host?
hpa and base are "handles" for different views of HW.
"hpa" doesn't have to be a physical address (though it normally is). On V-class, the hpa is bogus and just a reference to particular IO device. base could be "adjusted" (like the LASI example) or "F-extended" for 64-bit or whatever the platform code thinks the driver needs to reference the device properly.
But in practice, for the platforms we support to date, I think you can compare them (or compare most of the bits) to determine if it's the same device.
grant
Hi
Thanks for the answer, it's clear now. The fact is I'm able to retrieve the hpa for a PCI device "only". But for the lazy example, I can retrieve the base, but not the hpa. So it would be really nice if I can write something usable also on 712/710/etc.... and not only for PCI system. So I think I'll forget it at this time, and work only for PCI subsystem (I can still work on a function that test the kind of scsi card, and do the reverse job to calculate the hpa from the base, but I'm not sure that it is the best solution).
Thanks a lot.
Quoted 22 lines · Grant Grundler
Quoted 2 lines · Bruno Vidal
Can someone can explain what is the difference between the
"hpa" of a scsi card (pci or not) and the "base" in the structureScsi_Host?hpa and base are "handles" for different views of HW.
"hpa" doesn't have to be a physical address (though it normally is). On V-class, the hpa is bogus and just a reference to particular IO device. base could be "adjusted" (like the LASI example) or "F-extended" for 64-bit or whatever the platform code thinks the driver needs to reference the device properly.But in practice, for the platforms we support to date, I think you can compare them (or compare most of the bits) to determine if it's the same device.
grant
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
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