From owner-freebsd-hackers@freebsd.org Mon Sep 28 18:53:06 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4E95A0AF42 for ; Mon, 28 Sep 2015 18:53:06 +0000 (UTC) (envelope-from rpokala@panasas.com) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0069.outbound.protection.outlook.com [157.56.110.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39CBA103C; Mon, 28 Sep 2015 18:53:04 +0000 (UTC) (envelope-from rpokala@panasas.com) Received: from CY1PR08MB1802.namprd08.prod.outlook.com (10.162.218.24) by CY1PR08MB1264.namprd08.prod.outlook.com (10.163.22.30) with Microsoft SMTP Server (TLS) id 15.1.280.20; Mon, 28 Sep 2015 18:52:56 +0000 Received: from CY1PR08MB1803.namprd08.prod.outlook.com (10.162.218.25) by CY1PR08MB1802.namprd08.prod.outlook.com (10.162.218.24) with Microsoft SMTP Server (TLS) id 15.1.280.20; Mon, 28 Sep 2015 18:52:54 +0000 Received: from CY1PR08MB1803.namprd08.prod.outlook.com ([10.162.218.25]) by CY1PR08MB1803.namprd08.prod.outlook.com ([10.162.218.25]) with mapi id 15.01.0280.017; Mon, 28 Sep 2015 18:52:54 +0000 From: "Pokala, Ravi" To: John Baldwin CC: "freebsd-hackers@freebsd.org" Subject: Re: bus_.*_resource() and rid Thread-Topic: bus_.*_resource() and rid Thread-Index: AQHQ6qhpmlcbMDBrSUWapu14ripoSp42SMsAgAAUkACAE/CTgIAHZG6AgACp9YD//5bDgA== Date: Mon, 28 Sep 2015 18:52:54 +0000 Message-ID: References: <1637146.Rv3dkk0gMi@ralph.baldwin.cx> <3440562.CxbPY93XVj@ralph.baldwin.cx> In-Reply-To: <3440562.CxbPY93XVj@ralph.baldwin.cx> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.5.5.150821 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rpokala@panasas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [64.80.217.3] x-microsoft-exchange-diagnostics: 1; CY1PR08MB1802; 5:Q+33c5i5Rf4RWLfOk8dX1R+uRXRPIsF5OEMets2M5nAMGZrQ5UfP0D2z5JWjmYQx3gNoFR9reMfxpuG3H8sg3TUBLnnrrsDj0TgcdPhQnVjK/hvthG+F/u/SkC7VTPPKFOb05F2OoTPGWu5ozVYo8Q==; 24:ZAa5fsu1ifdOE72jdWvJH8LJYoj8Ql6f34ucH9rnpOXmzrSiqbkQaT5Xl1vQbQvJccby3jjMbjRJhM7EWKVJcFTTy3qUjXQea2pCi/NzV4g=; 20:Al2vLqGOufnEpD7DlEcq2FzBZJCvRM4ScChGhosJbCMuuxNQqBpCR3e101GTIAdtANmaKPSPbwzM0FLvDuxYig== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR08MB1802; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001); SRVR:CY1PR08MB1802; BCL:0; PCL:0; RULEID:; SRVR:CY1PR08MB1802; x-forefront-prvs: 0713BC207F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(377424004)(13464003)(199003)(189002)(99286002)(101416001)(83506001)(19580395003)(19580405001)(2950100001)(4001350100001)(106116001)(81156007)(2900100001)(5001860100001)(105586002)(4001540100001)(5001830100001)(11100500001)(77156002)(10400500002)(92566002)(86362001)(5002640100001)(106356001)(93886004)(46102003)(62966003)(450100001)(97736004)(110136002)(54356999)(40100003)(50986999)(122556002)(64706001)(76176999)(5001960100002)(189998001)(36756003)(5007970100001)(68736005)(77096005)(102836002)(87936001)(5004730100002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR08MB1802; H:CY1PR08MB1803.namprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: panasas.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2015 18:52:54.4734 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: acf01c9d-c699-42af-bdbb-44bf582e60b0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR08MB1802 X-Microsoft-Exchange-Diagnostics: 1; CY1PR08MB1264; 2:X+XCG9tngOMREaeh3dtdSz0Co3B4ys7zOUvyW2Qa+p/RQH9cVYM8qkCyyW/DGpOcytHdhRgoGcNY/328P7sLU4ETRumZuIO6zSRcHaiTxwsER8L1tIiLF1io+qA9iL2A05G84FW791VlSrnWXhg4Bz0QvoScsiCPYvpfxVm49sM=; 23:cuYn27BKpHtjzeGcCgTgLxkB69APiYsONcpWzv5mdziKIz8DCYeK70NhglA+rPCAUUaq4CdzWJSbi+dbhEkRGDytBkEWtAHPEE9c6jbxjIhpm6wwTU3QOlxr0D+H+1YJCd9mAsVDOyc9M2nUtALO3XGbVJuh5OGvqfWFELo/VgUERsSxluhYZt17KybgC5gQ X-OriginatorOrg: panasas.com X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 18:53:06 -0000 -----Original Message----- From: John Baldwin Date: 2015-09-28, Monday at 11:09 To: Ravi Pokala Cc: Francois Tigeot , "cem@FreeBSD.org" , "freebsd-hackers@freebsd.org" Subject: Re: bus_.*_resource() and rid >Ah, I did mean to include 'struct resource_i' as part of 'struct >resource'. >They are really stored as the same structure, and you can use >rman_get_rid() >on a struct resource. Okay, I think I see how that works. >> I have a one-line change to dump_rman() to include the RID along w/ the >> start and end address. That at least got me what I was interested in >>from >> ddb. > >Neat, can you share that? It's a very complicated diff. ;-) --- sys/kern/subr_rman.c (revision 288339) +++ sys/kern/subr_rman.c (working copy) @@ -1051,7 +1051,7 @@ devname =3D "nomatch"; } else devname =3D NULL; - db_printf(" 0x%lx-0x%lx ", r->r_start, r->r_end); + db_printf(" 0x%lx-0x%lx (%d)", r->r_start, r->r_end, r->r_rid); if (devname !=3D NULL) db_printf("(%s)\n", devname); else >> As for `devinfo', it looks like (struct u_resource) and (struct u_rman) >> don't include the RID either: > >Fooey. That would be a bit of a PITA to fix then. Yeah. Alas! >So there's actually a 'resource_list_add_next()' that bus drivers can use >that >does this, but that doesn't help you in this case. :( Yeah, looks like it needs a (struct resource_list *), which I don't know how to get. Hmm... perhaps: struct resource_list *rl =3D bus_get_resource_list(device_get_parent(dev), dev); rid =3D resource_list_add_next(rl, SYS_RES_IOPORT, start, end, count); I'll try that. Thanks! -Ravi