Re: next68k: current issues

Andreas Grabher <[email protected]> Thu, 9 Feb 2023 20:30:47 +0100
Newsgroups gmane.os.netbsd.ports.next68k
Message-ID <[email protected]>
Hello,

>> I'm pretty sure the patch below will fix the problem with Previous,
>> as it has a 54 byte message. But on the other hand it would be
>> more secure to handle any (short) length of message. The messages
>> might vary, especially on old disks. I don't see the point of
>> treating this as an error condition.
>=20
> I see your point.  Drivers should handle short transfers especially
> for SCSI disconnect etc. But one concern is the residual byte number
> check was explicitly added 20 years ago and it looks a workaround of
> some problem:
> =
https://github.com/NetBSD/src/commit/b1ce5975467f3b2651ba9b206a1e35a4af60e=
0f1
>=20
> If a fix against a number of inquiry xfer bytes works around,
> I would like to commit it for now.

I am OK with that although I think that the problem described in the old =
commit might have had another source. That kind of bus error would =
happen if someone tries writing to a non-existent physical address via =
DMA.
>=20
>>> --- a/sys/arch/next68k/stand/boot/sd.c
>>> +++ b/sys/arch/next68k/stand/boot/sd.c
>>> @@ -98,8 +98,8 @@ sdprobe(char target, char lun)
>>>=20
>>>   memset(&cdb2, 0, sizeof(cdb2));
>>>   cdb2.opcode =3D INQUIRY;
>>> -    cdb2.length =3D sizeof(inq);
>>> -    count =3D sizeof (inq);
>>> +    cdb2.length =3D SCSIPI_INQUIRY_LENGTH_SCSI2;
>>> +    count =3D SCSIPI_INQUIRY_LENGTH_SCSI2;
>>>   error =3D scsiicmd(target, lun, (u_char *)&cdb2, sizeof(cdb2),
>>> 		     (char *)&inq, &count);
>>>   if (error !=3D 0)
>=20
>> The bootloader is not contained on a partition. The first 160 kB
>> (320 blocks) are reserved for the disk label and bootloader.
>> There are 4 copies of the label and 2 copies of the bootloader
>> in case there are faulty blocks. The label already contains
>> correct information about the bootloader positions (else NeXT
>> ROM wouldn't load it). But the first partition overlaps with
>> the bootloader.=20
>=20
> I'm using the following label on my NetBSD/next68k:
> ---
> 4 partitions:
> #        size    offset     fstype [fsize bsize cpg/sgs]
> a:   2026528       872     4.2BSD   2048 16384   128  # (Cyl.      2 - =
  4649)
> b:     76736   2027400       swap                     # (Cyl.   4650 - =
  4825)
> c:   2109840         0     unused      0     0        # (Cyl.      0 - =
  4839*)
> d:       872         0       boot                     # (Cyl.      0 - =
     1)
> ---
>=20
> The partition d is not necessary for kernel or bootloader,
> but we can denote explicitly leading sectors should be preserved
> for a bootloader so that installboot(8) utility can check not
> overwriting existing root partition.
>=20
> Anyway we have to update install notes..
> https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/next68k/INSTALL.html

I do not exactly know how these things are handled. But if this leads to =
the first 160 kB being protected against overlap with partitions that =
should be OK.
>=20
> Thanks,
> ---
> Izumi Tsutsui

Thank you very much for your efforts!
Andreas Grabher=