From patchwork Thu Jul 9 16:21:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 6757341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 624D19F536 for ; Thu, 9 Jul 2015 16:21:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 882E8206DD for ; Thu, 9 Jul 2015 16:21:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 86DB8206AC for ; Thu, 9 Jul 2015 16:21:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6C2E6ECDF; Thu, 9 Jul 2015 09:21:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f179.google.com (mail-qk0-f179.google.com [209.85.220.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E1436E7EA for ; Thu, 9 Jul 2015 09:21:22 -0700 (PDT) Received: by qkbp125 with SMTP id p125so189135079qkb.2 for ; Thu, 09 Jul 2015 09:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MrYEOEDzEEoBlu4pn/UZl/gZUcK9hRU++No/ijknaZc=; b=rF+GiztaGVtKsQ4tIx74WgptJBYYeD76y02C5eNmlyoaf/hDpQbNnUU2I1FEbAZbHc UTg0tRVoCGpK+PojKd0mIT4ctQbDvHsaIrtgggPWflOSGPPM79fXkiBMZByrvw3KJZiB YqBMN8SxfksAIXzgYgBdF9lLQ79dneifEmka9p1l30V681luz9qmrvgpY4i5LEBTFwFY zZFT6qKAQ6kM4bsKseaHncQeslOZpSsIWrtuqdILkmx3RpUt6R+u/9Fmqf6nvuN8ITFM 6icLxNskv/WT0hziD32mFWOcsYwIesNCxsWl1Mt8KuCv5TTeOmVsD4TJT/vQBRPu3iE+ izNA== X-Received: by 10.140.16.74 with SMTP id 68mr11746956qga.99.1436458881862; Thu, 09 Jul 2015 09:21:21 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id z81sm3583711qkg.44.2015.07.09.09.21.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 09:21:21 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 06/12] drm/amdgpu: add atom interfaces for CGS Date: Thu, 9 Jul 2015 12:21:05 -0400 Message-Id: <1436458871-16358-6-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1436458871-16358-1-git-send-email-alexander.deucher@amd.com> References: <1436458871-16358-1-git-send-email-alexander.deucher@amd.com> Cc: Alex Deucher , Chunming Zhou , Maruthi.Bayyavarapu@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chunming Zhou This implements the interface for atombios command and data table access. Reviewed-by: Jammy Zhou Signed-off-by: Chunming Zhou Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 93fbf35..c1ee39e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -24,6 +24,7 @@ #include #include "amdgpu.h" #include "cgs_linux.h" +#include "atom.h" struct amdgpu_cgs_device { struct cgs_device base; @@ -221,24 +222,39 @@ static const void *amdgpu_cgs_atom_get_data_table(void *cgs_device, unsigned table, uint16_t *size, uint8_t *frev, uint8_t *crev) { - /* TODO */ + CGS_FUNC_ADEV; + uint16_t data_start; + + if (amdgpu_atom_parse_data_header( + adev->mode_info.atom_context, table, size, + frev, crev, &data_start)) + return (uint8_t*)adev->mode_info.atom_context->bios + + data_start; + return NULL; } static int amdgpu_cgs_atom_get_cmd_table_revs(void *cgs_device, unsigned table, uint8_t *frev, uint8_t *crev) { - /* TODO */ - return 0; + CGS_FUNC_ADEV; + + if (amdgpu_atom_parse_cmd_header( + adev->mode_info.atom_context, table, + frev, crev)) + return 0; + + return -EINVAL; } static int amdgpu_cgs_atom_exec_cmd_table(void *cgs_device, unsigned table, void *args) { - /* TODO */ - return 0; -} + CGS_FUNC_ADEV; + return amdgpu_atom_execute_table( + adev->mode_info.atom_context, table, args); +} static int amdgpu_cgs_create_pm_request(void *cgs_device, cgs_handle_t *request) {