[hatari-devel] Wrong MODE SENSE data length for page code 0x3f |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: [hatari-devel] Wrong MODE SENSE data length for page code 0x3f
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Fri, 25 Oct 2024 21:37:25 +0200
- Arc-authentication-results: i=1; strato.com; arc=none; dkim=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1729885058; s=strato-dkim-0002; d=strato.com; h=Message-ID:Subject:To:From:Date:Cc:Date:From:Subject:Sender; bh=K2zk6ySlJmnjIAuzKvliZkivzXtF81j1kKrNQ0MxSTs=; b=O8BRk5bSoKmE7ljZNc6V7BVYDoenheM91D3KpvG5HTxv+2dXP8oPnhRv97nkh6FlF1 Zm7ikqPGVvaCxlrV12ip0nZ87JGIZquqTfcTuLbsM2dc2s9HevwF8woQGtgv10LKMls2 kO+JdJ87hxdNav3mO9U0iTiodw+N4SE2FZHPx5lrurUp5sbGWgbwHs5PQfc4v7I7vA/v TveO/1S8nqLN42/GDwiN4YubhjaNCzh/h8GprRmGRGZetnAe/CcVdf44ACsxkWseIQtT l+B2c9RmHCCIa8ySoM0G7K7a/7KYAVi9vVNH6ytF2teyxhzYv9mw5XhVjNniMsU54q64 h4+Q==
- Arc-seal: i=1; a=rsa-sha256; t=1729885058; cv=none; d=strato.com; s=strato-dkim-0002; b=O89uVWnuzAuQ+Cb+7CYR+qsv4nkY01pCvRhlEt2DpxgZ30pKRE7u1++rKzCPAPR2Ou pchmrRzamIsYCI1r1Lrk7Un+tNUW2y3qkdE468cwA0qiZbPh8LnbT/5yNOKloFKZi4LU Y/w/TW3nDgd/qR7FC40Xx+/eM0Nx+srugLNS/d5OubowyDTrJSA3unTBwLGrtXrmo+68 38/mxn0G4YngLEg0oDhwp414ysd9lRced1NOIHWYFFijNuXCVJyVj9S+KzbJwQ7mj4ft 0As54THNpuVuDffXcz9dsgRqgBWu74mTUopBfYXyuuTPwfkMfi0ApYkrjBxOSOIakEm2 vXHw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1729885058; s=strato-dkim-0002; d=seimet.de; h=Message-ID:Subject:To:From:Date:Cc:Date:From:Subject:Sender; bh=K2zk6ySlJmnjIAuzKvliZkivzXtF81j1kKrNQ0MxSTs=; b=mrhllW6Il9A6Stf7tpFXZfX3nRihfxFP4PyH9rByYcFoc2mG1PG7pYLPls2aD7aTNx l11KC07fnUfnkQ0fIjw604CxG9+i+88oC/A3wm9R+7BmbZiMsxf2k+Lv5vYeJG4ranmY 6RwyCdIXZEP3f6F+DCY++o8qWlDKTy/BoTt+6oAFiEG5pnAWBCiJyGkskrkuADqjC7WI VRZbzanhHKmjvcJLLrE9yzofg5D47ps+w3RSpauvFXLuL8Jl7vXr/8uIlXll5AN+TuXK lqE0fS5q26CkSIMcSGZ5UTf9l0aWWB/dZGwxPnHnXBQkwXi6DUP8Udqf0ZhncPU/R0fZ sK9g==
- Dkim-signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1729885058; s=strato-dkim-0003; d=seimet.de; h=Message-ID:Subject:To:From:Date:Cc:Date:From:Subject:Sender; bh=K2zk6ySlJmnjIAuzKvliZkivzXtF81j1kKrNQ0MxSTs=; b=Wj0czFBd6uFPxxAXavorMKKomhkXezUrYbV/ev7Pdw3l8dc13b0fgjp1fZ9NbXMmg7 rvjn1u41nbfU9GNIzkCg==
Hello,
I noticed that the mode data length field when all pages are returned (page
code 0x3f) is wrong. Instead of 44 it has to be 43. The SPC-5 specification
says: "The mode data length field indicates the number of bytes that follow
in the mode parameter list". "Follow" is the important word here, because
usually fields that contain a byte count do not count themselves.
You also see that something is wrong with the current length field when
running the SCSI Driver test suite. Without the attached patch it says:
Page 0 (current, not savable)
Reading all mode pages with MODE SENSE (10)
MODE SENSE (10) is not supported by device
The empty line indicates that something is wrong. With the attached patch it
says:
Page 0 (current, not savable)
0e:00:08:00:00:00:08:00:00:02:00:00:00:00:00
Reading all mode pages with MODE SENSE (10)
MODE SENSE (10) is not supported by device
0e:00:08:00:00:00:08:00:00:02:00:00:00:00:00 matches the page 0 data
returned by Hatari.
These data are not really correct, by the way, because they return a
hard-coded sector size of 512 bytes even when a different physical sector
size is configured. But as long as this page is only there to please HDX it
does not matter.
Best regards
Uwe
diff --git a/src/hdc.c b/src/hdc.c
index 424bc081..70c2fac6 100644
--- a/src/hdc.c
+++ b/src/hdc.c
@@ -422,7 +422,7 @@ static void HDC_Cmd_ModeSense(SCSI_CTRLR *ctr)
buf = HDC_PrepRespBuf(ctr, 44);
HDC_CmdModeSense0x04(dev, ctr, buf + 4);
HDC_CmdModeSense0x00(dev, ctr, buf + 28);
- buf[0] = 44;
+ buf[0] = 43;
buf[1] = 0;
buf[2] = 0;
buf[3] = 0;