Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
In message: [EMAIL PROTECTED] John Hay [EMAIL PROTECTED] writes: : What is the GET_GEOMETRY used for anyway? : : Well the short version of the problem is that fdisk -BI disk works : on -stable to get a FreeBSD partition on the Compact Flash. This does : not work on -current anymore. I have traced that back to the commit : in umass.c rev 1.61 that removed the fake geometry setting and just : leave the cylinders, heads and sectors_per_track zero. This cause : fdisk to coredump with a floating point error. fdisk is using them, btw, to create a MBR which needs these fields to be somewhat sane. The floating point error likely is because we're dividing by zero on this case: #define RoundCyl(x) x) + cylsecs - 1) / cylsecs) * cylsecs) if cylsecs is 0, guess what happens. We do similar things with dos_cylsecs in init_sector0. There's also code in get_params() that devides by dos_heads * 512 * dos_sectors: static int get_params() { int error; u_int u; off_t o; error = ioctl(fd, DIOCGFWSECTORS, u); if (error == 0) sectors = dos_sectors = u; error = ioctl(fd, DIOCGFWHEADS, u); if (error == 0) heads = dos_heads = u; dos_cylsecs = cylsecs = heads * sectors; disksecs = cyls * heads * sectors; error = ioctl(fd, DIOCGSECTORSIZE, u); if (error != 0) u = 512; error = ioctl(fd, DIOCGMEDIASIZE, o); if (error == 0) { disksecs = o / u; cyls = dos_cyls = o / (u * dos_heads * dos_sectors); } return (disksecs); } fdisk likely should do something sane in the face of such insanity, but it is unclear what and fdisk is a royal pita to work on anyway :-( Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
Well the short version of the problem is that fdisk -BI disk works on -stable to get a FreeBSD partition on the Compact Flash. This does not work on -current anymore. I have traced that back to the commit in umass.c rev 1.61 that removed the fake geometry setting and just leave the cylinders, heads and sectors_per_track zero. This cause fdisk to coredump with a floating point error. Hm, strange. I would think that a compact flasg is an ATAPI over CBI device (see attach message in your dmesg). If that is the case, the 'fake setting' was not done in STABLE either and I would expect the problem to be somewhere else. But that would contradict your research. Nick To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
Let's work on the 'proper' solution first. What SCSI commands are suitable for getting the geometry, generically on a device? Nick fdisk likely should do something sane in the face of such insanity, but it is unclear what and fdisk is a royal pita to work on anyway :-( Warner -- [EMAIL PROTECTED] http://www.van-laarhoven.org/ [EMAIL PROTECTED]http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
Hm, the only one that does something different is the iir/iir.c driver. I guess the best thing is to just copy what's in the aha driver. Nick Let's work on the 'proper' solution first. What SCSI commands are suitable for getting the geometry, generically on a device? Hmmm, I made an interesting discovery. I searched through some of the scsi drivers, sys/dev/{aha|ahb|aic*|sym}, looking for XPT_CALC_GEOMETRY and they all fake the geometry. :-/ fdisk likely should do something sane in the face of such insanity, but it is unclear what and fdisk is a royal pita to work on anyway :-( John -- [EMAIL PROTECTED] http://www.van-laarhoven.org/ [EMAIL PROTECTED]http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
See XPT_CALC_GEOMETRY in /sys/dev/aic7xxx/aic7xxx_osm.c On Mon, 4 Nov 2002, Nick Hibma wrote: Let's work on the 'proper' solution first. What SCSI commands are suitable for getting the geometry, generically on a device? Nick fdisk likely should do something sane in the face of such insanity, but it is unclear what and fdisk is a royal pita to work on anyway :-( Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
On Mon, 4 Nov 2002, John Hay wrote: Let's work on the 'proper' solution first. What SCSI commands are suitable for getting the geometry, generically on a device? Hmmm, I made an interesting discovery. I searched through some of the scsi drivers, sys/dev/{aha|ahb|aic*|sym}, looking for XPT_CALC_GEOMETRY and they all fake the geometry. :-/ That's the currently the only correct way to do it. Geometry means nothing in SCSI, everything is linear block address. For an example of how to convert from LBA to C/H/S, see p. 92 of CAM2. --- SETSIZE converts a read capacity value to int 13h head-cylinder-sector requirements. It minimizes the value for number of heads and maximizes the number of cylinders. This supports very large disks before the number of heads will not fit in 4 bits (or 6 bits). This algorithm also minimizes the number of sectors that are unused at the end of the disk while allowing for large disks to be accommodated. This algorithm does not use physical geometry. --- It might be more useful for GEOM to query the BIOS for the physical values and provide a way for upper levels (like CAM) to retrieve this. I'm not familiar with what GEOM provides so far so perhaps someone can speak up with a better way. I'm also not sure why someone would need the physical values. -Nate To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
That wasn't quite what I meant. I was referring to SCSI commands that are sent to the device that return info that would be usable as the number of heads and cylinders. But I guess faking them like the ah[abc] drivers do will work, as this is what many systems are already running with. Nick See XPT_CALC_GEOMETRY in /sys/dev/aic7xxx/aic7xxx_osm.c On Mon, 4 Nov 2002, Nick Hibma wrote: Let's work on the 'proper' solution first. What SCSI commands are suitable for getting the geometry, generically on a device? Nick fdisk likely should do something sane in the face of such insanity, but it is unclear what and fdisk is a royal pita to work on anyway :-( Warner -- [EMAIL PROTECTED] http://www.van-laarhoven.org/ [EMAIL PROTECTED]http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
On Mon, 4 Nov 2002, Poul-Henning Kamp wrote: In message [EMAIL PROTECTED], Nate Lawson writ es: It might be more useful for GEOM to query the BIOS for the physical values and provide a way for upper levels (like CAM) to retrieve this. This is a driver task. besides GEOM is above CAM, not below it. Ok. There are two things that would be useful: 1. Merging the multiple LBA to C/H/S calculations (aic7xxx, umass, ...) to one CAM convenience routine. 2. Adding a MI way to call an MD routine that will get the disk's physical geometry. I don't know much about the best way to do this. -Nate To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
Nate Lawson wrote: 2. Adding a MI way to call an MD routine that will get the disk's physical geometry. I don't know much about the best way to do this. Perhaps we could invent a Common Access Method (CAM), and make it part of that API... -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
In message: [EMAIL PROTECTED] Poul-Henning Kamp [EMAIL PROTECTED] writes: : We should obviously fix it. I have no idea what is possible in USB : devices in this respect. Nor do I. Maybe there's some SCSI command that we can send that is well defined enough to work often enough. However, I'm not clueful enough about SCSI to know if this can be done (likely reading some mode page will do it in real SCSI), nor about USB's mass storage devices, nor about all the wonderful and weird variations that one might find in the wild... Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: umass CF geometry problems, was Re: fdisk -BI ob clean diskbroken
USB is only the transport. It doesn't add or remove functionality (the only exception being probing for LUNs on CBI devices). If you want to determine the geometry you will have to do this through SCSI commands. I was hoping that the CAM code would be smart enough to request the details from the drive itself, but perhaps there is a good reason for asking the controller for this. It did work without, so it hasn't been implemented yet. Feel free to suggest a SCSI command together with the logic. What is the GET_GEOMETRY used for anyway? Nick In message: [EMAIL PROTECTED] Poul-Henning Kamp [EMAIL PROTECTED] writes: : We should obviously fix it. I have no idea what is possible in USB : devices in this respect. Nor do I. Maybe there's some SCSI command that we can send that is well defined enough to work often enough. However, I'm not clueful enough about SCSI to know if this can be done (likely reading some mode page will do it in real SCSI), nor about USB's mass storage devices, nor about all the wonderful and weird variations that one might find in the wild... Warner -- [EMAIL PROTECTED] http://www.van-laarhoven.org/ [EMAIL PROTECTED]http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message