From: Bruno Vidal <bruno_vidal@hpfrcu03.france.hp.com>
To: Grant Grundler <grundler@dsl2.external.hp.com>
Cc: "parisc-linux@lists.parisc-linux.org"
<parisc-linux@lists.parisc-linux.org>
Subject: Re: [parisc-linux] How retrieving HPA/SPA with the device node
Date: Fri, 17 May 2002 16:11:07 +0200 [thread overview]
Message-ID: <3CE50F7B.771EC8B8@admin.france.hp.com> (raw)
In-Reply-To: 20020402164417.6C6B6482A@dsl2.external.hp.com
[-- Attachment #1: Type: text/plain, Size: 3108 bytes --]
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.
Grant Grundler wrote:
>
> Bruno Vidal wrote:
> > 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 ?????
>
> 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().
>
> _______________________________________________
> parisc-linux mailing list
> parisc-linux@lists.parisc-linux.org
> http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
--
Vidal Bruno, (770-4271)
SSD-HA Team, HP-UX & LINUX Support
bruno_vidal@admin.france.hp.com
[-- Attachment #2: Card for Bruno Vidal --]
[-- Type: text/x-vcard, Size: 386 bytes --]
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:bruno_vidal@hp.com
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
next prev parent reply other threads:[~2002-05-17 14:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-02 14:08 [parisc-linux] How retrieving HPA/SPA with the device node Bruno Vidal
2002-04-02 14:23 ` Matthew Wilcox
2002-04-02 14:36 ` Bruno Vidal
2002-04-02 16:44 ` Grant Grundler
2002-04-02 16:50 ` Grant Grundler
2002-04-03 7:00 ` Bruno Vidal
2002-05-17 14:11 ` Bruno Vidal [this message]
2002-05-17 15:36 ` Grant Grundler
2002-06-03 11:04 ` Bruno Vidal
2002-06-03 12:26 ` Matthew Wilcox
2002-06-03 20:38 ` Grant Grundler
2002-06-04 7:57 ` Bruno Vidal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3CE50F7B.771EC8B8@admin.france.hp.com \
--to=bruno_vidal@hpfrcu03.france.hp.com \
--cc=grundler@dsl2.external.hp.com \
--cc=parisc-linux@lists.parisc-linux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.