From nobody Sat May 10 14:59:49 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1499791869780514.8708593990924; Tue, 11 Jul 2017 09:51:09 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dUyLV-00043u-Pz; Tue, 11 Jul 2017 18:49:09 +0200 Received: from mail-qk0-f195.google.com ([209.85.220.195]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1dUyLJ-000419-J1 for seabios@seabios.org; Tue, 11 Jul 2017 18:49:07 +0200 Received: by mail-qk0-f195.google.com with SMTP id p21so1484767qke.0 for ; Tue, 11 Jul 2017 09:50:39 -0700 (PDT) Received: from localhost ([64.9.249.1]) by smtp.gmail.com with ESMTPSA id w46sm369352qtw.28.2017.07.11.09.50.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jul 2017 09:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=6m4PSUsEtGbcAKuSfBF4/IQHE49aI1PrqJqwb1dAfis=; b=K+JkQ0VaQyQg4YGKXKVg9rW/6cbO6f/rta9UZM8STDoPluAjF8PHXmMYZ0tM9UwvQT Go97qVU1TMmlllTgTx7KYaCFQxivThpEnIoe1E6UHiXn65QQgeJYcWqCEPMuNrpgpL3d WHLH9yx8LH68IZ8lYlBvxMUgEuzeSx5gpFHHMeVZdvhQjmOXO5GS0I0Eegm8WpFzhawh 3od+fdeYZCkK6dixc+Q6tYTCkzyWgvRuklKraP4QfomxYeinrQmXRthApZAZgkgI9RCX GhjHYccD6t+wBL8EdgBeFqXQMwsPn5FNIrhClMrjfdPnxtKNPPJ7k9HJBBPd7ieJVuST UOjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6m4PSUsEtGbcAKuSfBF4/IQHE49aI1PrqJqwb1dAfis=; b=hJxlkuT/LRAzGeKMpTu2sj9aMZ5834e8ep98tIf/Ppj6o3jPALH9RO1u1n5gQap6c9 ZHjFexkIh7JMf21NIAjhp2zBEJuuvYlxUP/v5Ufisvw7hsJ5Dym0Uw7Y7ODFX7OU+S2m tXngFEwDUVuhNt2sFV1ku4HpOXyFm8uF3xao2b1QFqhm+5PJf1CqdNzeKb80dPjoR+hl qY1BnMDTeDqL+ODdqgd+Ka1rC6QSVkHzsVhGzy9j9myTb9c+KK0wY/BYBq3eygOMuGMe ENOkeDf+8fwGApKswtUqn6iWR2wc0/etB/pqCKpUhVz7SntPvY7g4RWBL47oEAvCnAfe gK5A== X-Gm-Message-State: AIVw113nvnRs9434USJTM1tS3JHDgEzvgomxSmnjKjMTvixjcueNTT8U 0D/jWA4FLdf5JYEzNnfK/g== X-Received: by 10.55.152.66 with SMTP id a63mr1012443qke.31.1499791836928; Tue, 11 Jul 2017 09:50:36 -0700 (PDT) From: Kevin O'Connor To: seabios@seabios.org Date: Tue, 11 Jul 2017 12:50:30 -0400 Message-Id: <20170711165032.2443-3-kevin@koconnor.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170711165032.2443-1-kevin@koconnor.net> References: <20170711165032.2443-1-kevin@koconnor.net> X-Spam-Score: 0.3 (/) Subject: [SeaBIOS] [PATCH 2/4] disk: Don't require the 'struct drive_s' to be in the f-segment X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow the 'struct drive_s' drive description structure to be in either the "low" memory segment or the f-segment. Signed-off-by: Kevin O'Connor --- src/block.c | 22 +++++++++++----------- src/disk.c | 10 +++++----- src/hw/blockcmd.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/block.c b/src/block.c index d104f6d..8c5fb2d 100644 --- a/src/block.c +++ b/src/block.c @@ -312,12 +312,12 @@ fill_generic_edd(struct segoff_s edd, struct drive_s = *drive_gf =20 // EDD 1.x =20 - u8 type =3D GET_GLOBALFLAT(drive_gf->type); - u16 npc =3D GET_GLOBALFLAT(drive_gf->pchs.cylinder); - u16 nph =3D GET_GLOBALFLAT(drive_gf->pchs.head); - u16 nps =3D GET_GLOBALFLAT(drive_gf->pchs.sector); - u64 lba =3D GET_GLOBALFLAT(drive_gf->sectors); - u16 blksize =3D GET_GLOBALFLAT(drive_gf->blksize); + u8 type =3D GET_FLATPTR(drive_gf->type); + u16 npc =3D GET_FLATPTR(drive_gf->pchs.cylinder); + u16 nph =3D GET_FLATPTR(drive_gf->pchs.head); + u16 nps =3D GET_FLATPTR(drive_gf->pchs.sector); + u64 lba =3D GET_FLATPTR(drive_gf->sectors); + u16 blksize =3D GET_FLATPTR(drive_gf->blksize); =20 dprintf(DEBUG_HDL_13, "disk_1348 size=3D%d t=3D%d chs=3D%d,%d,%d lba= =3D%d bs=3D%d\n" , size, type, npc, nph, nps, (u32)lba, blksize); @@ -469,7 +469,7 @@ fill_ata_edd(struct segoff_s edd, struct drive_s *drive= _gf) int noinline fill_edd(struct segoff_s edd, struct drive_s *drive_gf) { - switch (GET_GLOBALFLAT(drive_gf->type)) { + switch (GET_FLATPTR(drive_gf->type)) { case DTYPE_ATA: case DTYPE_ATA_ATAPI: return fill_ata_edd(edd, drive_gf); @@ -477,7 +477,7 @@ fill_edd(struct segoff_s edd, struct drive_s *drive_gf) case DTYPE_VIRTIO_SCSI: return fill_generic_edd( edd, drive_gf, 0xffffffff, EDD_PCI | EDD_SCSI - , edd_pci_path(GET_GLOBALFLAT(drive_gf->cntl_id), 0), 0); + , edd_pci_path(GET_FLATPTR(drive_gf->cntl_id), 0), 0); default: return fill_generic_edd(edd, drive_gf, 0, 0, 0, 0); } @@ -527,7 +527,7 @@ default_process_op(struct disk_op_s *op) static int process_op_both(struct disk_op_s *op) { - switch (GET_GLOBALFLAT(op->drive_gf->type)) { + switch (GET_FLATPTR(op->drive_gf->type)) { case DTYPE_ATA_ATAPI: return ata_atapi_process_op(op); case DTYPE_USB: @@ -585,7 +585,7 @@ static int process_op_16(struct disk_op_s *op) { ASSERT16(); - switch (GET_GLOBALFLAT(op->drive_gf->type)) { + switch (GET_FLATPTR(op->drive_gf->type)) { case DTYPE_FLOPPY: return floppy_process_op(op); case DTYPE_ATA: @@ -608,7 +608,7 @@ process_op(struct disk_op_s *op) , op->count, op->command); =20 int ret, origcount =3D op->count; - if (origcount * GET_GLOBALFLAT(op->drive_gf->blksize) > 64*1024) { + if (origcount * GET_FLATPTR(op->drive_gf->blksize) > 64*1024) { op->count =3D 0; return DISK_RET_EBOUNDARY; } diff --git a/src/disk.c b/src/disk.c index 6e58428..5a4fe9d 100644 --- a/src/disk.c +++ b/src/disk.c @@ -81,9 +81,9 @@ getLCHS(struct drive_s *drive_gf) res.sector =3D sptcyl & 0x3f; return res; } - res.cylinder =3D GET_GLOBALFLAT(drive_gf->lchs.cylinder); - res.head =3D GET_GLOBALFLAT(drive_gf->lchs.head); - res.sector =3D GET_GLOBALFLAT(drive_gf->lchs.sector); + res.cylinder =3D GET_FLATPTR(drive_gf->lchs.cylinder); + res.head =3D GET_FLATPTR(drive_gf->lchs.head); + res.sector =3D GET_FLATPTR(drive_gf->lchs.sector); return res; } =20 @@ -168,7 +168,7 @@ extended_access(struct bregs *regs, struct drive_s *dri= ve_gf, u16 command) dop.lba =3D GET_FARVAR(regs->ds, param_far->lba); dop.command =3D command; dop.drive_gf =3D drive_gf; - if (dop.lba >=3D GET_GLOBALFLAT(drive_gf->sectors)) { + if (dop.lba >=3D GET_FLATPTR(drive_gf->sectors)) { warn_invalid(regs); disk_ret(regs, DISK_RET_EPARAM); return; @@ -287,7 +287,7 @@ disk_1308(struct bregs *regs, struct drive_s *drive_gf) if (CONFIG_CDROM_EMU && drive_gf =3D=3D GET_GLOBAL(cdemu_drive_gf)) regs->bx =3D GET_LOW(CDEmu.media) * 2; else - regs->bx =3D GET_GLOBALFLAT(drive_gf->floppy_type); + regs->bx =3D GET_FLATPTR(drive_gf->floppy_type); =20 // set es & di to point to 11 byte diskette param table in ROM regs->es =3D SEG_BIOS; diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index 98c06ce..f260dd8 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -5,10 +5,10 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. =20 -#include "biosvar.h" // GET_GLOBALFLAT #include "block.h" // struct disk_op_s #include "blockcmd.h" // struct cdb_request_sense #include "byteorder.h" // be32_to_cpu +#include "farptr.h" // GET_FLATPTR #include "output.h" // dprintf #include "std/disk.h" // DISK_RET_EPARAM #include "string.h" // memset @@ -117,7 +117,7 @@ scsi_fill_cmd(struct disk_op_s *op, void *cdbcmd, int m= axcdb) : CDB_CMD_WRITE_10); cmd->lba =3D cpu_to_be32(op->lba); cmd->count =3D cpu_to_be16(op->count); - return GET_GLOBALFLAT(op->drive_gf->blksize); + return GET_FLATPTR(op->drive_gf->blksize); case CMD_SCSI: if (MODESEGMENT) return -1; --=20 2.9.4 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios